Revision 1654 trunk/src/sparse/hs_sparse.cpp

hs_sparse.cpp (revision 1654)
15 15
//#include <df1b2fun.h>
16 16
//#include <adrndeff.h>
17 17
#define XCONST const
18
#include "hs.h"        
18
#include "hs.h"
19 19
//pthread_mutex_t mutex_dfpool = PTHREAD_MUTEX_INITIALIZER;
20 20

  
21 21
#define USE_ADJOINT_CODE
......
63 63
    {
64 64
        p [i] = nz ;
65 65
        nz += c [i] ;
66
        nz2 += c [i] ;                    // also in double to avoid int overflow 
66
        nz2 += c [i] ;                    // also in double to avoid int overflow
67 67
        c [i] = p [i] ;                    // also copy p[0..n-1] back into c[0..n-1]
68 68
    }
69 69
    p [n] = nz ;
70
    return (nz2) ;                    // return sum (c [0..n-1]) 
70
    return (nz2) ;                    // return sum (c [0..n-1])
71 71
}
72 72

  
73 73
// clear w
......
82 82
    return (mark) ;        // at this point, w [0..n-1] < mark holds
83 83
}
84 84

  
85
// Find C = A' 
85
// Find C = A'
86 86
 void cs_transpose (XCONST hs_smatrix &_A, int values, hs_smatrix &C)
87 87
{
88 88
    ADUNCONST(hs_smatrix,A)
89 89
    int p, q, j;
90 90

  
91
    int n = A.n ; 
92
    int m = n; 
91
    int n = A.n ;
92
    int m = n;
93 93
    ivector & Ap=A.p;
94 94
    ivector & Ai=A.i;
95 95
    dvector & Ax=A.x;
......
101 101
    ivector w(0,n-1);                                      // workspace
102 102
    w.initialize();
103 103

  
104
    for (p = 0 ; p < Ap [n] ; p++) 
104
    for (p = 0 ; p < Ap [n] ; p++)
105 105
      w [Ai [p]]++ ;                                          // row counts
106 106
    cs_cumsum (Cp, w, m) ;                              // row pointers
107 107
    for (j = 0 ; j < n ; j++)
......
120 120
    ADUNCONST(dvar_hs_smatrix,A)
121 121
    int p, q, j;
122 122

  
123
    int n = A.n ; 
124
    int m = n; 
123
    int n = A.n ;
124
    int m = n;
125 125
    ivector & Ap=A.p;
126 126
    ivector & Ai=A.i;
127 127
    dvar_vector & Ax=A.x;
......
133 133
    ivector w(0,n-1);                                      // workspace
134 134
    w.initialize();
135 135

  
136
    for (p = 0 ; p < Ap [n] ; p++) 
136
    for (p = 0 ; p < Ap [n] ; p++)
137 137
      w [Ai [p]]++ ;                                          // row counts
138 138
    cs_cumsum (Cp, w, m) ;                              // row pointers
139 139
    for (j = 0 ; j < n ; j++)
......
246 246
}
247 247

  
248 248

  
249
hs_smatrix::hs_smatrix(int _n, XCONST dcompressed_triplet &_M)         
249
hs_smatrix::hs_smatrix(int _n, XCONST dcompressed_triplet &_M)
250 250
{
251
    ADUNCONST(dcompressed_triplet,M)         
251
    ADUNCONST(dcompressed_triplet,M)
252 252

  
253 253
    n = _n;
254 254
    m = n;                // May remove m from code; only square matrices needed
255 255

  
256 256
    int nz = M.indexmax()- M.indexmin() + 1;
257 257
    nzmax = nz;
258
    
258

  
259 259
    int k;
260 260

  
261 261
    // Matrix in triplet format
......
274 274
    Tx = M.get_x();
275 275
    Tx.shift(0);
276 276

  
277
    if( min(Ti)<0 || max(Ti)>(n-1) || max(Tj)>(n-1) || min(Tj)<0) 
277
    if( min(Ti)<0 || max(Ti)>(n-1) || max(Tj)>(n-1) || min(Tj)<0)
278 278
      cout << "Error #2 in hs_smatrix::hs_smatrix" << endl;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff