1 /* ========================================================================== */ 2 /* === ssmult.h ============================================================= */ 3 /* ========================================================================== */ 4 5 /* Include file for ssmult.c and ssmultsym.c 6 * Copyright 2007-2009, Timothy A. Davis, http://www.suitesparse.com 7 */ 8 9 #include "mex.h" 10 #include <stdlib.h> 11 12 /* NOTE: this code will FAIL abysmally if Int is mwIndex. */ 13 #define Int mwSignedIndex 14 15 #define ERROR_DIMENSIONS (-1) 16 #define ERROR_TOO_LARGE (-2) 17 18 /* turn off debugging */ 19 #ifndef NDEBUG 20 #define NDEBUG 21 #endif 22 23 #define MAX(a,b) (((a) > (b)) ? (a) : (b)) 24 25 #define MXFREE(a) { \ 26 void *ptr ; \ 27 ptr = (void *) (a) ; \ 28 if (ptr != NULL) mxFree (ptr) ; \ 29 } 30 31 mxArray *ssmult_transpose /* returns C = A' or A.' */ 32 ( 33 const mxArray *A, 34 int conj /* compute A' if true, compute A.' if false */ 35 ) ; 36 37 int ssmult_nnz (const mxArray *A) ; 38 39 void ssmult_invalid (int error_code) ; 40 41 mxArray *ssmult /* returns C = A*B or variants */ 42 ( 43 const mxArray *A, 44 const mxArray *B, 45 int at, /* if true: trans(A) if false: A */ 46 int ac, /* if true: conj(A) if false: A. ignored if A real */ 47 int bt, /* if true: trans(B) if false: B */ 48 int bc, /* if true: conj(B) if false: B. ignored if B real */ 49 int ct, /* if true: trans(C) if false: C */ 50 int cc /* if true: conj(C) if false: C. ignored if C real */ 51 ) ; 52 53 mxArray *ssmult_saxpy /* returns C = A*B using the sparse saxpy method */ 54 ( 55 const mxArray *A, 56 const mxArray *B, 57 int ac, /* if true use conj(A) */ 58 int bc, /* if true use conj(B) */ 59 int cc, /* if true compute conj(C) */ 60 int sorted /* if true, return C with sorted columns */ 61 ) ; 62 63 mxArray *ssmult_dot /* returns C = A'*B using sparse dot product method */ 64 ( 65 const mxArray *A, 66 const mxArray *B, 67 int ac, /* if true: conj(A) if false: A. ignored if A real */ 68 int bc, /* if true: conj(B) if false: B. ignored if B real */ 69 int cc /* if true: conj(C) if false: C. ignored if C real */ 70 ) ; 71 72 void ssdump (const mxArray *A) ; 73