M*N 個の要素を持つ配列 X があります。この同じデータでサイズ M x N の行列 A を作成しようとしています。私は行列に gsl を使用しており、X は配列として宣言されています。私は問題を抱えており、マトリックスでオーバーラップし続けています。
これが私がやろうとしていることの例です:
Vector X[4*2]
1,2,3,4,5,6,7,8
Matrix A 4X2
1, 2
3, 4
5, 6
7, 8
//heres one of my many fail attempts as an example
//creation of array X here
X[n*m] = someCbasedformulafromtheweb(n, m);
//gsl matrix allocation for matrix A N x M
gsl_matrix * A = gsl_matrix_alloc(n, m);
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {
// setting the x[i*j] entry to gsl_matrix A at positions i , j
gsl_matrix_set (A,i,j, x[i*j]);
}
}