/*********************************************************************** * mexMatvec: compute * * mexMatvec(A,y,options) * * options = 0, compute A*y * = 1, compute (y'*A)' * * Copyright (c) 2004 by * K.C. Toh * Last Modified: 120404 ************************************************************************/ #include #include /******************************** * realdotde: x dense matrix, * y dense vector *********************************/ double realdotde(const double *x, const int idx, const double *y, const int n) { int i; double r; r=0.0; for (i=0; i 2) { mexErrMsgTxt("mexMatvec: requires 1 output argument"); } if (nrhs == 2) { options = 0; } else { options = (int) *mxGetPr(prhs[2]); } /***** assign pointers *****/ A = mxGetPr(prhs[0]); m1 = mxGetM(prhs[0]); n1 = mxGetN(prhs[0]); isspA = mxIsSparse(prhs[0]); if (isspA) { irA = mxGetIr(prhs[0]); jcA = mxGetJc(prhs[0]); } isspy = mxIsSparse(prhs[1]); m2 = mxGetM(prhs[1]); n2 = mxGetN(prhs[1]); if (n2 > 1) { mexErrMsgTxt("mexMatvec: 2ND input must be a column vector"); } if (isspy) { iry = mxGetIr(prhs[1]); jcy = mxGetJc(prhs[1]); ytmp = mxGetPr(prhs[1]); /***** copy ytmp to y *****/ y = (double*)mxCalloc(m2,sizeof(double)); kstart = jcy[0]; kend = jcy[1]; for (k=kstart; k