1 #include <gsl/gsl_matrix.h> 2 #include <gsl/gsl_blas.h> 3 #include <gsl/gsl_linalg.h> 4 #include <gsl/gsl_eigen.h> 21 for(j=0;j<m1->size2;j++) {
22 for(i=0;i<m1->size1;i++)
23 gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
25 for(i=0;i<m2->size1;i++)
26 gsl_matrix_set(m3, m1->size1+i, j, gsl_matrix_get(m2,i,j));
38 for(i=0;i<m1->size1;i++) {
39 for(j=0;j<m1->size2;j++)
40 gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
42 for(j=0;j<m2->size2;j++)
43 gsl_matrix_set(m3, i, m1->size2+j, gsl_matrix_get(m2,i,j));
51 gsl_matrix_add(m1,m2);
63 for(i=0;i<m1->size1;i++) {
64 *gsl_matrix_ptr(m1, i, j) += gsl_matrix_get(m2,i,0);
73 gsl_matrix_memcpy(m2,m1);
80 gsl_matrix_scale(m2, s);
89 gsl_matrix_memcpy(m3,m1);
90 gsl_matrix_add(m3,m2);
103 gsl_blas_dgemm(CblasNoTrans,CblasNoTrans,1.0,a,b,0.0,ab);
111 gsl_matrix_transpose_memcpy(m2,m1);
120 gsl_matrix *
m = gsl_matrix_alloc(n,n);
121 gsl_matrix_memcpy(m,A);
122 gsl_permutation * perm = gsl_permutation_alloc (n);
125 gsl_linalg_LU_decomp (m, perm, &s);
127 gsl_linalg_LU_invert (m, perm, invA);
128 gsl_permutation_free(perm);
138 gsl_matrix *A = gsl_matrix_alloc(N,N);
139 gsl_matrix_memcpy(A, m);
141 gsl_vector *eval = gsl_vector_alloc(N);
142 gsl_matrix *evec = gsl_matrix_alloc(N,N);
144 gsl_eigen_symmv_workspace * ws = gsl_eigen_symmv_alloc(N);
145 gsl_eigen_symmv(A, eval, evec, ws);
146 gsl_eigen_symmv_free(ws);
149 gsl_eigen_symmv_sort(eval, evec, GSL_EIGEN_SORT_VAL_DESC);
153 eigenvalues[j] = gsl_vector_get(eval, j);
157 *
egsl_atmp(eigenvectors[j],i,0) = gsl_matrix_get(evec,i,j);
161 gsl_vector_free(eval);
162 gsl_matrix_free(evec);
void egsl_symm_eig(val v, double *eigenvalues, val *eigenvectors)
val egsl_copy_val(val v1)
void egsl_add_to_col(val v1, size_t j, val v2)
val egsl_alloc(size_t rows, size_t columns)
val egsl_transpose(val v1)
val egsl_mult(val v1, val v2)
val egsl_sum3(val v1, val v2, val v3)
val egsl_compose_col(val v1, val v2)
void egsl_expect_size(val v, size_t rows, size_t cols)
gsl_matrix * egsl_gslm(val v)
double * egsl_atmp(val v, size_t i, size_t j)
val egsl_sum(val v1, val v2)
val egsl_sub(val v1, val v2)
val egsl_scale(double s, val v1)
val egsl_compose_row(val v1, val v2)
void egsl_add_to(val v1, val v2)