title: Blas DGEMV input error
body: <p>I'm having trouble figuring out why a piece of blas call is throwing n error. The problem call is the last blas call. The code compiles without issue and runs fine up until this call then fails with the following message.</p>
  
  <blockquote>
    <p>** ACML error: on entry to DGEMV  parameter number  6 had an illegal value</p>
  </blockquote>
  
  <p>As far as I can tell everything the input types are correct and array a has 
  I would really appreciate an insight into the problem.
  Thanks</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #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", &amp;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 &lt; n; i++ ){
      for( j = 0; j &lt; 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 &lt; 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_(  &amp;n, &amp;nrhs, a[ 0 ], &amp;n, ipiv, b, &amp;n, &amp;info );
  
    /* Tell the world the results */
    printf( "info = %i\n", info );
    for( i = 0; i &lt; 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;
  }
  </code></pre>