39 { cout << s << count <<
"\n"; }
45 cout <<
"\nMatrix type: " << X.
Type().
Value() <<
" (";
46 cout << X.
Nrows() <<
", ";
47 cout << X.
Ncols() <<
")\n\n";
48 if (X.
IsZero()) { cout <<
"All elements are zero\n" << flush;
return; }
50 for (
int i=1; i<=nr; i++)
52 for (
int j=1; j<=nc; j++) cout << X(i,j) <<
"\t";
61 cout <<
"\nMatrix type: " << X.
Type().
Value() <<
" (";
62 cout << X.
Nrows() <<
", ";
63 cout << X.
Ncols() <<
")\n\n";
64 if (X.
IsZero()) { cout <<
"All elements are zero\n" << flush;
return; }
66 for (
int i=1; i<=nr; i++)
69 for (j=1; j<i; j++) cout <<
"\t";
70 for (j=i; j<=nc; j++) cout << X(i,j) <<
"\t";
79 cout <<
"\nMatrix type: " << X.
Type().
Value() <<
" (";
80 cout << X.
Nrows() <<
", ";
81 cout << X.
Ncols() <<
")\n\n";
82 if (X.
IsZero()) { cout <<
"All elements are zero\n" << flush;
return; }
84 for (
int i=1; i<=nr; i++)
86 for (
int j=1; j<i; j++) cout <<
"\t";
87 if (i<=nc) cout << X(i,i) <<
"\t";
96 cout <<
"\nMatrix type: " << X.
Type().
Value() <<
" (";
97 cout << X.
Nrows() <<
", ";
98 cout << X.
Ncols() <<
")\n\n";
99 if (X.
IsZero()) { cout <<
"All elements are zero\n" << flush;
return; }
101 for (
int i=1; i<=nr; i++)
104 for (j=1; j<i; j++) cout << X(j,i) <<
"\t";
105 for (j=i; j<=nc; j++) cout << X(i,j) <<
"\t";
108 cout << flush; ++
PCZ;
114 cout <<
"\nMatrix type: " << X.
Type().
Value() <<
" (";
115 cout << X.
Nrows() <<
", ";
116 cout << X.
Ncols() <<
")\n\n";
117 if (X.
IsZero()) { cout <<
"All elements are zero\n" << flush;
return; }
119 for (
int i=1; i<=nr; i++)
121 for (
int j=1; j<=i; j++) cout << X(i,j) <<
"\t";
124 cout << flush; ++
PCZ;
131 for (
int i=1; i<=nr; i++)
133 for (
int j=1; j<=nc; j++)
134 {
Real a = A(i,j);
if ((a < c) && (a > -c)) A(i,j) = 0.0; }
141 for (
int i=1; i<=nr; i++)
142 {
Real a = A(i,i);
if ((a < c) && (a > -c)) A(i,i) = 0.0; }
149 if ( R > 1 || R < -1)
150 cout <<
"Pentium error detected: % error = " << 100 * R / N <<
"\n";
158 if (s>=1.0 || s<=0.0)
160 x = (
unsigned long)(s * 4294967296.0);
169 unsigned long mult = 2083801278;
170 unsigned long m_hi = mult >> 16;
171 unsigned long m_lo = mult & 0xFFFF;
173 unsigned long x_hi = x >> 16;
174 unsigned long x_lo = x & 0xFFFF;
176 unsigned long c_hi = crry >> 16;
177 unsigned long c_lo = crry & 0xFFFF;
179 x = x_lo * m_lo + c_lo;
180 unsigned long axc = x_lo * m_hi + x_hi * m_lo + c_hi + (x >> 16);
181 crry = x_hi * m_hi + (axc >> 16);
183 x = (x & 0xFFFF) + (axc << 16);
194 for (
int i = 1; i <= nr; ++i)
for (
int j = 1; j <= nc; ++ j)
195 M(i, j) = MWC.
Next();
201 using namespace NEWMAT;
219 cout <<
"\nBegin test\n";
220 cout <<
"Now print a real number: " << 3.14159265 << endl;
222 #ifndef DisableExceptions 226 cout <<
"Not doing exceptions\n";
231 Tracer et(
"Matrix test program");
237 for (i=1;i<=7;i++) A(i)=0.0; A(8)=1.0;
269 cout <<
"\nEnd of tests\n";
273 cout <<
"\nTest program fails - exception generated\n\n";
281 cout <<
"\n(The following memory checks are probably not valid with all\n";
282 cout <<
"compilers - see documentation)\n";
283 cout <<
"\nChecking for lost memory (large block): " 284 << (
unsigned long)s1 <<
" " << (
unsigned long)s2 <<
" ";
285 if (s1 != s2) cout <<
" - see section 2.8\n\n";
else cout <<
" - ok\n\n";
287 cout <<
"\nChecking for lost memory (small block): " 288 << (
unsigned long)s3 <<
" " << (
unsigned long)s4 <<
" ";
289 if (s3 != s4) cout <<
" - see section 2.8\n\n";
else cout <<
" - ok\n\n";
334 cout << list[i].
Value() <<
" ";
336 cout << (list[j]+list[i]).Value() <<
" ";
362 cout << list[i].Value() <<
" ";
366 cout << list[i].
Value() <<
" ";
368 cout << (list[j]*list[i]).Value() <<
" ";
394 cout << list[i].Value() <<
" ";
398 cout << list[i].
Value() <<
" ";
400 cout << (list[j] | list[i]).Value() <<
" ";
426 cout << list[i].Value() <<
" ";
430 cout << list[i].
Value() <<
" ";
432 cout << (list[j].
SP(list[i])).Value() <<
" ";
458 cout << list[i].Value() <<
" ";
462 cout << list[i].
Value() <<
" ";
464 cout << (list[j].
KP(list[i])).Value() <<
" ";
490 cout << list[i].Value() <<
" ";
494 cout << list[i].
Value() <<
" ";
496 cout << ((list[j]>=list[i]) ?
"Yes " :
"No ");
507 start_time = ((double)clock())/(
double)CLOCKS_PER_SEC;
512 double time = ((double)clock())/(
double)CLOCKS_PER_SEC - start_time;
513 cout <<
"Elapsed (processor) time = " << setprecision(2) << time <<
" seconds" << endl;
void PentiumCheck(Real N, Real D)
PrintCounter PCZ("Number of non-zero matrices (should be 1) = ")
SPMatrix SP(const BaseMatrix &, const BaseMatrix &)
KPMatrix KP(const BaseMatrix &, const BaseMatrix &)
PrintCounter(const char *sx)
void Clean(Matrix &A, Real c)
The usual rectangular matrix.
FloatVector FloatVector * a
static const char * what()
const char * Value() const
void Print(const Matrix &X)
MultWithCarry(double s=0.46875)
PrintCounter PCN("Number of matrices tested = ")
void FillWithValues(MultWithCarry &MWC, Matrix &M)