BLAS
Copyright (C) 2005 IENT-RWTH Aachen
Linear Algebra
Examples
{ int n=8; DenseVector<float>::self X(n,1), Y(n,2); cblas_sdot(X.size(),&X[0],1,&Y[0],1); cout << Y << endl; } { int m=8, n=8; DenseMatrix<double>::self A(m,n,1); DenseVector<double>::self X(m,1), Y(m); cblas_dgemv(CblasRowMajor,CblasNoTrans, A.nrows(),A.ncols(), (double)1,&A(0,0),n, &X[0],1, (double)1,&Y|0],1); cout << Y << endl; } { int m=8, n=8, k=8; complex<float> alpha(1,0), beta(0,0); DenseMatrix<complex<float> >::self X(m,k,1), Y(k,n,2), Z(m,n); cblas_cgemm(CblasRowMajor,CblasNoTrans,CblasNoTrans, Z.nrows(),X.ncols(),Z.ncols(), (void *)&alpha,(void *)&X(0,0),k,(void *)&Y(0,0),n, (void *)&beta,(void *)&Z(0,0),n); cout << Z << endl; }
Level 1 | Vector Algebra |
Level 2 | Matrix-Vector Algebra |
Level 3 | Matrix-Matrix Algebra |
See Also