36 #include <itpp/itexports.h>
43 inline std::complex<double>
operator+(
const int &x,
const std::complex<double> &y) {
return std::complex<double>(x + y.real(), y.imag());}
45 inline std::complex<double>
operator+(
const float &x,
const std::complex<double> &y) {
return std::complex<double>(x + y.real(), y.imag());}
47 inline std::complex<double>
operator+(
const std::complex<double> &x,
const int &y) {
return std::complex<double>(x.real() + y, x.imag());}
49 inline std::complex<double>
operator+(
const std::complex<double> &x,
const float &y) {
return std::complex<double>(x.real() + y, x.imag());}
52 inline std::complex<double>
operator-(
const int &x,
const std::complex<double> &y) {
return std::complex<double>(x - y.real(), -y.imag());}
54 inline std::complex<double>
operator-(
const float &x,
const std::complex<double> &y) {
return std::complex<double>(x - y.real(), -y.imag());}
56 inline std::complex<double>
operator-(
const std::complex<double> &x,
const int &y) {
return std::complex<double>(x.real() - y, x.imag());}
58 inline std::complex<double>
operator-(
const std::complex<double> &x,
const float &y) {
return std::complex<double>(x.real() - y, x.imag());}
61 inline std::complex<double>
operator*(
const int &x,
const std::complex<double> &y) {
return std::complex<double>(x*y.real(), x*y.imag());}
63 inline std::complex<double>
operator*(
const float &x,
const std::complex<double> &y) {
return std::complex<double>(x*y.real(), x*y.imag());}
65 inline std::complex<double>
operator*(
const std::complex<double> &x,
const int &y) {
return std::complex<double>(x.real()*y, x.imag()*y);}
67 inline std::complex<double>
operator*(
const std::complex<double> &x,
const float &y) {
return std::complex<double>(x.real()*y, x.imag()*y);}
70 inline std::complex<double>
operator/(
const std::complex<double> &x,
const int &y) {
return std::complex<double>(x.real() / y, x.imag() / y);}
72 inline std::complex<double>
operator/(
const std::complex<double> &x,
const float &y) {
return std::complex<double>(x.real() / y, x.imag() / y);}
81 inline vec
operator+(
const float &s,
const vec &v) {
return static_cast<double>(s) + v;}
87 inline vec
operator+(
const short &s,
const vec &v) {
return static_cast<double>(s) + v;}
93 inline vec
operator+(
const int &s,
const vec &v) {
return static_cast<double>(s) + v;}
99 inline vec
operator+(
const vec &v,
const float &s) {
return static_cast<double>(s) + v;}
105 inline vec
operator+(
const vec &v,
const short &s) {
return static_cast<double>(s) + v;}
111 inline vec
operator+(
const vec &v,
const int &s) {
return static_cast<double>(s) + v;}
117 inline vec
operator-(
const float &s,
const vec &v) {
return static_cast<double>(s) - v;}
123 inline vec
operator-(
const short &s,
const vec &v) {
return static_cast<double>(s) - v;}
129 inline vec
operator-(
const int &s,
const vec &v) {
return static_cast<double>(s) - v;}
135 inline vec
operator-(
const vec &v,
const float &s) {
return v -
static_cast<double>(s);}
141 inline vec
operator-(
const vec &v,
const short &s) {
return v -
static_cast<double>(s);}
147 inline vec
operator-(
const vec &v,
const int &s) {
return v -
static_cast<double>(s);}
153 inline vec
operator*(
const float &s,
const vec &v) {
return static_cast<double>(s)*v;}
159 inline vec
operator*(
const short &s,
const vec &v) {
return static_cast<double>(s)*v;}
165 inline vec
operator*(
const int &s,
const vec &v) {
return static_cast<double>(s)*v;}
171 cvec
operator*(
const std::complex<double> &s,
const vec &v);
177 inline vec
operator*(
const vec &v,
const float &s) {
return static_cast<double>(s)*v;}
183 inline vec
operator*(
const vec &v,
const short &s) {
return static_cast<double>(s)*v;}
189 inline vec
operator*(
const vec &v,
const int &s) {
return static_cast<double>(s)*v;}
195 cvec
operator*(
const vec &v,
const std::complex<double> &s);
201 inline vec
operator/(
const vec &v,
const float &s) {
return v /
static_cast<double>(s);}
207 inline vec
operator/(
const vec &v,
const short &s) {
return v /
static_cast<double>(s);}
213 inline vec
operator/(
const vec &v,
const int &s) {
return v /
static_cast<double>(s);}
222 ITPP_EXPORT vec
operator+(
const double &s,
const ivec &v);
228 inline vec
operator+(
const ivec &v,
const double &s) {
return s + v;}
234 ITPP_EXPORT vec
operator-(
const double &s,
const ivec &v);
240 inline vec
operator-(
const ivec &v,
const double &s) {
return v + (-s); }
246 ITPP_EXPORT vec
operator*(
const double &s,
const ivec &v);
252 inline vec
operator*(
const ivec &v,
const double &s) {
return s*v; }
258 ITPP_EXPORT vec
operator/(
const double &s,
const ivec &v);
264 ITPP_EXPORT vec
operator/(
const ivec &v,
const double &s);
270 ITPP_EXPORT cvec
operator+(
const std::complex<double> &s,
const ivec &v);
276 inline cvec
operator+(
const ivec &v,
const std::complex<double> &s) {
return s + v;}
282 ITPP_EXPORT cvec
operator-(
const std::complex<double> &s,
const ivec &v);
288 inline cvec
operator-(
const ivec &v,
const std::complex<double> &s) {
return v + (-s); }
294 ITPP_EXPORT cvec
operator*(
const std::complex<double> &s,
const ivec &v);
300 inline cvec
operator*(
const ivec &v,
const std::complex<double> &s) {
return s*v; }
306 ITPP_EXPORT cvec
operator/(
const std::complex<double> &s,
const ivec &v);
312 ITPP_EXPORT cvec
operator/(
const ivec &v,
const std::complex<double> &s);
320 ITPP_EXPORT cvec
operator+(
const double &s,
const cvec &v);
326 inline cvec
operator+(
const float &s,
const cvec &v) {
return static_cast<double>(s) + v;}
332 inline cvec
operator+(
const short &s,
const cvec &v) {
return static_cast<double>(s) + v;}
338 inline cvec
operator+(
const int &s,
const cvec &v) {
return static_cast<double>(s) + v;}
344 inline cvec
operator+(
const cvec &v,
const float &s) {
return s + v;}
350 inline cvec
operator+(
const cvec &v,
const double &s) {
return s + v;}
356 inline cvec
operator+(
const cvec &v,
const short &s) {
return s + v;}
362 inline cvec
operator+(
const cvec &v,
const int &s) {
return s + v;}
368 ITPP_EXPORT cvec
operator-(
const double &s,
const cvec &v);
374 inline cvec
operator-(
const float &s,
const cvec &v) {
return static_cast<double>(s) - v;}
380 inline cvec
operator-(
const short &s,
const cvec &v) {
return static_cast<double>(s) - v;}
386 inline cvec
operator-(
const int &s,
const cvec &v) {
return static_cast<double>(s) - v;}
392 inline cvec
operator-(
const cvec &v,
const float &s) {
return v + (-s);}
398 inline cvec
operator-(
const cvec &v,
const double &s) {
return v + (-s);}
404 inline cvec
operator-(
const cvec &v,
const short &s) {
return v + (-s);}
410 inline cvec
operator-(
const cvec &v,
const int &s) {
return v + (-s);}
416 ITPP_EXPORT cvec
operator*(
const double &s,
const cvec &v);
422 inline cvec
operator*(
const float &s,
const cvec &v) {
return static_cast<double>(s)*v;}
428 inline cvec
operator*(
const short &s,
const cvec &v) {
return static_cast<double>(s)*v;}
434 inline cvec
operator*(
const int &s,
const cvec &v) {
return static_cast<double>(s)*v;}
440 inline cvec
operator*(
const cvec &v,
const float &s) {
return s*v;}
446 inline cvec
operator*(
const cvec &v,
const double &s) {
return s*v;}
452 inline cvec
operator*(
const cvec &v,
const short &s) {
return s*v;}
458 inline cvec
operator*(
const cvec &v,
const int &s) {
return s*v;}
464 ITPP_EXPORT cvec
operator/(
const cvec &v,
const double &s);
470 ITPP_EXPORT cvec
operator/(
const double &s,
const cvec &v);
476 inline cvec
operator/(
const cvec &v,
const float &s) {
return v /
static_cast<double>(s);}
482 inline cvec
operator/(
const cvec &v,
const short &s) {
return v /
static_cast<double>(s);}
488 inline cvec
operator/(
const cvec &v,
const int &s) {
return v /
static_cast<double>(s);}
496 inline mat
operator+(
const float &s,
const mat &m) {
return static_cast<double>(s) + m;}
502 inline mat
operator+(
const short &s,
const mat &m) {
return static_cast<double>(s) + m;}
508 inline mat
operator+(
const int &s,
const mat &m) {
return static_cast<double>(s) + m;}
514 inline mat
operator+(
const mat &m,
const float &s) {
return static_cast<double>(s) + m;}
520 inline mat
operator+(
const mat &m,
const short &s) {
return static_cast<double>(s) + m;}
526 inline mat
operator+(
const mat &m,
const int &s) {
return static_cast<double>(s) + m;}
532 inline mat
operator-(
const float &s,
const mat &m) {
return static_cast<double>(s) - m;}
538 inline mat
operator-(
const short &s,
const mat &m) {
return static_cast<double>(s) - m;}
544 inline mat
operator-(
const int &s,
const mat &m) {
return static_cast<double>(s) - m;}
550 inline mat
operator-(
const mat &m,
const float &s) {
return m -
static_cast<double>(s);}
556 inline mat
operator-(
const mat &m,
const short &s) {
return m -
static_cast<double>(s);}
562 inline mat
operator-(
const mat &m,
const int &s) {
return m -
static_cast<double>(s);}
568 inline mat
operator*(
const float &s,
const mat &m) {
return static_cast<double>(s)*m;}
574 inline mat
operator*(
const short &s,
const mat &m) {
return static_cast<double>(s)*m;}
580 inline mat
operator*(
const int &s,
const mat &m) {
return static_cast<double>(s)*m;}
586 inline mat
operator*(
const mat &m,
const float &s) {
return static_cast<double>(s)*m;}
592 inline mat
operator*(
const mat &m,
const short &s) {
return static_cast<double>(s)*m;}
598 inline mat
operator*(
const mat &m,
const int &s) {
return static_cast<double>(s)*m;}
604 inline mat
operator/(
const mat &m,
const float &s) {
return m /
static_cast<double>(s);}
610 inline mat
operator/(
const mat &m,
const short &s) {
return m /
static_cast<double>(s);}
616 inline mat
operator/(
const mat &m,
const int &s) {
return m /
static_cast<double>(s);}
624 ITPP_EXPORT cmat
operator+(
const double &s,
const cmat &m);
630 ITPP_EXPORT cmat
operator-(
const double &s,
const cmat &m);
636 ITPP_EXPORT cmat
operator*(
const double &s,
const cmat &m);
642 ITPP_EXPORT cmat
operator*(
const std::complex<double> &s,
const mat &m);
648 inline cmat
operator*(
const mat &m,
const std::complex<double> &s) {
return s*m;}
654 ITPP_EXPORT cmat
operator/(
const cmat &m,
const double &s);
662 ITPP_EXPORT vec
operator+(
const bvec &a,
const vec &b);
668 ITPP_EXPORT vec
operator+(
const svec &a,
const vec &b);
674 ITPP_EXPORT vec
operator+(
const ivec &a,
const vec &b);
680 inline vec
operator+(
const vec &a,
const bvec &b) {
return b + a;}
686 inline vec
operator+(
const vec &a,
const svec &b) {
return b + a;}
692 inline vec
operator+(
const vec &a,
const ivec &b) {
return b + a;}
698 inline vec
operator-(
const bvec &a,
const vec &b) {
return a + (-b);}
704 inline vec
operator-(
const svec &a,
const vec &b) {
return a + (-b);}
710 inline vec
operator-(
const ivec &a,
const vec &b) {
return a + (-b);}
716 inline vec
operator-(
const vec &a,
const bvec &b) {
return a + (-b);}
722 inline vec
operator-(
const vec &a,
const svec &b) {
return a + (-b);}
728 inline vec
operator-(
const vec &a,
const ivec &b) {
return a + (-b);}
734 ITPP_EXPORT
double operator*(
const bvec &a,
const vec &b);
740 ITPP_EXPORT
double operator*(
const svec &a,
const vec &b);
746 ITPP_EXPORT
double operator*(
const ivec &a,
const vec &b);
752 inline double operator*(
const vec &a,
const bvec &b) {
return b*a;}
758 inline double operator*(
const vec &a,
const svec &b) {
return b*a;}
764 inline double operator*(
const vec &a,
const ivec &b) {
return b*a;}
772 ITPP_EXPORT cvec
operator+(
const bvec &a,
const cvec &b);
778 ITPP_EXPORT cvec
operator+(
const svec &a,
const cvec &b);
784 ITPP_EXPORT cvec
operator+(
const ivec &a,
const cvec &b);
790 inline cvec
operator+(
const cvec &a,
const bvec &b) {
return b + a;}
796 inline cvec
operator+(
const cvec &a,
const svec &b) {
return b + a;}
802 inline cvec
operator+(
const cvec &a,
const ivec &b) {
return b + a;}
808 inline cvec
operator-(
const bvec &a,
const cvec &b) {
return a + (-b);}
814 inline cvec
operator-(
const svec &a,
const cvec &b) {
return a + (-b);}
820 inline cvec
operator-(
const ivec &a,
const cvec &b) {
return a + (-b);}
826 inline cvec
operator-(
const cvec &a,
const bvec &b) {
return a + (-b);}
832 inline cvec
operator-(
const cvec &a,
const svec &b) {
return a + (-b);}
838 inline cvec
operator-(
const cvec &a,
const ivec &b) {
return a + (-b);}
844 ITPP_EXPORT std::complex<double>
operator*(
const bvec &a,
const cvec &b);
850 ITPP_EXPORT std::complex<double>
operator*(
const svec &a,
const cvec &b);
856 ITPP_EXPORT std::complex<double>
operator*(
const ivec &a,
const cvec &b);
862 inline std::complex<double>
operator*(
const cvec &a,
const bvec &b) {
return b*a;}
868 inline std::complex<double>
operator*(
const cvec &a,
const svec &b) {
return b*a;}
874 inline std::complex<double>
operator*(
const cvec &a,
const ivec &b) {
return b*a;}
888 ITPP_EXPORT mat
operator+(
const smat &a,
const mat &b);
894 ITPP_EXPORT mat
operator+(
const imat &a,
const mat &b);
906 inline mat
operator+(
const mat &a,
const smat &b) {
return b + a;}
912 inline mat
operator+(
const mat &a,
const imat &b) {
return b + a;}
924 inline mat
operator-(
const smat &a,
const mat &b) {
return a + (-b);}
930 inline mat
operator-(
const imat &a,
const mat &b) {
return a + (-b);}
942 inline mat
operator-(
const mat &a,
const smat &b) {
return a + (-b);}
948 inline mat
operator-(
const mat &a,
const imat &b) {
return a + (-b);}
962 ITPP_EXPORT cmat
operator+(
const smat &a,
const cmat &b);
968 ITPP_EXPORT cmat
operator+(
const imat &a,
const cmat &b);
974 ITPP_EXPORT cmat
operator+(
const mat &a,
const cmat &b);
986 inline cmat
operator+(
const cmat &a,
const smat &b) {
return b + a;}
992 inline cmat
operator+(
const cmat &a,
const imat &b) {
return b + a;}
998 inline cmat
operator+(
const cmat &a,
const mat &b) {
return b + a;}
1010 inline cmat
operator-(
const smat &a,
const cmat &b) {
return a + (-b);}
1016 inline cmat
operator-(
const imat &a,
const cmat &b) {
return a + (-b);}
1022 inline cmat
operator-(
const mat &a,
const cmat &b) {
return a + (-b);}
1034 inline cmat
operator-(
const cmat &a,
const smat &b) {
return a + (-b);}
1040 inline cmat
operator-(
const cmat &a,
const imat &b) {
return a + (-b);}
1046 inline cmat
operator-(
const cmat &a,
const mat &b) {
return a + (-b);}
1098 #endif // #ifndef OPERATORS_H