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

« back to all changes in this revision

Viewing changes to CXSparse/MATLAB/CSparse/cs_counts_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
/* cs_counts: column counts for sparse Cholesky factor L. */
 
3
void mexFunction
 
4
(
 
5
    int nargout,
 
6
    mxArray *pargout [ ],
 
7
    int nargin,
 
8
    const mxArray *pargin [ ]
 
9
)
 
10
{
 
11
    cs_dl Amatrix, *A ;
 
12
    CS_INT n, ata, *parent, *post, *c ;
 
13
    char mode [20] ;
 
14
    if (nargout > 2 || nargin < 1 || nargin > 2)
 
15
    {
 
16
        mexErrMsgTxt ("Usage: c = cs_counts(A,mode)") ;
 
17
    }
 
18
    ata = 0 ;                                           /* get mode */
 
19
    if (nargin > 1 && mxIsChar (pargin [1]))
 
20
    {
 
21
        mxGetString (pargin [1], mode, 8) ;
 
22
        ata = (mode [0] == 'c') ;
 
23
    }
 
24
    A = cs_dl_mex_get_sparse (&Amatrix, !ata, 0, pargin [0]) ;  /* get A */
 
25
    n = A->n ;
 
26
    parent = cs_dl_etree (A, ata) ;                     /* compute etree */
 
27
    post = cs_dl_post (parent, n) ;                     /* postorder the etree*/
 
28
    c = cs_dl_counts (A, parent, post, ata) ;           /* get column counts */
 
29
    pargout [0] = cs_dl_mex_put_int (c, n, 0, 1) ;              /* return counts */
 
30
    cs_free (parent) ;
 
31
    cs_free (post) ;
 
32
}