Subversion Repositories gelsvn

Rev

Rev 107 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 107 Rev 417
Line 1... Line 1...
1
//disable the stl warning of debug information conflicting with names of longer than 255 char.
1
//disable the stl warning of debug information conflicting with names of longer than 255 char.
2
#pragma warning( disable :4786 )  
2
#pragma warning( disable :4786 )  
3
 
3
 
4
#include <iostream>
4
#include <iostream>
5
#include <vector>
5
#include <vector>
-
 
6
#include "CGLA/CGLA.h"
6
#include "LinAlg/Matrix.h"
7
#include "LinAlg/Matrix.h"
7
#include "LinAlg/Vector.h"
8
#include "LinAlg/Vector.h"
8
#include "LinAlg/LapackFunc.h"
9
#include "LinAlg/LapackFunc.h"
9
 
10
 
10
using namespace std;
11
using namespace std;
11
using namespace LinAlg;
12
using namespace LinAlg;
-
 
13
using namespace CGLA;
12
 
14
 
13
int main()
15
int main()
14
{
16
{
15
		// Matrix row and column dimensions
17
		// Matrix row and column dimensions
16
		int N=4,M=4;
18
		int N=4,M=4;
17
 
19
 
18
		// Fill the matrix with random values.
20
		// Fill the matrix with random values.
19
		srand(0);
21
		gel_srand(0);
20
		CMatrix mat(N,M,0);
22
		CMatrix mat(N,M,0);
21
		for(int i=0;i<N;++i)
23
		for(int i=0;i<N;++i)
22
				for(int j=0;j<M;++j)
24
				for(int j=0;j<M;++j)
23
						mat.set(i,j,rand()/double(RAND_MAX)-0.5);
25
						mat.set(i,j,gel_rand()/double(GEL_RAND_MAX)-0.5);
24
 
26
 
25
		// Create a vector of random values
27
		// Create a vector of random values
26
		CVector b(N);
28
		CVector b(N);
27
		for(int i=0;i<N;++i)
29
		for(int i=0;i<N;++i)
28
				b.set(i, rand()/double(RAND_MAX)-0.5);
30
				b.set(i, gel_rand()/double(GEL_RAND_MAX)-0.5);
29
		
31
		
30
		// Some output
32
		// Some output
31
		cout << "Matrix rows, cols = "; 
33
		cout << "Matrix rows, cols = "; 
32
		cout << mat.Rows() << " , " << mat.Cols() << endl;
34
		cout << mat.Rows() << " , " << mat.Cols() << endl;
33
		cout << "Matrix: " << mat << endl;
35
		cout << "Matrix: " << mat << endl;