Commit Graph

45 Commits

Author SHA1 Message Date
Gael Guennebaud
8496f86f84 Enable CompleteOrthogonalDecomposition::pseudoInverse with non-square fixed-size matrices. 2019-11-13 21:16:53 +01:00
Patrick Peltzer
15e53d5d93 PR 567: makes all dense solvers inherit SoverBase (LU,Cholesky,QR,SVD).
This changeset also includes:
 * add HouseholderSequence::conjugateIf
 * define int as the StorageIndex type for all dense solvers
 * dedicated unit tests, including assertion checking
 * _check_solve_assertion(): this method can be implemented in derived solver classes to implement custom checks
 * CompleteOrthogonalDecompositions: add applyZOnTheLeftInPlace, fix scalar type in applyZAdjointOnTheLeftInPlace(), add missing assertions
 * Cholesky: add missing assertions
 * FullPivHouseholderQR: Corrected Scalar type in _solve_impl()
 * BDCSVD: Unambiguous return type for ternary operator
 * SVDBase: Corrected Scalar type in _solve_impl()
2019-01-17 01:17:39 +01:00
Gael Guennebaud
82f0ce2726 Get rid of EIGEN_TEST_FUNC, unit tests must now be declared with EIGEN_DECLARE_TEST(mytest) { /* code */ }.
This provide several advantages:
- more flexibility in designing unit tests
- unit tests can be glued to speed up compilation
- unit tests are compiled with same predefined macros, which is a requirement for zapcc
2018-07-17 14:46:15 +02:00
Gael Guennebaud
12e1ebb68b Remove local Index typedef from unit-tests 2018-07-12 17:16:40 +02:00
Gael Guennebaud
80b5133789 Fix compilation of qr.inverse() for column and full pivoting variants. 2016-10-06 09:55:50 +02:00
Gael Guennebaud
5e4dda8a12 Enable custom scalar types in some unit tests. 2016-07-20 15:19:17 +02:00
Christoph Hertzberg
718521d5cf Silenced several double-promotion warnings 2016-05-22 18:17:04 +02:00
Christoph Hertzberg
dacb469bc9 Enable and fix -Wdouble-conversion warnings 2016-05-05 13:35:45 +02:00
Rasmus Munk Larsen
b6fdf7468c Rename inverse -> pseudoInverse. 2016-02-10 13:03:07 -08:00
Rasmus Munk Larsen
bb8811c655 Enable inverse() method for computing pseudo-inverse. 2016-02-09 20:35:20 -08:00
Rasmus Munk Larsen
414efa47d3 Add missing calls to tests of COD.
Fix a few mistakes in 3.2 -> 3.3 port.
2016-02-08 08:50:34 -08:00
Rasmus Munk Larsen
d904c8ac8f Implement complete orthogonal decomposition in Eigen. 2016-02-06 16:32:00 -08:00
Rasmus Munk Larsen
2e39cc40a4 Fix condition that made the unit test spam stdout with bogus error messages. 2016-02-04 12:56:14 -08:00
Rasmus Munk Larsen
5fb04ab2da Fix bad line break. Don't repeat Kahan matrix test since it is deterministic. 2016-02-03 10:12:10 -08:00
Rasmus Munk Larsen
acce4dd050 Change Eigen's ColPivHouseholderQR to use the numerically stable norm downdate formula from http://www.netlib.org/lapack/lawnspdf/lawn176.pdf, which has been used in LAPACK's xGEQPF and xGEQP3 since 2006. With the old formula, the code chooses the wrong pivots and fails to correctly determine rank on graded matrices.
This change also adds additional checks for non-increasing diagonal in R11 to existing unit tests, and adds a new unit test with the Kahan matrix, which consistently fails for the original code.

Benchmark timings on Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz. Code compiled with AVX & FMA. I just ran on square matrices of 3 difference sizes.

Benchmark               Time(ns)     CPU(ns) Iterations
-------------------------------------------------------
Before:
BM_EigencolPivQR/64        53677       53627      12890
BM_EigencolPivQR/512    15265408    15250784         46
BM_EigencolPivQR/4k  15403556228 15388788368          2

