I am using cblas_icamax. I want to pass a float vector z13] to cblas_icamax (see below). My code includes the following.
float z[13] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f ,0.f, 0.f, 0.f, 0.f, 0.f};
//...
for (i = 0; i < 13; i++) {
printf("%.4f\n", z[i]);
}
int cardIndex = cblas_icamax(13,(float*) z,1);
NSLog(@"cardIndex: %d", cardIndex);
I also tried this code with the same result.
int cardIndex = cblas_icamax(13,&z,1);
And the result of the print is as follows for which the maximum absolute value is 138.1086 which is position 10, but the function cblas_icamax is returning 5. What is wrong?
-1.2624
74.1524
52.3533
89.9426
28.8639
-7.6203
-30.2820
48.9747
124.8693
29.4351
138.1086
36.2638
-45.0410
Returns the index of the element with the largest absolute value in a vector (single-precision complex).
int cblas_icamax (
const int N,
const void *X,
const int incX
);