Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: dot product in mex file
Replies: 6   Last Post: Sep 3, 2013 4:08 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Toan Cao

Posts: 52
Registered: 10/15/10
dot product in mex file
Posted: Sep 2, 2013 10:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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, C-style cast or function-style 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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.