18 using namespace NEWMAT;
28 Tracer et(
"Twenty second test of Matrix package");
47 C.
Row(1) << 21 << 6 << 27 << 35 << 10 << 45 << 14 << 4 << 18;
48 C.
Row(2) << 3 << 9 << 18 << 5 << 15 << 30 << 2 << 6 << 12;
49 C.
Row(3) << 12 << 30 << 15 << 20 << 50 << 25 << 8 << 20 << 10;
50 C.
Row(4) << 33 << 24 << 36 << 55 << 40 << 60 << 22 << 16 << 24;
52 C.
Row(5) << 28 << 8 << 36 << 7 << 2 << 9 << 42 << 12 << 54;
53 C.
Row(6) << 4 << 12 << 24 << 1 << 3 << 6 << 6 << 18 << 36;
54 C.
Row(7) << 16 << 40 << 20 << 4 << 10 << 5 << 24 << 60 << 30;
55 C.
Row(8) << 44 << 32 << 48 << 11 << 8 << 12 << 66 << 48 << 72;
79 C.
Row(1) <<12<< 3<<21<< 6 <<32<< 8<<56<<16 <<20<< 5<<35<<10;
80 C.
Row(2) << 9<<27<<24 << 0<<24<<72<<64 << 0<<15<<45<<40;
81 C.
Row(3) << 3<<15 << 0<< 0<< 8<<40 << 0<< 0<< 5<<25;
82 C.
Row(4) <<18 << 0<< 0<< 0<<48 << 0<< 0<< 0<<30;
84 C.
Row(5) <<28<< 7<<49<<14 << 8<< 2<<14<< 4;
85 C.
Row(6) <<21<<63<<56 << 0<< 6<<18<<16;
86 C.
Row(7) << 7<<35 << 0<< 0<< 2<<10;
87 C.
Row(8) <<42 << 0<< 0<< 0<<12;
89 C.
Row(9) <<16<< 4<<28<< 8;
90 C.
Row(10) <<12<<36<<32;
99 N.
Row(1) <<12 << 0<< 0<< 0 <<32<< 0<< 0<< 0 <<20<< 0<< 0<< 0;
100 N.
Row(2) << 3 << 9<< 0<< 0 << 8<<24<< 0<< 0 << 5<<15<< 0<< 0;
101 N.
Row(3) <<21 <<27<< 3<< 0 <<56<<72<< 8<< 0 <<35<<45<< 5<< 0;
102 N.
Row(4) << 6 <<24<<15<<18 <<16<<64<<40<<48 <<10<<40<<25<<30;
104 N.
Row(5) << 0 << 0<< 0<< 0 <<28<< 0<< 0<< 0 << 8<< 0<< 0<< 0;
105 N.
Row(6) << 0 << 0<< 0<< 0 << 7<<21<< 0<< 0 << 2<< 6<< 0<< 0;
106 N.
Row(7) << 0 << 0<< 0<< 0 <<49<<63<< 7<< 0 <<14<<18<< 2<< 0;
107 N.
Row(8) << 0 << 0<< 0<< 0 <<14<<56<<35<<42 << 4<<16<<10<<12;
109 N.
Row(9) << 0 << 0<< 0<< 0 << 0<< 0<< 0<< 0 <<16<< 0<< 0<< 0;
110 N.
Row(10)<< 0 << 0<< 0<< 0 << 0<< 0<< 0<< 0 << 4<<12<< 0<< 0;
111 N.
Row(11)<< 0 << 0<< 0<< 0 << 0<< 0<< 0<< 0 <<28<<36<< 4<< 0;
112 N.
Row(12)<< 0 << 0<< 0<< 0 << 0<< 0<< 0<< 0 << 8<<32<<20<<24;
115 AB <<
KP(A, BT); AB << (AB - N);
Print(AB);
116 BT <<
KP(A, BT); BT << (BT - N);
Print(BT);
119 N1 =
KP(AT, B); N1 -= N.
t();
Print(N1);
120 AB <<
KP(AT, B); AB << (AB - N.
t());
Print(AB);
121 BT <<
KP(AT, B); BT << (BT - N.
t());
Print(BT);
128 BMA.
Row(1) << 5.25 << 4.75 << 2.25 << 1.75;
129 BMA.
Row(2) << 1.25 << 9.75 << 4.50 << 0.25 << 1.50;
130 BMA.
Row(3) << 7.75 << 1.50 << 3.00 << 4.25 << 0.50 << 5.50;
131 BMA.
Row(4) << 2.75 << 9.00 << 8.00 << 3.25 << 3.50;
132 BMA.
Row(5) << 8.75 << 6.25 << 5.00 << 5.75;
133 BMA.
Row(6) << 3.75 << 6.75 << 6.00;
138 BMB.
Row(1) << 4.5 << 9.5;
139 BMB.
Row(2) << 1.5 << 6.0 << 2.0;
140 BMB.
Row(3) << 0.5 << 2.5 << 8.5 << 7.5;
141 BMB.
Row(4) << 3.0 << 4.0 << 6.5;
151 M = C - BMC1;
Print(M);
152 M = C - C2;
Print(M);
172 SM1.
Row(2) << 4 << 5;
173 SM1.
Row(3) << 9 << 2 << 1;
174 SM1.
Row(4) << 3 << 6 << 8 << 2;
178 SM2.
Row(2) << -7 << -6;
179 SM2.
Row(3) << 4 << -2 << -1;
184 M =
KP(SM1, SM2) - SM;
Print(M);
185 M =
KP(M1, SM2) - SM;
Print(M);
186 M =
KP(SM1, M2) - SM;
Print(M);
187 M =
KP(M1, M2); M -= SM;
Print(M);
198 B << 7 << 2 << 9 << 11
200 << 4 << 10 << 5 << 12;
213 B << 3 << 2 << 0 << 1 << 6;
214 C << 15 << 10 << 0 << 5 << 30
215 << 6 << 4 << 0 << 2 << 12
216 << 12 << 8 << 0 << 4 << 24;
218 N =
KP(A.t(), B.t()) - C.
t();
Print(N);
228 B.
Row(1) << 9 << 8 << 6 << 12 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5;
229 B.
Row(2) << 5 << 5 << 5 << 5 << 9 << 8 << 6 << 12 << 5 << 5 << 5 << 5;
230 B.
Row(3) << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 9 << 8 << 6 << 12;
246 M = (A.t() * B.t()).t(); M -= AB;
Print(M);
251 C.
Row(1) << 2 << 6 << 7 << 1 << 3;
252 C.
Row(2) << 4 << 3 << 9 << 4 << 8;
253 C.
Row(3) << 1 << 3 << 0 << 0 << 6;
254 C.
Row(4) << 4 << 8 << 2 << 6 << 7;
255 C.
Row(5) << 0 << 6 << 4 << 3 << 9;
258 AB = (AB | AB) & (AB | AB);
260 C.
Row(1) << 2 << 6 << 2 << 6;
261 C.
Row(2) << 4 << 3 << 4 << 3;
262 C.
Row(3) << 2 << 6 << 2 << 6;
263 C.
Row(4) << 4 << 3 << 4 << 3;
266 C << M; C += -M;
Print(C);
KPMatrix KP(const BaseMatrix &, const BaseMatrix &)
virtual MatrixBandWidth BandWidth() const
TransposedMatrix t() const
The usual rectangular matrix.
GetSubMatrix SymSubMatrix(int f, int l) const
GetSubMatrix Row(int f) const
GetSubMatrix SubMatrix(int fr, int lr, int fc, int lc) const
DiagedMatrix AsDiagonal() const
void Print(const Matrix &X)