C-XSC - A C++ Class Library for Extended Scientific Computing
2.5.4
|
28 #include "rmatrix.hpp"
30 #include "rmatrix.inl"
40 for(
int i=
Lb(A,1) ; i<=
Ub(A,1) ; i++) {
41 for(
int j=
Lb(A,2) ; j<=
Ub(A,2) ; j++) {
42 if(i-
Lb(A,1) == j-
Lb(A,2))
43 M[i][j] =
abs(A[i][j]);
45 M[i][j] = -
abs(A[i][j]);
55 int lbi =
Lb(A,1), ubi =
Ub(A,1);
56 int lbj =
Lb(A,2), ubj =
Ub(A,2);
59 for (i = lbi; i <= ubi; i++)
60 for (j = lbj; j <= ubj; j++)
61 B[i][j] = (i==j) ? 1.0 : 0.0;
70 for (n =
Lb(A,1); n <=
Ub(A,1); n++)
Col(res,n) =
Row(A,n);
89 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(dotprecision&, const rmatrix_subv &, const rmatrix_subv &)"));
95 addDot_op(dp,rv1,rv2);
100 #if(CXSC_INDEX_CHECK)
106 #if(CXSC_INDEX_CHECK)
107 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(dotprecision&, const rvector &, const rmatrix_subv &)"));
113 addDot_op(dp,rv1,rv2);
118 #if(CXSC_INDEX_CHECK)
124 #if(CXSC_INDEX_CHECK)
125 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(dotprecision&, const rmatrix_subv &, const rvector &)"));
131 addDot_op(dp,rv1,rv2);
136 #if(CXSC_INDEX_CHECK)
142 #if(CXSC_INDEX_CHECK)
143 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(idotprecision&, const rmatrix_subv &, const rmatrix_subv &)"));
154 #if(CXSC_INDEX_CHECK)
160 #if(CXSC_INDEX_CHECK)
161 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(idotprecision&, const rvector&, const rmatrix_subv &)"));
172 #if(CXSC_INDEX_CHECK)
178 #if(CXSC_INDEX_CHECK)
179 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(idotprecision&, const rmatrix_subv&, const rvector &)"));
190 #if(CXSC_INDEX_CHECK)
196 #if(CXSC_INDEX_CHECK)
197 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rmatrix_subv&, const rmatrix_subv &)"));
199 addDot(Re(dp),rv1,rv2);
204 addDot_op(Re(dp),rv1,rv2);
209 #if(CXSC_INDEX_CHECK)
215 #if(CXSC_INDEX_CHECK)
216 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rvector&, const rmatrix_subv &)"));
218 addDot(Re(dp),rv1,rv2);
223 addDot_op(Re(dp),rv1,rv2);
227 #if(CXSC_INDEX_CHECK)
233 #if(CXSC_INDEX_CHECK)
234 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rmatrix_subv&, const rvector &)"));
236 addDot(Re(dp),rv1,rv2);
241 addDot_op(Re(dp),rv1,rv2);
245 #if(CXSC_INDEX_CHECK)
251 #if(CXSC_INDEX_CHECK)
252 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rmatrix_subv &, const rmatrix_subv &)"));
261 #if(CXSC_INDEX_CHECK)
267 #if(CXSC_INDEX_CHECK)
268 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rvector &, const rmatrix_subv &)"));
277 #if(CXSC_INDEX_CHECK)
283 #if(CXSC_INDEX_CHECK)
284 if(
VecLen(rv1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rmatrix_subv &, const rvector &)"));
294 #if(CXSC_INDEX_CHECK)
300 #if(CXSC_INDEX_CHECK)
301 if(
VecLen(sl)!=
VecLen(sv)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(dotprecision&, const rvector_slice &, const rmatrix_subv &)"));
312 #if(CXSC_INDEX_CHECK)
318 #if(CXSC_INDEX_CHECK)
319 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rvector_slice&, const rmatrix_subv &)"));
321 addDot(Re(dp),sl1,rv2);
326 addDot_op(Re(dp),sl1,rv2);
331 #if(CXSC_INDEX_CHECK)
337 #if(CXSC_INDEX_CHECK)
338 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(idotprecision&, const rvector_slice&, const rmatrix_subv &)"));
348 #if(CXSC_INDEX_CHECK)
354 #if(CXSC_INDEX_CHECK)
355 if(
VecLen(sl1)!=
VecLen(rv2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rvector_slice &, const rmatrix_subv &)"));
365 #if(CXSC_INDEX_CHECK)
371 #if(CXSC_INDEX_CHECK)
372 if(
VecLen(mv)!=
VecLen(vs)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(dotprecision&, const rmatrix_subv &, const rvector_slice &)"));
384 #if(CXSC_INDEX_CHECK)
390 #if(CXSC_INDEX_CHECK)
391 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cdotprecision&, const rmatrix_subv&, const rvector_slice &)"));
393 addDot(Re(dp),rv1,sl2);
398 addDot_op(Re(dp),rv1,sl2);
403 #if(CXSC_INDEX_CHECK)
409 #if(CXSC_INDEX_CHECK)
410 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(idotprecision&, const rmatrix_subv&, const rvector_slice &)"));
420 #if(CXSC_INDEX_CHECK)
426 #if(CXSC_INDEX_CHECK)
427 if(
VecLen(rv1)!=
VecLen(sl2)) cxscthrow(OP_WITH_WRONG_DIM(
"void accumulate(cidotprecision&, const rmatrix_subv &, const rvector_slice &)"));
int get_k() const
Get currently set precision for computation of dot products.
rmatrix CompMat(const cimatrix &A)
Returns Ostrowski's comparison matrix.
int get_k() const
Get currently set precision for computation of dot products.
int Ub(const cimatrix &rm, const int &i) noexcept
Returns the upper bound index.
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
The Data Type idotprecision.
cimatrix_subv Col(cimatrix &m, const int &i) noexcept
Returns one column of the matrix as a vector.
The Data Type rvector_slice.
int Lb(const cimatrix &rm, const int &i) noexcept
Returns the lower bound index.
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...
The Data Type dotprecision.
The Data Type rmatrix_subv.
The Data Type cidotprecision.
void set_k(unsigned int i)
Set precision for computation of dot products.
The namespace cxsc, providing all functionality of the class library C-XSC.
void DoubleSize(cimatrix &A)
Doubles the size of the matrix.
cimatrix transp(const cimatrix &A)
Returns the transposed matrix.
The Data Type cdotprecision.
cimatrix Id(const cimatrix &A)
Returns the Identity matrix.
void Resize(cimatrix &A) noexcept
Resizes the matrix.
cimatrix_subv Row(cimatrix &m, const int &i) noexcept
Returns one row of the matrix as a vector.
int VecLen(const scimatrix_subv &S)
Returns the length of the subvector.