PageRenderTime 16ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

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

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