Changeset 4748


Ignore:
Timestamp:
07/22/10 14:14:00 (15 years ago)
Author:
Eric.Larour
Message:

Preliminary version of SparseToVector mex module

Location:
issm/trunk/src/mex/SparseToVector
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/mex/SparseToVector/SparseToVector.c

    r4746 r4748  
     1/*\file SparseToVector.cpp
     2 *\brief: extract from a sparse matlab matrix ir, jc, and other information
     3 */
    14
    2 #define THISFUNCTION "SparseToVector"
     5#include "./SparseToVector.h"
    36
    4 #include <stdio.h>
    5 #include <string.h>    /*  strcasecmp  */
    6 #include <time.h>      /*  clock,time,difftime  */
    7 #include "mex.h"
    8 
    9 
    10 /* Input Arguments */
    11 
    12 #define    A_IN         prhs[0]
    13 
    14 /* Output Arguments */
    15 
    16 #define    IR_OUT       plhs[0]
    17 #define    JC_OUT       plhs[1]
    18 #define    PR_OUT       plhs[2]
    19 #define    M_OUT        plhs[3]
    20 #define    N_OUT        plhs[4]
    21 #define    NZMAX_OUT    plhs[5]
    22 
    23 
    24 void SparseToVectorUsage( void );
    25 
    26 
    27 void mexFunction( int nlhs,
    28                                   mxArray *plhs[],
    29                                   int nrhs,
    30                                   const mxArray *prhs[] )
    31 {
    32         mwIndex *ir =NULL,*jc =NULL;
    33         double  *ird=NULL,*jcd=NULL,*pr=NULL,*prd=NULL;
     7void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
     8       
    349        int     i;
     10       
     11        /*Output: */
     12        mwIndex *ir =NULL;
     13        mwIndex *jc =NULL;
     14        double  *ird=NULL;
     15        double  *jcd=NULL;
     16        double   *pr=NULL;
     17        double   *prd=NULL;
    3518
    3619        /* Check for proper number of arguments */
     
    4831
    4932        if (!mxIsNumeric(A_IN) || !mxIsSparse(A_IN)) {
    50                 mexPrintf("%s -- Input matrix must be numeric and sparse.\n",THISFUNCTION);
     33                mexPrintf("%s -- Input matrix must be numeric and sparse.\n",__FUNCT__);
    5134                mexErrMsgTxt(" ");
    5235        }
     
    9578                }
    9679                mexPrintf("%s -- Input matrix is of size %d by %d with %d non-zeroes.\n",
    97                                   THISFUNCTION,mxGetM(A_IN),mxGetN(A_IN),mxGetNzmax(A_IN));
     80                                  __FUNCT__,mxGetM(A_IN),mxGetN(A_IN),mxGetNzmax(A_IN));
    9881        }
    99 
    100         return;
    10182}
    10283
    103 void SparseToVectorUsage( void )
    104 {
     84void SparseToVectorUsage( void ){
    10585
    10686    mexPrintf("\n");
    10787    mexPrintf("Usage: [ir,jc,pr,m,n,nzmax]=SparseToVector(a);\n");
    10888    mexPrintf("\n");
    109 
    110     return;
    11189}
    11290
Note: See TracChangeset for help on using the changeset viewer.