cpx

  1. Cpx!R cpx(R re)
  2. Cpx!(CommonType!(R, I)) cpx(R re, I im)
    Cpx!(CommonType!(R, I))
    cpx
    (
    alias Cpx = complex_t
    R
    I
    )
    (
    R re
    ,
    I im
    )
    if ()
  3. Cpx!(typeof(C.init.re)) cpx(C c)

Examples

1 complex_t!float c1 = cpx(1.0f);
2 assert(c1.re == 1);
3 assert(c1.im == 0);
4 
5 complex_t!float c2 = cpx(1.0f, 1.0f);
6 assert(c2.re == 1);
7 assert(c2.im == 1);
8 
9 complex_t!float c3 = cpx(1.0f + 1.0fi);
10 assert(c2.re == 1);
11 assert(c2.im == 1);
12 
13 cfloat c4 = cpx!std_complex_t(1.0f);
14 assert(c4.re == 1);
15 assert(c4.im == 0);
16 
17 cfloat c5 = cpx!std_complex_t(1.0f, 1.0f);
18 assert(c5.re == 1);
19 assert(c5.im == 1);
20 
21 cfloat c6 = cpx!std_complex_t(1.0f + 1.0fi);
22 assert(c6.re == 1);
23 assert(c6.im == 1);

Meta