After (non-vectorized version):
Benchmark               Time(ns)     CPU(ns) Iterations  Degradation
--------------------------------------------------------------------
BM_EigencolPivQR/64        63736       63669      10844         18.5%
BM_EigencolPivQR/512    16052546    16037381         43          5.1%
BM_EigencolPivQR/4k  15149263620 15132025316          2         -2.0%

Performance-wise there seems to be a ~18.5% degradation for small (64x64) matrices, probably due to the cost of more O(min(m,n)^2) sqrt operations that are not needed for the unstable formula.
2016-01-28 15:07:26 -08:00
Gael Guennebaud
392a30db82 Use VERIFY_IS_EQUAL instead of VERIFY(a==b) to get more feedback in case of failure 2015-06-26 16:22:49 +02:00
Gael Guennebaud
899c0c2b6c Clean source code and unit tests with respect to -Wunused-local-typedefs 2013-04-10 22:27:35 +02:00
Gael Guennebaud
a76fbbf397 Fix bug #314:
- remove most of the metaprogramming kung fu in MathFunctions.h (only keep functions that differs from the std)
- remove the overloads for array expression that were in the std namespace
2012-11-06 15:25:50 +01:00
Benoit Jacob
69124cfca2 Automatic relicensing to MPL2 using Keirs script. Manual fixup follows. 2012-07-13 14:42:47 -04:00
Gael Guennebaud
42e2578ef9 the min/max macros to detect unprotected min/max were undefined by some std header,
so let's declare them after and do the respective fixes ;)
2011-08-19 14:18:05 +02:00
Gael Guennebaud
a8f66fec65 add the possibility to configure the maximal matrix size in the unit tests 2011-07-12 14:41:00 +02:00
Hauke Heibel
7bc8e3ac09 Initial fixes for bug #85.
Renamed meta_{true|false} to {true|false}_type, meta_if to conditional, is_same_type to is_same, un{ref|pointer|const} to remove_{reference|pointer|const} and makeconst to add_const.
Changed boolean type 'ret' member to 'value'.
Changed 'ret' members refering to types to 'type'.
Adapted all code occurences.
2010-10-25 22:13:49 +02:00
Benoit Jacob
4716040703 bug #86 : use internal:: namespace instead of ei_ prefix 2010-10-25 10:15:22 -04:00
Gael Guennebaud
28e64b0da3 email change 2010-06-24 23:21:58 +02:00
Hauke Heibel
f1679c7185 Utilize Index in all unit tests. 2010-06-20 17:37:56 +02:00
Benoit Jacob
aaaade4b3d the Index types change.
As discussed on the list (too long to explain here).
2010-05-30 16:00:58 -04:00
Adolfo Rodriguez Tsouroukdissian
28dde19e40 - Added problem size constructor to decompositions that did not have one. It preallocates member data structures.
- Updated unit tests to check above constructor.
- In the compute() method of decompositions: Made temporary matrices/vectors class members to avoid heap allocations during compute() (when dynamic matrices are used, of course).

These  changes can speed up decomposition computation time when a solver instance is used to solve multiple same-sized problems. An added benefit is that the compute() method can now be invoked in contexts were heap allocations are forbidden, such as in real-time control loops.

CAVEAT: Not all of the decompositions in the Eigenvalues module have a heap-allocation-free compute() method. A future patch may address this issue, but some required API changes need to be incorporated first.
2010-04-21 17:15:57 +02:00
Benoit Jacob
04c663840b * add some 1x1 tests
* temporarily disable tests that strangely fail, with a big FIXME
2010-04-16 12:32:33 -04:00
Benoit Jacob
d92df336ad Further LU test improvements. I'm not aware of any test failures anymore, not even with huge numbers of repetitions.
Finally the createRandomMatrixOfRank() function is renamed to createRandomPIMatrixOfRank, where PI stands for 'partial isometry', that is, a matrix whose singular values are 0 or 1.
2010-02-23 15:40:24 -05:00
Benoit Jacob
7dc75380c1 * FullPivLU: replace "remaining==0" termination condition (from Golub) by a fuzzy compare
(fixes lu test failures when testing solve())
* LU test: set appropriate threshold and limit the number of times that a specially tricky test
  is run. (fixes lu test failures when testing rank()).
