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

« back to all changes in this revision

Viewing changes to CHOLMOD/MATLAB/lchol.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:
3
3
/* ========================================================================== */
4
4
 
5
5
/* -----------------------------------------------------------------------------
6
 
 * CHOLMOD/MATLAB Module.  Version 1.3.  Copyright (C) 2005-2006,
7
 
 * Timothy A. Davis
 
6
 * CHOLMOD/MATLAB Module.  Copyright (C) 2005-2006, Timothy A. Davis
8
7
 * The CHOLMOD/MATLAB Module is licensed under Version 2.0 of the GNU
9
8
 * General Public License.  See gpl.txt for a text of the license.
10
9
 * CHOLMOD is also available under other licenses; contact authors for details.
38
37
    const mxArray *pargin [ ]
39
38
)
40
39
{
41
 
    double dummy = 0 ;
 
40
    double dummy = 0, *px ;
42
41
    cholmod_sparse Amatrix, *A, *Lsparse ;
43
42
    cholmod_factor *L ;
44
43
    cholmod_common Common, *cm ;
45
 
    int n, minor ;
 
44
    Int n, minor ;
46
45
 
47
46
    /* ---------------------------------------------------------------------- */
48
47
    /* start CHOLMOD and set parameters */ 
49
48
    /* ---------------------------------------------------------------------- */
50
49
 
51
50
    cm = &Common ;
52
 
    cholmod_start (cm) ;
 
51
    cholmod_l_start (cm) ;
53
52
    sputil_config (SPUMONI, cm) ;
54
53
 
55
54
    /* convert to packed LL' when done */
80
79
    {
81
80
        mexErrMsgTxt ("A must be square and sparse") ;
82
81
    }
83
 
    if (!mxIsDouble (pargin [0]))
84
 
    {
85
 
        mexErrMsgTxt ("A must be double (or complex double)") ;
86
 
    }
87
82
 
88
83
    /* get sparse matrix A, use tril(A)  */
89
84
    A = sputil_get_sparse (pargin [0], &Amatrix, &dummy, -1) ; 
100
95
    /* analyze and factorize */
101
96
    /* ---------------------------------------------------------------------- */
102
97
 
103
 
    L = cholmod_analyze (A, cm) ;
104
 
    cholmod_factorize (A, L, cm) ;
 
98
    L = cholmod_l_analyze (A, cm) ;
 
99
    cholmod_l_factorize (A, L, cm) ;
105
100
 
106
101
    if (nargout < 2 && cm->status != CHOLMOD_OK)
107
102
    {
114
109
 
115
110
    /* the conversion sets L->minor back to n, so get a copy of it first */
116
111
    minor = L->minor ;
117
 
    Lsparse = cholmod_factor_to_sparse (L, cm) ;
 
112
    Lsparse = cholmod_l_factor_to_sparse (L, cm) ;
118
113
    if (Lsparse->xtype == CHOLMOD_COMPLEX)
119
114
    {
120
115
        /* convert Lsparse from complex to zomplex */
121
 
        cholmod_sparse_xtype (CHOLMOD_ZOMPLEX, Lsparse, cm) ;
 
116
        cholmod_l_sparse_xtype (CHOLMOD_ZOMPLEX, Lsparse, cm) ;
122
117
    }
123
118
 
124
119
    if (minor < n)
140
135
    /* return minor (translate to MATLAB convention) */
141
136
    if (nargout > 1)
142
137
    {
143
 
        pargout [1] = mxCreateDoubleScalar ((minor == n) ? 0 : (minor+1)) ;
 
138
        pargout [1] = mxCreateDoubleMatrix (1, 1, mxREAL) ;
 
139
        px = mxGetPr (pargout [1]) ;
 
140
        px [0] = ((minor == n) ? 0 : (minor+1)) ;
144
141
    }
145
142
 
146
143
    /* return permutation */
153
150
    /* free workspace and the CHOLMOD L, except for what is copied to MATLAB */
154
151
    /* ---------------------------------------------------------------------- */
155
152
 
156
 
    cholmod_free_factor (&L, cm) ;
157
 
    cholmod_finish (cm) ;
158
 
    cholmod_print_common (" ", cm) ;
 
153
    cholmod_l_free_factor (&L, cm) ;
 
154
    cholmod_l_finish (cm) ;
 
155
    cholmod_l_print_common (" ", cm) ;
159
156
    /* 
160
157
    if (cm->malloc_count != 3 + mxIsComplex (pargout[0])) mexErrMsgTxt ("!") ;
161
158
    */