Closed cgdeboer closed 2 years ago
There are several issues:
If you really need to add a constant then you should use axpy
. Just use your favorite search engine and look for "add a constant to a vector in BLAS". The first result is:
https://stackoverflow.com/questions/14051064/add-scalar-to-vector-in-blas-cublas-cuda
You'll see examples in C++ but doing the same in neanderthal
will be a million times easier
If you really need to add a constant then you should use
axpy
. Just use your favorite search engine and look for "add a constant to a vector in BLAS". The first result is:
I would suggest an even faster way that does not require additional identity matrix: use linear-frac!
from the vect-math namespace.
Thanks for the tip :) Maybe typo? This? https://neanderthal.uncomplicate.org/codox/uncomplicate.neanderthal.vect-math.html#var-linear-frac
Yes, linear-frac.
Thanks folks !
@blueberry or others, I'm new to neanderthal (but not to scientific programming) and am considering it for replacing a python/numpy service I currently maintain. One thing that has plagued me so far is access to (or ability to locate) some basic vector management functions. e.g
1
to each item in vectora
: in python/numpy that's1 + vector
a
with vectorb
: in python/numpy that'sa.append(b)
These are certainly easily solvable in plain clojure but wanted to see if there was an opportunity to keep the vector math a little speedier. Am I not seeing these in the docs, or are those simpler sorts of vector manipulation not included in this lib.
Thanks for the help !