-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheaders.hpp
84 lines (61 loc) · 2.33 KB
/
headers.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef HEADERS_HPP
#define HEADERS_HPP
#include <iostream>
#include <fstream>
#include <Eigen/Eigen>
#include <Eigen/Eigenvalues>
#include <mpi.h>
#include <math.h>
#include <stdio.h>
using namespace std;
//using namespace Eigen;
//================================================================================
// SPECIAL TYPES
//================================================================================
// Types for dense storage
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> Vector;
typedef Eigen::Matrix<double, 1, Eigen::Dynamic> LineVect;
typedef Eigen::Matrix<int, Eigen::Dynamic, 1> IntVector;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> Matrix;
typedef Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic> IntMatrix;
// Structure for problem
struct Problem
{
Matrix A;
Vector v;
Vector v0;
Vector Lmbd;
};
//================================================================================
// FUNCTIONS
//================================================================================
//==== Functions in 'BLASs.cpp'
double BLAS1(Vector a, Vector b);
Vector BLAS2(Matrix A, Vector x);
Vector BLAS3(Matrix A, Vector x);
//==== Functions in 'Tests.cpp'
void TestBLAS(Problem& q);
void TestERAM(Problem& p, Vector& LmbdApp, Matrix& Vm, int m, int jj, double tol, int maxiter);
//==== Functions in 'Datastruct.cpp'
// Read/Write of the data from datafiles
void readData(Problem& p, string filename);
void writeData(Problem& p, string filename);
//==== Functions in 'parallel.cpp'
void buildLocSplitMPI(Problem& q, int lrep, int crep);
//==== Function in 'solve.cpp'
void ERAM(Problem& p, Vector& LmbdApp, Matrix& Vm, int m, int jj, int maxiter, double tol);
void Arnoldi(Problem& p, Matrix& Vm, Matrix& Hm, double *hm1, Vector& vm1, int m, int jj);
// Gram-Schmidt function
void GS(Matrix& A, Matrix& Q, Matrix& R);
void MGS(Matrix& A, Matrix& Q, Matrix& R);
//==== Functions in 'accessories.cpp'
void sortVect(Vector& v);
void sort(Eigen::MatrixXd& Eigval, Eigen::MatrixXd& Eigvect);
double Prodsc(Vector a, Vector b);
void OrthogVerif(Matrix& Q);
void MatrixRows(Vector& v, Matrix& A, int i);
void MatrixCols(Vector& v, Matrix& A, int j);
void Tests(Problem& p, int cas, int dim);
void Block(Matrix& AA, Matrix& B, int i1, int i2, int j1, int j2);
double min(double a, double b);
#endif /* HEADERS_HPP */