17 using namespace NEWMAT;
34 bool IsBandMatrix = u > 0 && l > 0 && !(u == 0 && l == 0);
38 if (fabs(CV(i)) != x2)
return 1.1;
40 if (fabs(M(i,j)) != x3)
return 1.2;
41 if (x3 != x1)
return 1.3;
42 if (x2 != x1)
return 1.4;
44 for (k = 1; k <= n; k++)
46 Real cvk = fabs(CV(k));
47 if (x1 <= cvk) {
if (x1 < cvk)
return 1.5;
else c++; }
49 if (c == 0)
return 1.6;
54 if (fabs(CV(i)) != x2)
return 2.1;
56 if (fabs(M(i,j)) != x3)
return 2.2;
57 if (x3 != x1)
return 2.3;
62 for (i = 1; i <= nr; i++)
for (j = 1; j <= nc; j++)
63 if (i - j <= l && j - i <= u)
65 Real mij = fabs(M(i,j));
66 if (x1 >= mij) {
if (x1 > mij)
return 2.51;
else c++; }
71 for (k = 1; k <= n; k++)
73 Real cvk = fabs(CV(k));
74 if (x1 >= cvk) {
if (x1 > cvk)
return 2.52;
else c++; }
77 if (c == 0)
return 2.6;
81 if (CV(i) != x2)
return 3.1;
83 if (M(i,j) != x3)
return 3.2;
84 if (x3 != x1)
return 3.3;
85 if (x2 != CV.
Maximum())
return 3.4;
89 for (i = 1; i <= nr; i++)
for (j = 1; j <= nc; j++)
90 if (i - j <= l && j - i <= u)
93 if (x1 <= mij) {
if (x1 < mij)
return 3.51;
else c++; }
98 for (k = 1; k <= n; k++)
101 if (x1 <= cvk) {
if (x1 < cvk)
return 3.52;
else c++; }
104 if (c == 0)
return 3.6;
108 if (CV(i) != x2)
return 4.1;
110 if (M(i,j) != x3)
return 4.2;
111 if (x3 != x1)
return 4.3;
112 if (x2 != CV.
Minimum())
return 4.4;
116 for (i = 1; i <= nr; i++)
for (j = 1; j <= nc; j++)
117 if (i - j <= l && j - i <= u)
120 if (x1 >= mij) {
if (x1 > mij)
return 4.51;
else c++; }
125 for (k = 1; k <= n; k++)
128 if (x1 >= cvk) {
if (x1 > cvk)
return 4.52;
else c++; }
131 if (c == 0)
return 4.6;
140 Tracer et(
"Twenty first test of Matrix package");
144 M << 1.5 << 1.0 << -4.0 << 4.5
145 << 3.5 << 7.0 << 2.0 << -1.0
146 << -1.5 << 7.5 << -6.0 << 5.0
147 << 0.5 << -8.0 << 5.5 << 4.0;
179 RV << 1 << 3 << -5 << 2 << -4 << 3;
190 Test(++k) = (
Maximum(-RV) - 5);
191 Test(++k) = (
Minimum(-RV) + 3);
195 RV2 << 2 << 8 << 1 << 9 << 3 << -1;
198 Test(++k) = (
Maximum(RV+RV2) - 11);
199 Test(++k) = (
Minimum(RV+RV2) + 4);
Real Maximum1(int &i) const
Real Minimum(const BaseMatrix &B)
Real Maximum(const BaseMatrix &B)
Real Minimum2(int &i, int &j) const
void Inject(const GeneralMatrix &GM)
Real Maximum2(int &i, int &j) const
Real MinimumAbsoluteValue1(int &i) const
virtual MatrixBandWidth BandWidth() const
Real MaximumAbsoluteValue() const
Real MinimumAbsoluteValue2(int &i, int &j) const
Real Minimum1(int &i) const
TransposedMatrix t() const
Real MaximumAbsoluteValue2(int &i, int &j) const
Real MaximumAbsoluteValue(const BaseMatrix &B)
The usual rectangular matrix.
Real TestMax(const GenericMatrix &GM)
ColedMatrix AsColumn() const
Real MinimumAbsoluteValue(const BaseMatrix &B)
Real MaximumAbsoluteValue1(int &i) const
void Print(const Matrix &X)
Real MinimumAbsoluteValue() const
A matrix which can be of any GeneralMatrix type.