views:

41

answers:

2

Hey guys, I have some questions about the Accelerate.framework. I am trying to do some vector stuff. First of all what is the difference between Single Precision Float, Single-Precision Complex, Double-Precision Float, and Double-Precision Complex? And what should I be using for my own struct defined like float x; float y; float z; And finally can someone go into more depth on what each of the arguments to the functions mean?

void cblas_cdotc_sub (
   const int N,
   const void *X,
   const int incX,
   const void *Y,
   const int incY,
   void *dotc
);

Apples descriptions are a little weak. What do they mean by the length for N? Is that the size of the vector in bytes? Or the actual unit length of the vector?

+1  A: 

Complex variables are 2 dimensional quantities, normally treated as the real and imaginary parts of complex numbers in arithmetic/math operations.

IEEE single and double floats allow differing amounts of binary precision (roughly the amount of significant digits without rounding error), very approximately 7 or so digits for single, around double that for double, plus a wider exponent range as well.

But single float arithmetic runs a lot faster on current iOS devices than does double (unlike the Simulator, where they may both run more the same speed.)

Apple's descriptions may require some basic knowledge of C data types, arrays and structures, and the mathematical theory of complex variables. I'd start by reading some books on basic C programming and numerical algorithms in C.

hotpaw2
I understand what it meant by single and double precision I was more asking what the complex meant but thanks for the clarification. Now any ideas on the N part of that function?
Justin Meiners
Nevermind I found some stronger documentation and figured it out.
Justin Meiners
A: 

Ok I figured it out I looked at the documentation for this function instead which is probably what most people should be using anyway:

float cblas_sdot (
   const int N,
   const float *X,
   const int incX,
   const float *Y,
   const int incY
);

N is the number of elements in the vector (for 3D, 3)

X and Y are your pointers to your vectors which you can point to a struct like this:

(float*)&vector

incX and incY are your stride, which should probably just be 1

Justin Meiners