File: spqr_mx.hpp

package info (click to toggle)
suitesparse 1%3A4.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 74,020 kB
  • ctags: 12,092
  • sloc: ansic: 146,148; cpp: 17,776; makefile: 5,777; fortran: 1,927; java: 1,846; csh: 749; ruby: 725; perl: 225; sed: 164; awk: 27; sh: 18
file content (162 lines) | stat: -rw-r--r-- 3,575 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// =============================================================================
// === spqr_mx_matlab.hpp ======================================================
// =============================================================================

// utility functions and definitions solely for use in a MATLAB mexFunction

#ifndef SPQR_MX_MATLAB_H
#define SPQR_MX_MATLAB_H

#include "mex.h"
#include "SuiteSparseQR.hpp"

// SuiteSparse_long is defined in SuiteSparse_config.h, included by
// SuiteSparseQR.hpp:

#define Long SuiteSparse_long

// get the BLAS_INT definition from CHOLMOD (this is for spumoni output only)
#include "cholmod_blas.h"

#include <complex>
typedef std::complex<double> Complex ;

#define TRUE 1
#define FALSE 0
#define EMPTY (-1)
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))

#define MXFREE(a) { \
    void *ptr ; \
    ptr = (void *) (a) ; \
    if (ptr != NULL) mxFree (ptr) ; \
}

typedef struct spqr_mx_options_struct
{
    double tol ;            // <= -2 means to use default tol
    Long econ ;
    int ordering ;
    int permvector ;
    int Qformat ;
    int haveB ;
    int spumoni ;
    int min2norm ;

} spqr_mx_options ;

// for error and warning messages
#define LEN 200

// default value of spumoni
#define SPUMONI 0

// values for opts.Qformat
#define SPQR_Q_DISCARD 0
#define SPQR_Q_MATRIX 1
#define SPQR_Q_HOUSEHOLDER 2

int spqr_mx_get_options
(
    const mxArray *mxopts,
    spqr_mx_options *opts,
    Long m,
    int nargout,

    // workspace and parameters
    cholmod_common *cc
)  ;

mxArray *spqr_mx_put_sparse
(
    cholmod_sparse **Ahandle,	// CHOLMOD version of the matrix
    cholmod_common *cc
) ;

mxArray *spqr_mx_put_dense2
(
    Long m,
    Long n,
    double *Ax,         // size nz if real; size 2*nz if complex (and freed)
    int is_complex,

    // workspace and parameters
    cholmod_common *cc
) ;

mxArray *spqr_mx_put_dense
(
    cholmod_dense **Ahandle,	// CHOLMOD version of the matrix
    cholmod_common *cc
) ;

mxArray *spqr_mx_put_permutation
(
    Long *P,
    Long n,
    int vector,

    // workspace and parameters
    cholmod_common *cc
) ;

double *spqr_mx_merge_if_complex
(
    // inputs, not modified
    const mxArray *A,
    int make_complex,

    // output
    Long *p_nz,              // number of entries in A

    // workspace and parameters
    cholmod_common *cc
) ;

int spqr_mx_config (Long spumoni, cholmod_common *cc) ;

cholmod_sparse *spqr_mx_get_sparse
(
    const mxArray *Amatlab, // MATLAB version of the matrix
    cholmod_sparse *A,	    // CHOLMOD version of the matrix
    double *dummy 	    // a pointer to a valid scalar double
) ;

cholmod_dense *spqr_mx_get_dense
(
    const mxArray *Amatlab, // MATLAB version of the matrix
    cholmod_dense *A,	    // CHOLMOD version of the matrix
    double *dummy	    // a pointer to a valid scalar double
) ;

void spqr_mx_get_usage
(
    mxArray *A,         // mxArray to check
    int tight,          // if true, then nnz(A) must equal nzmax(A)
    Long *p_usage,      // bytes used
    Long *p_count,      // # of malloc'd blocks
    cholmod_common *cc
) ;

extern "C" {
extern int spqr_spumoni ;
void spqr_mx_error (int status, const char *file, int line, const char *msg) ;
#include <string.h>
}

void spqr_mx_spumoni
(
    spqr_mx_options *opts,
    int is_complex,             // TRUE if complex, FALSE if real
    cholmod_common *cc
) ;

mxArray *spqr_mx_info       // return a struct with info statistics
(
    cholmod_common *cc,
    double t,
    double flops
) ;

#endif