24 #define REPORT { static ExeCounter ExeCount(__LINE__,4); ++ExeCount; } 30 #define DO_SEARCH // search for LHS of = in RHS 35 {
return (n*(n+1))/2; }
41 { store=0; storage=0; nrows_val=0; ncols_val=0; tag_val=-1; }
46 storage=s.
Value(); tag_val=-1;
59 :
Matrix(n.Value(),n.Value())
101 Tracer tr(
"SquareMatrix(Matrix)");
123 Tracer tr(
"ColumnVector");
204 {
REPORT X.
indx = indx; indx = 0;
d =
true; sing =
true;
return; }
206 {
REPORT indx = 0;
d =
true; sing =
true;
return; }
210 Tracer tr(
"CroutMatrix::get_aux");
213 int n =
nrows_val;
int*
i = ix;
int* j = indx;
214 while(n--) *i++ = *j++;
222 Tracer tr(
"CroutMatrix(const CroutMatrix&)");
258 #ifdef SETUP_C_SUBSCRIPTS 298 Tracer tr(
"SquareMatrix::resize");
323 Tracer tr(
"RowVector::resize");
330 Tracer tr(
"ColumnVector::resize");
348 Tracer tr(
"SquareMatrix::resize(GM)");
369 Tracer tr(
"SymmetricMatrix::resize(GM)");
381 Tracer tr(
"DiagonalMatrix::resize(GM)");
393 Tracer tr(
"UpperTriangularMatrix::resize(GM)");
405 Tracer tr(
"LowerTriangularMatrix::resize(GM)");
417 Tracer tr(
"IdentityMatrix::resize(GM)");
426 Tracer tr(
"GeneralMatrix::resize(GM)");
434 Tracer tr(
"Matrix::resize_keep");
456 X.submatrix(1,nr,1,nc) =
submatrix(1,nr,1,nc);
463 Tracer tr(
"SquareMatrix::resize_keep");
481 Tracer tr(
"SquareMatrix::resize_keep 2");
490 Tracer tr(
"SymmetricMatrix::resize_keep");
508 Tracer tr(
"UpperTriangularMatrix::resize_keep");
526 Tracer tr(
"LowerTriangularMatrix::resize_keep");
544 Tracer tr(
"DiagonalMatrix::resize_keep");
562 Tracer tr(
"RowVector::resize_keep");
580 Tracer tr(
"RowVector::resize_keep 2");
588 Tracer tr(
"ColumnVector::resize_keep");
606 Tracer tr(
"ColumnVector::resize_keep 2");
636 {
REPORT return (s==
this) ? 1 : 0; }
639 {
REPORT return gm->search(s); }
642 {
REPORT return bm1->search(s) + bm2->search(s); }
645 {
REPORT return bm->search(s); }
648 {
REPORT return bm->search(s); }
651 {
REPORT return (s==gm) ? 1 : 0; }
688 {
REPORT return gm->bandwidth(); }
691 {
REPORT return gm1->bandwidth() + gm2->bandwidth(); }
694 {
REPORT return gm1->bandwidth().minimum(gm2->bandwidth()); }
702 if (bw2.Lower() < 0) {
REPORT lower = -1; }
703 else {
REPORT lower = bw2.Lower() + (gm1->Nrows() - 1) * gm2->Nrows(); }
708 {
REPORT lower = (1 + bw1.
Lower()) * gm2->Nrows() - 1; }
709 else {
REPORT lower = bw2.Lower() + bw1.
Lower() * gm2->Nrows(); }
713 if (bw2.Upper() < 0) {
REPORT upper = -1; }
714 else {
REPORT upper = bw2.Upper() + (gm1->Nrows() - 1) * gm2->Nrows(); }
719 {
REPORT upper = (1 + bw1.
Upper()) * gm2->Nrows() - 1; }
720 else {
REPORT upper = bw2.Upper() + bw1.
Upper() * gm2->Nrows(); }
726 {
REPORT return gm1->bandwidth() * gm2->bandwidth(); }
733 {
REPORT return gm2->bandwidth(); }
734 else {
REPORT return -1; }
738 {
REPORT return gm->bandwidth(); }
741 {
REPORT return gm->bandwidth(); }
744 {
REPORT return gm->bandwidth().t(); }
750 else {
REPORT return -1; }
758 {
REPORT return gm->bandwidth(); }
763 if (row_skip==col_skip && row_number==col_number)
764 {
REPORT return gm->bandwidth(); }
813 *to++ = *from++; *to++ = *from++; *to++ = *from++; *to++ = *from++;
814 *to++ = *from++; *to++ = *from++; *to++ = *from++; *to++ = *from++;
816 i = n & 7;
while (i--) *to++ = *from++;
840 if (tag_val<0 || tag_val>1)
895 int counter=X.
search(
this);
982 if (!destination) { destination=source;
return true; }
983 if (destination==source)
return true;
984 if (!destination.
DataLossOK && !(destination>=source))
1086 if (i)
for (;;) { *rp++ = s;
if (!(--i))
break; s+=
ncols_val; }
1088 else row_pointer = 0;
1146 if (storage2)
delete [] store2;
1154 if (storage2)
delete [] store2;
1166 else if (n == 0) {
REPORT a = 0; }
1199 {
REPORT for (
int i = 0; i <
n; i++) a[i] = ai; }
1208 for (
int i = 0; i <
n; i++) a[i] = b.
a[i];
1216 if (n == 0) {
REPORT a = 0; }
1221 for (
int i = 0; i <
n; i++) a[i] = b.
a[i];
1230 if (n1 == n) {
REPORT return; }
1231 else if (n1 == 0) {
REPORT n = 0;
delete []
a; a = 0; }
1248 else for (i = n; i < n1; i++) a[i] = 0;
1249 for (i = 0; i <
n; i++) a[i] = a1[i];
1250 n = n1;
delete [] a1;
1254 REPORT n = n1;
delete [] a1;
1279 Real** rp = row_pointer; row_pointer = gm.row_pointer; gm.row_pointer = rp;
1286 int* i = indx; indx = gm.indx; gm.indx = i;
1288 b =
d;
d = gm.d; gm.d = b;
1289 b = sing; sing = gm.sing; gm.sing = b;
1297 i = lower_val; lower_val = gm.lower_val; gm.lower_val = i;
1298 i = upper_val; upper_val = gm.upper_val; gm.upper_val = i;
1306 i = lower_val; lower_val = gm.lower_val; gm.lower_val = i;
1313 int* i = indx; indx = gm.indx; gm.indx = i;
1315 b =
d;
d = gm.d; gm.d = b;
1316 b = sing; sing = gm.sing; gm.sing = b;
1318 m = storage2; storage2 = gm.storage2; gm.storage2 =
m;
1319 m = m1; m1 = gm.m1; gm.m1 =
m;
1320 m = m2; m2 = gm.m2; gm.m2 =
m;
1321 Real* s = store2; store2 = gm.store2; gm.store2 = s;
1335 Tracer tr(
"RealStarStar");
1341 for (
int i = 0; i <
m; ++i) a[i] = d + i * n;
1347 Tracer tr(
"ConstRealStarStar");
1350 a =
new const Real*[
m];
1353 for (
int i = 0; i <
m; ++i) a[i] = d + i * n;
1358 #ifdef use_namespace MatrixBandWidth bandwidth() const
friend class LowerTriangularMatrix
GeneralMatrix * Image() const
int search(const BaseMatrix *) const
GeneralMatrix * Image() const
void swap(SymmetricBandMatrix &gm)
MatrixBandWidth bandwidth() const
int search(const BaseMatrix *) const
friend class SquareMatrix
void operator=(const CroutMatrix &)
friend class UpperTriangularMatrix
void operator=(int ai)
set the array equal to a constant
Miscellaneous exception (details in character string).
MatrixBandWidth bandwidth() const
void inject(const GeneralMatrix &)
#define MONITOR_INT_DELETE(Operation, Size, Pointer)
ReturnMatrix for_return() const
virtual int search(const BaseMatrix *) const =0
MatrixBandWidth bandwidth() const
GetSubMatrix rows(int, int) const
int * a
pointer to the array
Internal newmat exception - shouldn't happen.
friend class ColumnVector
GetSubMatrix columns(int, int) const
virtual void MiniCleanUp()
void swap(GenericMatrix &x)
GeneralMatrix * Image() const
friend class DiagonalMatrix
virtual MatrixType type() const =0
virtual MatrixBandWidth bandwidth() const
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
void Eq2(const BaseMatrix &, MatrixType)
void swap(nricMatrix &gm)
void get_aux(CroutMatrix &)
GeneralMatrix * Image() const
~SimpleIntArray()
return the space to memory
MatrixBandWidth bandwidth() const
MatrixBandWidth bandwidth() const
#define MONITOR_INT_NEW(Operation, Size, Pointer)
MatrixBandWidth bandwidth() const
A matrix is not square exception.
MatrixBandWidth bandwidth() const
void resize(int, int, int)
int search(const BaseMatrix *) const
void swap(GeneralMatrix &gm)
GeneralMatrix * Image() const
MatrixBandWidth bandwidth() const
MatrixBandWidth bandwidth() const
GeneralMatrix * Image() const
bool Compare(const MatrixType &source, MatrixType &destination)
GetSubMatrix sym_submatrix(int, int) const
#define MONITOR_REAL_DELETE(Operation, Size, Pointer)
MatrixBandWidth bandwidth() const
int search(const BaseMatrix *) const
MatrixBandWidth bandwidth() const
ConstRealStarStar(const Matrix &A)
MatrixBandWidth bandwidth() const
MatrixBandWidth bandwidth() const
Base of the matrix classes.
MatrixBandWidth bandwidth() const
void Eq(const BaseMatrix &, MatrixType)
MatrixBandWidth bandwidth() const
MatrixBandWidth bandwidth() const
The usual rectangular matrix.
#define MONITOR_REAL_NEW(Operation, Size, Pointer)
GeneralMatrix * Image() const
int search(const BaseMatrix *) const
MatrixBandWidth bandwidth() const
Incompatible dimensions exception.
Rectangular matrix for use with Numerical Recipes in C.
MatrixBandWidth bandwidth() const
GeneralMatrix * Image() const
void resize(int m, int n)
FloatVector FloatVector * a
LU decomposition of a band matrix.
void resize(int i, bool keep=false)
change length, keep data if keep = true
GeneralMatrix * Image() const
void MatrixErrorNoSpace(const void *)
test for allocation fails
void swap(CroutMatrix &gm)
MatrixBandWidth bandwidth() const
int search(const BaseMatrix *bm) const
void swap(BandLUMatrix &gm)
static int tristore(int n)
virtual void resize(int, int)
SimpleIntArray()
build an array length 0
void newmat_block_copy(int n, Real *from, Real *to)
int & operator[](int i)
access element of the array - start at 0
GeneralMatrix * BorrowStore(GeneralMatrix *, MatrixType)
void swap(BandMatrix &gm)
virtual void resize_keep(int, int)
The classes for matrices that can contain data are derived from this.
MatrixBandWidth bandwidth() const
virtual GeneralMatrix * Image() const
void Inject(const MatrixRowCol &)
friend class SymmetricMatrix
GeneralMatrix * Image() const
Cannot convert to vector exception.
GetSubMatrix submatrix(int, int, int, int) const
A matrix which can be of any GeneralMatrix type.
virtual void SetParameters(const GeneralMatrix *)
GeneralMatrix * Image() const
void GetMatrix(const GeneralMatrix *)
MatrixBandWidth bandwidth() const
friend class ReturnMatrix
MatrixBandWidth bandwidth() const