31#include "cvecrmat.inl"
45 for(
int i=
Lb(A,1) ; i<=
Ub(A,1) ; i++) {
46 for(
int j=
Lb(A,2) ; j<=
Ub(A,2) ; j++) {
47 if(i-
Lb(A,1) == j-
Lb(A,2))
48 M[i][j] =
abs(A[i][j]);
50 M[i][j] = -
abs(A[i][j]);
61 int lbi =
Lb(A,1), ubi =
Ub(A,1);
62 int lbj =
Lb(A,2), ubj =
Ub(A,2);
65 for (i = lbi; i <= ubi; i++)
66 for (j = lbj; j <= ubj; j++)
67 B[i][j] =
complex( (i==j) ? 1.0 : 0.0 );
76 for (n =
Lb(A,1); n <=
Ub(A,1); n++)
Col(res,n) =
Row(A,n);
94 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cmatrix_subv &, const cmatrix_subv &)"));
96 addDot_op(dp,rv1,rv2);
101 addDot_op(dp,rv1,rv2);
113 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cvector &, const cmatrix_subv &)"));
120 addDot_op(dp,rv1,rv2);
132 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cmatrix_subv &, const cvector &)"));
139 addDot_op(dp,rv1,rv2);
151 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cvector_slice &, const cmatrix_subv &)"));
158 addDot_op(dp,sl1,rv2);
170 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cmatrix_subv &, const cvector_slice &)"));
177 addDot_op(dp,rv1,sl2);
188 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const cmatrix_subv &)"));
204 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cvector &, const cmatrix_subv &)"));
220 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const cvector &)"));
236 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cvector_slice &, const cmatrix_subv &)"));
252 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const cvector_slice &)"));
268 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rmatrix_subv &, const cmatrix_subv &)"));
270 addDot(Re(dp),rv1,Re(rv2));
271 addDot(Im(dp),rv1,Im(rv2));
276 addDot_op(Re(dp),rv1,Re(rv2));
277 addDot_op(Im(dp),rv1,Im(rv2));
288 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rmatrix_subv &, const cvector_slice &)"));
290 addDot(Re(dp),rv1,Re(rv2));
291 addDot(Im(dp),rv1,Im(rv2));
296 addDot_op(Re(dp),rv1,Re(rv2));
297 addDot_op(Im(dp),rv1,Im(rv2));
309 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rmatrix_subv &, const cvector &)"));
311 addDot(Re(dp),rv1,Re(rv2));
312 addDot(Im(dp),rv1,Im(rv2));
317 addDot_op(Re(dp),rv1,Re(rv2));
318 addDot_op(Im(dp),rv1,Im(rv2));
330 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cmatrix_subv &, const rmatrix_subv &)"));
332 addDot(Re(dp),Re(rv1),rv2);
333 addDot(Im(dp),Im(rv1),rv2);
338 addDot_op(Re(dp),Re(rv1),rv2);
339 addDot_op(Im(dp),Im(rv1),rv2);
350 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cvector &, const rmatrix_subv &)"));
352 addDot(Re(dp),Re(rv1),rv2);
353 addDot(Im(dp),Im(rv1),rv2);
358 addDot_op(Re(dp),Re(rv1),rv2);
359 addDot_op(Im(dp),Im(rv1),rv2);
370 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cvector_slice &, const rmatrix_subv &)"));
372 addDot(Re(dp),Re(rv1),rv2);
373 addDot(Im(dp),Im(rv1),rv2);
378 addDot_op(Re(dp),Re(rv1),rv2);
379 addDot_op(Im(dp),Im(rv1),rv2);
390 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rvector &, const cmatrix_subv &)"));
392 addDot(Re(dp),rv1,Re(rv2));
393 addDot(Im(dp),rv1,Im(rv2));
398 addDot_op(Re(dp),rv1,Re(rv2));
399 addDot_op(Im(dp),rv1,Im(rv2));
410 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cmatrix_subv &, const rvector &)"));
412 addDot(Re(dp),Re(rv1),rv2);
413 addDot(Im(dp),Im(rv1),rv2);
418 addDot_op(Re(dp),Re(rv1),rv2);
419 addDot_op(Im(dp),Im(rv1),rv2);
430 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rvector_slice &, const cmatrix_subv &)"));
432 addDot(Re(dp),sl1,Re(rv2));
433 addDot(Im(dp),sl1,Im(rv2));
438 addDot_op(Re(dp),sl1,Re(rv2));
439 addDot_op(Im(dp),sl1,Im(rv2));
450 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const cmatrix_subv &, const rvector_slice &)"));
452 addDot(Re(dp),Re(rv1),sl2);
453 addDot(Im(dp),Im(rv1),sl2);
458 addDot_op(Re(dp),Re(rv1),sl2);
459 addDot_op(Im(dp),Im(rv1),sl2);
470 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rmatrix_subv &, const cmatrix_subv &)"));
474 addDot(Re(tmp),rv1,Re(rv2));
475 addDot(Im(tmp),rv1,Im(rv2));
487 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const rmatrix_subv &)"));
491 addDot(Re(tmp),Re(rv1),rv2);
492 addDot(Im(tmp),Im(rv1),rv2);
504 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rvector &, const cmatrix_subv &)"));
508 addDot(Re(tmp),rv1,Re(rv2));
509 addDot(Im(tmp),rv1,Im(rv2));
521 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const rvector &)"));
525 addDot(Re(tmp),Re(rv1),rv2);
526 addDot(Im(tmp),Im(rv1),rv2);
538 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rvector_slice &, const cmatrix_subv &)"));
542 addDot(Re(tmp),sl1,Re(rv2));
543 addDot(Im(tmp),sl1,Im(rv2));
555 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const rvector_slice &)"));
559 addDot(Re(tmp),Re(rv1),sl2);
560 addDot(Im(tmp),Im(rv1),sl2);
572 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const imatrix_subv &, const cvector &)"));
578 addDot(tmp_re,rv1,Re(rv2));
579 addDot(tmp_im,rv1,Im(rv2));
591 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cvector &, const imatrix_subv &)"));
597 addDot(tmp_re,Re(rv1),rv2);
598 addDot(tmp_im,Im(rv1),rv2);
609 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const imatrix_subv &, const cvector_slice &)"));
615 addDot(tmp_re,rv1,Re(rv2));
616 addDot(tmp_im,rv1,Im(rv2));
628 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cvector_slice &, const imatrix_subv &)"));
634 addDot(tmp_re,Re(rv1),rv2);
635 addDot(tmp_im,Im(rv1),rv2);
647 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const ivector &)"));
653 addDot(tmp_re,Re(rv1),rv2);
654 addDot(tmp_im,Im(rv1),rv2);
666 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const ivector &, const cmatrix_subv &)"));
672 addDot(tmp_re,rv1,Re(rv2));
673 addDot(tmp_im,rv1,Im(rv2));
685 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const cmatrix_subv &, const ivector_slice &)"));
691 addDot(tmp_re,Re(rv1),rv2);
692 addDot(tmp_im,Im(rv1),rv2);
704 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const ivector_slice &, const cmatrix_subv &)"));
710 addDot(tmp_re,rv1,Re(rv2));
711 addDot(tmp_im,rv1,Im(rv2));
The Data Type cdotprecision.
void set_k(unsigned int i)
Set precision for computation of dot products.
The Data Type cidotprecision.
int get_k() const
Get currently set precision for computation of dot products.
The Data Type cmatrix_subv.
The Data Type cvector_slice.
The Data Type idotprecision.
void set_k(unsigned int i)
Set precision for computation of dot products.
The Data Type imatrix_subv.
The Data Type ivector_slice.
The Data Type rmatrix_subv.
The Data Type rvector_slice.
The namespace cxsc, providing all functionality of the class library C-XSC.
int VecLen(const scimatrix_subv &S)
Returns the length of the subvector.
void accumulate_approx(cdotprecision &dp, const cmatrix_subv &rv1, const cmatrix_subv &rv2)
The accurate scalar product of the last two arguments added to the value of the first argument (witho...
cimatrix_subv Col(cimatrix &m, const int &i) noexcept
Returns one column of the matrix as a vector.
rmatrix CompMat(const cimatrix &A)
Returns Ostrowski's comparison matrix.
cimatrix transp(const cimatrix &A)
Returns the transposed matrix.
int Ub(const cimatrix &rm, const int &i) noexcept
Returns the upper bound index.
cimatrix_subv Row(cimatrix &m, const int &i) noexcept
Returns one row of the matrix as a vector.
void DoubleSize(cimatrix &A)
Doubles the size of the matrix.
cimatrix Id(const cimatrix &A)
Returns the Identity matrix.
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
void Resize(cimatrix &A) noexcept
Resizes the matrix.
int Lb(const cimatrix &rm, const int &i) noexcept
Returns the lower bound index.