PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/complextest.i

#
Swig | 61 lines | 46 code | 15 blank | 0 comment | 0 complexity | 416b5a78b1a967aac27aec462ce94241 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module complextest
  2. %include <complex.i>
  3. #ifdef __cplusplus
  4. %{
  5. #include <algorithm>
  6. #include <functional>
  7. #include <numeric>
  8. %}
  9. %include <std_vector.i>
  10. #if 1
  11. %template(VectorStdCplx) std::vector<std::complex<double> >;
  12. #endif
  13. %inline
  14. {
  15. std::complex<double> Conj(const std::complex<double>& a)
  16. {
  17. return std::conj(a);
  18. }
  19. std::complex<float> Conjf(const std::complex<float>& a)
  20. {
  21. return std::conj(a);
  22. }
  23. #if 1
  24. std::vector<std::complex<double> > Copy_h(const std::vector<std::complex<double> >& a)
  25. {
  26. std::vector<std::complex<double> > b(a.size()/2);
  27. std::copy(a.begin(), a.begin()+a.size()/2, b.begin());
  28. return b;
  29. }
  30. #endif
  31. }
  32. #else
  33. %{
  34. %}
  35. %inline
  36. {
  37. complex Conj(complex a)
  38. {
  39. return conj(a);
  40. }
  41. complex float Conjf(float complex a)
  42. {
  43. return conj(a);
  44. }
  45. }
  46. #endif