Commit Graph

198 Commits

Author SHA1 Message Date
Gael Guennebaud
5686eca7b1 * fix multiple temporary copies for coeff based products
* introduce a lazy product version of the coefficient based implementation
  => flagged is not used anymore
  => small outer product are now lazy by default (aliasing is really unlikely for outer products)
2010-02-09 11:05:39 +01:00
Gael Guennebaud
73eb0e633c * resurected Flagged from Eigen2Support
* reimplement .diagonal() for ProductBase to make (A*B).diagonal() more efficient!
2010-02-04 18:28:09 +01:00
Gael Guennebaud
0ce5bc0d14 add support for global math function for array 2010-01-27 23:23:59 +01:00
Hauke Heibel
5d48cc1f5b Moved the Array module to Core. 2010-01-20 20:51:01 +01: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
Gael Guennebaud
9d9e00b608 merge and add start/end to Eigen2Support 2010-01-05 13:07:32 +01:00
Thomas Capricelli
57275b2b8c make some changes to please clang, fix some warnings too. 2010-01-04 23:21:04 +01:00
Gael Guennebaud
eaaba30cac merge with default branch 2009-12-22 22:51:08 +01:00
Gael Guennebaud
ebb2878829 finally add a Array class with storage via the introduction of a DenseStorageBase
base class shared by both Matrix and Array
2009-12-17 13:37:00 +01:00
Gael Guennebaud
8e05f9cfa1 add a DenseBase class for MAtrixBase and ArrayBase and more code factorisation 2009-12-04 23:17:14 +01:00
Mark Borgerding
ff1e9542f6 added comments to help vim understand the header files are c++. 2009-12-01 18:00:29 -05:00
Benoit Jacob
684d76eba3 add SSE4 support, start with integer multiplication 2009-11-24 15:12:43 -05:00
Gael Guennebaud
4af1753b6f * remove EnforceAlignedAccess option to Block, VectorBlock, Map and MapBase
because thanks to the previous commit this is not needed anymore
* add a more general ForceAlignedAccess expression which can be used for any expression.
  It is already used by StableNorm.h.
2009-11-20 16:30:14 +01:00
Gael Guennebaud
eb8f450071 Hey, finally the copyCoeff stuff is not only used to implement swap anymore :)
Add an internal pseudo expression allowing to optimize operators like +=, *= using
the copyCoeff stuff.
This allows to easily enforce aligned load for the destination matrix everywhere.
2009-11-20 15:39:38 +01:00
Gael Guennebaud
e3d890bc5a Another big refactoring change:
* add a new Eigen2Support module including Cwise, Flagged, and some other deprecated stuff
* add a few cwiseXxx functions
* adapt a few modules to use cwiseXxx instead of the .cwise() prefix
2009-11-18 18:15:19 +01:00
Gael Guennebaud
1e62e0b0d8 more ET refactoring:
* extend Cwise for multiple storage base class
* a lot of cleaning in the Sparse module
2009-11-17 16:04:19 +01:00
Benoit Jacob
955cd7f884 * add PermutationMatrix
* DiagonalMatrix:
   - add MaxSizeAtCompileTime parameter
   - DiagonalOnTheLeft ---> OnTheLeft
   - fix bug in DiagonalMatrix::setIdentity()
2009-11-15 21:12:15 -05:00
Gael Guennebaud
7b0c4102fa * add a Make* expression type builder to allow the
construction of generic expressions working
  for both dense and sparse matrix. A nicer solution
  would be to use CwiseBinaryOp for any kind of matrix.
  To this end we either need to change the overall design
  so that the base class(es) depends on the kind of matrix,
  or we could add a template parameter to each expression
  type (e.g., int Kind = ei_traits<MatrixType>::Kind)
  allowing to specialize each expression for each kind of matrix.
* Extend AutoDiffScalar to work with sparse vector expression
  for the derivatives.
