Commit Graph

350 Commits

Author SHA1 Message Date
Gael Guennebaud
440664cd5d temporary fix of the pèrevious commit 2008-08-24 15:27:05 +00:00
Gael Guennebaud
ba100998bf * split Meta.h to Meta.h (generic meta programming) and XprHelper.h (relates to eigen mechanism)
* added a meta.cpp unit test
* EIGEN_TUNE_FOR_L2_CACHE_SIZE now represents L2 block size in Bytes (whence the ei_meta_sqrt...)
* added a CustomizeEigen.dox page
* added a TOC to QuickStartGuide.dox
2008-08-24 15:15:32 +00:00
Gael Guennebaud
bfe86b8fc0 * add documentation of the cool (?) "print with format" feature
* move the ioformat.cpp test to a documentation example
* rename IoFormat => IOFormat
2008-08-23 19:41:00 +00:00
Gael Guennebaud
f2f48b6560 * remove LargeBit and related stuff
* replaced the Flags template parameter of Matrix by StorageOrder
  and move it back to the 4th position such that we don't have to
  worry about the two Max* template parameters
* extended EIGEN_USING_MATRIX_TYPEDEFS with the ei_* math functions
2008-08-23 17:11:44 +00:00
Gael Guennebaud
2120fed849 * bug fixes in: Dot, generalized eigen problem, singular matrix detetection in Cholesky
* fix all numerical instabilies in the unit tests, now all tests can be run 2000 times
  with almost zero failures.
2008-08-23 15:14:20 +00:00
Benoit Jacob
312013a089 compile fix for code like Vector3d::Random().x() 2008-08-23 02:19:03 +00:00
Gael Guennebaud
8509668466 bugfix from Timothy Hunter s/ei_div/ei_pdiv 2008-08-22 22:01:02 +00:00
Gael Guennebaud
e0f627a7db s/Affine/Linear, thanks to Thomas Vaughan 2008-08-22 17:54:37 +00:00
Gael Guennebaud
f0394edfa7 * bugfix in SolveTriangular found by Timothy Hunter (did not compiled for very small fixed size matrices)
* bugfix in Dot unroller
* added special random generator for the unit tests and reduced the tolerance threshold by an order of magnitude
  this fixes issues with sum.cpp but other tests still failed sometimes, this have to be carefully checked...
2008-08-22 17:48:36 +00:00
Gael Guennebaud
a95c1e190b patch from Konstantinos Margaritis: Altivec vectorization is resurrected ! 2008-08-22 13:19:35 +00:00
Gael Guennebaud
95db4e9841 added SparseSetter doc 2008-08-22 11:19:12 +00:00
Benoit Jacob
a814ebe180 fix a number of compiler errors and warnings with gcc 4.3. There was a missing
#include<algorithm> so I'm not sure how it compiled at all for you :)
2008-08-22 01:19:53 +00:00
Gael Guennebaud
db628c6ad7 Reimplement fitHyperplane such that the fit is done in a total LS sense
(use eigen decomposition).
Added optional feedback on the stability of the actual fit (think about fitting a 3D plane
on data lying on a line...)
2008-08-22 00:09:46 +00:00
Benoit Jacob
0998c51d1f - remove the ASM macro as in fact Gael had been removing all the remaining
asm("...") from the code while fixing MSVC compat (so your changes crossed
  one another).
- move the pragma warning to CoreDeclarations, it's the right place to do early
  platform checks.

CCMAIL:ps_ml@gmx.de
2008-08-21 21:07:24 +00:00
Gael Guennebaud
58061f5ffc extend sparse unit test and more bugfix, major todo: finilize the SparseSetter 2008-08-21 18:40:56 +00:00
Gael Guennebaud
60804c306d *patch by Daniel Gomez:
- bugfix in SparseMatrix
 - add a sparse unit test
* renamed Transform::affine => linear
2008-08-21 17:02:47 +00:00
Benoit Jacob
082e309d2a patch by Patrick Spendrin: fix MSVC compatibility 2008-08-21 16:17:51 +00:00
Gael Guennebaud
67813e01bf disable the vectorization of div for AltiVec 2008-08-21 14:03:17 +00:00
Gael Guennebaud
f729fc1d70 * Add the possibility to customize the output of matrices, e.g.:
IoFormat OctaveFmt(4, AlignCols, ", ", ";\n", "", "", "[", "]");
   cout << mat.format(OctaveFmt);
  The first "4" is the precision.
  Documentation missing.
