Commit Graph

1093 Commits

Author SHA1 Message Date
Benoit Jacob
7d18c30641 finally the first version was the good one... 2009-09-03 01:25:40 -04:00
Gael Guennebaud
7586f7f706 fix #51 (bad use of std::complex::real) 2009-09-02 15:18:11 +02:00
Gael Guennebaud
b83654b5d0 * rename JacobiRotation => PlanarRotation
* move the makeJacobi and make_givens_* to PlanarRotation
* rename applyJacobi* => apply*
2009-09-02 15:04:10 +02:00
Gael Guennebaud
496ea63972 fix wrong assert 2009-09-02 14:08:33 +02:00
Gael Guennebaud
4a8258369a much simpler fix for Matrix::swap 2009-09-02 13:37:15 +02:00
Benoit Jacob
ec20d58317 * add serious unit test for swap
* fix my stupidity in Matrix::swap()
2009-09-02 16:56:48 -04:00
Benoit Jacob
cc375e2f79 merge 2009-09-02 06:37:41 -04:00
Benoit Jacob
e6b77bcc6b JacobiSVD: implement general R-SVD using full-pivoting QR, so we now support any rectangular matrix size by reducing to the smaller of the two dimensions (which is also an optimization) 2009-09-02 06:36:55 -04:00
Benoit Jacob
c16d65f015 fix compilation errors in swap (could not swap with anything else than the exact same Matrix type) 2009-09-02 06:35:01 -04:00
Hauke Heibel
05ddd32849 added missing JacobiRotation's ... 2009-09-01 23:12:40 +02:00
Gael Guennebaud
4d91229bdc [mq]: eigensolver 2009-09-01 16:20:56 +02:00
Gael Guennebaud
1e7a9ea70a fix issue #47: now m.noalias() = XXX properly resize m if needed 2009-09-01 13:35:44 +02:00
Gael Guennebaud
8392373d96 add a JacobiRotation class wrapping the cosine-sine pair with
some convenient features (transpose, adjoint, product)
2009-09-01 13:18:03 +02:00
Benoit Jacob
6e4e94ff32 * JacobiSVD:
- support complex numbers
 - big rewrite of the 2x2 kernel, much more robust
* Jacobi:
 - fix weirdness in initial design, e.g. applyJacobiOnTheRight actually did the inverse transformation
 - fully support complex numbers
 - fix logic to decide whether to vectorize
 - remove several clumsy methods