2009-10-16 13:22:38 +02:00
Benoit Jacob
6b5f96cb03 undef B0 2009-09-19 19:14:28 -04:00
Gael Guennebaud
49dd5d7847 * add a HouseholderSequence class (not good enough yet for Triadiagonalization and HessenbergDecomposition)
* rework a bit AnyMatrixBase, and mobe it to a separate file
2009-09-16 14:35:42 +02: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
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
8abec72259 oops forgot to remove the #include in Core 2009-08-14 09:49:33 +02: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
Gael Guennebaud
56d00779db more product refactoring 2009-08-06 12:20:02 +02:00
Gael Guennebaud
7d607048a9 implement a ProductBase class and, as a proof of concept, update TriangularProduct
and SelfAdjointMatrixProduct to take advantage of it => fewer LOC
2009-08-04 16:54:17 +02:00
Gael Guennebaud
54804eb626 synch with main branch 2009-07-28 17:35:07 +02:00
Gael Guennebaud
6aba84719d trmm is now working in all storage order configurations 2009-07-27 10:27:01 +02:00
Gael Guennebaud
f4112dcff3 The new trsm is working very very well (read very fast) for
lower triangular matrix and row or col major lhs.
TODO: handle upper triangular and row major rhs cases
2009-07-25 21:41:01 +02:00
Gael Guennebaud
a81388fae9 Implement efficient sefladjoint product (aka SYRK) : C += alpha * U U^T
It is currently available via SelfAdjointView::rankKupdate.
TODO: allows to write SelfAdjointView += u * u.adjoint()
2009-07-23 19:01:20 +02:00
Gael Guennebaud
d6475ea390 more refactoring in the level3 products 2009-07-22 11:54:58 +02:00
Gael Guennebaud
d6627d540e * refactoring of the matrix product into multiple small kernels
* started an efficient selfadjoint matrix * general matrix product
  based on the generic kernels ( => need a very little LOC)
2009-07-21 16:58:35 +02:00
Gael Guennebaud
32b08ac971 re-implement stableNorm using a homemade blocky and
vectorization friendly algorithm (slow if no vectorization)
2009-07-17 16:22:39 +02:00
Gael Guennebaud
587029a612 started an implementation of BandMatrix: at least the read/write access
to the main/sub/super diagonals seems to work well.
2009-07-14 23:27:37 +02:00
Gael Guennebaud
8120a5cecd synch with main devel branch 2009-07-14 23:06:25 +02:00
Gael Guennebaud
279cedc1ce some cleaning/renaming is Triangular/SelfadjointView 2009-07-14 22:38:21 +02:00
Gael Guennebaud
a2cf7ba955 add triangular * vector product 2009-07-13 13:17:55 +02:00
Gael Guennebaud
a2087cd7a3 Add an efficient rank2 update function (like the level2 blas xSYR2 routine).
Note that it is already used in Tridiagonalization.
2009-07-11 21:14:59 +02:00
Gael Guennebaud
ec5c608aa3 Set of fixes and workaround to make sun studio more happy.
Still remains the problem of alignment and vectorization.
2009-07-10 16:10:03 +02:00
Gael Guennebaud
1aea45335f * bybye Part, welcome TriangularView and SelfAdjointView.
* move solveTriangular*() to TriangularView::solve*()
* move .llt() to SelfAdjointView
* add a high level wrapper to the efficient selfadjoint * vector product
* improve LLT so that we can specify which triangular part is meaningless
=> there are still many things to do (doc, cleaning, improve the matrix products, etc.)
2009-07-06 23:43:20 +02:00
Gael Guennebaud
c6f610093b add a VectorBlock expr as a specialization of Block 2009-07-05 11:33:55 +02:00
Benoit Jacob
6809f7b1cd new implementation of diagonal matrices and diagonal matrix expressions 2009-06-28 21:27:37 +02:00
Benoit Jacob
7667a93cbe merge 2009-05-22 20:31:26 +02:00
Benoit Jacob
6347b1db5b remove sentence "Eigen itself is part of the KDE project."
it never made very precise sense. but now does it still make any?
2009-05-22 20:25:33 +02:00
Gael Guennebaud
dd45c4805c * add a writable generic coeff wise expression (CwiseUnaryView)
* add writable .real() and .imag() functions
2009-05-20 15:41:23 +02:00
Benoit Jacob
9afd1324fd constant Diagonal ---> DiagonalBits
introduce ei_is_diagonal to check for it
DiagonalCoeffs ---> Diagonal and allow Index to by Dynamic
-> add MatrixBase::diagonal(int) with unittest and doc
2009-05-10 16:24:39 +00:00
Benoit Jacob
0c0d38272e add copyright on two public headers that are not so trivial... 2009-05-06 15:48:28 +00:00
Benoit Jacob
8aa8854bbf fix SSE2 detection on win64, reported by 'kajala' 2009-05-04 12:13:37 +00:00
Benoit Jacob
95bda5e6ab let the user disable alignment altogether by #defining EIGEN_DONT_ALIGN.
Until now, the user had to edit the source code to do that.
Internally, add EIGEN_ALIGN that takes into account both EIGEN_DONT_ALIGN.and
EIGEN_ARCH_WANTS_ALIGNMENT. From now on, only EIGEN_ALIGN should be used to
test whether we want to align.
2009-05-03 13:50:56 +00:00
Gael Guennebaud
49fc1e3e84 add vectorization of sqrt for float 2009-03-27 14:41:46 +00:00
Gael Guennebaud
17860e578c add SSE2 versions of sin, cos, log, exp using code from Julien
Pommier. They are for float only, and they return exactly the same
result as the standard versions in about 90% of the cases. Otherwise the max error
is below 1e-7. However, for very large values (>1e3) the accuracy of sin and cos
slighlty decrease. They are about 3 or 4 times faster than 4 calls to their respective
standard versions. So, is it ok to enable them by default in their respective functors ?
2009-03-25 12:26:13 +00:00
Gael Guennebaud
31332fca0b remove bad #include of SelfadjointRank2Update.h 2009-03-05 10:29:20 +00:00
Gael Guennebaud
0be89a4796 big addons:
* add Homogeneous expression for vector and set of vectors (aka matrix)
  => the next step will be to overload operator*
