10 #define WANT_MATH // for sqrt 19 using namespace NEWMAT;
28 Tracer et(
"Sixteenth test of Matrix package");
33 for (i=1; i<=4; i++)
for (j=1; j<=7; j++) M(i,j) = 100 * i + j;
44 test(7) = (CV.
t()*CV).AsScalar();
45 test = test - 2156560.0;
Print(test);
49 for (i=1; i<=6; i++)
for (j=i; j<=6; j++) U(i,j) = i + (i-j) * (i-j);
60 test(6) = ((L+U)/2.0).Trace();
61 test = test - 21;
Print(test);
68 test = test - 720;
Clean(test,0.000000001);
Print(test);
83 test = test - 720.0 * 720.0;
Clean(test,0.00000001);
Print(test);
94 test = test - 3925961.0;
Print(test);
100 for (i=1; i<=10; i++)
for (j=i; j<=10; j++)
102 SM(i,j) = 1.5 * i - j; SN(i,j) = SM(i,j) * SM(i,j);
103 if (SM(i,j) < 0.0) SN(i,j) = - SN(i,j);
104 S += SN(i,j) * ((i==j) ? 1.0 : 2.0);
111 test = test - 1168.75;
Print(test);
116 test = test - S;
Print(test);
121 test = test - 8.5;
Print(test);
126 for (i=1; i<=15; i++) {
for (j=1; j<=20; j++) M(i,j) = 1.5 * i - j; }
127 for (i=1; i<=20; i++)
133 test = test - 165;
Print(test);
141 test = test - 21.5;
Print(test);
146 for (i=1; i<=15; i++) {
for (j=1; j<=20; j++) M(i,j) = 2.5 * i - j; }
LogAndSign LogDeterminant(const BaseMatrix &B)
Real Sum(const BaseMatrix &B)
Real SumSquare(const BaseMatrix &B)
void Clean(Matrix &A, Real c)
GetSubMatrix Column(int f) const
Real NormInfinity(const BaseMatrix &B)
Real Norm1(const BaseMatrix &B)
TransposedMatrix t() const
Real Trace(const BaseMatrix &B)
Real MaximumAbsoluteValue(const BaseMatrix &B)
Real NormFrobenius() const
Real NormFrobenius(const BaseMatrix &B)
The usual rectangular matrix.
Real SumAbsoluteValue(const BaseMatrix &B)
FloatVector FloatVector * a
DiagedMatrix AsDiagonal() const
Real Determinant(const BaseMatrix &B)
ColedMatrix AsColumn() const
void Print(const Matrix &X)