* Some compilation fixes
2008-08-21 13:17:21 +00:00
Benoit Jacob
591d497b84 add resize() methods to Map, doing nothing but assertions.
This is useful in Krita where I call lu().solve() with a Map object
as result. As solve() resizes the result, this was needed.
2008-08-21 04:36:48 +00:00
Gael Guennebaud
fd681507dc Add a packetmath unit test, re-enable the comma-initializer unit test,
and bug fix in PacketMath/SSE
2008-08-20 20:08:38 +00:00
Benoit Jacob
ff8e98c974 Fix bugs in Sum.h, add unit-test 2008-08-20 16:43:28 +00:00
Gael Guennebaud
c501c7a4ef * Fix CMakeLists.txt issue with SVD
* Fix on stack memory allocation issues
2008-08-20 15:58:01 +00:00
Gael Guennebaud
752ec27293 minor bugfix found using gcc-4.0 2008-08-20 14:05:57 +00:00
Gael Guennebaud
8afaeb4ad5 doc fixes, and extended Basic Linear Algebra and Reductions sections 2008-08-20 13:07:46 +00:00
Benoit Jacob
c705c38a23 * it's \returns not \Returns
* add some explanations in the typedefs page
* expand a bit the new QuickStartGuide. Some placeholders (not a pb since
it's not even yet linked to from other pages). The point I want to make is
that it's super important to have fully compilable short programs (even
with compile instructions for the first one) not just small snippets, at
least at the beginning. Let's start with examples of compilable programs.
2008-08-20 04:34:04 +00:00
Gael Guennebaud
7aba51ce53 * Added .all() and .any() members to PartialRedux
* Bug fixes in euler angle snippet, Assign and MapBase
* Started a "quick start guide" (draft state)
2008-08-20 00:58:25 +00:00
Gael Guennebaud
c6674ab076 missing SVD header file 2008-08-19 20:18:46 +00:00
Gael Guennebaud
104f8fd36e Added a SVD module:
- the decompostion code has been adfapted from JAMA
 - handles non square matrices of size MxN with M>=N
 - does not work for complex matrices
 - includes a solver where the parts corresponding to zero singular values are set to zero
2008-08-19 17:52:04 +00:00
Benoit Jacob
54137f1ca7 * fix bug found by Boudewijn Rempt: no CMakeLists in arch/ subdir
* fix warning in SolveTriangular
2008-08-19 13:15:13 +00:00
Gael Guennebaud
a6d387a359 Various compilation fixes for MSVC 9. All tests compile but some
still fail at runtime in ei_aligned_free() (even without vectorization).
2008-08-19 11:06:40 +00:00
Benoit Jacob
9466e5f94e * doc improvements in Cwise and PartialRedux:
- 33 new snippets
  - unfuck doxygen output in Cwise (issues with function macros)
  - more see-also links from outside, making Cwise more discoverable
* rename matrixNorm() to operatorNorm(). There are many matrix norms
  (the L2 is another one) but only one is called the operator norm.
  Risk of confusion with keyword operator is not too scary after all.
2008-08-19 04:30:28 +00:00
Gael Guennebaud
95dd09bea6 * revert the previous interface change in solveTriangular (pointer vs reference)
* remove the cast operators in the Geometry module: they are replaced by constructors
  and new operator= in Matrix
* extended the operations supported by Rotation2D
* rewrite in solveTriangular:
  - merge the Upper and Lower specializations
  - big optimization of the path for row-major triangular matrices
2008-08-18 22:17:42 +00:00
Benoit Jacob
e778ae2559 only use alloca on linux. Use malloc on other platforms. Needed for mingw
compatibility.
2008-08-18 16:36:47 +00:00
Benoit Jacob
baf0cffedd *add operator()(int) for vectors, synonymous to operator[](int).
I don't see any reason not to allow it, it doesn't add much code, and
 it makes porting from eigen1 easier.