* add homogeneous normalization (again for vector and set of vectors)
* add a Replicate expression (with uni-directional replication
  facilities)
=> for all of them I'll add examples once we agree on the API
* fix gcc-4.4 warnings
* rename reverse.cpp array_reverse.cpp
2009-03-05 10:25:22 +00:00
Gael Guennebaud
6a26506341 add ReturnByValue pseudo expression for in-place evaluation with a
return-by-value API style (will soon use it for the transform products)
2009-03-04 13:00:00 +00:00
Gael Guennebaud
de014efdaf * split CacheFriendlyProduct into multiple smaller files
* add an efficient selfadjoint * vector implementation (= blas symv)
  perf are inbetween MKL and GOTO
  => the interface is still missing (have to be rethougth)
2009-02-21 20:20:38 +00:00
Gael Guennebaud
51c991af45 * exit Sum.h, exit Prod.h, welcome vectorization of redux() !
* add vectorization for minCoeff and maxCoeff
2009-02-12 15:18:59 +00:00
Gael Guennebaud
cbbc6d940b * add ei_predux_mul internal function
* apply Ricard Marxer's prod() patch with fixes for the vectorized path
2009-02-10 18:06:05 +00:00
Gael Guennebaud
6fbca94803 apply Ricard patch for Reverse with minor modifications 2009-02-06 09:01:50 +00:00
Benoit Jacob
dcaa58744e #error if min or max is defined 2009-01-19 13:23:41 +00:00
Benoit Jacob
50ad8b9010 fix potential compilation issue on MSVC + no vectorization 2009-01-10 14:10:40 +00:00
Kenneth Frank Riddile
f52a9e5315 * Added aligned_allocator for using 16-byte aligned types with STL containers. There is still a compile-time problem with STL containers that have a standard-conformant resize() method, but this should resolve the original user issue which was storing aligned objects in a std::map. 2009-01-09 00:55:53 +00:00
Benoit Jacob
8106d35408 Patch by Kenneth Riddile: disable MSVC warnings, reenable them outside
of Eigen, and add a MSVC-friendly path in StaticAssert.
2008-12-18 20:48:02 +00:00
Benoit Jacob
38b83b4157 * throw bad_alloc if exceptions are enabled, after patch by Kenneth Riddile
* disable vectorization on MSVC 2005, as it doesn't have all the required intrinsics. require 2008.
2008-12-16 15:17:29 +00:00
Benoit Jacob
0a220721d1 Finally work around enough of MSVC preprocessor dumbness so that it actually detects SSE2 2008-12-15 21:20:40 +00:00
Benoit Jacob
dd139b92b4 work around the braindead msvc preprocessor 2008-12-15 17:16:22 +00:00
Benoit Jacob
11c8a6bf63 Fix detection of SSE2 with MSVC. 2008-12-15 16:14:54 +00:00
Benoit Jacob
703951d5cd Fix memory alignment (hence vectorization) on MSVC thanks to help from Armin Berres. 2008-12-15 15:54:33 +00:00
Gael Guennebaud
80be1ea515 remove CoreDeclaration from the documentation 2008-08-28 19:11:03 +00:00
Gael Guennebaud
3ced3f91c2 * temporarily remove doxygen customization, we'll see if that fix api.kde.org
but I no hope, that would be too simple !
* added Rotation2D typedefs
* remove CoreDeclarations header file
2008-08-28 15:28:23 +00:00
Gael Guennebaud
70266b4d05 doc + quick bug fix in Matrix ctor 2008-08-28 00:33:58 +00:00
Gael Guennebaud
63d3ef8204 * remove debug code commited by mistake in Assign
* keep going on the doc: added a short geometry tutorial
2008-08-26 23:07:33 +00:00
Gael Guennebaud
00a8d314c5 * move memory related stuff to util/Memory.h
* clean ugly doxygen inheritence of expressions
* keep improving the documentation... slowly !
2008-08-26 19:12:23 +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
Gael Guennebaud
b13148c358 renamed inverseProduct => solveTriangular 2008-08-09 20:06:25 +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
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
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
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
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
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
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
dc9206cec5 split sum away from redux and vectorize it.
(could come back to redux after it has been vectorized,
and could serve as a starting point for that)
also make the abs2 functor vectorizable (for real types).
2008-06-23 10:32:48 +00:00
Gael Guennebaud
0ee6b08128 * split Product to a DiagonalProduct template specialization
to optimize matrix-diag and diag-matrix products without
  making Product over complicated.
