18 using namespace NEWMAT;
28 Tracer et(
"Second test of Matrix package");
34 for (i=1; i<=3; i++)
for (j=1; j<=5; j++) M(i,j) = 100*i + j;
36 for (i=1; i<=8; i++)
for (j=1; j<=10; j++) X(i,j) = 1000*i + 10*j;
39 for (i=1; i<=3; i++)
for (j=1; j<=5; j++) Y(i+1,j+2) = 100*i + j;
44 for (i=1; i<=3; i++)
for (j=1; j<=5; j++) *r++ = 100*i + j;
52 for (i=1; i<=8; i++)
for (j=1; j<=10; j++) X(i,j) = 1000*i + 10*j;
55 for (i=1; i<=5; i++)
for (j=i; j<=5; j++) U(i,j) = 100*i + j;
57 for (i=1; i<=5; i++)
for (j=i; j<=5; j++) Y(i+2,j+4) = 100*i + j;
58 for (i=1; i<=5; i++)
for (j=1; j<i; j++) Y(i+2,j+4) = 0.0;
60 for (i=1; i<=8; i++)
for (j=1; j<=10; j++) X(i,j) = 1000*i + 10*j;
62 for (i=1; i<=5; i++)
for (j=i; j<=5; j++) U(i,j) = 100*i + j;
64 for (i=1; i<=5; i++)
for (j=i; j<=5; j++) Y(i+2,j+4) = 100*i + j;
71 for (i=1;i<=100;i++) V(i) = i*i+i;
80 for (i=1;i<=50;i++) V(i) -= i*i+i;
87 V = CV1-CV2;
Print(V);
91 V = (RV1-RV2).t();
Print(V);
94 for (i=1; i<=4; i++)
for (j=1; j<=7; j++) X(i,j) = 1000*i + 10*j;
97 M = Z + X * 10.5 - 7.25;
101 M = Z - X * 2.5 - 9.25;
104 for (i=1; i<=8; i++)
for (j=i; j<=8; j++) U(i,j) = 100*i + j;
114 T = 100 - S; M = T + S - 100;
Print(M);
115 T = 100 - 2 * S; M = T + S * 2 - 100;
Print(M);
116 X = 100 - 2 * S; M = X + S * 2 - 100;
Print(M);
117 T = S; T = 100 - T; M = T + S - 100;
Print(M);
125 for (i = 1; i <= 10; i++)
for (j = 1; j <= 20; j++)
126 (*MX)(i,j) = 100 * i + j;
129 *CV << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10;
133 *MX -= 100 * *CV * RV1 + CV1 * *RV;
135 delete MX;
delete CV;
delete RV;
166 dims(9) = M2.
Nrows(); dims(10) = M2.
Ncols()-1;
169 dims(13) = M2.
Nrows(); dims(14) = M2.
Ncols()-1;
183 dims(9) = M2.
Nrows()-1; dims(10) = M2.
Ncols();
186 dims(13) = M2.
Nrows()-1; dims(14) = M2.
Ncols();
195 M = I; M -= D;
Print(M);
209 for (i = 1; i <= 10; i++)
for (j = 1; j <= 10; j++)
210 M(i,j) = 100 * i + j;
212 N = M * I - M;
Print(N);
213 N = I * M - M;
Print(N);
214 N = M * I.
i() - M;
Print(N);
215 N = I.
i() * M - M;
Print(N);
216 N = I.
i(); N -= I;
Print(N);
217 N = I.
t(); N -= I;
Print(N);
218 N = I.
t(); N += (-I);
Print(N);
219 D = I; N = D; D = 1; N -= D;
Print(N);
220 N = I; D = 1; N -= D;
Print(N);
237 X(9) = I.
Maximum1(i) - 4; X(10) = i-1;
238 X(11) = I.
Maximum2(i,j) - 4; X(12) = i-10; X(13) = j-10;
239 X(14) = I.
Nrows() - 10;
246 N = M * I - 4 * M;
Print(N);
247 N = I * M - 4 * M;
Print(N);
248 N = M * I.
i() - 0.25 * M;
Print(N);
249 N = I.
i() * M - 0.25 * M;
Print(N);
250 N = I.
i(); N -= I * 0.0625;
Print(N);
251 N = I.
i(); N = N - 0.0625 * I;
Print(N);
252 N = I.
t(); N -= I;
Print(N);
253 D = I * 2; N = D; D = 1; N -= 8 * D;
Print(N);
254 N = I * 2; N -= 8 * D;
Print(N);
255 N = 0.5 * I + M; N -= M; N -= 2.0 * D;
Print(N);
257 IdentityMatrix J(10); J = 8;
260 N = (I + J) - (D + E);
Print(N);
261 N = (5*I + 3*J) - (5*D + 3*E);
Print(N);
262 N = (-I + J) - (-D + E);
Print(N);
263 N = (I - J) - (D - E);
Print(N);
264 N = (I | J) - (D | E);
Print(N);
265 N = (I & J) - (D & E);
Print(N);
269 N = M; N.
Inject(I); D << M; N -= (M + I); N += D;
Print(N);
272 IdentityMatrix
K = I.
i()*7 - J.
t()/4;
273 N = D.
i() * 7 - E / 4 -
K;
Print(N);
274 K = I * J; N = K - D * E;
Print(N);
275 N = I * J; N -= D * E;
Print(N);
277 N = K - (5*D - 3*E);
Print(N);
278 K = I.
i(); N = K - 0.0625 * I;
Print(N);
279 K = I.
t(); N = K - I;
Print(N);
285 I.ReSize(3); J.ReSize(3); K = I * J; N = K - I;
Print(N);
286 K << D; N = K - D;
Print(N);
292 X << 5.25 << 7.75 << 1.25
293 << 9.00 << 1.00 << 2.50;
301 X << 5.25f << 7.75f << 1.25f
302 << 9.00f << 1.00f << 2.50f;
LogAndSign LogDeterminant(const BaseMatrix &B)
Real Sum(const BaseMatrix &B)
Real Maximum1(int &i) const
Real Minimum(const BaseMatrix &B)
SPMatrix SP(const BaseMatrix &, const BaseMatrix &)
Real Maximum(const BaseMatrix &B)
virtual void ReSize(int m, int n)
void Inject(const GeneralMatrix &GM)
Real Maximum2(int &i, int &j) const
Real SumSquare(const BaseMatrix &B)
void Inject(const GeneralMatrix &GM)
void Clean(Matrix &A, Real c)
TransposedMatrix t() const
Real Trace(const BaseMatrix &B)
The usual rectangular matrix.
Real SumAbsoluteValue(const BaseMatrix &B)
FloatVector FloatVector * a
GetSubMatrix SubMatrix(int fr, int lr, int fc, int lc) const
void Print(const Matrix &X)
GetSubMatrix Rows(int f, int l) const