18 using namespace NEWMAT;
24 Tracer et(
"Nineteenth test of Matrix package");
30 Matrix A(13,7), B(13,7), C(13,7);
32 for (i=1;i<=13;i++)
for (j=1; j<=7; j++)
34 Real a = (i+j*j)/2, b = (i*j-i/4);
35 A(i,j)=
a; B(i,j)=b; C(i,j)=a*b;
41 X =
SP(A-1,B+1)+B-A-C+1;
Print(X);
43 A = A.Rows(7,13); B = B.Rows(7,13); C = C.Rows(7,13);
48 X =
SP(LTA*2,UTB) - DC*2;
Print(X);
49 X =
SP(LTA, UTB /2) - DC/2;
Print(X);
50 X =
SP(LTA/2, UTB*2) - DC;
Print(X);
52 DX <<
SP(A,B); DX << (DX-C);
Print(DX);
53 DX <<
SP(A*4,B); DX << (DX-C*4);
Print(DX);
54 DX <<
SP(A,B*2); DX << (DX-C*2);
Print(DX);
55 DX <<
SP(A/4,B/4); DX << (DX-C/16);
Print(DX);
57 LX =
SP(LTA,B); LX << (LX-C);
Print(LX);
58 LX =
SP(LTA*3,B); LX << (LX-C*3);
Print(LX);
59 LX =
SP(LTA,B*5); LX << (LX-C*5);
Print(LX);
60 LX =
SP(-LTA,-B); LX << (LX-C);
Print(LX);
67 for (i=1;i<=25;i++)
for (j=i;j<=25;j++)
69 Real a = i*j +i - j + 3;
71 A(i,j)=
a; B(i,j)=b; C(i,j)=a*b;
74 UT <<
SP(A,B); UT << (UT - C);
Print(UT);
79 BA.Inject(A); BB.Inject(B); BC.
Inject(C);
83 X =
SP(BA*16,BB/16)-BC;
Print(X);
84 X =
SP(BA,BB); X=X-BC;
Print(X);
85 X =
SP(BA*2, BB/2)-BC;
Print(X);
86 X =
SP(BA, BB/2)-BC/2;
Print(X);
87 X =
SP(BA*2, BB)-BC*2;
Print(X);
92 Matrix A(19,19), B(19,19), C(19,19);
94 for (i=1;i<=19;i++)
for (j=1;j<=19;j++)
96 Real a = i*j +i - 1.5*j + 3;
98 A(i,j)=
a; B(i,j)=b; C(i,j)=a*b;
100 BandMatrix BA(19,10,7), BB(19,8,15), BC(19,8,7);
101 BA.Inject(A); BB.Inject(B); BC.
Inject(C);
103 X =
SP(BA,BB); X=X-BC;
Print(X);
104 X =
SP(BA/8,BB); X=X-BC/8;
Print(X);
105 X =
SP(BA,BB*17); X=X-BC*17;
Print(X);
106 X =
SP(BA/4,BB*7); X=X-BC*7/4;
Print(X);
108 X =
SP(BA/8,BB)-BC/8;
Print(X);
109 X =
SP(BA,BB*17)-BC*17;
Print(X);
110 X =
SP(BA/4,BB*7)-BC*7/4;
Print(X);
114 BA.ReSize(19,7,10); BB.ReSize(19,15,8);
116 BA.Inject(A); BB.Inject(B); BC.Inject(C);
118 X =
SP(BA,BB); X=X-BC;
Print(X);
119 X =
SP(BA/8,BB); X=X-BC/8;
Print(X);
120 X =
SP(BA,BB*17); X=X-BC*17;
Print(X);
121 X =
SP(BA/4,BB*7); X=X-BC*7/4;
Print(X);
123 X =
SP(BA/8,BB)-BC/8;
Print(X);
124 X =
SP(BA,BB*17)-BC*17;
Print(X);
125 X =
SP(BA/4,BB*7)-BC*7/4;
Print(X);
134 for (i=1;i<=7;i++)
for (j=1;j<=7;j++)
136 Real a = i*j +i - 1.5*j + 3;
144 SB.
Inject(S); A = BA; S = SB;
147 X =
SP(BA*2,SB); X=X-
SP(A,S*2);
Print(X);
148 X =
SP(BA,SB/4); X=X-
SP(A/4,S);
Print(X);
149 X =
SP(BA*4,SB/4); X=X-
SP(A,S);
Print(X);
SPMatrix SP(const BaseMatrix &, const BaseMatrix &)
void Inject(const GeneralMatrix &GM)
TransposedMatrix t() const
The usual rectangular matrix.
FloatVector FloatVector * a
void Print(const Matrix &X)