Nowe posty

Autor Wątek: BLAS mnoznie w C++  (Przeczytany 2817 razy)

Gosik

  • Gość
BLAS mnoznie w C++
« dnia: 2013-02-09, 14:37:00 »
Probuje pomnozyc macierz i wektor wykorzystjac bibliteke CBLAS.

#include "cblas.h"
#include

using namespace std;


int main()
{
   enum CBLAS_ORDER order;
   enum CBLAS_TRANSPOSE transa;

   double **a, *x, *y;
   double alpha, beta;
   int m, n, lda, incx, incy, i;  //m - liczba wierszy ; n -liczba kolumn

   order = CblasColMajor;
   transa = CblasNoTrans;

  a = new double *[m];
  for (int i=0; i 
  x = new double [n];
  y = new double [n];
 
  m = 4;
  n = 4;
  lda = 1;
  incx = 1;
  incy = 1;
  alpha =1;
  beta = 0;

//element tablic
   
   for (int i = 0; i   for (int j = 0; j    { a[i][j] = 2; }
 
 x[0] = 1;
  x[1] = 2;
  x[2] = 3;
  x[3] = 4;
  y[0] = 0;
  y[1] = 0;
  y[2] = 0;
  y[3] = 0;


  cblas_dgemv( order, transa, m, n, alpha, a, lda, x, incx, beta, y, incy );

  for (int i = 0; i    cout << "y[" << i << "]=" << y[i];

return 0;

}
Jednazke wyskakuje blad:
cannot convert ‘double**’ to ‘const double*’ for argument ‘6’ to ‘void cblas_dgemv(CBLAS_ORDER, CBLAS_TRANSPOSE, int, int, double, const double*, int, const double*, int, double, double*, int)’

Moja tablica musi byc w posatci double*. jak powinnam poprawnie to uczynic?

Offline Paweł Kraszewski

  • Administrator
  • Guru
  • *****
  • Wiadomości: 3059
  • Lenistwo jest matką potrzeby = babcią wynalazku
    • Zobacz profil
BLAS mnoznie w C++
« Odpowiedź #1 dnia: 2013-02-09, 18:20:55 »
Poczytaj sobie to, rozdział B.2.6.
Paweł Kraszewski
~Arch/Void/Gentoo/FreeBSD/OpenBSD/Specjalizowane customy