This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
View | Details | Raw Unified | Return to bug 949 | Differences between
and this patch

Collapse All | Expand All

(-)a/Eigen/src/Cholesky/LDLT.h (+7 lines)
Lines 221-236 template<typename _MatrixType, int _UpLo Link Here
221
    
221
    
222
    #ifndef EIGEN_PARSED_BY_DOXYGEN
222
    #ifndef EIGEN_PARSED_BY_DOXYGEN
223
    template<typename RhsType, typename DstType>
223
    template<typename RhsType, typename DstType>
224
    EIGEN_DEVICE_FUNC
224
    EIGEN_DEVICE_FUNC
225
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
225
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
226
    #endif
226
    #endif
227
227
228
  protected:
228
  protected:
229
    
230
    static void check_template_parameters()
231
    {
232
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
233
    }
229
234
230
    /** \internal
235
    /** \internal
231
      * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U.
236
      * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U.
232
      * The strict upper part is used during the decomposition, the strict lower
237
      * The strict upper part is used during the decomposition, the strict lower
233
      * part correspond to the coefficients of L (its diagonal is equal to 1 and
238
      * part correspond to the coefficients of L (its diagonal is equal to 1 and
234
      * is not stored), and the diagonal entries correspond to D.
239
      * is not stored), and the diagonal entries correspond to D.
235
      */
240
      */
236
    MatrixType m_matrix;
241
    MatrixType m_matrix;
Lines 419-434 template<typename MatrixType> struct LDL Link Here
419
424
420
} // end namespace internal
425
} // end namespace internal
421
426
422
/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix
427
/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix
423
  */
428
  */
424
template<typename MatrixType, int _UpLo>
429
template<typename MatrixType, int _UpLo>
425
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
430
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
426
{
431
{
432
  check_template_parameters();
433
  
427
  eigen_assert(a.rows()==a.cols());
434
  eigen_assert(a.rows()==a.cols());
428
  const Index size = a.rows();
435
  const Index size = a.rows();
429
436
430
  m_matrix = a;
437
  m_matrix = a;
431
438
432
  m_transpositions.resize(size);
439
  m_transpositions.resize(size);
433
  m_isInitialized = false;
440
  m_isInitialized = false;
434
  m_temporary.resize(size);
441
  m_temporary.resize(size);
(-)a/Eigen/src/Cholesky/LLT.h (+8 lines)
Lines 165-180 template<typename _MatrixType, int _UpLo Link Here
165
    
165
    
166
    #ifndef EIGEN_PARSED_BY_DOXYGEN
166
    #ifndef EIGEN_PARSED_BY_DOXYGEN
167
    template<typename RhsType, typename DstType>
167
    template<typename RhsType, typename DstType>
168
    EIGEN_DEVICE_FUNC
168
    EIGEN_DEVICE_FUNC
169
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
169
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
170
    #endif
170
    #endif
171
171
172
  protected:
172
  protected:
173
    
174
    static void check_template_parameters()
175
    {
176
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
177
    }
178
    
173
    /** \internal
179
    /** \internal
174
      * Used to compute and store L
180
      * Used to compute and store L
175
      * The strict upper part is not used and even not initialized.
181
      * The strict upper part is not used and even not initialized.
176
      */
182
      */
177
    MatrixType m_matrix;
183
    MatrixType m_matrix;
178
    bool m_isInitialized;
184
    bool m_isInitialized;
179
    ComputationInfo m_info;
185
    ComputationInfo m_info;
180
};
186
};
Lines 372-387 template<typename MatrixType> struct LLT Link Here
372
  * \returns a reference to *this
378
  * \returns a reference to *this
373
  *
379
  *
374
  * Example: \include TutorialLinAlgComputeTwice.cpp
380
  * Example: \include TutorialLinAlgComputeTwice.cpp
375
  * Output: \verbinclude TutorialLinAlgComputeTwice.out
381
  * Output: \verbinclude TutorialLinAlgComputeTwice.out
376
  */
382
  */
