Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Waht is wrong with cblas_dgemv

$
0
0

Hello,

   I am interested in the following operation:

Y = A^T * X

using the cblas_dgemv or cblas_dgemm routine in MKL. In the code I use small letters: y, a, and x.

I have a test example as follows:

#include <cstdio>
#include <cstdlib>
#include "mkl.h"

void main()
{

 double a[6] = {2., 3., 1., 1., 0., 2. }; // 3 x 2 matrix
  double x[3] = {1., 1., 1.};
  double y[2] = {0., 0.};
  int m = 3;
  int n = 2;
  double alpha = 1.0;
  double beta = 1.0;
  int incx = 1;
  int incy = 1;
  int i,j;

  for (i=0; i<m; i++){
    for (j=0; j<n; j++)
      printf("%g ", a[i*n + j]);
    printf("\n");
  }

  cblas_dgemv(CblasRowMajor, CblasTrans, m, n, alpha, a, m, x, incx, beta, y, incy );

  for (i=0; i<n; i++)
    printf("%g\n", y[i]);

}

After running the code, I get wrong results. Can someone point out the mistake?

Regards,

Pawan


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>