* compilation fixes in Tridiagonalization and HessenbergDecomposition
  in the case of 2x2 matrices.
* added an Orientation2D small class with similar interface than Quaternion
  (used by Transform to handle 2D and 3D orientations seamlessly)
* added a couple of features in Transform.
2008-06-15 11:54:18 +00:00
Gael Guennebaud
f07f907810 Add QR and Cholesky module instantiations in the lib.
To try it with the unit tests set the cmake variable TEST_LIB to ON.
2008-06-14 13:02:41 +00:00
Benoit Jacob
ac88feebb7 work around Doxygen bug triggered by r814874, which caused many classes to disappear
from the docs.
2008-06-02 19:29:23 +00:00
Gael Guennebaud
64169389ed added an *optional* Eigen2 dynamic library.
it allows the possiblity to save some compilation time by linking to it
*and* defining the token EIGEN_EXTERN_INSTANCIATIONS
2008-05-31 23:21:49 +00:00
Gael Guennebaud
310f7aa096 moved purely "array" related stuff to a new module Array.
This include:
 - cwise Pow,Sin,Cos,Exp...
 - cwise Greater and other comparison operators
 - .any(), .all() and partial reduction
 - random
2008-05-31 18:11:48 +00:00
Gael Guennebaud
e2ac5d244e Added ArrayBit to get the ability to manipulate a Matrix like a simple scalar.
In particular this flag changes the behavior of operator* to a coeff wise product.
2008-05-29 22:33:07 +00:00
Benoit Jacob
f54760c889 hehe, the complicated nesting scheme in Flagged in the previous commit
was a sign that we were doing something wrong. In fact, having
NestByValue as a special case of Flagged was wrong, and the previous
commit, while not buggy, was inefficient because then when the resulting
NestByValue xpr was nested -- hence copied -- the original xpr which was
already nested by value was copied again; hence instead of 1 copy we got
3 copies.
The solution was to ressuscitate the old Temporary.h (renamed
NestByValue.h) as it was the right approach.
2008-05-28 05:14:16 +00:00
Benoit Jacob
aebecae510 * find the proper way of nesting the expression in Flagged:
finally that's more subtle than just using ei_nested, because when
  flagging with NestByValueBit we want to store the expression by value
  already, regardless of whether it already had the NestByValueBit set.
