Last change
on this file since 807 was 807, checked in by ansari, 25 years ago |
Amelioration tests - Adaptation modifs TArray<T>,PPersist - Reza 03/04/2000
|
File size:
1.4 KB
|
Rev | Line | |
---|
[778] | 1 | #include "machdefs.h"
|
---|
| 2 |
|
---|
| 3 | #include <math.h>
|
---|
| 4 | #include <iostream.h>
|
---|
| 5 |
|
---|
| 6 | #include "nbrandom.h"
|
---|
| 7 | #include "tarrinit.h"
|
---|
| 8 | #include "tarray.h"
|
---|
| 9 | #include "tvector.h"
|
---|
| 10 | #include "timing.h"
|
---|
| 11 | #include "intflapack.h"
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | int main(int narg, char* arg[])
|
---|
| 15 | {
|
---|
| 16 |
|
---|
| 17 | SophyaInit();
|
---|
| 18 | InitTim(); // Initializing the CPU timer
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | int n = 5;
|
---|
| 22 | int i,j,k;
|
---|
| 23 |
|
---|
| 24 | if (narg > 1) n = atoi(arg[1]);
|
---|
[807] | 25 | cout << ":::::::: rztest_lapack - Size=" << n << " ::::::::: " << endl;
|
---|
[778] | 26 | try {
|
---|
| 27 | TArray<r_4> a(n,n);
|
---|
| 28 | for(i=0; i<n; i++)
|
---|
| 29 | for(j=0; j<n; j++) a(i,j,0) = GauRnd(0., 1.);
|
---|
| 30 |
|
---|
[789] | 31 | TArray<r_4> x(n,1), b(n,1);
|
---|
[778] | 32 | r_4 sum ;
|
---|
[789] | 33 | for(i=0; i<n; i++) x(i,0,0) = GauRnd(2., 1.5);
|
---|
[778] | 34 | for(i=0; i<n; i++) {
|
---|
| 35 | sum = 0.;
|
---|
[789] | 36 | for(j=0; j<n; j++) sum += a(i,j,0)*x(j,0,0);
|
---|
| 37 | b(i,0,0) = sum;
|
---|
[778] | 38 | }
|
---|
| 39 |
|
---|
[807] | 40 | cout << " ------------ Array A = \n " << a << "\n" << endl;
|
---|
| 41 | cout << " ------------ Array X = \n " << x << "\n" << endl;
|
---|
| 42 | cout << " ------------ Array B = \n " << b << "\n" << endl;
|
---|
[778] | 43 |
|
---|
| 44 | cout << "\n Calling rztest_lapack ... " << endl;
|
---|
| 45 |
|
---|
| 46 | rztest_lapack(a, b);
|
---|
| 47 |
|
---|
| 48 | cout << " ------------ Result B(=X ?) = \n " << b << "\n" << endl;
|
---|
| 49 |
|
---|
| 50 | PrtTim(" End of lpk (rztest_lapack) ");
|
---|
| 51 | }
|
---|
| 52 | catch (PThrowable exc) {
|
---|
| 53 | cerr << " catched Exception (rztest_lapack) " << exc.Msg() << endl;
|
---|
| 54 | }
|
---|
| 55 | catch (...) {
|
---|
| 56 | cerr << " catched unknown (...) exception (rztest_lapack) " << endl;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | cout << " --------------- END of Programme -------------- " << endl;
|
---|
| 60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.