*expand tests/basicstuff to first test coefficient access methods
2008-08-18 12:33:14 +00:00
Benoit Jacob
239b47e033 *make Eigen2 install to prefix/include/eigen2/Eigen
*Add FindEigen2.cmake module in kdelibs
2008-08-16 12:56:38 +00:00
Gael Guennebaud
5546e963c9 bugfix in CholeskyWithoutSquareRoot::solve found by Timothy Hunter 2008-08-16 07:09:39 +00:00
Gael Guennebaud
8a3e6b1ee2 change solveTriangularInPlace() to take a pointer as input (as discussed on IRC).
extended the documentation of the triangular solver.
2008-08-12 07:49:59 +00:00
Benoit Jacob
13ad88736e last small fixes, this is alpha6, eigen2 is now ready for eigen1 apps to
port to.
2008-08-12 02:14:02 +00:00
Benoit Jacob
f04c1cb774 Complete LU documentation 2008-08-11 21:26:37 +00:00
Benoit Jacob
17ec407ccd * add Regression module, from eigen1, improved, with doc and unit-test.
* fix .normalized() so that Random().normalized() works; since the return
type became complicated to write down i just let it return an actual
vector, perhaps not optimal.
* add Sparse/CMakeLists.txt. I suppose that it was intentional that it
didn't have CMakeLists, but in <=2.0 releases I'll just manually remove
Sparse.
2008-08-11 02:25:40 +00:00
Gael Guennebaud
55e8d670ce Renamed allowAligned() => forceAligned() and added the constants ForceAligned
and AsRequested for the PacketAccess parameter of MapBase. Updated respective
documentation.
2008-08-09 21:57:50 +00:00
Gael Guennebaud
b13148c358 renamed inverseProduct => solveTriangular 2008-08-09 20:06:25 +00:00
Benoit Jacob
d6e88f8155 * add LU unit-test. Seems like we have very good numerical stability!
* some cleanup, and grant me a copyright line on the determinant test.
2008-08-09 19:26:14 +00:00
Gael Guennebaud
4fa40367e9 * Big change in Block and Map:
- added a MapBase base xpr on top of which Map and the specialization
    of Block are implemented
  - MapBase forces both aligned loads (and aligned stores, see below) in expressions
    such as "x.block(...) += other_expr"
* Significant vectorization improvement:
 - added a AlignedBit flag meaning the first coeff/packet is aligned,
   this allows to not generate extra code to deal with the first unaligned part
 - removed all unaligned stores when no unrolling
 - removed unaligned loads in Sum when the input as the DirectAccessBit flag
* Some code simplification in CacheFriendly product
* Some minor documentation improvements
2008-08-09 18:41:24 +00:00
Benoit Jacob
becbeda50a * reimplement the general case of inverse() on top of LU. Advantages:
- removes much code
  - 2.5x faster (even though LU uses complete pivoting contrary to what
inverse used to do!)
  - there _were_ numeric stability problems with the partial pivoting
approach of inverse(), with 200x200 matrices inversion failed almost
half of the times (overflow). Now these problems are solved thanks to
complete pivoting.

* remove some useless stuff in LU
2008-08-09 15:50:07 +00:00
Benoit Jacob
681e944670 *implement LU solver (solves any rectangular system)
*in test/CMakeLists : modify EI_ADD_TEST so that 2nd argument is
additional compiler flags. used to add -O2 to test_product_large so it
doesn't take forever.
2008-08-09 15:23:54 +00:00
Benoit Jacob
a41f2b4216 * fix bug in SwapWrapper : store the wrapped expression by reference
* optimize setIdentity: when the matrix is large enough it is better to
  setZero() and overwrite the diagonal