377
template<typename MatrixType, int _UpLo>
383
template<typename MatrixType, int _UpLo>
378
LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
384
LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
379
{
385
{
386
  check_template_parameters();
387
  
380
  eigen_assert(a.rows()==a.cols());
388
  eigen_assert(a.rows()==a.cols());
381
  const Index size = a.rows();
389
  const Index size = a.rows();
382
  m_matrix.resize(size, size);
390
  m_matrix.resize(size, size);
383
  m_matrix = a;
391
  m_matrix = a;
384
392
385
  m_isInitialized = true;
393
  m_isInitialized = true;
386
  bool ok = Traits::inplace_decomposition(m_matrix);
394
  bool ok = Traits::inplace_decomposition(m_matrix);
387
  m_info = ok ? Success : NumericalIssue;
395
  m_info = ok ? Success : NumericalIssue;
(-)a/Eigen/src/Eigenvalues/ComplexEigenSolver.h (+8 lines)
Lines 229-244 template<typename _MatrixType> class Com Link Here
229
229
230
    /** \brief Returns the maximum number of iterations. */
230
    /** \brief Returns the maximum number of iterations. */
231
    Index getMaxIterations()
231
    Index getMaxIterations()
232
    {
232
    {
233
      return m_schur.getMaxIterations();
233
      return m_schur.getMaxIterations();
234
    }
234
    }
235
235
236
  protected:
236
  protected:
237
    
238
    static void check_template_parameters()
239
    {
240
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
241
    }
242
    
237
    EigenvectorType m_eivec;
243
    EigenvectorType m_eivec;
238
    EigenvalueType m_eivalues;
244
    EigenvalueType m_eivalues;
239
    ComplexSchur<MatrixType> m_schur;
245
    ComplexSchur<MatrixType> m_schur;
240
    bool m_isInitialized;
246
    bool m_isInitialized;
241
    bool m_eigenvectorsOk;
247
    bool m_eigenvectorsOk;
242
    EigenvectorType m_matX;
248
    EigenvectorType m_matX;
243
249
244
  private:
250
  private:
Lines 246-261 template<typename _MatrixType> class Com Link Here
246
    void sortEigenvalues(bool computeEigenvectors);
252
    void sortEigenvalues(bool computeEigenvectors);
247
};
253
};
248
254
249
255
250
template<typename MatrixType>
256
template<typename MatrixType>
251
ComplexEigenSolver<MatrixType>& 
257
ComplexEigenSolver<MatrixType>& 
252
ComplexEigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
258
ComplexEigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
253
{
259
{
260
  check_template_parameters();
261
  
254
  // this code is inspired from Jampack
262
  // this code is inspired from Jampack
255
  eigen_assert(matrix.cols() == matrix.rows());
263
  eigen_assert(matrix.cols() == matrix.rows());
256
264
257
  // Do a complex Schur decomposition, A = U T U^*
265
  // Do a complex Schur decomposition, A = U T U^*
258
  // The eigenvalues are on the diagonal of T.
266
  // The eigenvalues are on the diagonal of T.
259
  m_schur.compute(matrix, computeEigenvectors);
267
  m_schur.compute(matrix, computeEigenvectors);
260
268
261
  if(m_schur.info() == Success)
269
  if(m_schur.info() == Success)
(-)a/Eigen/src/Eigenvalues/EigenSolver.h (+9 lines)
Lines 294-309 template<typename _MatrixType> class Eig Link Here
294
    {
294
    {
295
      return m_realSchur.getMaxIterations();
295
      return m_realSchur.getMaxIterations();
296
    }
296
    }
297
297
298
  private:
298
  private:
299
    void doComputeEigenvectors();
299
    void doComputeEigenvectors();
300
300
301
  protected:
301
  protected:
302
    
303
    static void check_template_parameters()
304
    {
305
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
306
      EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL);
307
    }
308
    
302
    MatrixType m_eivec;
309
    MatrixType m_eivec;
303
    EigenvalueType m_eivalues;
310
    EigenvalueType m_eivalues;
304
    bool m_isInitialized;
311
    bool m_isInitialized;
305
    bool m_eigenvectorsOk;
312
    bool m_eigenvectorsOk;
306
    ComputationInfo m_info;
313
    ComputationInfo m_info;
307
    RealSchur<MatrixType> m_realSchur;
314
    RealSchur<MatrixType> m_realSchur;
308
    MatrixType m_matT;
315
    MatrixType m_matT;
309
316
Lines 361-376 typename EigenSolver<MatrixType>::Eigenv Link Here
361
  }