* rename temporary() ----> nestByValue()
* move the old Product.h to disabled/, replace by what was ProductWIP.h
* tweak -O and -g flags for tests and examples
* reorder the tests -- basic things go first
* simplifications, e.g. in many methoeds return derived() and count on
  implicit casting to the actual return type.
* strip some not-really-useful stuff from the heaviest tests
2008-05-28 04:38:16 +00:00
Benoit Jacob
5aa00f6870 part 2 of big change: rename Triangular.h -> Extract.h
(svn required to commit that separately)
2008-05-27 05:50:36 +00:00
Benoit Jacob
953efdbfe7 - introduce Part and Extract classes, splitting and extending the former
Triangular class
- full meta-unrolling in Part
- move inverseProduct() to MatrixBase
- compilation fix in ProductWIP: introduce a meta-selector to only do
  direct access on types that support it.
- phase out the old Product, remove the WIP_DIRTY stuff.
- misc renaming and fixes
2008-05-27 05:47:30 +00:00
Benoit Jacob
5da60897ab Introduce generic Flagged xpr, remove already Lazy.h and Temporary.h
Rename DefaultLostFlagMask --> HerediraryBits
2008-05-14 08:20:15 +00:00
Gael Guennebaud
4317fad869 * Added several cast to int of the enums (needed for some compilers)
* Fix a mistake in CwiseNullary.
* Added a CoreDeclarions header that declares only the forward declarations
  and related basic stuffs.
2008-05-12 18:09:30 +00:00
Benoit Jacob
678f18fce4 put inline keywords everywhere appropriate. So we don't need anymore to pass
-finline-limit=1000 to gcc to get good performance. By the way some cleanup.
2008-05-12 17:34:46 +00:00
Gael Guennebaud
45cda6704a * Draft of a eigenvalues solver
(does not support complex and does not re-use the QR decomposition)

* Rewrite the cache friendly product to have only one instance per scalar type !
  This significantly speeds up compilation time and reduces executable size.
  The current drawback is that some trivial expressions might be
  evaluated like conjugate or negate.

* Renamed "cache optimal" to "cache friendly"

* Added the ability to directly access matrix data of some expressions via:
  - the stride()/_stride() methods
  - DirectAccessBit flag (replace ReferencableBit)
2008-05-12 10:23:09 +00:00
Benoit Jacob
dca416cace move arch-specific code to arch/SSE and arch/AltiVec subdirs.
rename the noarch PacketMath.h to DummyPacketMath.h
2008-05-12 08:30:42 +00:00
Benoit Jacob
3562b01105 * Give Konstantinos a copyright line
* Fix compilation of Inverse.h with vectorisation
* Introduce EIGEN_GNUC_AT_LEAST(x,y) macro doing future-proof (e.g. gcc v5.0) check
* Only use ProductWIP if vectorisation is enabled
* rename EIGEN_ALWAYS_INLINE -> EIGEN_INLINE with fall-back to inline keyword
* some cleanup/indentation
2008-05-12 08:12:40 +00:00
Benoit Jacob
4f6d7abc87 only include SSE3 headers if compiling with SSE3 support 2008-05-08 09:15:16 +00:00
Gael Guennebaud
bf5326c3ca * Added ReferencableBit flag to known if coeffRef is available.
(needed by the new product implementation)
* Make the packet* members template to support aligned and unaligned
  access. This makes Block vectorizable. Combined with ReferencableBit,
  we should be able to determine at runtime (in some specific cases) if
  an aligned vectorization is possible or not.
* Improved the new product implementation to robustly handle all cases,
  it now passes all the tests.
* Renamed the packet version ei_predux to ei_preduxp to avoid name collision.
2008-05-08 08:12:52 +00:00