* start of LU solver, disabled for now
2008-08-09 04:37:09 +00:00
Benoit Jacob
9bbe396939 forgot to remove that old code 2008-08-07 21:50:29 +00:00
Benoit Jacob
5f350448e1 - add kernel computation using the triangular solver
- take advantage of the fact that our LU dec sorts the eigenvalues of U
in decreasing order
- add meta selector in determinant
2008-08-07 21:48:21 +00:00
Benoit Jacob
58ba9ca72f LU: remove partial-pivoting path (moderately useful since it's does
not allow to easily get the rank), fix a bug (which could have been
triggered by matrices having coefficients of very different
magnitudes).
Part: add an assert to prevent hard to find bugs
Swap: update comments
2008-08-07 04:31:05 +00:00
Benoit Jacob
88bb2087c1 New implementation of Swap as discussed, reusing Assign. Makes LU run
10% faster overall.
2008-08-05 21:55:57 +00:00
Benoit Jacob
c94be35bc8 introduce copyCoeff and copyPacket methods in MatrixBase, used by
Assign, in preparation for new Swap impl reusing Assign code.
remove last remnant of old Inverse class in Transform.
2008-08-05 18:00:23 +00:00
Benoit Jacob
09ef7db9d9 Add partial pivoting runtime option to LU.
Note: in fact, inverse() always uses partial pivoting because the algo
currently used doesn't make sense with complete pivoting. No num
stability issue so far even with size 200x200. If there is any problem
we can of course reimplement inverse on top of LU.
2008-08-05 15:43:11 +00:00
Benoit Jacob
e741b7beca further big perf improvement in Inverse 2008-08-04 23:47:09 +00:00
Benoit Jacob
79a0feee68 big performance improvement in inverse and LU 2008-08-04 23:34:21 +00:00
Benoit Jacob
c2f8ecf466 * LU decomposition, supporting all rectangular matrices, with full
pivoting for better numerical stability. For now the only application is
determinant.
* New determinant unit-test.
* Disable most of Swap.h for now as it makes LU fail (mysterious).
Anyway Swap needs a big overhaul as proposed on IRC.
* Remnants of old class Inverse removed.
* Some warnings fixed.
2008-08-04 04:45:59 +00:00
Gael Guennebaud
f81dfcf00b fix two perf issues in product.
fix positive definite test in Cholesky.
remove #include <cstring> in CoreDeclaration.
2008-08-03 20:23:06 +00:00
Benoit Jacob
49ae3fca89 fix compile errors with gcc 4.3: unresolved func call to
ei_cache_friendly_product, and undeclared memcpy
2008-08-03 15:44:06 +00:00
Gael Guennebaud
6d11a07e5e Added a ei_palign function align a packet from two others.
This allows much faster code dealing with unligned as
in the updated matrix-vector product functions.
2008-08-03 15:15:46 +00:00
Gael Guennebaud
55aeb1f83a Optimizations:
* faster matrix-matrix and matrix-vector products (especially for not aligned cases)
 * faster tridiagonalization (make it using our matrix-vector impl.)
Others:
 * fix Flags of Map
 * split the test_product to two smaller ones
2008-08-01 23:44:59 +00:00
Gael Guennebaud
b32b186c14 removed the packet specializations of some functors
(GCC generates better code without those "optimizations")
2008-07-31 21:03:11 +00:00
Gael Guennebaud
842c4f8bfa Several compilation fixes for MSVC and NVCC, basically:
- added explicit enum to int conversion where needed
- if a function is not defined as declared and the return type is "tricky"
  then the type must be typedefined somewhere. A "tricky return type" can be:
  * a template class with a default parameter which depends on another template parameter
  * a nested template class, or type of a nested template class
2008-07-29 16:33:07 +00:00
Gael Guennebaud
44d95e0540 fix some internal asserts in CacheFrinedlyProduct 2008-07-27 22:14:08 +00:00
Gael Guennebaud
02a7efa910 forgot to include this file in previous commit 2008-07-27 14:24:32 +00:00
Gael Guennebaud
e9e5261664 Fix a couple issues introduced in the previous commit:
* removed DirectAccessBit from Part
* use a template specialization in inverseProduct() to transform a Part xpr to a Flagged xpr
2008-07-26 23:05:44 +00:00
Gael Guennebaud
e77ccf2928 * Rewrite the triangular solver so that we can take advantage of our efficient matrix-vector products:
=> up to 6 times faster !
* Added DirectAccessBit to Part
* Added an exemple of a cwise operator
* Renamed perpendicular() => someOrthogonal() (geometry module)
* Fix a weired bug in ei_constant_functor: the default copy constructor did not copy
  the imaginary part when the single member of the class is a complex...
