У меня возникли проблемы с выяснением, почему кусок звонка blas бросает ошибку n. Вызов проблемы - последний вызов blas. Код компилируется без проблем и выполняется до тех пор, пока этот вызов не завершится с последующим сообщением.Ошибка ввода данных Blas DGEMV
** ACML error: on entry to DGEMV parameter number 6 had an illegal value
Насколько я могу сказать, все типы ввода являются правильными и массив а имеет я бы очень признателен за понимание проблемы. Благодаря
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "cblas.h"
#include "array_alloc.h"
int main(void)
{
double **a, **A;
double *b, *B, *C;
int *ipiv;
int n, nrhs;
int info;
int i, j;
printf("How big a matrix?\n");
fscanf(stdin, "%i", &n);
/* Allocate the matrix and set it to random values but
with a big value on the diagonal. This makes sure we don't
accidentally get a singular matrix */
a = alloc_2d_double(n, n);
A= alloc_2d_double(n, n);
for(i = 0; i < n; i++){
for(j = 0; j < n; j++){
a[ i ][ j ] = ((double) rand())/RAND_MAX;
}
a[ i ][ i ] = a[ i ][ i ] + n;
}
memcpy(A[0],a[0],n*n*sizeof(double)+1);
/* Allocate and initalise b */
b = alloc_1d_double(n);
B = alloc_1d_double(n);
C = alloc_1d_double(n);
for(i = 0; i < n; i++){
b[ i ] = 1;
}
cblas_dcopy(n,b,1,B,1);
/* the pivot array */
ipiv = alloc_1d_int(n);
/* Note we MUST pass pointers, so have to use a temporary var */
nrhs = 1;
/* Call the Fortran. We need one underscore on our system*/
dgesv_( &n, &nrhs, a[ 0 ], &n, ipiv, b, &n, &info);
/* Tell the world the results */
printf("info = %i\n", info);
for(i = 0; i < n; i++){
printf("%4i ", i);
printf("%12.8f", b[ i ]);
printf("\n");
}
/* Want to check my lapack result with blas */
cblas_dgemv(CblasRowMajor,CblasTrans,n,n,1.0,A[0],1,B,1,0.0,C,1);
return 0;
}