fix for complex numbers
2009-08-31 22:26:15 -04:00
Gael Guennebaud
a16599751f fix Matrix::stride for vectors, add a unit test for Block::stride
and make use of it where it was relevant
2009-08-31 17:39:56 +02:00
Hauke Heibel
ab6eb6a1a4 Adaptions from .lazy() towards .noalias().
Added missing casts.
2009-08-31 17:29:37 +02:00
Hauke Heibel
bc7aec0ef5 ifdef removed from MapBase and warning disabled 2009-08-31 17:24:38 +02:00
Gael Guennebaud
095809edda fix issue #45 and document the .data() and .stride() functions 2009-08-31 17:07:54 +02:00
Gael Guennebaud
27c9ecc50f fix copy/paste issue 2009-08-31 16:41:13 +02:00
Hauke Heibel
0a0a805569 Fixed a cast warning in scaleAndAddTo.
Fixed lazyness in umeyama.
Added a few missing casts.
2009-08-31 15:34:57 +02:00
Hauke Heibel
32a9aee286 Added MSVC guards to assignment operators. 2009-08-31 14:40:53 +02:00
Hauke Heibel
99bfab6dcf Removed redundant assignment operators. 2009-08-31 13:47:32 +02:00
Gael Guennebaud
9005eb0788 compilation fix in AmbiVector<int> 2009-08-31 09:32:46 +02:00
Gael Guennebaud
3705498721 add coeff(int,int), coeff(int) and value() functions to the inner product specialization 2009-08-26 00:24:22 +02:00
Thomas Capricelli
d0a5da95b1 fix installation for recently added files 2009-08-25 18:57:59 +02:00
Benoit Jacob
191d5275a7 modernize HouseholderQR too, uniformize all that stuff, update tests 2009-08-24 13:46:14 -04:00
Jitse Niesen
7e4bd70157 Fix comment which may cause latex to hang when generating docs 2009-08-24 18:01:18 +01:00
Gael Guennebaud
078a870a87 fix issue #43 2009-08-24 18:56:27 +02: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
3288e5157a finally, the correct way of dealing with zero matrices in solve() 2009-08-24 10:51:07 -04:00
Benoit Jacob
b8106e97b4 add logAbsDeterminant()
move log and exp functors from Array to Core
update documentation
2009-08-24 09:46:17 -04:00
Benoit Jacob
c9a307f330 give FullPivotingHouseholderQR all the modern comfort 2009-08-24 00:23:35 -04:00
Benoit Jacob
b37ab9b324 clarifications in LU::solve() and in LU documentation 2009-08-24 00:02:49 -04:00
Benoit Jacob
0926549659 fix bug: with complex matrices, the condition (ei_imag(c0)==RealScalar(0)) being wrong could bypass the other condition in the &&.
at least that's my explanation why the test_lu was often failing on complex matrices (it uses that via createRandomMatrixOfRank)
and why that's fixed by this diff.
also gcc 4.4 gave a warning about tailSqNorm potentially uninitialized
2009-08-24 00:02:22 -04:00
Benoit Jacob
d38624b1ad merge 2009-08-23 18:05:33 -04:00
Benoit Jacob
97bc1af1f1 add ColPivotingHouseholderQR
rename RRQR to fullPivotingHouseholderQR
2009-08-23 18:04:33 -04:00
Gael Guennebaud
47fda1f3b2 hm, forgot to conjugate the arguments in applyJacobiOnTheLeft 2009-08-24 00:01:02 +02:00
Gael Guennebaud
e86dbd5255 fix apply Jacobi for complexes and add documentation for some *Jacobi* functions 2009-08-23 23:49:44 +02:00
Benoit Jacob
7bedf5e9cb add initial, rough, full-pivoting RRQR decomposition
lots of room for improvement!
and add Gael a (c) line in Householder.h
2009-08-22 01:13:21 -04:00
Benoit Jacob
2f0b4e1abc fix compilation with gcc 4.1. Indeed the path for recent gcc doesn't work with gcc 4.1, and looking at the implementation of vector in g++ 4.1, it was exactly our fallback case, so use that. 2009-08-21 12:16:37 -04:00
Benoit Jacob
72b002eab9 work around internal compiler error with gcc 4.1 and 4.2, reported on the forum 2009-08-20 12:19:15 -04:00
Gael Guennebaud
d56be9c128 * make HessenbergDecomposition uses the Householder module
* bugfix in ei_blas_traits for .conjugate().conjugate()
2009-08-17 17:41:01 +02:00
Gael Guennebaud
ff0f005d4c change the make householder algorithm so that the remaining coefficient
is real, and make Tridiagonalization use it
2009-08-17 17:04:32 +02:00
Gael Guennebaud
e125c199bb add EIGEN_TRANSFORM_PLUGIN 2009-08-17 09:16:41 +02:00
Gael Guennebaud
737bed19c1 make HouseholderQR uses the Householder module 2009-08-16 19:22:15 +02:00
Gael Guennebaud
fc9480cbb3 bugfix in compute_matrix_flags, optimization in LU,
improve doc, and workaround aliasing detection in MatrixBase_eval snippet
(not very nice but I don't know how to do it in a better way)
2009-08-16 10:55:10 +02:00
Benoit Jacob
ee982709d3 in all decs, make the compute() methods return *this
(implements feature request #18)
2009-08-15 23:12:39 -04:00
Gael Guennebaud
65fe5f76fd rename back MayAliasBit to EvalBeforeAssigningBit 2009-08-16 00:14:05 +02:00
Gael Guennebaud
f5f2b222a3 make SVD reuses applyJacobi 2009-08-16 00:02:36 +02:00
Gael Guennebaud
044dd0c1dd revert previous change in Quaternion::setFromTwoVectors 2009-08-15 23:37:20 +02:00
Benoit Jacob
03c1e79f35 svd: sort in decreasing order, remove unused code 2009-08-15 19:20:48 -04:00
Gael Guennebaud
239ada95b7 add overloads of lazyAssign to detect common aliasing issue with
transpose and adjoint
2009-08-15 22:19:29 +02:00
Benoit Jacob
a3e6047c25 fix and improve docs 2009-08-15 15:29:44 -04:00
Gael Guennebaud
50c703f0c7 As proposed on the list:
- rename EvalBeforeAssignBit to MayAliasBit
- make .lazy() remove the MayAliasBit only, and mark it as deprecated
- add a NoAlias pseudo expression, and MatrixBase::noalias() function
Todo:
- we have to decide whether += and -= assume no aliasing by default ?
- once we agree on the API: update the Sparse module and the unit tests respectively.
2009-08-15 18:35:51 +02:00
Gael Guennebaud
13a8956188 bugfix in inner-product specialization,
compilation fix in stable norm,
optimize apply householder
2009-08-15 13:12:50 +02:00
Gael Guennebaud
7b60713e87 my previous fix was not very good 2009-08-15 11:52:50 +02:00
Gael Guennebaud
0da31a6e1d bugfix and compilation fix in ProductBase 2009-08-15 10:55:11 +02:00
Gael Guennebaud
bff4238d15 fix setFromTwoVectors because of the change in sorting of the the singular values 2009-08-15 10:24:27 +02:00
Gael Guennebaud
109a4f650b fix a couple of warnings 2009-08-15 10:20:01 +02:00
Benoit Jacob
fe4a86443f fix warning 2009-08-14 20:16:04 -04:00
Benoit Jacob
a5f820b873 forgot to update this 2009-08-14 20:03:14 -04:00
Benoit Jacob
2f74801ca4 as discussed on list: default to align cols, reorganize parameters accordingly so that the default corresponds to 0 flag,
and implement FullPrecision output (non-default).
2009-08-14 16:31:42 -04:00
Benoit Jacob
16abc0ba7f try to support 16 bit platforms... optimistic, but can't hurt 2009-08-14 15:49:14 -04:00
Benoit Jacob
22ae236d4e machine_epsilon -> epsilon as wrapper around numeric_traits 2009-08-14 15:12:32 -04:00
Gael Guennebaud
6373c3cd00 oops bis, I forgot that SelfAdjointEigneSolver directly called the selector... 2009-08-14 13:49:29 +02:00
Gael Guennebaud
8abec72259 oops forgot to remove the #include in Core 2009-08-14 09:49:33 +02:00
Gael Guennebaud
13e95f7f68 optimize "apply Jacobi" for small sizes, and move it to Jacobi.h 2009-08-14 00:17:14 +02:00
Benoit Jacob
f2536416da * remove EIGEN_DONT_INLINE that harm performance for small sizes
* normalize left Jacobi rotations to avoid having to swap rows
* set precision to 2*machine_epsilon instead of machine_epsilon, we lose 1 bit of precision
  but gain between 10% and 100% speed, plus reduce the risk that some day we hit a bad matrix
  where it's impossible to approach machine precision
2009-08-13 14:56:39 -04:00
Benoit Jacob
76a3089a43 oops, don't set the precision to -1 !! 2009-08-13 09:56:53 -04:00
Benoit Jacob
13b191d94b apply Koldo's workaround for MSVC bug 2009-08-13 09:53:47 -04:00
Gael Guennebaud
1b257a7620 add an optimized "apply in place a rotation in the plane",
and make Jacobi and SelfAdjointEigenSolver use it
=> ~ x1.75 speedup for JacobiSVD and x2 for SelfAdjointEigenSolver
2009-08-13 11:42:02 +02:00
Benoit Jacob
1d80f561ad apply change discussed on the list :
* new default precision "-1" means use the current stream precision
* otherwise, save and restore the stream precision
2009-08-13 22:50:55 -04:00
Benoit Jacob
99802094e4 do without an empirical homemade formula that i wasn't comfortable about...
turns out it's not needed anymore and removing it seems to only increase the precision
2009-08-12 18:30:37 -04:00
Benoit Jacob
2b618a2c16 make jacobi SVD more robust after experimenting with very nasty matrices...
it turns out to be better to repeat the jacobi steps on a given (p,q) pair until it
is diagonal to machine precision, before going to the next (p,q) pair. it's also
an optimization as experiments show that in a majority of cases this allows to find out
that the (p,q) pair is already diagonal to machine precision.
2009-08-12 18:23:39 -04:00
Benoit Jacob
309d540d4a add parentheses; hopefully this solves Koldos MSVC compilation issue... 2009-08-12 10:14:15 -04:00
Benoit Jacob
22d65d47d0 finally, the good approach was two-sided Jacobi. Indeed, it allows
to guarantee the precision of the output, which is very valuable.
Here, we guarantee that the diagonal matrix returned by the SVD is
actually diagonal, to machine precision.

Performance isn't bad at all at 50% of the current householder SVD
performance for a 200x200 matrix (no vectorization) and we have
lots of room for improvement.
2009-08-12 02:35:07 -04:00
Benoit Jacob
ce033ebdfe add EIGEN_DEBUG_VAR 2009-08-11 16:12:34 -04:00
Gael Guennebaud
afbd73b5cd overload operartor* with a ProductBase such that "scalar * (mat * mat)" is optimized
as one could naturally expect
2009-08-11 15:15:06 +02:00
Gael Guennebaud
a4f6642518 fix issue #36 (missing return *this in Rotation2D 2009-08-11 15:11:47 +02:00
Gael Guennebaud
ea884e6f48 remove #include Bidiagonalization, and add missing ";" 2009-08-11 15:08:03 +02:00
Gael Guennebaud
35b4077a5d merge 2009-08-09 23:11:25 +02:00
Gael Guennebaud
ef55e7f4ce make custom asm directive volatile 2009-08-09 23:09:46 +02:00
Benoit Jacob
216ee335ac LinearVectorization: If the destination isn't aligned,
we have to do runtime checks and we don't unroll, so it's only good for large enough sizes
2009-08-09 22:19:12 +02:00
Benoit Jacob
1f1705868b now you can #define EIGEN_DEBUG_ASSIGN, and all the values in ei_assign_traits are printed 2009-08-09 21:35:13 +02:00
Benoit Jacob
527557672a disable the assembly for fast unaligned stores. indeed, there is a strange bug that is triggered by this code:
#include<Eigen/Core>

int main()
{
  Eigen::Matrix4f m;
  m <<1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16;
  m.col(0).swap(m.col(1));
  std::cout << m << std::endl;
}

when the fast unaligned stores are used, the column is copied instead of being swapped.
2009-08-09 20:49:55 +02:00
Benoit Jacob
8e08680119 don't depend on uninitialized value 2009-08-09 17:18:42 +02:00
Benoit Jacob
3ed83fa681 * add Jacobi transformations
* add Jacobi (Hestenes) SVD decomposition for square matrices
* add function for trivial Householder
2009-08-09 16:58:13 +02:00
Gael Guennebaud
fe813911f2 make LU::solve() not to crash when rank=0 2009-08-09 00:06:53 +02:00
Benoit Jacob
5f8d58f36a fix bug in sorting of singular values 2009-08-09 00:05:38 +02:00
Gael Guennebaud
f5e1c896c7 replace custom rank one update in LU by an expression 2009-08-08 00:01:43 +02:00
Gael Guennebaud
d1dc088ef0 * implement a second level of micro blocking (faster for small sizes)
* workaround GCC bad implementation of _mm_set1_p*
2009-08-07 11:09:34 +02:00
Gael Guennebaud
543a785756 Fix compilation in sparse module 2009-08-06 17:28:49 +02:00
Gael Guennebaud
2707a6b87c fix determinant in PartialLU 2009-08-06 17:28:31 +02:00
Gael Guennebaud
1d1e4884da oops, one more bug fix in homogeneous 2009-08-06 16:56:10 +02:00
Gael Guennebaud
9822493aaf fixes in determinant and homogeneous 2009-08-06 16:54:55 +02:00
Gael Guennebaud
3ac01b1400 compilation fix in EigenSolver,
bugfix in PartialLU
2009-08-06 16:41:54 +02:00
Gael Guennebaud
e82e30862a typo 2009-08-06 15:04:42 +02:00
Gael Guennebaud
03febf00a0 fix VS compilation issue in MapBase::operator+= and -= 2009-08-06 15:03:37 +02:00
Gael Guennebaud
2e46e9f2b4 shame on me 2009-08-06 14:57:38 +02:00
Gael Guennebaud
d34c5ef509 fix my bad fix of Hauke's fix ;) 2009-08-06 14:54:25 +02:00