2008-07-26 20:40:29 +00:00
Gael Guennebaud
2940617e6f bugfix in some internal asserts of CacheFriendlyProduct 2008-07-26 12:26:27 +00:00
Benoit Jacob
f997a3e902 update the inverse test a little
make use of static asserts in Map
fix 2 warnings in CacheFriendlyProduct: unused var 'Vectorized'
2008-07-26 12:08:28 +00:00
Gael Guennebaud
b466c266a0 * Fix some complex alignment issues in the cache friendly matrix-vector products.
* Minor update of the cores of the Cholesky algorithms to make them more friendly
  wrt to matrix-vector products => speedup x5 !
2008-07-23 17:30:00 +00:00
Gael Guennebaud
172000aaeb Add .perpendicular() function in Geometry module (adapted from Eigen1)
Documentation:
 * add an overview for each module.
 * add an example for .all() and Cwise::operator<
2008-07-22 10:54:42 +00:00
Gael Guennebaud
516db2c3b9 Fix compilation issues with icc and g++ < 4.1. Those include:
- conflicts with operator * overloads
 - discard the use of ei_pdiv for interger
   (g++ handles operators on __m128* types, this is why it worked)
 - weird behavior of icc in fixed size Block() constructor complaining
   the initializer of m_blockRows and m_blockCols were missing while
   we are in fixed size (maybe this hide deeper problem since this is a
   recent one, but icc gives only little feedback)
2008-07-21 12:40:56 +00:00
Gael Guennebaud
c10f069b6b * Merge Extract and Part to the Part expression.
Renamed "MatrixBase::extract() const" to "MatrixBase::part() const"
* Renamed static functions identity, zero, ones, random with an upper case
  first letter: Identity, Zero, Ones and Random.
2008-07-21 00:34:46 +00:00
Gael Guennebaud
ce425d92f1 Various documentation improvements, in particualr in Cholesky and Geometry module.
Added doxygen groups for Matrix typedefs and the Geometry module
2008-07-20 15:18:54 +00:00
Gael Guennebaud
269f683902 Add cholesky's members to MatrixBase
Various documentation improvements including new snippets (AngleAxis and Cholesky)
2008-07-19 22:59:05 +00:00
Gael Guennebaud
6e2c53e056 Added an automatically generated list of selected examples in the documentation.
Added the custom gemetry_module tag, and use it.
2008-07-19 20:36:41 +00:00
Gael Guennebaud
05ad083467 Added MatrixBase::Unit*() static function to easily create unit/basis vectors.
Removed EulerAngles, addes typdefs for Quaternion and AngleAxis,
and added automatic conversions from Quaternion/AngleAxis to Matrix3 such that:
 Matrix3f m = AngleAxisf(0.2,Vector3f::UnitX) * AngleAxisf(0.2,Vector3f::UnitY);
just works.
2008-07-19 13:03:23 +00:00
Gael Guennebaud
7245c63067 Complete rewrite of partial reduction according to mailing list discussions. 2008-07-19 11:36:32 +00:00
Benoit Jacob
8b4945a5a2 add some static asserts, use them, fix gcc 4.3 warning in Product.h. 2008-07-19 00:25:41 +00:00
Gael Guennebaud
22a816ade8 * Fix a couple of issues related to the recent cache friendly products
* Improve the efficiency of matrix*vector in unaligned cases
* Trivial fixes in the destructors of MatrixStorage
* Removed the matrixNorm in test/product.cpp (twice faster and
  that assumed the matrix product was ok while checking that !!)
2008-07-19 00:09:01 +00:00
Benoit Jacob
62ec1dd616 * big rework of Inverse.h:
- remove all invertibility checking, will be redundant with LU
  - general case: adapt to matrix storage order for better perf
  - size 4 case: handle corner cases without falling back to gen case.
  - rationalize with selectors instead of compile time if
  - add C-style computeInverse()
