Imagine++
MyEigen.h
1 // ===========================================================================
2 // Imagine++ Libraries
3 // Copyright (C); Imagine
4 // For detailed information: http://imagine.enpc.fr/software
5 // ===========================================================================
6 
7 void symToMatrix(int n, const double *ap, double *t);
8 void symToMatrix(int n, const float *ap, float *t);
9 
10 // Vectors equalization (replaces xcopy)
11 void equalize(int n, const double *s, int a, double *t, int b);
12 void equalize(int n, const float *s, int a, float *t, int b);
13 
14 // Linear combination alpha * X + Y
15 void combine(int n, double alpha, const double *X, double *Y);
16 void combine(int n, float alpha, const float *X, float *Y);
17 
18 // Scalar product
19 double scalarProduct(int n, const double *X, const double *Y);
20 float scalarProduct(int n, const float *X, const float *Y);
21 
22 // Product by a number
23 void multiply(int n, double alpha, double *X);
24 void multiply(int n, float alpha, float *X);
25 
26 // Norm 2 (euclidian)
27 double squaredNorm(int n, const double *X);
28 float squaredNorm(int n, const float *X);
29 
30 // Affine transformation Y <- alpha * [A, A transpose, A adjoint] * X + beta * B (replaces xgemv)
31 void affinity(int m, int n, double alpha, const double *A, const double *X, double beta, double *Y, char t);
32 void affinity(int m, int n, float alpha, const float *A, const float *X, float beta, float *Y, char t);
33 
34 // Matrix product C <- alpha * [A, A transpose, A adjoint] * [B, B transpose, B adjoint] + beta * C (replaces xgemm)
35 void matrixProduct(int m, int n, int K, double alpha, const double *A, int lda, const double *B, int ldb, double beta, double *C, char t1, char t2);
36 void matrixProduct(int m, int n, int K, float alpha, const float *A, int lda, const float *B, int ldb, float beta, float *C, char t1, char t2);
37 
38 // Matrix/vector product (replaces xspmv)
39 void vectorProduct(int n,double alpha,const double *ap,const double *x,double beta,double* y);
40 void vectorProduct(int n,float alpha,const float *ap,const float *x,float beta,float* y);
41 
42 // LU-inverse
43 void matrixInverse(int *n, double *a,int *lda,int *ipiv,int *info);
44 void matrixInverse(int *n, float *a,int *lda,int *ipiv,int *info);
45 
46 //corriger
47 //info=0 si succès, -i si ieme parametre illegal, i si bdsdc ne converge pas
48 //info important car utilisé dans Matrix.h
49 // Singular values decomposition (SVD) (replaces xgesdd_)
50 /* *jobz est inusité et est présent dans la signature de Imagine::svd... */
51 void singularValuesDecomposition(const char *jobz,int *m,int *n, double *a, double *s, double *u, double *vt, int *info);
52 void singularValuesDecomposition(const char *jobz,int *m,int *n, float *a, float *s, float *u, float *vt, int *info);
53 
54 //Non stable en Eigen (experimental);
55 //info important car utilisé dans Matrix.h
56 // Returns Eigen values
57 void eigenValues(int *n, double *a, double *wr, double *wi, double *vr, int *info);
58 void eigenValues(int *n, float *a, float *wr, float *wi, float *vr, int *info);
59 
60 //Experimental et pas de décomposition uplow='U' dans eigen et seulement pour les matrices def pos
61 //info important car utilisé dans Matrix.h
62 // Cholesky decomposition (replaces xpotf2_)
63 void choleskyDecomposition(const char* job, int *n, double* a, int *info);
64 void choleskyDecomposition(const char* job, int *n, float* a, int *info);
65 
66 // Matrix norms (replaces xlange_)
67 double matrixNorm(char* norm, int *m, int *n, double *a, int *lda);
68 float matrixNorm(char* norm, int *m, int *n, float *a, int *lda);
69 
70 //info important car utilisé dans Matrix.h
71 // System solving by LU decomposition
72 void LUSystemSolve(int *n, double *a, int *ipiv, double *b, int *info);
73 void LUSystemSolve(int *n, float *a, int *ipiv, float *b, int *info);
74 
75 //corriger: info + retour b
76 //info important car utilisé dans Matrix.h
77 // System solving by QR decomposition
78 void QRSystemSolve(int *m, int *n, double *a, double *b, int *info);
79 void QRSystemSolve(int *m, int *n, float *a, float *b, int *info);
80 
81 //Besoin de la précédente
82 //corriger
83 //info important car utilisé dans Matrix.h
84 void QRFactorization(int *m, int *n, int *k, double *a, double *r, int *info);
85 void QRFactorization(int *m, int *n, int *k, float *a, float *r, int *info);
86 
87 //Il faut reconstituer la matrice
88 //corriger
89 //info important car utilisé dans Matrix.h
90 void conditionNumber(int *n, double *a, int *lda, double *rcond, int *info);
91 void conditionNumber(int *n, float *a, int *lda, float *rcond, int *info);
92 
93 // Pas de calcul d'inverse avec ldlt dans eigen
94 //#if 0
95 //info important car utilisé dans SymMatrix.h
96 void symInverse(int *n, double *ap, double *t, int *info);
97 void symInverse(int *n, float *ap, float *t, int *info);
98 
99 //pas de calcul d'inverse avec llt dans eigen
100 //On va donc resoudre AX=B avec B=(1,0,0,0...); puis B=(0,1,0,....); etc...
101 //Puis on constitue la matrice inverse avec les n colonnes
102 //corriger
103 //#if 0
104 //info important car utilisé dans Matrix.h
105 void symDPInverse(int *n, double *ap, double *t, int *info);
106 void symDPInverse(int *n, float *ap, float *t, int *info);
107 
108 //SVD+valeures propres+vecteurs propres
109 //corriger
110 //info important car utilisé dans SymMatrix.h
111 void symEigenValues(int *n, double *ap, double *w, double *z, int* info);
112 void symEigenValues(int *n, float *ap, float *w, float *z, int* info);
113 
114 //Besoin de
115 //corriger
116 //info important car utilisé dans SymMatrix.h
117 // Linear system solve
118 void symSolve(int *n, double *ap, int *ipiv, double *b, int *info);
119 void symSolve(int *n, float *ap, int *ipiv, float *b, int *info);
120 
121 // Determinant
122 double determinant(int *m, int *n, double *A, int *info);
123 float determinant(int *m, int *n, float *A, int *info);
124 
125 double symDeterminant(int *n, double *ap, int *info);
126 float symDeterminant(int *n, float *ap, int *info);