Changes
Page history
Update BLAS
authored
Mar 22, 2023
by
Alfredo Correa
Hide whitespace changes
Inline
Side-by-side
BLAS.md
View page @
d49a61ea
...
...
@@ -5,8 +5,7 @@ All these operations are now supported for CPU and GPU memory, real and complex.
| SWAP |
`blas::swap(x, y)`
| $
`x_i \leftrightarrow y_i`
$ |
`(x^y)`
| |
`swap_ranges(begin(x), end(x), begin(y))`
|
| COPY |
`blas::copy(x, y)`
| $
`y_i \leftrightarrow x_i`
$ |
`y << x`
|
`y = blas::copy(x)`
|
`copy(begin(x), end(x), begin(y))`
|
| ASUM |
`blas::asum(x, res)`
| $
`r \leftarrow \sum_i \|\Re x_i\| + \|\Im x_i\|`
$ |
`x==0`
/
`x!=0`
`isinf(x)`
`isnan(x)`
|
`res = blas::asum(x)`
|
`transform_reduce(begin(x), end(x), 0.0, plus<>{}, [](auto const& e){return abs(e.real()) + abs(e.imag());})`
|
| NRM2 |
`blas::
nrm2(x, res)`
| $
`r \leftarrow \sqrt{\sum_i \|x_i\|^2}`
$ |
`abs(x)`
|
`res = blas::nrm2(x);`
|
`sqrt(trasnform_reduce(begin(x), end(x), 0.0, plus<>{}, [](auto const& e){return norm(e);}));`
|
| NRM2 |
`blas::nrm2(x, res)`
| $
`r \leftarrow \sqrt{\sum_i \|x_i\|^2}`
$ |
`abs(x)`
|
`res = blas::nrm2(x);`
|
`sqrt(trasnform_reduce(begin(x), end(x), 0.0, plus<>{}, [](auto const& e){return norm(e);}));`
|
| SCAL |
`blas::scal(aa, x);`
| $
`x_i \leftarrow \alpha x_i`
$ |
`x*=aa;`
| |
`for_each(begin(x), end(x), [aa](auto& e){return e*=aa;})`
|
| AXPY |
`blas::axpy(aa, x, y)`
| $
`y_i \leftarrow \alpha x_i + y_i`
$ |
`y+=x`
`y-=x`
`y+=aa*x`
`y-=aa*x`
| |
`transform(x.begin(), x.end(), y.begin(), y.begin(), [aa](auto ex, auto ey) {return aa*ex + ey;}`
|
| DOT |
`blas::dot(x, y, res)`
| $
`r = \sum_i x_i y_i`
$ |
`res = (x, y);`
|
`res = blas::dot(x, y)`
|
`inner_product(begin(x), end(x), begin(y), T{});`
|
...
...
...
...