https://github.com/0382/blas-hpp
A c++ wrapper of CBLAS, for generic programming.
https://github.com/0382/blas-hpp
blas cblas linear-algebra matrix matrix-library openblas openblas-bindings
Last synced: 3 months ago
JSON representation
A c++ wrapper of CBLAS, for generic programming.
- Host: GitHub
- URL: https://github.com/0382/blas-hpp
- Owner: 0382
- License: mit
- Created: 2023-05-02T08:56:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-02T09:31:32.000Z (about 2 years ago)
- Last Synced: 2025-02-18T01:52:00.866Z (4 months ago)
- Topics: blas, cblas, linear-algebra, matrix, matrix-library, openblas, openblas-bindings
- Language: C++
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# blas-hpp
A c++ wrapper of CBLAS, for generic programming.
A simple example is like
```c++
#include "blas.hpp"
#include
#includeint main(int argc, char const *argv[])
{
std::vector m(100, 1.0), v(10, 1.0), r(10, 0.0);
blas::gemv(CblasColMajor, CblasNoTrans, 10, 10, 1.0, m.data(), 10, v.data(), 1, 0., r.data(), 1);
for(int i = 0; i < 10; ++i)
{
std::cout << r[i] << ',';
}
return 0;
}
```Every function like `blas::gemv` supports `float, double, std::complex, std::complex`, so that your can use them in a `template` function.
In addition, `blas::dot` for `std::complex, std::complex` is alias of `cdotc, zdotc`, and `blas::hemv` for `float, double` is alias of `ssymv, dsymv`. `blas::her, blas::her2, blas::hemm, blas::herk, blas::her2k` also works similarly. Thus you can write `template` simpler.