blas 호출이 왜 n 오류를 발생시키는 지 알아내는 데 문제가 있습니다. 문제는 마지막 blas 호출입니다. 코드는 문제없이 컴파일되고이 호출이 다음 메시지와 함께 실패 할 때까지 정상적으로 실행됩니다.Blas DGEMV 입력 오류
** ACML error: on entry to DGEMV parameter number 6 had an illegal value
는 지금까지 내가 모든 걸 말할 수있는 입력 유형이 올바른지 및 배열 A는 그 문제에 대한 통찰력을 주셔서 감사합니다 정말 것이다 있습니다. 감사
#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;
}