15 using namespace NEWMAT;
24 Tracer et(
"Ninth test of Matrix package");
30 for (i=1;i<=7;i++)
for (j=1;j<=7;j++) A(i,j)=i*i+j+((i==j) ? 1 : 0);
31 for (i=1;i<=7;i++)
for (j=1;j<=3;j++) X(i,j)=i-j;
36 Q=A; Q = Q.
i() * X; Q = A*Q - X;
Clean(Q, 0.000000001);
Print(Q);
37 Q=X; Q = A.
i() * Q; Q = A*Q - X;
Clean(Q, 0.000000001);
Print(Q);
39 for (i=1;i<=7;i++) D(i,i)=i*i+1;
44 DXE = E.
i() * DXE.
t() * D - X.
t();
Clean(DXE, 0.00000001);
Print(DXE);
45 E=D;
for (i=1;i<=7;i++) E(i,i)=i*3+1;
55 F=E; F=F.
i()*D; F=F*E-D;
Clean(F,0.00000001);
Print(F);
62 X << 3 << 5 << 7 << 5 << 8 << 2 << 7 << 2 << 9;
64 B(1) = S == X; A(1) =
true;
65 B(2) = S == (X+1); A(2) =
false;
66 B(3) = (S+2) == (X+2); A(3) =
true;
68 B(4) = X == Y; A(4) =
true;
69 B(5) = (X*2) == (Y*2); A(5) =
true;
71 B(6) = X == Y; A(6) =
false;
72 B(7) = (X*2) == (Y*2); A(7) =
false;
73 B(8) = S == Y; A(8) =
false;
74 B(9) = S == S; A(9) =
true;
76 B(10) = X == Z; A(10) =
false;
80 B(11) = GS == GX; A(11) =
true;
81 B(12) = GS == GY; A(12) =
false;
85 B(13) = CS == CX; A(13) =
true;
86 B(14) = CS == CY; A(14) =
false;
87 B(15) = X == CX; A(15) =
false;
88 B(16) = X == A; A(16) =
false;
89 B(17) = X == (X | X); A(17) =
false;
90 B(18) = CX == X; A(18) =
false;
99 X(2,1)=12; X(2,2)=17; X(2,3)=45;
100 X(3,1)=35; X(3,2)=19; X(3,3)=24; X(3,4)=29;
101 X(4,2)=17; X(4,3)=11; X(4,4)=19; X(4,5)=35;
102 X(5,3)=10; X(5,4)=44; X(5,5)=23; X(5,6)=31;
103 X(6,4)=49; X(6,5)=41; X(6,6)=17;
106 B(1) = U == X; A(1) =
true;
107 B(2) = U == (X*3); A(2) =
false;
108 B(3) = (U*5) == (X*5); A(3) =
true;
110 B(4) = X == Y; A(4) =
true;
111 B(5) = (X*2) == (Y*2); A(5) =
true;
113 B(6) = X == Y; A(6) =
false;
114 B(7) = (X*2) == (Y*2); A(7) =
false;
115 B(8) = U == Y; A(8) =
false;
116 B(9) = U == U; A(9) =
true;
118 B(10) = X == Z; A(10) =
false;
122 B(11) = GU == GX; A(11) =
true;
123 B(12) = GU == GY; A(12) =
false;
124 X = X + X.
t(); U = U + U.
t();
131 B(13) = BS == BX; A(13) =
true;
132 B(14) = BX == BU; A(14) =
false;
133 B(15) = X == BX; A(15) =
false;
134 B(16) = X != BX; A(16) =
true;
135 B(17) = BX != BS; A(17) =
false;
136 B(18) = (2*X) != (X*2);A(18) =
false;
137 B(19) = (X*2) != (X+2);A(19) =
true;
138 B(20) = BX == CX; A(20) =
false;
139 B(21) = CX == BX; A(21) =
false;
140 B(22) = BX == X; A(22) =
false;
150 X1.
Row(2) << 12 << 17;
151 X1.
Row(3) << 35 << 19 << 24;
152 X1.
Row(4) << 17 << 11 << 19;
153 X1.
Row(5) << 10 << 44 << 23;
154 X1.
Row(6) << 49 << 41 << 17;
161 Matrix MX2(20,20); MX2 = 0;
163 MX2 -= X2;
Print(MX2);
168 Matrix MX4(20,20); MX4 = 0;
170 MX4 -= X4;
Print(MX4);
182 X(1,1)=23; X(1,2)=21;
183 X(2,1)=12; X(2,2)=17; X(2,3)=45;
184 X(3,1)=35; X(3,2)=19; X(3,3)=24; X(3,4)=29;
185 X(4,2)=17; X(4,3)=11; X(4,4)=19; X(4,5)=35;
186 X(5,3)=10; X(5,4)=44; X(5,5)=23; X(5,6)=31;
187 X(6,4)=49; X(6,5)=41; X(6,6)=17;
194 B(1) = LX == CX; A(1) =
false;
195 B(2) = LY == CY; A(2) =
true;
196 B(3) = X == Y; A(3) =
true;
197 B(4) = BX == LX; A(4) =
true;
198 B(5) = CX == CY; A(5) =
true;
199 B(6) = LX == LY; A(6) =
false;
200 B(7) = BX == BX; A(7) =
true;
201 B(8) = CX == CX; A(8) =
true;
202 B(9) = LX == LX; A(9) =
true;
203 B(10) = LY == LY; A(10) =
true;
205 B(11) = CX == CX1; A(11) =
false;
207 B(12) = BX == BX1; A(12) =
false;
222 for (
int i = 1; i <= 50; ++i)
for (
int j = 1; j <= i; ++j)
223 if (i - j <= 10) SBM(i, j) = MWC.
Next();
247 for (
int i = 1; i <= 51; ++i)
for (
int j = 1; j <= i; ++j)
248 if (i - j <= 10) SBM(i, j) = MWC.
Next();
LogAndSign log_determinant(const BaseMatrix &B)
void Inject(const GeneralMatrix &GM)
void Clean(Matrix &A, Real c)
Real value() const
the value
TransposedMatrix t() const
The usual rectangular matrix.
GetSubMatrix SymSubMatrix(int f, int l) const
LU decomposition of a band matrix.
int sign() const
sign of the value
GetSubMatrix Row(int f) const
GetSubMatrix SubMatrix(int fr, int lr, int fc, int lc) const
void Print(const Matrix &X)
A matrix which can be of any GeneralMatrix type.