368
  }
362
  return matV;
369
  return matV;
363
}
370
}
364
371
365
template<typename MatrixType>
372
template<typename MatrixType>
366
EigenSolver<MatrixType>& 
373
EigenSolver<MatrixType>& 
367
EigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
374
EigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
368
{
375
{
376
  check_template_parameters();
377
  
369
  using std::sqrt;
378
  using std::sqrt;
370
  using std::abs;
379
  using std::abs;
371
  using numext::isfinite;
380
  using numext::isfinite;
372
  eigen_assert(matrix.cols() == matrix.rows());
381
  eigen_assert(matrix.cols() == matrix.rows());
373
382
374
  // Reduce to real Schur form.
383
  // Reduce to real Schur form.
375
  m_realSchur.compute(matrix, computeEigenvectors);
384
  m_realSchur.compute(matrix, computeEigenvectors);
376
  
385
  
(-)a/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h (+9 lines)
Lines 258-273 template<typename _MatrixType> class Gen Link Here
258
    */
258
    */
259
    GeneralizedEigenSolver& setMaxIterations(Index maxIters)
259
    GeneralizedEigenSolver& setMaxIterations(Index maxIters)
260
    {
260
    {
261
      m_realQZ.setMaxIterations(maxIters);
261
      m_realQZ.setMaxIterations(maxIters);
262
      return *this;
262
      return *this;
263
    }
263
    }
264
264
265
  protected:
265
  protected:
266
    
267
    static void check_template_parameters()
268
    {
269
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
270
      EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL);
271
    }
272
    
266
    MatrixType m_eivec;
273
    MatrixType m_eivec;
267
    ComplexVectorType m_alphas;
274
    ComplexVectorType m_alphas;
268
    VectorType m_betas;
275
    VectorType m_betas;
269
    bool m_isInitialized;
276
    bool m_isInitialized;
270
    bool m_eigenvectorsOk;
277
    bool m_eigenvectorsOk;
271
    RealQZ<MatrixType> m_realQZ;
278
    RealQZ<MatrixType> m_realQZ;
272
    MatrixType m_matS;
279
    MatrixType m_matS;
273
280
Lines 285-300 template<typename _MatrixType> class Gen Link Here
285
//  // TODO
292
//  // TODO
286
//  return matV;
293
//  return matV;
287
//}
294
//}
288
295
289
template<typename MatrixType>
296
template<typename MatrixType>
290
GeneralizedEigenSolver<MatrixType>&
297
GeneralizedEigenSolver<MatrixType>&
291
GeneralizedEigenSolver<MatrixType>::compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors)
298
GeneralizedEigenSolver<MatrixType>::compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors)
292
{
299
{
300
  check_template_parameters();
301
  
293
  using std::sqrt;
302
  using std::sqrt;
294
  using std::abs;
303
  using std::abs;
295
  eigen_assert(A.cols() == A.rows() && B.cols() == A.rows() && B.cols() == B.rows());
304
  eigen_assert(A.cols() == A.rows() && B.cols() == A.rows() && B.cols() == B.rows());
296
305
297
  // Reduce to generalized real Schur form:
306
  // Reduce to generalized real Schur form:
298
  // A = Q S Z and B = Q T Z
307
  // A = Q S Z and B = Q T Z
299
  m_realQZ.compute(A, B, computeEigenvectors);
308
  m_realQZ.compute(A, B, computeEigenvectors);
300
309
(-)a/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h (+7 lines)
Lines 342-357 template<typename _MatrixType> class Sel Link Here
342
    /** \brief Maximum number of iterations.
342
    /** \brief Maximum number of iterations.
343
      *
343
      *
344
      * The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n
344
      * The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n
345
      * denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK).
345
      * denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK).
346
      */
346
      */
347
    static const int m_maxIterations = 30;
347
    static const int m_maxIterations = 30;
348
348
349
  protected:
349
  protected:
350
    static void check_template_parameters()
351
    {
352
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
353
    }
354
    
350
    MatrixType m_eivec;
355
    MatrixType m_eivec;
351
    RealVectorType m_eivalues;
356
    RealVectorType m_eivalues;
352
    typename TridiagonalizationType::SubDiagonalType m_subdiag;
357
    typename TridiagonalizationType::SubDiagonalType m_subdiag;
353
    ComputationInfo m_info;
358
    ComputationInfo m_info;
354
    bool m_isInitialized;
359
    bool m_isInitialized;
355
    bool m_eigenvectorsOk;
360
    bool m_eigenvectorsOk;
356
};
361
};
357
362
Lines 377-392 EIGEN_DEVICE_FUNC Link Here
377
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
382
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
378
}
383
}
379
384
380
template<typename MatrixType>
385
template<typename MatrixType>
381
EIGEN_DEVICE_FUNC
386
EIGEN_DEVICE_FUNC
382
SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
387
SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
383
::compute(const MatrixType& matrix, int options)
388
::compute(const MatrixType& matrix, int options)
384
{
389
{
390
  check_template_parameters();
391
  
385
  using std::abs;
392
  using std::abs;
386
  eigen_assert(matrix.cols() == matrix.rows());
393
  eigen_assert(matrix.cols() == matrix.rows());
387
  eigen_assert((options&~(EigVecMask|GenEigMask))==0
394
  eigen_assert((options&~(EigVecMask|GenEigMask))==0
388
          && (options&EigVecMask)!=EigVecMask
395
          && (options&EigVecMask)!=EigVecMask
389
          && "invalid option parameter");
396
          && "invalid option parameter");
390
  bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
397
  bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
391
  Index n = matrix.cols();
398
  Index n = matrix.cols();
392
  m_eivalues.resize(n,1);
399
  m_eivalues.resize(n,1);
(-)a/Eigen/src/LU/FullPivLU.h (+8 lines)
Lines 385-400 template<typename _MatrixType> class Ful Link Here
385
    
385
    
386
    #ifndef EIGEN_PARSED_BY_DOXYGEN
386
    #ifndef EIGEN_PARSED_BY_DOXYGEN
387
    template<typename RhsType, typename DstType>
387
    template<typename RhsType, typename DstType>
388
    EIGEN_DEVICE_FUNC
388
    EIGEN_DEVICE_FUNC
389
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
389
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
390
    #endif
390
    #endif
391
391
392
  protected:
392
  protected:
393
    
394
    static void check_template_parameters()
395
    {
396
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
397
    }
398
    
393
    MatrixType m_lu;
399
    MatrixType m_lu;
394
    PermutationPType m_p;
400
    PermutationPType m_p;
395
    PermutationQType m_q;
401
    PermutationQType m_q;
396
    IntColVectorType m_rowsTranspositions;
402
    IntColVectorType m_rowsTranspositions;
397
    IntRowVectorType m_colsTranspositions;
403
    IntRowVectorType m_colsTranspositions;
398
    Index m_det_pq, m_nonzero_pivots;
404
    Index m_det_pq, m_nonzero_pivots;
399
    RealScalar m_maxpivot, m_prescribedThreshold;
405
    RealScalar m_maxpivot, m_prescribedThreshold;
400
    bool m_isInitialized, m_usePrescribedThreshold;
406
    bool m_isInitialized, m_usePrescribedThreshold;
Lines 429-444 FullPivLU<MatrixType>::FullPivLU(const M Link Here
429
    m_usePrescribedThreshold(false)
435
    m_usePrescribedThreshold(false)
430
{
436
{
431
  compute(matrix);
437
  compute(matrix);
432
}
438
}
433
439
434
template<typename MatrixType>
440
template<typename MatrixType>
435
FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix)
441
FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix)
436
{
442
{
443
  check_template_parameters();
444
  
437
  // the permutations are stored as int indices, so just to be sure:
445
  // the permutations are stored as int indices, so just to be sure:
438
  eigen_assert(matrix.rows()<=NumTraits<int>::highest() && matrix.cols()<=NumTraits<int>::highest());
446
  eigen_assert(matrix.rows()<=NumTraits<int>::highest() && matrix.cols()<=NumTraits<int>::highest());
439
  
447
  
440
  m_isInitialized = true;
448
  m_isInitialized = true;
441
  m_lu = matrix;
449
  m_lu = matrix;
442
450
443
  const Index size = matrix.diagonalSize();
451
  const Index size = matrix.diagonalSize();
444
  const Index rows = matrix.rows();
452
  const Index rows = matrix.rows();
(-)a/Eigen/src/LU/PartialPivLU.h (+8 lines)
Lines 204-219 template<typename _MatrixType> class Par Link Here
204
      m_lu.template triangularView<UnitLower>().solveInPlace(dst);
204
      m_lu.template triangularView<UnitLower>().solveInPlace(dst);
205
205
206
      // Step 3
206
      // Step 3
207
      m_lu.template triangularView<Upper>().solveInPlace(dst); 
207
      m_lu.template triangularView<Upper>().solveInPlace(dst); 
208
    }
208
    }
209
    #endif
209
    #endif
210
210
211
  protected:
211
  protected:
212
    
213
    static void check_template_parameters()
214
    {
215
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
216
    }
217
    
212
    MatrixType m_lu;
218
    MatrixType m_lu;
213
    PermutationType m_p;
219
    PermutationType m_p;
214
    TranspositionType m_rowsTranspositions;
220
    TranspositionType m_rowsTranspositions;
215
    Index m_det_p;
221
    Index m_det_p;
216
    bool m_isInitialized;
222
    bool m_isInitialized;
217
};
223
};
218
224
219
template<typename MatrixType>
225
template<typename MatrixType>
Lines 420-435 void partial_lu_inplace(MatrixType& lu, Link Here
420
    ::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions);