* Tests: rename createRandomMatrixOfRank to createRandomProjectionOfRank
2010-02-23 09:04:59 -05:00
Gael Guennebaud
c5d7c9f0de remove the Triangular suffix to Upper, Lower, UnitLower, etc,
and remove the respective bit flags
2010-01-07 21:15:32 +01:00
Benoit Jacob
3e73f6036c * HouseholderSequence:
* be aware of number of actual householder vectors
    (optimization in non-full-rank case, no behavior change)
  * fix applyThisOnTheRight, it was using k instead of actual_k
* QR: rename matrixQ() to householderQ() where applicable
2009-12-02 11:11:09 -05:00
Benoit Jacob
95d88e1327 Big reworking of ColPivQR and its unit test, which now passes even with thousands of repetitions and correctly tests matrices of all sizes. Several surprises along the way: for example, a major cause of trouble was the optimized "table of column squared norms" where the accumulation of imprecision was a serious issue; another surprise is that tests like "x!=0" before dividing by x really benefit from being replaced by fuzzy tests, as i hit real cases where i got wrong results in 1/epsilon. 2009-12-01 13:26:29 -05:00
Benoit Jacob
126a8e6a69 fix remaining bug in ColPivHouseholderQR, so now all tests pass again 2009-11-18 17:40:45 -05:00
Benoit Jacob
8860203e6a fix stuff after the PermutationMatrix changes.
I still have JacobiSVD errors when cols>rows
2009-11-18 12:41:24 -05:00
Benoit Jacob
ba7bfe110c port the qr module to ei_solve_xxx. 2009-11-08 10:21:26 -05:00
Benoit Jacob
2840ac7e94 big huge changes, so i dont remember everything.
* renaming, e.g. LU ---> FullPivLU
* split tests framework: more robust, e.g. dont generate empty tests if a number is skipped
* make all remaining tests use that splitting, as needed.
* Fix 4x4 inversion (see stable branch)
* Transform::inverse() and geo_transform test : adapt to new inverse() API, it was also trying to instantiate inverse() for 3x4 matrices.
* CMakeLists: more robust regexp to parse the version number
* misc fixes in unit tests
2009-10-28 18:19:29 -04:00
Benoit Jacob
c4ab6a2032 also test that the matrix Q is unitary 2009-10-12 22:33:51 -04:00
Benoit Jacob
eeabd18afc Fix compilation of HouseholderQR and ColPivotingHouseholderQR for non-square fixed-size matrices.
For Colpiv that was just changing MatrixQType to MatrixType in the instantiation of HouseholderSequence.
For HouseholderQR I also re-ported the solve method from Colpiv as there were multiple issues.
2009-09-28 10:49:55 -04:00
Benoit Jacob
67bf7c90c5 * update test to expose bug #57
* update createRandomMatrixOfRank to support fixed size
2009-09-28 09:40:18 -04:00
Gael Guennebaud
24950bdfcb make ColPivotingQR use HouseholderSequence 2009-09-16 15:56:20 +02:00
Benoit Jacob
a4fd0aa25b * fix bug in col-pivoting qr, forgot to swap the colNorms when swapping cols
* add Gael a copyright line
2009-09-16 14:19:59 -04:00
Benoit Jacob
191d5275a7 modernize HouseholderQR too, uniformize all that stuff, update tests 2009-08-24 13:46:14 -04:00
Benoit Jacob
0eb142f559 bring the modern comfort also to ColPivotingHouseholderQR
+ some fixes in FullPivotingHouseholderQR
2009-08-24 11:11:41 -04:00
Benoit Jacob
97bc1af1f1 add ColPivotingHouseholderQR
rename RRQR to fullPivotingHouseholderQR
2009-08-23 18:04:33 -04:00