0
我使用C++的邊界元法求解時,我有我的代碼有問題:GSL C++在Cygwin的問題
#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.;
}
}
一旦A和B都建,我們需要解決的方程組Ax =由
計算X = A的逆說明b ^( - 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;
}
當我在cygwin的編譯使用
g++ test.cpp -lm -lgsl -o bem.out -L/usr/bin
我得到以下錯誤:
test.cpp: In function 'int main()':
test.cpp:39:59: error: cannot 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'
我也跟着暴露在GSL教程相同的例子,但我得到這些錯誤。有人能幫忙嗎?我真的很感激。
謝謝!