17 using namespace NEWMAT;
52 Tracer et(
"Eleventh test of Matrix package");
58 for (i=1;i<=10;i++) RV(i)=i*i-3;
59 Matrix X(1,1); X(1,1) = .25;
65 for (i=1; i<=5; i++)
for (j=1; j<=i; j++)
66 { L(i,j) = i*i + j -2.0; U(j,i) = i*i*j+3; }
68 for (i=1; i<=5; i++) D(i,i) = i*i + i + 2;
70 Matrix M5 = M1 - D; M1 = D * (-3) - M3;
80 for (i=1; i<=5; i++)
for (j=1; j<=i; j++) S(i,j) = i*j+i-j+5;
81 M2 = S.
i() * M4; M1 = S; M3=M1*M2-M4;
Clean(M3,0.00000001);
Print(M3);
83 for (i=1; i<=5; i++)
for (j=1; j<=i; j++) T(i,j) = i*i*j*j+i-j+5-i*j;
84 M1 = S.
i() * T; M1 = S * M1; M1 = M1-T;
Clean(M1,0.00000001);
Print(M1);
85 ColumnVector CV(5);
for (i=1; i<=5; i++) CV(i) = i*i*i+10;
91 for (i=1; i<=5; i++)
for (j=1; j<=10; j++) M4(i,j) = (i*i*i+10)*(j*j-3);
101 for (i=1; i<=10; i++)
for (j=1; j<=10; j++) M2(i,j) = (i*i*i+10)*(j*j-3);
102 D << M2; L << M2; U << M2;
108 for (i=1; i<=6; i++)
for (j=1; j<=10; j++) M1(i,j) = 100*i + j;
110 for (i=3; i<=5; i++)
for (j=4; j<=7; j++) M3(i-2,j-3) = 100*i + j;
117 a1=4; a2=9; a3=4; a4=7;
119 for (i=1; i<=10; i++)
for (j=i; j<=10; j++) U(i,j) = 100*i + j;
121 M3.
ReSize(a2-a1+1,a4-a3+1); M3=0.0;
122 for (i=a1; i<=a2; i++) for (j=(i>a3) ? i : a3; j<=a4; j++)
123 M3(i-a1+1,j-a3+1) = 100*i + j;
128 a1=3; a2=9; a3=2; a4=7;
130 for (i=1; i<=10; i++)
for (j=i; j<=10; j++) U(i,j) = 100*i + j;
132 M3.
ReSize(a2-a1+1,a4-a3+1); M3=0.0;
133 for (i=a1; i<=a2; i++) for (j=(i>a3) ? i : a3; j<=a4; j++)
134 M3(i-a1+1,j-a3+1) = 100*i + j;
139 a1=4; a2=6; a3=2; a4=5;
141 for (i=1; i<=10; i++)
for (j=i; j<=10; j++) U(i,j) = 100*i + j;
143 M3.
ReSize(a2-a1+1,a4-a3+1); M3=0.0;
144 for (i=a1; i<=a2; i++) for (j=(i>a3) ? i : a3; j<=a4; j++)
145 M3(i-a1+1,j-a3+1) = 100*i + j;
Real Sum(const BaseMatrix &B)
virtual void ReSize(int m, int n)
void Clean(Matrix &A, Real c)
TransposedMatrix t() const
The usual rectangular matrix.
GetSubMatrix SubMatrix(int fr, int lr, int fc, int lc) const
ReturnMatrix ForReturn() const
void Print(const Matrix &X)