43 for (
int i = 0;i < v.size();i++) {
44 temp(i) = s + double(v(i));
54 for (
int i = 0;i < v.size();i++) {
55 temp(i) = s - double(v(i));
65 for (
int i = 0;i < v.size();i++) {
66 temp(i) = s * double(v(i));
76 for (
int i = 0;i < v.size();i++) {
77 temp(i) = s / double(v(i));
87 for (
int i = 0;i < v.size();i++) {
88 temp(i) = double(v(i)) / s;
93 cvec
operator+(
const std::complex<double> &s,
const ivec &v)
98 for (
int i = 0;i < v.size();i++) {
99 temp(i) = s + std::complex<double>(v(i));
104 cvec
operator-(
const std::complex<double> &s,
const ivec &v)
109 for (
int i = 0;i < v.size();i++) {
110 temp(i) = s - std::complex<double>(v(i));
115 cvec
operator*(
const std::complex<double> &s,
const ivec &v)
120 for (
int i = 0;i < v.size();i++) {
121 temp(i) = s * std::complex<double>(v(i));
126 cvec
operator/(
const std::complex<double> &s,
const ivec &v)
131 for (
int i = 0;i < v.size();i++) {
132 temp(i) = s / std::complex<double>(v(i));
137 cvec
operator/(
const ivec &v,
const std::complex<double> &s)
142 for (
int i = 0;i < v.size();i++) {
143 temp(i) = std::complex<double>(v(i)) / s;
155 for (
int i = 0;i < v.size();i++) {
166 for (
int i = 0;i < v.size();i++) {
167 temp(i) = std::complex<double>((double)s - v(i).real(), -v(i).imag());
177 for (
int i = 0;i < v.size();i++) {
178 temp(i) *= (double)s;
188 for (
int i = 0;i < v.size();i++) {
189 temp(i) /= (double)s;
198 cvec temp(v.length());
199 for (
int i = 0;i < v.size();i++) {
209 it_assert_debug(m.rows() > 0 && m.cols() > 0,
"operator+(): Matrix of zero length");
212 for (
int i = 0;i < m._datasize();i++) {
213 temp._data()[i] += s;
220 it_assert_debug(m.rows() > 0 && m.cols() > 0,
"operator-(): Matrix of zero length");
222 cmat temp(m.rows(), m.cols());
223 for (
int i = 0;i < m._datasize();i++) {
224 temp._data()[i] = std::complex<double>((double)s - m(i).real(), -m(i).imag());
231 it_assert_debug(m.rows() > 0 && m.cols() > 0,
"operator*(): Matrix of zero length");
234 for (
int i = 0;i < m._datasize();i++) {
235 temp._data()[i] *= (double)s;
240 cmat
operator*(
const std::complex<double> &s,
const mat &m)
242 it_assert_debug(m.rows() > 0 && m.cols() > 0,
"operator*(): Matrix of zero length");
244 cmat temp(m.rows(), m.cols());
246 for (
int i = 0;i < m._datasize();i++) {
247 temp._data()[i] = s * m._data()[i];
254 it_assert_debug(m.rows() > 0 && m.cols() > 0,
"operator/(): Matrix of zero length");
257 for (
int i = 0;i < m._datasize();i++) {
258 temp._data()[i] /= (double)s;
267 cvec
operator*(
const std::complex<double> &s,
const vec &v)
270 for (
int i = 0;i < v.size();i++) {
271 temp(i) = s * std::complex<double>(v(i), 0.0);
276 cvec
operator*(
const vec &v,
const std::complex<double> &s)
279 for (
int i = 0;i < v.size();i++) {
280 temp(i) = s * std::complex<double>(v(i), 0.0);
292 it_assert_debug(a.size() == b.size(),
"operator+(): sizes does not match");
294 for (
int i = 0;i < a.size();i++) {temp(i) = (double)a(i) + b(i);}
300 it_assert_debug(a.size() == b.size(),
"operator+(): sizes does not match");
302 for (
int i = 0;i < a.size();i++) {temp(i) = (double)a(i) + b(i);}
308 it_assert_debug(a.size() == b.size(),
"operator+(): sizes does not match");
310 for (
int i = 0;i < a.size();i++) {temp(i) = (double)a(i) + b(i);}
316 it_assert_debug(a.size() == b.size(),
"operator+(): sizes does not match");
318 for (
int i = 0;i < a.size();i++) {temp(i) += (double)a(i);}
324 it_assert_debug(a.size() == b.size(),
"operator+(): sizes does not match");
326 for (
int i = 0;i < a.size();i++) {temp(i) += (double)a(i);}
332 it_assert_debug(a.size() == b.size(),
"operator+(): sizes does not match");
334 for (
int i = 0;i < a.size();i++) {temp(i) += (double)a(i);}
342 it_assert_debug(a.size() == b.size(),
"operator*(): sizes does not match");
344 for (
int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
350 it_assert_debug(a.size() == b.size(),
"operator*(): sizes does not match");
352 for (
int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
358 it_assert_debug(a.size() == b.size(),
"operator*(): sizes does not match");
360 for (
int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
364 std::complex<double>
operator*(
const bvec &a,
const cvec &b)
366 it_assert_debug(a.size() == b.size(),
"operator*(): sizes does not match");
367 std::complex<double> temp = 0;
368 for (
int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
372 std::complex<double>
operator*(
const svec &a,
const cvec &b)
374 it_assert_debug(a.size() == b.size(),
"operator*(): sizes does not match");
375 std::complex<double> temp = 0;
376 for (
int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
380 std::complex<double>
operator*(
const ivec &a,
const cvec &b)
382 it_assert_debug(a.size() == b.size(),
"operator*(): sizes does not match");
383 std::complex<double> temp = 0;
384 for (
int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
392 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
395 for (
int i = 0;i < a.rows();i++) {
396 for (
int j = 0;j < a.cols();j++) {
397 temp(i, j) += (double)a(i, j);
405 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
408 for (
int i = 0;i < a.rows();i++) {
409 for (
int j = 0;j < a.cols();j++) {
410 temp(i, j) += (double)a(i, j);
418 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
421 for (
int i = 0;i < a.rows();i++) {
422 for (
int j = 0;j < a.cols();j++) {
423 temp(i, j) += (double)a(i, j);
433 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
436 for (
int i = 0;i < a.rows();i++) {
437 for (
int j = 0;j < a.cols();j++) {
438 temp(i, j) += std::complex<double>(
static_cast<double>(a(i, j)), 0.0);
446 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
449 for (
int i = 0;i < a.rows();i++) {
450 for (
int j = 0;j < a.cols();j++) {
451 temp(i, j) += (double)a(i, j);
459 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
462 for (
int i = 0;i < a.rows();i++) {
463 for (
int j = 0;j < a.cols();j++) {
464 temp(i, j) += std::complex<double>(
static_cast<double>(a(i, j)), 0.0);
472 it_assert_debug(a.cols() == b.cols() && a.rows() == b.rows(),
"operator+(): sizes does not match");
475 for (
int i = 0;i < a.rows();i++) {
476 for (
int j = 0;j < a.cols();j++) {
477 temp(i, j) += std::complex<double>(
static_cast<double>(a(i, j)), 0.0);