~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to CXSparse_newfiles/MATLAB/CSparse/cs_transpose_mex.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "cs_mex.h"
 
2
/* C = cs_transpose (A), computes C=A', where A must be sparse.
 
3
   C = cs_transpose (A,kind) computes C=A.' if kind <= 0, C=A' if kind > 0 */
 
4
void mexFunction
 
5
(
 
6
    int nargout,
 
7
    mxArray *pargout [ ],
 
8
    int nargin,
 
9
    const mxArray *pargin [ ]
 
10
)
 
11
{
 
12
    CS_INT values ;
 
13
    if (nargout > 1 || nargin < 1 || nargin > 2)
 
14
    {
 
15
        mexErrMsgTxt ("Usage: C = cs_transpose(A,kind)") ;
 
16
    }
 
17
    values = (nargin > 1) ? mxGetScalar (pargin [1]) : 1 ;
 
18
    values = (values <= 0) ? -1 : 1 ;
 
19
    if (mxIsComplex (pargin [0]))
 
20
    {
 
21
#ifndef NCOMPLEX
 
22
        cs_cl Amatrix, *A, *C ;
 
23
        A = cs_cl_mex_get_sparse (&Amatrix, 0, pargin [0]) ;    /* get A */
 
24
        C = cs_cl_transpose (A, values) ;                       /* C = A' */
 
25
        pargout [0] = cs_cl_mex_put_sparse (&C) ;               /* return C */
 
26
#else
 
27
        mexErrMsgTxt ("complex matrices not supported") ;
 
28
#endif
 
29
    }
 
30
    else
 
31
    {
 
32
        cs_dl Amatrix, *A, *C ;
 
33
        A = cs_dl_mex_get_sparse (&Amatrix, 0, 1, pargin [0]) ; /* get A */
 
34
        C = cs_dl_transpose (A, values) ;                       /* C = A' */
 
35
        pargout [0] = cs_dl_mex_put_sparse (&C) ;               /* return C */
 
36
    }
 
37
}