426
    ::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions);
421
}
427
}
422
428
423
} // end namespace internal
429
} // end namespace internal
424
430
425
template<typename MatrixType>
431
template<typename MatrixType>
426
PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix)
432
PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix)
427
{
433
{
434
  check_template_parameters();
435
  
428
  // the row permutation is stored as int indices, so just to be sure:
436
  // the row permutation is stored as int indices, so just to be sure:
429
  eigen_assert(matrix.rows()<NumTraits<int>::highest());
437
  eigen_assert(matrix.rows()<NumTraits<int>::highest());
430
  
438
  
431
  m_lu = matrix;
439
  m_lu = matrix;
432
440
433
  eigen_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
441
  eigen_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
434
  const Index size = matrix.rows();
442
  const Index size = matrix.rows();
435
443
(-)a/Eigen/src/QR/ColPivHouseholderQR.h (+8 lines)
Lines 393-408 template<typename _MatrixType> class Col Link Here
393
    
393
    
394
    #ifndef EIGEN_PARSED_BY_DOXYGEN
394
    #ifndef EIGEN_PARSED_BY_DOXYGEN
395
    template<typename RhsType, typename DstType>
395
    template<typename RhsType, typename DstType>
396
    EIGEN_DEVICE_FUNC
396
    EIGEN_DEVICE_FUNC
397
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
397
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
398
    #endif
398
    #endif
399
399
400
  protected:
400
  protected:
401
    
402
    static void check_template_parameters()
403
    {
404
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
405
    }
406
    
401
    MatrixType m_qr;
407
    MatrixType m_qr;
402
    HCoeffsType m_hCoeffs;
408
    HCoeffsType m_hCoeffs;
403
    PermutationType m_colsPermutation;
409
    PermutationType m_colsPermutation;
404
    IntRowVectorType m_colsTranspositions;
410
    IntRowVectorType m_colsTranspositions;
405
    RowVectorType m_temp;
411
    RowVectorType m_temp;
406
    RealRowVectorType m_colSqNorms;
412
    RealRowVectorType m_colSqNorms;
407
    bool m_isInitialized, m_usePrescribedThreshold;
413
    bool m_isInitialized, m_usePrescribedThreshold;
408
    RealScalar m_prescribedThreshold, m_maxpivot;
414
    RealScalar m_prescribedThreshold, m_maxpivot;
Lines 431-446 typename MatrixType::RealScalar ColPivHo Link Here
431
  * the factorization is stored into \c *this, and a reference to \c *this
437
  * the factorization is stored into \c *this, and a reference to \c *this
432
  * is returned.
438
  * is returned.
433
  *
439
  *
434
  * \sa class ColPivHouseholderQR, ColPivHouseholderQR(const MatrixType&)
440
  * \sa class ColPivHouseholderQR, ColPivHouseholderQR(const MatrixType&)
435
  */
441
  */
436
template<typename MatrixType>
442
template<typename MatrixType>
437
ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
443
ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
438
{
444
{
445
  check_template_parameters();
446
  
439
  using std::abs;
447
  using std::abs;
440
  Index rows = matrix.rows();
448
  Index rows = matrix.rows();
441
  Index cols = matrix.cols();
449
  Index cols = matrix.cols();
442
  Index size = matrix.diagonalSize();
450
  Index size = matrix.diagonalSize();
443
  
451
  
444
  // the column permutation is stored as int indices, so just to be sure:
452
  // the column permutation is stored as int indices, so just to be sure:
445
  eigen_assert(cols<=NumTraits<int>::highest());
453
  eigen_assert(cols<=NumTraits<int>::highest());
446
454
(-)a/Eigen/src/QR/FullPivHouseholderQR.h (+8 lines)
Lines 375-390 template<typename _MatrixType> class Ful Link Here
375
    
375
    
376
    #ifndef EIGEN_PARSED_BY_DOXYGEN
376
    #ifndef EIGEN_PARSED_BY_DOXYGEN
377
    template<typename RhsType, typename DstType>
377
    template<typename RhsType, typename DstType>
378
    EIGEN_DEVICE_FUNC
378
    EIGEN_DEVICE_FUNC
379
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
379
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
380
    #endif
380
    #endif
381
381
382
  protected:
382
  protected:
383
    
384
    static void check_template_parameters()
385
    {
386
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
387
    }
388
    
383
    MatrixType m_qr;
389
    MatrixType m_qr;
384
    HCoeffsType m_hCoeffs;
390
    HCoeffsType m_hCoeffs;
385
    IntDiagSizeVectorType m_rows_transpositions;
391
    IntDiagSizeVectorType m_rows_transpositions;
386
    IntDiagSizeVectorType m_cols_transpositions;
392
    IntDiagSizeVectorType m_cols_transpositions;
387
    PermutationType m_cols_permutation;
393
    PermutationType m_cols_permutation;
388
    RowVectorType m_temp;
394
    RowVectorType m_temp;
389
    bool m_isInitialized, m_usePrescribedThreshold;
395
    bool m_isInitialized, m_usePrescribedThreshold;
390
    RealScalar m_prescribedThreshold, m_maxpivot;
396
    RealScalar m_prescribedThreshold, m_maxpivot;
Lines 414-429 typename MatrixType::RealScalar FullPivH Link Here
414
  * the factorization is stored into \c *this, and a reference to \c *this
420
  * the factorization is stored into \c *this, and a reference to \c *this
415
  * is returned.
421
  * is returned.
416
  *
422
  *
417
  * \sa class FullPivHouseholderQR, FullPivHouseholderQR(const MatrixType&)
423
  * \sa class FullPivHouseholderQR, FullPivHouseholderQR(const MatrixType&)
418
  */
424
  */
419
template<typename MatrixType>
425
template<typename MatrixType>
420
FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
426
FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
421
{
427
{
428
  check_template_parameters();
429
  
422
  using std::abs;
430
  using std::abs;
423
  Index rows = matrix.rows();
431
  Index rows = matrix.rows();
424
  Index cols = matrix.cols();
432
  Index cols = matrix.cols();
425
  Index size = (std::min)(rows,cols);
433
  Index size = (std::min)(rows,cols);
426
434
427
  m_qr = matrix;
435
  m_qr = matrix;
428
  m_hCoeffs.resize(size);
436
  m_hCoeffs.resize(size);
429
437
(-)a/Eigen/src/QR/HouseholderQR.h (+8 lines)
Lines 191-206 template<typename _MatrixType> class Hou Link Here
191
    
191
    
192
    #ifndef EIGEN_PARSED_BY_DOXYGEN
192
    #ifndef EIGEN_PARSED_BY_DOXYGEN
193
    template<typename RhsType, typename DstType>
193
    template<typename RhsType, typename DstType>
194
    EIGEN_DEVICE_FUNC
194
    EIGEN_DEVICE_FUNC
195
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
195
    void _solve_impl(const RhsType &rhs, DstType &dst) const;
196
    #endif
196
    #endif
197
197
198
  protected:
198
  protected:
199
    
200
    static void check_template_parameters()
201
    {
202
      EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
203
    }
204
    
199
    MatrixType m_qr;
205
    MatrixType m_qr;
200
    HCoeffsType m_hCoeffs;
206
    HCoeffsType m_hCoeffs;
201
    RowVectorType m_temp;
207
    RowVectorType m_temp;
202
    bool m_isInitialized;
208
    bool m_isInitialized;
203
};
209
};
204
210
205
template<typename MatrixType>
211
template<typename MatrixType>
206
typename MatrixType::RealScalar HouseholderQR<MatrixType>::absDeterminant() const
212
typename MatrixType::RealScalar HouseholderQR<MatrixType>::absDeterminant() const
Lines 343-358 void HouseholderQR<_MatrixType>::_solve_ Link Here
343
  * the factorization is stored into \c *this, and a reference to \c *this
349
  * the factorization is stored into \c *this, and a reference to \c *this
344
  * is returned.
350
  * is returned.
345
  *
351
  *
346
  * \sa class HouseholderQR, HouseholderQR(const MatrixType&)
352
  * \sa class HouseholderQR, HouseholderQR(const MatrixType&)
347
  */
353
  */
348
template<typename MatrixType>
354
template<typename MatrixType>
349
HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
355
HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
350
{
356
{
357
  check_template_parameters();
358
  
351
  Index rows = matrix.rows();
359
  Index rows = matrix.rows();
352
  Index cols = matrix.cols();
360
  Index cols = matrix.cols();
353
  Index size = (std::min)(rows,cols);
361
  Index size = (std::min)(rows,cols);
354
362
355
  m_qr = matrix;
363
  m_qr = matrix;
356
  m_hCoeffs.resize(size);
364
  m_hCoeffs.resize(size);
357
365
358
  m_temp.resize(cols);
366
  m_temp.resize(cols);
(-)a/Eigen/src/SVD/SVDBase.h (-1 / +9 lines)
Lines 212-227 public: Link Here
212
  
212
  
213
  #ifndef EIGEN_PARSED_BY_DOXYGEN
213
  #ifndef EIGEN_PARSED_BY_DOXYGEN
214
  template<typename RhsType, typename DstType>
214
  template<typename RhsType, typename DstType>
215
  EIGEN_DEVICE_FUNC
215
  EIGEN_DEVICE_FUNC
216
  void _solve_impl(const RhsType &rhs, DstType &dst) const;
216
  void _solve_impl(const RhsType &rhs, DstType &dst) const;
217
  #endif
217
  #endif
218
218
219
protected:
219
protected:
220
  
221
  static void check_template_parameters()
222
  {
223
    EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
224
  }
225
  
220
  // return true if already allocated
226
  // return true if already allocated
221
  bool allocate(Index rows, Index cols, unsigned int computationOptions) ;
227
  bool allocate(Index rows, Index cols, unsigned int computationOptions) ;
222
228
223
  MatrixUType m_matrixU;
229
  MatrixUType m_matrixU;
224
  MatrixVType m_matrixV;
230
  MatrixVType m_matrixV;
225
  SingularValuesType m_singularValues;
231
  SingularValuesType m_singularValues;
226
  bool m_isInitialized, m_isAllocated, m_usePrescribedThreshold;
232
  bool m_isInitialized, m_isAllocated, m_usePrescribedThreshold;
227
  bool m_computeFullU, m_computeThinU;
233
  bool m_computeFullU, m_computeThinU;
Lines 235-251 protected: Link Here
235
   * Default constructor of SVDBase
241
   * Default constructor of SVDBase
236
   */
242
   */
237
  SVDBase()
243
  SVDBase()
238
    : m_isInitialized(false),
244
    : m_isInitialized(false),
239
      m_isAllocated(false),
245
      m_isAllocated(false),
240
      m_usePrescribedThreshold(false),
246
      m_usePrescribedThreshold(false),
241
      m_computationOptions(0),
247
      m_computationOptions(0),
242
      m_rows(-1), m_cols(-1), m_diagSize(0)
248
      m_rows(-1), m_cols(-1), m_diagSize(0)
243
  {}
249
  {
250
    check_template_parameters();
251
  }
244
252
245
253
246
};
254
};
247
255
248
#ifndef EIGEN_PARSED_BY_DOXYGEN
256
#ifndef EIGEN_PARSED_BY_DOXYGEN
249
template<typename Derived>
257
template<typename Derived>
250
template<typename RhsType, typename DstType>
258
template<typename RhsType, typename DstType>
251
void SVDBase<Derived>::_solve_impl(const RhsType &rhs, DstType &dst) const
259
void SVDBase<Derived>::_solve_impl(const RhsType &rhs, DstType &dst) const
(-)a/failtest/CMakeLists.txt (+12 lines)
Lines 42-57 ei_add_failtest("swap_1") Link Here
42
ei_add_failtest("swap_2")
42
ei_add_failtest("swap_2")
43
43
44
ei_add_failtest("sparse_ref_1")
44
ei_add_failtest("sparse_ref_1")
45
ei_add_failtest("sparse_ref_2")
45
ei_add_failtest("sparse_ref_2")
46
ei_add_failtest("sparse_ref_3")
46
ei_add_failtest("sparse_ref_3")
47
ei_add_failtest("sparse_ref_4")
47
ei_add_failtest("sparse_ref_4")
48
ei_add_failtest("sparse_ref_5")
48
ei_add_failtest("sparse_ref_5")
49
49
50
ei_add_failtest("partialpivlu_int")
51
ei_add_failtest("fullpivlu_int")
52
ei_add_failtest("llt_int")
53
ei_add_failtest("ldlt_int")
54
ei_add_failtest("qr_int")
55
ei_add_failtest("colpivqr_int")
56
ei_add_failtest("fullpivqr_int")
57
ei_add_failtest("jacobisvd_int")
58
ei_add_failtest("bdcsvd_int")
59
ei_add_failtest("eigensolver_int")
60
ei_add_failtest("eigensolver_cplx")
61
50
if (EIGEN_FAILTEST_FAILURE_COUNT)
62
if (EIGEN_FAILTEST_FAILURE_COUNT)
51
  message(FATAL_ERROR
63
  message(FATAL_ERROR
52
          "${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "
64
          "${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "
53
          "To debug these failures, manually compile these programs in ${CMAKE_CURRENT_SOURCE_DIR}, "
65
          "To debug these failures, manually compile these programs in ${CMAKE_CURRENT_SOURCE_DIR}, "
54
          "with and without #define EIGEN_SHOULD_FAIL_TO_BUILD.")
66
          "with and without #define EIGEN_SHOULD_FAIL_TO_BUILD.")
55
else()
67
else()
56
  message(STATUS "Failtest SUCCESS: all ${EIGEN_FAILTEST_COUNT} failtests passed.")
68
  message(STATUS "Failtest SUCCESS: all ${EIGEN_FAILTEST_COUNT} failtests passed.")
57
  message(STATUS "")
69
  message(STATUS "")
(-)a/failtest/bdcsvd_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/SVD"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  BDCSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/colpivqr_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/QR"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  ColPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/eigensolver_cplx.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/Eigenvalues"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR std::complex<double>
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  EigenSolver<Matrix<SCALAR,Dynamic,Dynamic> > eig(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/eigensolver_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/Eigenvalues"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  EigenSolver<Matrix<SCALAR,Dynamic,Dynamic> > eig(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/fullpivlu_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/LU"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  FullPivLU<Matrix<SCALAR,Dynamic,Dynamic> > lu(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/fullpivqr_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/QR"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  FullPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/jacobisvd_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/SVD"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/ldlt_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/Cholesky"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  LDLT<Matrix<SCALAR,Dynamic,Dynamic> > ldlt(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/llt_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/Cholesky"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  LLT<Matrix<SCALAR,Dynamic,Dynamic> > llt(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/partialpivlu_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/LU"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  PartialPivLU<Matrix<SCALAR,Dynamic,Dynamic> > lu(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}
(-)a/failtest/qr_int.cpp (+14 lines)
Line 0 Link Here
1
#include "../Eigen/QR"
2
3
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
4
#define SCALAR int
5
#else
6
#define SCALAR float
7
#endif
8
9
using namespace Eigen;
10
11
int main()
12
{
13
  HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
14
}

Return to bug 949