2つの任意の長さのベクトル(通常の長さは2048)を作成し、要素ごとに乗算しようとしています。したがって、すべてのnについてZ [n] = X [n] *Y[n]です。
私がテストするように設定したコードはかなり基本的です:
float inputX[4] = { 2, 4, 8, 16 };
float inputY[4] = { 2, 4, 8, 16 };
catlas_saxpby(4, 1, inputX, 1, 1, inputY, 1);
結果はinputYに入り、結果は次のようになります。
4.000000, 8.000000, 16.000000, 32.000000
それらが乗算している場合、それは4、16、64、256であるはずです。しかし、それは加算しているように見えます。
したがって、これは私が期待することを行っておらず、ドキュメントはそれが何をしているのかを理解するのに十分な情報を私に与えていません。
何か案は?
Apple's documentation for BLAS says this:
Computes the product of two vectors, scaling each one separately (single-precision).
void catlas_saxpby (
const int N,
const float alpha,
const float *X,
const int incX,
const float beta,
float *Y,
const int incY
);
Parameters
N
Number of elements in the vector.
alpha
Scaling factor for X.
X
Input vector X.
incX
Stride within X. For example, if incX is 7, every 7th element is used.
beta
Scaling factor for Y.
Y
Input vector Y.
incY
Stride within Y. For example, if incY is 7, every 7th element is used.
Discussion
On return, the contents of vector Y are replaced with the result.