~ubuntu-branches/ubuntu/oneiric/suitesparse/oneiric

« back to all changes in this revision

Viewing changes to SPQR/Source/spqr_front.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Nick Ellery
  • Date: 2009-06-14 19:15:52 UTC
  • mfrom: (7.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090614191552-2hliya5q8n1quseu
Tags: 1:3.4.0-1ubuntu1
* Merge from debian unstable, remaining changes (LP: #387137):
  - debian/control:
    - demote libatlas-doc from recommends to suggests as it is not in main
    - drop recommends on doc-central as it is not in main

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
#define MINCHUNK_RATIO 4
112
112
 
113
113
// =============================================================================
114
 
// === house ===================================================================
 
114
// === spqr_private_house ======================================================
115
115
// =============================================================================
116
116
 
117
117
// Construct a Householder reflection H = I - tau * v * v' such that H*x is
134
134
*/
135
135
 
136
136
//  Note that for the complex case, the reflection must be applied as H'*x,
137
 
//  which requires that tau be conjugated in apply1.
 
137
//  which requires that tau be conjugated in spqr_private_apply1.
138
138
//
139
139
//  This function performs about 3*n+2 flops
140
140
 
141
 
static double larfg (Int n, double *X, cholmod_common *cc)
 
141
inline double spqr_private_larfg (Int n, double *X, cholmod_common *cc)
142
142
{
143
143
    double tau = 0 ;
144
144
    BLAS_INT N = n, one = 1 ;
154
154
}
155
155
 
156
156
 
157
 
static Complex larfg (Int n, Complex *X, cholmod_common *cc)
 
157
inline Complex spqr_private_larfg (Int n, Complex *X, cholmod_common *cc)
158
158
{
159
159
    Complex tau = 0 ;
160
160
    BLAS_INT N = n, one = 1 ;
170
170
}
171
171
 
172
172
 
173
 
template <typename Entry> static Entry house        // returns coefficient tau
 
173
template <typename Entry> Entry spqr_private_house  // returns tau
174
174
(
175
175
    // inputs, not modified
176
176
    Int n,
181
181
    cholmod_common *cc
182
182
)
183
183
{
184
 
    return (larfg (n, X, cc)) ;
 
184
    return (spqr_private_larfg (n, X, cc)) ;
185
185
}
186
186
 
187
187
 
188
188
// =============================================================================
189
 
// === apply1 ==================================================================
 
189
// === spqr_private_apply1 =====================================================
190
190
// =============================================================================
191
191
 
192
192
// Apply a single Householder reflection; C = C - tau * v * v' * C.  The
204
204
//  If applied to a single column, this function performs 2*n-1 flops to
205
205
//  compute w, and 2*n+1 to apply it to C, for a total of 4*n flops.
206
206
 
207
 
static void larf (Int m, Int n, double *V, double tau, double *C, Int ldc,
208
 
    double *W, cholmod_common *cc)
 
207
inline void spqr_private_larf (Int m, Int n, double *V, double tau,
 
208
    double *C, Int ldc, double *W, cholmod_common *cc)
209
209
{
210
210
    BLAS_INT M = m, N = n, LDC = ldc, one = 1 ;
211
211
    char left = 'L' ;
220
220
    }
221
221
}
222
222
 
223
 
static void larf (Int m, Int n, Complex *V, Complex tau, Complex *C, Int ldc,
224
 
    Complex *W, cholmod_common *cc)
 
223
inline void spqr_private_larf (Int m, Int n, Complex *V, Complex tau,
 
224
    Complex *C, Int ldc, Complex *W, cholmod_common *cc)
225
225
{
226
226
    BLAS_INT M = m, N = n, LDC = ldc, one = 1 ;
227
227
    char left = 'L' ;
237
237
}
238
238
 
239
239
 
240
 
template <typename Entry> static void apply1
 
240
template <typename Entry> void spqr_private_apply1
241
241
(
242
242
    // inputs, not modified
243
243
    Int m,              // C is m-by-n
262
262
    }
263
263
    vsave = V [0] ;     // temporarily restore unit diagonal of V
264
264
    V [0] = 1 ;
265
 
    larf (m, n, V, tau, C, ldc, W, cc) ;
 
265
    spqr_private_larf (m, n, V, tau, C, ldc, W, cc) ;
266
266
    V [0] = vsave ;     // restore V [0]
267
267
}
268
268
 
410
410
        // find a Householder reflection that reduces column k
411
411
        // ---------------------------------------------------------------------
412
412
 
413
 
        tau = house (t-g, &F [INDEX (g,k,m)], cc) ;
 
413
        tau = spqr_private_house (t-g, &F [INDEX (g,k,m)], cc) ;
414
414
 
415
415
        // ---------------------------------------------------------------------
416
416
        // check to see if the kth column is OK
507
507
            // v is stored in F (g:t-1,k).  This applies just one reflection
508
508
            // to the current panel.
509
509
            PR (("apply 1: k %ld\n", k)) ;
510
 
            apply1 (t-g, k2-k-1, m, &F [INDEX (g,k,m)], tau,
 
510
            spqr_private_apply1 (t-g, k2-k-1, m, &F [INDEX (g,k,m)], tau,
511
511
                &F [INDEX (g,k+1,m)], W, cc) ;
512
512
 
513
513
            g++ ;   // one more pivot found