Lines Matching refs:Complex
50 return Complex!R(re, 0);
52 return Complex!double(re, 0);
60 return Complex!(CommonType!(R, I))(re, im);
62 return Complex!double(re, im);
69 static assert(is(typeof(a) == Complex!double));
74 static assert(is(typeof(b) == Complex!real));
79 static assert(is(typeof(c) == Complex!double));
84 static assert(is(typeof(d) == Complex!real));
89 static assert(is(typeof(e) == Complex!double));
94 static assert(is(typeof(f) == Complex!double));
99 static assert(is(typeof(g) == Complex!real));
108 struct Complex(T)
178 this(R : T)(Complex!R z)
201 ref Complex opAssign(R : T)(Complex!R z)
209 ref Complex opAssign(R : T)(const R r)
219 bool opEquals(R : T)(Complex!R z) const
233 Complex opUnary(string op)() const
240 Complex opUnary(string op)() const
243 return Complex(-re, -im);
249 Complex!(CommonType!(T,R)) opBinary(string op, R)(Complex!R z) const
257 Complex!(CommonType!(T,R)) opBinary(string op, R)(const R r) const
266 Complex!(CommonType!(T, R)) opBinaryRight(string op, R)(const R r) const
273 Complex!(CommonType!(T, R)) opBinaryRight(string op, R)(const R r) const
276 return Complex(r - re, -im);
280 Complex!(CommonType!(T, R)) opBinaryRight(string op, R)(const R r) const
322 Complex!(CommonType!(T, R)) opBinaryRight(string op, R)(const R lhs) const
351 ref Complex opOpAssign(string op, C)(const C z)
352 if ((op == "+" || op == "-") && is(C R == Complex!R))
360 ref Complex opOpAssign(string op, C)(const C z)
361 if (op == "*" && is(C R == Complex!R))
370 ref Complex opOpAssign(string op, C)(const C z)
371 if (op == "/" && is(C R == Complex!R))
411 ref Complex opOpAssign(string op, C)(const C z)
412 if (op == "^^" && is(C R == Complex!R))
427 ref Complex opOpAssign(string op, U : T)(const U a)
435 ref Complex opOpAssign(string op, U : T)(const U a)
444 ref Complex opOpAssign(string op, R)(const R r)
456 ref Complex opOpAssign(string op, U)(const U i)
493 auto c2 = Complex!double(0.5, 2.0);
629 auto cf = Complex!float(1.0, 1.0);
630 auto cr = Complex!real(1.0, 1.0);
633 static assert(is(typeof(c1pcf) == Complex!double));
634 static assert(is(typeof(c1pcr) == Complex!real));
663 Complex!double a = 1;
665 Complex!double b = 1.0;
667 Complex!double c = Complex!real(1.0, 2);
674 Complex!double z;
688 auto w = Complex!real(1.0, 1.0);
693 auto c = Complex!float(2.0, 2.0);
713 template Complex(T)
714 if (is(T R == Complex!R))
716 alias Complex = T; variable
721 static assert(is(Complex!(Complex!real) == Complex!real));
723 Complex!T addI(T)(T x)
725 return x + Complex!T(0.0, 1.0);
731 enum one = Complex!double(1.0, 0.0);
741 T abs(T)(Complex!T z) @safe pure nothrow @nogc in abs()
770 Complex!T a = complex(T(-12), T(3));
784 T sqAbs(T)(Complex!T z) @safe pure nothrow @nogc in sqAbs()
822 T arg(T)(Complex!T z) @safe pure nothrow @nogc in arg()
845 T norm(T)(Complex!T z) @safe pure nothrow @nogc in norm()
866 Complex!T conj(T)(Complex!T z) @safe pure nothrow @nogc
868 return Complex!T(z.re, -z.im);
883 auto c = Complex!T(7, 3L);
884 assert(conj(c) == Complex!T(7, -3L));
885 auto z = Complex!T(0, -3.2L);
897 Complex!T proj(T)(Complex!T z)
902 return Complex!T(T.infinity, std.math.copysign(0.0, z.im));
923 Complex!(CommonType!(T, U)) fromPolar(T, U)(const T modulus, const U argument)
927 return Complex!(CommonType!(T,U))
946 int ceqrel(T)(const Complex!T x, const Complex!T y) @safe pure nothrow @nogc in version()
961 Complex!T sin(T)(Complex!T z) @safe pure nothrow @nogc
983 Complex!T cos(T)(Complex!T z) @safe pure nothrow @nogc
1009 Complex!T tan(T)(Complex!T z) @safe pure nothrow @nogc
1019 int ceqrel(T)(const Complex!T x, const Complex!T y) @safe pure nothrow @nogc in ceqrel()
1036 Complex!T asin(T)(Complex!T z) @safe pure nothrow @nogc
1038 auto ash = asinh(Complex!T(-z.im, z.re));
1039 return Complex!T(ash.im, -ash.re);
1060 Complex!T acos(T)(Complex!T z) @safe pure nothrow @nogc
1064 return Complex!T(T(std.math.PI_2) - as.re, as.im);
1086 Complex!T atan(T)(Complex!T z) @safe pure nothrow @nogc
1098 return Complex!T(T(0.5) * std.math.atan2(2 * z.re, x),
1118 Complex!T sinh(T)(Complex!T z) @safe pure nothrow @nogc
1121 return Complex!T(std.math.sinh(z.re) * core.math.cos(z.im),
1135 Complex!T cosh(T)(Complex!T z) @safe pure nothrow @nogc
1138 return Complex!T(std.math.cosh(z.re) * core.math.cos(z.im),
1152 Complex!T tanh(T)(Complex!T z) @safe pure nothrow @nogc
1173 Complex!T asinh(T)(Complex!T z) @safe pure nothrow @nogc
1175 auto t = Complex!T((z.re - z.im) * (z.re + z.im) + 1, 2 * z.re * z.im);
1190 Complex!T acosh(T)(Complex!T z) @safe pure nothrow @nogc
1206 Complex!T atanh(T)(Complex!T z) @safe pure nothrow @nogc
1218 return Complex!T(T(0.25) * (std.math.log(num) - std.math.log(den)),
1239 Complex!real expi(real y) @trusted pure nothrow @nogc
1242 return Complex!real(cos(y), sin(y));
1260 Complex!real coshisinh(real y) @safe pure nothrow @nogc
1265 return Complex!real(std.math.cosh(y), std.math.sinh(y));
1271 return Complex!real(z + zi, z - zi);
1286 Complex!T sqrt(T)(Complex!T z) @safe pure nothrow @nogc
1345 auto c2 = Complex!double(0.5, 2.0);
1373 wstring wformat(T)(string format, Complex!T c) in wformat()
1423 Complex!T exp(T)(Complex!T x) @trusted pure nothrow @nogc // TODO: @safe
1434 return Complex!T(0, std.math.copysign(0, x.im));
1441 return Complex!T(0, std.math.copysign(0, x.im));
1443 return Complex!T(T.infinity, -T.nan);
1448 return Complex!T(0.0);
1450 return Complex!T(T.infinity);
1456 return Complex!T(T.nan, T.nan);
1463 return Complex!T(T.nan, T.nan);
1465 return Complex!T(1.0, 0.0);
1567 Complex!T log(T)(Complex!T x) @safe pure nothrow @nogc
1576 return Complex!T(T.infinity, T.nan);
1578 return Complex!T(T.nan, T.nan);
1583 return Complex!T(T.infinity, T.nan);
1587 return Complex!T(T.infinity, std.math.copysign(3.0 * std.math.PI_4, x.im));
1589 return Complex!T(T.infinity, std.math.copysign(std.math.PI_4, x.im));
1594 return Complex!T(T.infinity, std.math.copysign(std.math.PI, x.im));
1596 return Complex!T(T.infinity, std.math.copysign(0.0, x.im));
1600 return Complex!T(T.nan, T.nan);
1602 return Complex!T(T.infinity, std.math.copysign(std.math.PI_2, x.im));
1606 return Complex!T(-T.infinity, std.math.copysign(std.math.PI, x.im));
1608 return Complex!T(-T.infinity, std.math.copysign(0.0, x.im));
1611 return Complex!T(std.math.log(abs(x)), arg(x));
1696 Complex!T log10(T)(Complex!T x) @safe pure nothrow @nogc
1700 return log(x) / Complex!T(std.math.log(10.0));
1754 Complex!T pow(T, Int)(Complex!T x, const Int n) @safe pure nothrow @nogc
1760 Complex!T y = (m % 2) ? x : Complex!T(1);
1769 return (n < 0) ? Complex!T(1) / y : y;
1785 Complex!T pow(T)(Complex!T x, const T n) @trusted pure nothrow @nogc
1790 return Complex!T(0.0);
1793 return Complex!T(std.math.pow(x.re, n));
1795 Complex!T t = log(x);
1814 Complex!T pow(T)(Complex!T x, Complex!T y) @trusted pure nothrow @nogc
1816 return (x == 0) ? Complex!T(0) : exp(y * log(x));
1834 Complex!T pow(T)(const T x, Complex!T n) @trusted pure nothrow @nogc
1840 : pow(Complex!T(x), n);
1895 Complex!T ref1 = pow(complex(a), complex(b));
1896 Complex!T res1 = pow(a, complex(b));
1897 Complex!T res2 = pow(complex(a), b);
1904 Complex!T ref2 = pow(complex(a), complex(b));
1905 Complex!T res3 = pow(a, complex(b));
1906 Complex!T res4 = pow(complex(a), b);