20 #ifndef STL_INTERFACE_HH 21 #define STL_INTERFACE_HH 24 #include "utilities.h" 42 static inline std::string
name(
void )
68 static inline void copy_vector(
const gene_vector & source, gene_vector & cible,
int N){
69 for (
int i=0;
i<
N;
i++){
75 static inline void copy_matrix(
const gene_matrix & source, gene_matrix & cible,
int N){
78 cible[
i][
j]=source[
i][
j];
81 static inline void ata_product(
const gene_matrix & A, gene_matrix &
X,
int N)
84 for (
int j=0;
j<
N;
j++){
85 for (
int i=0;
i<
N;
i++){
88 somme += A[
i][k]*A[
j][k];
94 static inline void aat_product(
const gene_matrix & A, gene_matrix &
X,
int N)
97 for (
int j=0;
j<
N;
j++){
98 for (
int i=0;
i<
N;
i++){
102 for (
int k=0;k<
N;k++){
103 somme+=A[k][
i]*A[k][
j];
115 for (
int j=0;
j<
N;
j++){
116 for (
int i=0;
i<
N;
i++){
118 for (
int k=0;k<
N;k++)
119 somme+=A[k][
i]*B[
j][k];
128 for (
int i=0;
i<
N;
i++){
130 for (
int j=0;
j<
N;
j++)
136 static inline void symv(gene_matrix & A, gene_vector & B, gene_vector &
X,
int N)
138 for (
int j=0;
j<
N; ++
j)
140 for (
int j=0;
j<
N; ++
j)
144 X[
j] += t1 * A[
j][
j];
145 for (
int i=
j+1;
i<
N; ++
i) {
146 X[
i] += t1 * A[
j][
i];
147 t2 += A[
j][
i] * B[
i];
153 static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector &
X,
int N)
155 for (
int j=0;
j<
N; ++
j)
157 for (
int i=
j;
i<
N; ++
i)
158 A[
j][
i] += B[
i]*X[
j] + B[
j]*X[
i];
162 static inline void ger(gene_matrix & A, gene_vector &
X, gene_vector &
Y,
int N)
164 for (
int j=0;
j<
N; ++
j)
166 for (
int i=
j;
i<
N; ++
i)
167 A[
j][
i] += X[
i]*Y[
j];
171 static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector &
X,
int N)
174 for (
int i=0;
i<
N;
i++){
176 for (
int j=0;
j<
N;
j++)
177 somme += A[
i][
j]*B[
j];
182 static inline void axpy(
real coef,
const gene_vector &
X, gene_vector &
Y,
int N){
183 for (
int i=0;
i<
N;
i++)
188 for (
int i=0;
i<
N;
i++)
189 Y[
i] = a*X[
i] + b*Y[
i];
192 static inline void trisolve_lower(
const gene_matrix &
L,
const gene_vector & B, gene_vector &
X,
int N){
194 for(
int i=0;
i<
N; ++
i)
198 for (
int j=
i+1;
j<
N; ++
j)
199 X[
j] -= tmp * L[
i][
j];
209 for (
int i=0;
i<
N;
i++){
223 for (
int i=0;
i<
N;
i++){
224 for (
int j=0;
j<
N;
j++){
227 somme2 += A[
i][
j]*A[
i][
j];
237 for (
int i=0;
i<
N;
i++){
238 INFOS(
"A["<<
i<<
"]="<<A[
i]<<endl);
static void axpy(real coef, const gene_vector &X, gene_vector &Y, int N)
static void axpby(real a, const gene_vector &X, real b, gene_vector &Y, int N)
static void trisolve_lower(const gene_matrix &L, const gene_vector &B, gene_vector &X, int N)
static void copy_vector(const gene_vector &source, gene_vector &cible, int N)
static std::string name(void)
static void vector_to_stl(gene_vector &B, stl_vector &B_stl)
std::vector< stl_vector > stl_matrix
static void ger(gene_matrix &A, gene_vector &X, gene_vector &Y, int N)
static void atv_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
std::vector< real > stl_vector
static void free_matrix(gene_matrix &, int)
static void matrix_matrix_product(const gene_matrix &A, const gene_matrix &B, gene_matrix &X, int N)
static void free_vector(gene_vector &)
static void aat_product(const gene_matrix &A, gene_matrix &X, int N)
static void ata_product(const gene_matrix &A, gene_matrix &X, int N)
static real norm_diff(const stl_matrix &A, const stl_matrix &B)
static void matrix_to_stl(gene_matrix &A, stl_matrix &A_stl)
static void vector_from_stl(gene_vector &B, stl_vector &B_stl)
static void matrix_vector_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
static void copy_matrix(const gene_matrix &source, gene_matrix &cible, int N)
static void matrix_from_stl(gene_matrix &A, stl_matrix &A_stl)
static real norm_diff(const stl_vector &A, const stl_vector &B)
static void display_vector(const stl_vector &A)
static void symv(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
static void syr2(gene_matrix &A, gene_vector &B, gene_vector &X, int N)