开发者

gsl c++ in cygwin problem

I am using C++ to solve by boundary element method, the I have a problem with my code:

#include <stdio.h> 
#include <math.h> 
#include <gsl/gsl_linalg.h> 
using namespace std; 
string STRING; 
int i,q,s;  
int const nodes = 16; 
double A[nodes][nodes];  
double b[nodes]; 
 int main(){ 
  for (i=0;i<nodes;i++) 
       { 


           { 
            A[q][i] = 1.;       
            b[q] = 1.; 
           }        
       } 

Once A and b are built, we need to solve the system Ax=b by the

calculation of the inverse of x=A^(-1)*b

gsl_matrix_view m = gsl_matrix_view_array (*A, nodes, nodes); for(q=0;q<nodes;q++)
gsl_matrix_view b = gsl_matrix_view_array (b, nodes, nodes); 
gsl_vector *x = gsl_vector_alloc (nodes); 
gsl_permutation * p = gsl_permutation_alloc (nodes); 
gsl_linalg_LU_decomp (&m.matrix, p, &s); 
gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x); 

      return 0;    
     }  

When I compile in cygwin using

g++ test.cpp -lm -lgsl -o bem.out -L/usr/bin

I get the following error:

test.cpp: In function 'int main()':
test.cpp:39:59: error: 开发者_StackOverflowcannot convert 'gsl_matrix_view' to 'double*' for argument '1' to '_gsl_matrix_view gsl_matrix_view_array(double*, size_t, size_t)'
test.cpp:43:39: error: 'struct gsl_matrix_view' has no member named 'vector'

I followed the same example that the GSL tutorial exposed, but I am getting these errors. Could anybody help out? I would really appreciate.

Thanks!


You've re-declared b as a gsl_matrix_view in the very same line that the compile is complaining about. You have it declared as a double array earlier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