* update inverse test.
* in snippets, default cout precision to 3 decimal places
* add some cmake module from kdelibs to support btl with cmake 2.4
2008-07-15 23:56:17 +00:00
Gael Guennebaud
b970a9c8aa trivial fix in EulerAngles constructor 2008-07-15 22:42:55 +00:00
Gael Guennebaud
99a625243f Optimization: added super efficient rowmajor * vector product (and vector * colmajor).
It basically performs 4 dot products at once reducing loads of the vector and improving
instructions scheduling. With 3 cache friendly algorithms, we now handle all product
configurations with outstanding perf for large matrices.
2008-07-13 01:22:54 +00:00
Gael Guennebaud
861d18d553 * Optimization: added a specialization of Block for xpr with DirectAccessBit
* some simplifications and fixes in cache friendly products
2008-07-12 22:59:34 +00:00
Gael Guennebaud
b7bd1b3446 Add a *very efficient* evaluation path for both col-major matrix * vector
and vector * row-major products. Currently, it is enabled only is the matrix
has DirectAccessBit flag and the product is "large enough".
Added the respective unit tests in test/product/cpp.
2008-07-12 12:12:02 +00:00
Benoit Jacob
2b53fd4d53 some performance fixes in Assign.h reported by Gael. Some doc update in
Cwise.
2008-07-10 16:15:55 +00:00
Gael Guennebaud
c9b046d5d5 * added optimized paths for matrix-vector and vector-matrix products
(using either a cache friendly strategy or re-using dot-product
  vectorized implementation)
* add LinearAccessBit to Transpose
2008-07-09 22:30:18 +00:00
Gael Guennebaud
5f55ab524c * added a lazyAssign overload skipping .lazy() such that c = (<xpr>).lazy() such that
lazyAssign overloads of <xpr> are automatically called (this also reduces assign instansiations)
2008-07-09 13:54:21 +00:00
Gael Guennebaud
783eb6da9b I forgot that the previous commit needed minor changes outside the bench folder 2008-07-08 17:25:58 +00:00
Benoit Jacob
6f09d3a67d - many updates after Cwise change
- fix compilation in product.cpp with std::complex
- fix bug in MatrixBase::operator!=
2008-07-08 07:56:01 +00:00
Benoit Jacob
f5791eeb70 the big Array/Cwise rework as discussed on the mailing list. The new API
can be seen in Eigen/src/Core/Cwise.h.
2008-07-08 00:49:10 +00:00
Benoit Jacob
a9d319d44f * do the ActualPacketAccesBit change as discussed on list
* add comment in Product.h about CanVectorizeInner
* fix typo in test/product.cpp
2008-07-04 12:43:55 +00:00
Gael Guennebaud
8463b7d3f4 * fix compilation issue in Product
* added some tests for product and swap
* overload .swap() for dynamic-sized matrix of same size
2008-07-02 16:05:33 +00:00
Gael Guennebaud
9433df83a7 * resurected Flagged::_expression used to optimize m+=(a*b).lazy()
(equivalent to the GEMM blas routine)
* added a GEMM benchmark
2008-07-01 16:20:06 +00:00
Gael Guennebaud
37a50fa526 * added an in-place version of inverseProduct which
might be twice faster fot small fixed size matrix
* added a sparse triangular solver (sparse version
  of inverseProduct)
* various other improvements in the Sparse module
2008-06-29 21:29:12 +00:00
Gael Guennebaud
027818d739 * added innerSize / outerSize functions to MatrixBase
* added complete implementation of sparse matrix product
  (with a little glue in Eigen/Core)
* added an exhaustive bench of sparse products including GMM++ and MTL4
  => Eigen outperforms in all transposed/density configurations !
2008-06-28 23:07:14 +00:00
Benoit Jacob
55e08f7102 fix breakage from my last commit 2008-06-28 17:15:16 +00:00
Benoit Jacob
844f69e4a9 * update CMakeLists, only build instantiations if TEST_LIB is defined
* allow default Matrix constructor in dynamic size, defaulting to (1,
1), this is convenient in mandelbrot example.
2008-06-27 10:53:30 +00:00
Benoit Jacob
6de4871c8c fix a couple of issues in the new Map.h 2008-06-27 01:42:44 +00:00
Benoit Jacob
e27b2b95cf * rework Map, allow vectorization
* rework PacketMath and DummyPacketMath, make these actual template
specializations instead of just overriding by non-template inline
functions
* introduce ei_ploadt and ei_pstoret, make use of them in Map and Matrix
* remove Matrix::map() methods, use Map constructors instead.
2008-06-27 01:22:35 +00:00