24 #define REPORT { static ExeCounter ExeCount(__LINE__,5); ++ExeCount; } 40 gm1 = mt.
New(ncols_val,nrows_val,tm);
41 for (
int i=0; i<ncols_val; i++)
50 gm1 = mt.
New(ncols_val,nrows_val,tm);
60 {
REPORT return Evaluate(mt); }
64 {
REPORT return Evaluate(mt); }
70 gmx->nrows_val = 1; gmx->ncols_val = gmx->storage = storage;
71 return BorrowStore(gmx,mt);
78 gmx->ncols_val = 1; gmx->nrows_val = gmx->storage = storage;
79 return BorrowStore(gmx,mt);
83 {
REPORT return Evaluate(mt); }
94 tDelete(); gmx->ReleaseAndDelete();
return gmx;
101 Tracer et(
"CroutMatrix::Evaluate");
108 {
REPORT return gm->Evaluate(mt); }
113 int nr=gm->
Nrows();
int nc=gm->Ncols();
114 Compare(gm->Type().AddEqualEl(),mt);
115 if (!(mt==gm->Type()))
121 while (nr--) { mrx.
Add(mr,f); mrx.
Next(); mr.
Next(); }
122 gmx->ReleaseAndDelete(); gm->tDelete();
125 else if (gm->reuse())
141 int nr=gm->
Nrows();
int nc=gm->Ncols();
142 Compare(gm->Type().AddEqualEl(),mt);
143 if (!(mt==gm->Type()))
150 gmx->ReleaseAndDelete(); gm->tDelete();
153 else if (gm->reuse())
169 int nr=gm->
Nrows();
int nc=gm->Ncols();
191 gmx->ReleaseAndDelete(); gm->tDelete();
199 int nr=gm->
Nrows();
int nc=gm->Ncols();
222 gmx->ReleaseAndDelete(); gm->tDelete();
231 if ((gm->Type()).is_band() && ! (gm->Type()).is_diagonal())
237 if (gm->reuse()) {
REPORT gm->ReverseElements(); gmx = gm; }
241 gmx = gm->
Type().
New(gm->Nrows(), gm->Ncols(),
this);
262 return gm->BorrowStore(gmx,mt);
270 return gm->BorrowStore(gmx,mt);
278 return gm->BorrowStore(gmx,mt);
283 Tracer tr(
"MatedMatrix::Evaluate");
289 return gm->BorrowStore(gmx,mt);
295 Tracer tr(
"SubMatrix(evaluate)");
297 if (row_number < 0) row_number = gm->Nrows();
298 if (col_number < 0) col_number = gm->Ncols();
299 if (row_skip+row_number > gm->Nrows() || col_skip+col_number > gm->Ncols())
304 if (IsSym)
Compare(gm->Type().ssub(), mt);
305 else Compare(gm->Type().sub(), mt);
316 gmx->ReleaseAndDelete(); gm->tDelete();
332 { *s++ = *s1++ + f; *s++ = *s1++ + f; *s++ = *s1++ + f; *s++ = *s1++ + f; }
333 i = storage & 3;
while (i--) *s++ = *s1++ + f;
339 Real* s=store;
int i=(storage >> 2);
340 while (i--) { *s++ += f; *s++ += f; *s++ += f; *s++ += f; }
341 i = storage & 3;
while (i--) *s++ += f;
349 { *s++ = f - *s1++; *s++ = f - *s1++; *s++ = f - *s1++; *s++ = f - *s1++; }
350 i = storage & 3;
while (i--) *s++ = f - *s1++;
356 Real* s=store;
int i=(storage >> 2);
359 *s = f - *s; s++; *s = f - *s; s++;
360 *s = f - *s; s++; *s = f - *s; s++;
362 i = storage & 3;
while (i--) { *s = f - *s; s++; }
371 { *s++ = -(*s1++); *s++ = -(*s1++); *s++ = -(*s1++); *s++ = -(*s1++); }
372 i = storage & 3;
while(i--) *s++ = -(*s1++);
378 Real* s=store;
int i=(storage >> 2);
380 { *s = -(*s); s++; *s = -(*s); s++; *s = -(*s); s++; *s = -(*s); s++; }
381 i = storage & 3;
while(i--) { *s = -(*s); s++; }
389 { *s++ = *s1++ * f; *s++ = *s1++ * f; *s++ = *s1++ * f; *s++ = *s1++ * f; }
390 i = storage & 3;
while (i--) *s++ = *s1++ * f;
396 Real* s=store;
int i=(storage >> 2);
397 while (i--) { *s++ *= f; *s++ *= f; *s++ *= f; *s++ *= f; }
398 i = storage & 3;
while (i--) *s++ *= f;
412 *r = (
Real)f;
int n1 = n-1; n=0;
423 Real* r; r = Store(); *r = (
Real)f; n--;
430 Tracer et(
"MatrixInput (GetSubMatrix)");
432 if (row_number != 1 || col_skip != 0 || col_number != gm->Ncols())
455 *r = (
Real)f;
int n1 = n-1; n=0;
466 Real* r; r = Store(); *r = (
Real)f; n--;
473 Tracer et(
"MatrixInput (GetSubMatrix)");
475 if (row_number != 1 || col_skip != 0 || col_number != gm->Ncols())
497 std::cerr <<
"Error in destructor: A list of values was too short" << std::endl;
542 int n = Storage();
Real* rx = Store() + n;
Real* x = gm->
Store();
543 while (n--) *(--rx) = *(x++);
550 int n = Storage();
Real* x = Store();
Real* rx = x + n;
552 while (n--) {
Real t = *(--rx); *rx = *x; *(x++) = t; }
void Add(GeneralMatrix *, Real)
void operator<<(const BaseMatrix &)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void Copy(const MatrixRowCol &)
GeneralMatrix * Transpose(TransposedMatrix *, MatrixType)
GeneralMatrix * New() const
new matrix of given type
void NegAdd(const MatrixRowCol &, Real)
Miscellaneous exception (details in character string).
GeneralMatrix * Transpose(TransposedMatrix *, MatrixType)
void Add(const MatrixRowCol &)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void SubRowCol(MatrixRowCol &, int, int) const
void NegAdd(GeneralMatrix *, Real)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
GeneralMatrix * Transpose(TransposedMatrix *, MatrixType)
GeneralMatrix * Transpose(TransposedMatrix *, MatrixType)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void Negate(const MatrixRowCol &)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void Multiply(const MatrixRowCol &)
MatrixInput operator<<(double)
bool Compare(const MatrixType &, MatrixType &)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Base of the matrix classes.
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
The usual rectangular matrix.
void Multiply(GeneralMatrix *, Real)
Incompatible dimensions exception.
Submatrix dimension exception.
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void MatrixErrorNoSpace(const void *)
test for allocation fails
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void operator<<(const double *)
void operator<<(const double *r)
virtual GeneralMatrix * Transpose(TransposedMatrix *, MatrixType)
The classes for matrices that can contain data are derived from this.
GeneralMatrix * Transpose(TransposedMatrix *, MatrixType)
GeneralMatrix * Evaluate(MatrixType=MatrixTypeUnSp)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)