preciseComplexNCO

正確なComplexNCO

preciseComplexNCO
pure nothrow @safe @nogc
(
real freq
,
real deltaT
,
real theta = 0
)

Examples

1 scope(failure) {writefln("Unittest failure :%s(%s)", __FILE__, __LINE__); stdout.flush();}
2 scope(success) {writefln("Unittest success :%s(%s)", __FILE__, __LINE__); stdout.flush();}
3 
4 auto sig1 = preciseComplexNCO(1000, 0.001, 0);
5 static assert(isInputStream!(typeof(sig1)));
6 static assert(isInplaceComputableStream!(typeof(sig1)));
7 static assert(is(ElementType!(typeof(sig1)) == creal));
8 
9 assert(equal!((a, b) => approxEqual(a.re, b.re) && approxEqual(a.im, b.im))
10             (sig1[0 .. 4], cast(creal[])[1, 1, 1, 1]));
11 
12 sig1 = preciseComplexNCO(1, 0.25, 0);
13 assert(equal!((a, b) => approxEqual(a.re, b.re) && approxEqual(a.im, b.im))
14             (sig1[0 .. 4], cast(creal[])[1, 0+1i, -1, -1i]));
15 
16 sig1 = preciseComplexNCO(1000, 10.0L^^-6, std.math.E);
17 auto buf = sig1[0 .. 1024].array;
18 assert(sig1.readOp!"-"(buf).length == buf.length);
19 assert(equal!"a == 0"(buf, buf));
20 
21 sig1.readOp!"a+b"(buf);

Meta