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

« back to all changes in this revision

Viewing changes to CHOLMOD/MATLAB/ldlchol.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.
69
68
    const mxArray *pargin [ ]
70
69
)
71
70
{
72
 
    double dummy = 0, beta [2] ;
 
71
    double dummy = 0, beta [2], *px ;
73
72
    cholmod_sparse Amatrix, *A, *Lsparse ;
74
73
    cholmod_factor *L ;
75
74
    cholmod_common Common, *cm ;
76
 
    int n, minor ;
 
75
    Int n, minor ;
77
76
 
78
77
    /* ---------------------------------------------------------------------- */
79
78
    /* start CHOLMOD and set parameters */ 
80
79
    /* ---------------------------------------------------------------------- */
81
80
 
82
81
    cm = &Common ;
83
 
    cholmod_start (cm) ;
 
82
    cholmod_l_start (cm) ;
84
83
    sputil_config (SPUMONI, cm) ;
85
84
 
86
85
    /* convert to packed LDL' when done */
119
118
    {
120
119
        mexErrMsgTxt ("A must be square") ;
121
120
    }
122
 
    if (!mxIsDouble (pargin [0]))
123
 
    {
124
 
        mexErrMsgTxt ("A must be double (or complex double)") ;
125
 
    }
126
121
 
127
122
    /* get sparse matrix A, use tril(A)  */
128
123
    A = sputil_get_sparse (pargin [0], &Amatrix, &dummy, -1) ; 
152
147
    /* analyze and factorize */
153
148
    /* ---------------------------------------------------------------------- */
154
149
 
155
 
    L = cholmod_analyze (A, cm) ;
156
 
    cholmod_factorize_p (A, beta, NULL, 0, L, cm) ;
 
150
    L = cholmod_l_analyze (A, cm) ;
 
151
    cholmod_l_factorize_p (A, beta, NULL, 0, L, cm) ;
157
152
 
158
153
    if (nargout < 2 && cm->status != CHOLMOD_OK)
159
154
    {
166
161
 
167
162
    /* the conversion sets L->minor back to n, so get a copy of it first */
168
163
    minor = L->minor ;
169
 
    Lsparse = cholmod_factor_to_sparse (L, cm) ;
 
164
    Lsparse = cholmod_l_factor_to_sparse (L, cm) ;
170
165
    if (Lsparse->xtype == CHOLMOD_COMPLEX)
171
166
    {
172
167
        /* convert Lsparse from complex to zomplex */
173
 
        cholmod_sparse_xtype (CHOLMOD_ZOMPLEX, Lsparse, cm) ;
 
168
        cholmod_l_sparse_xtype (CHOLMOD_ZOMPLEX, Lsparse, cm) ;
174
169
    }
175
170
 
176
171
    /* ---------------------------------------------------------------------- */
183
178
    /* return minor (translate to MATLAB convention) */
184
179
    if (nargout > 1)
185
180
    {
186
 
        pargout [1] = mxCreateDoubleScalar ((minor == n) ? 0 : (minor+1)) ;
 
181
        pargout [1] = mxCreateDoubleMatrix (1, 1, mxREAL) ;
 
182
        px = mxGetPr (pargout [1]) ;
 
183
        px [0] = ((minor == n) ? 0 : (minor+1)) ;
187
184
    }
188
185
 
189
186
    /* return permutation */
196
193
    /* free workspace and the CHOLMOD L, except for what is copied to MATLAB */
197
194
    /* ---------------------------------------------------------------------- */
198
195
 
199
 
    cholmod_free_factor (&L, cm) ;
200
 
    cholmod_finish (cm) ;
201
 
    cholmod_print_common (" ", cm) ;
 
196
    cholmod_l_free_factor (&L, cm) ;
 
197
    cholmod_l_finish (cm) ;
 
198
    cholmod_l_print_common (" ", cm) ;
202
199
    /*
203
200
    if (cm->malloc_count != 3 + mxIsComplex (pargout[0])) mexErrMsgTxt ("!") ;
204
201
    */