Last change
on this file since 786 was 786, checked in by ansari, 26 years ago |
Programmes test de TArray<T> Reza 16/3/2000
|
File size:
1.3 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]);
|
---|
| 25 | cout << "rztest_lapack - Size=" << n << endl;
|
---|
| 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 |
|
---|
[786] | 31 | TArray<r_4> x(1,n), b(n,n);
|
---|
[778] | 32 | r_4 sum ;
|
---|
| 33 | for(i=0; i<n; i++) x(0,i,0) = GauRnd(2., 1.5);
|
---|
| 34 | for(i=0; i<n; i++) {
|
---|
| 35 | sum = 0.;
|
---|
| 36 | for(j=0; j<n; j++) sum += a(j,i,0)*x(0,j,0);
|
---|
| 37 | b(0,i,0) = sum;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | cout << " ------------ Matrix A = \n " << a << "\n" << endl;
|
---|
| 41 | cout << " ------------ Matrix X = \n " << x << "\n" << endl;
|
---|
| 42 | cout << " ------------ Matrix B = \n " << b << "\n" << endl;
|
---|
| 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.