
dot product in mex file
Posted:
Sep 2, 2013 10:34 PM


Hi, I am using function "ddot" in BLAS.h library for computing dot product between two 3D vectors in a C mex file. My usage for this function as follows:  .... #include "blas.h" .... int dot_len, dot_inc1, dot_inc2 ; mxArray *p_C1, *p_C2 ; double *C1, *C2, Out ; .... p_C1 = mxCreateDoubleMatrix(3,1, mxREAL); p_C2 = mxCreateDoubleMatrix(3,1, mxREAL); C1 = mxGetPr(p_C1); C2 = mxGetPr(p_C2); .... dot_len =3; dot_inc1 =1; dot_inc2 =1; Out= ddot(&dot_len,C1,&dot_inc1,C2,&dot_inc2);  when i compile, i receive error: " error C2664: 'ddot' : cannot convert parameter 1 from 'int *' to 'ptrdiff_t *'. Types pointed to are unrelated; conversion requires reinterpret_cast, Cstyle cast or functionstyle cast"
Although my usage is followed the definition of this function: DOUBLE PRECISION function ddot (integer N, double precision, dimension(*) DX, integer INCX, double precision, dimension(*) DY, integer INCY )
So, if you have used this function, can you tell me what is the reason of my problem? Thanks in advance! Toan

