Commit Graph

714 Commits

Author SHA1 Message Date
Gael Guennebaud
2126baf9dc add an optimized path for the tridiagonalization of a 3x3 matrix.
(useful for plane fitting, and covariance analysis of 3D data)
2008-06-04 13:41:32 +00:00
Gael Guennebaud
48262b9734 added a static assertion mechanism
(see notes in Core/util/StaticAssert.h for details)
2008-06-04 11:16:11 +00:00
Gael Guennebaud
a0cff1a295 fix eigenvectors computations :) 2008-06-03 18:03:55 +00:00
Gael Guennebaud
915587d03d * add CommaInitializer::finished to allow the use of (Matrix3() << v0, v1, v2).finished()
as an argument of a function. Other possibilities for the name could be "end" or "matrix" ??
* various update in Quaternion, in particular I added a lot of FIXME about the API options,
  these have to be discussed and fixed.
2008-06-03 15:50:09 +00:00
Gael Guennebaud
196f38f5db improved Quaternion class:
- Euler angles and angle axis conversions,
 - stable spherical interpolation
 - documentation
 - update the respective unit test
2008-06-03 13:43:29 +00:00
Gael Guennebaud
a9cf229e15 add a geometry unit test and fix a couple of typo in Quaternion.h 2008-06-03 07:32:12 +00:00
Benoit Jacob
8de4d92b70 - get the doc of the enums in MatrixBase right
- get the doc of the flags in Constants right
- finally give up with SEPARATE_MEMBER_PAGES: it triggers too big
  Doxygen bugs, and produces too many small pages. So we have one
  huge page for MatrixBase at currently 300kb and going up, so the
  solution especially for users with low bandwidth will be to provide
  an archive of the html documentation.
2008-06-03 02:06:18 +00:00
Gael Guennebaud
366971bea4 * start of the Geometry module with a cross product and quaternion expressions
(haven't tried them yet)
* applied the meta selector rule to MatrixBase::swap()
2008-06-02 22:58:36 +00:00
Benoit Jacob
75de41a00b big changes in Doxygen configuration; work around bug with doxygen parsing of
initialized enum values showing the last word the initializer instead of the actual
enum value's name; add some more docs.
2008-06-02 20:08:37 +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
54ae2ac7e8 Added the computation of eigen vectors in the symmetric eigen solver.
However the eigen vectors are not correct yet, but I really cannot find the
problem.
2008-06-02 12:52:08 +00:00
Benoit Jacob
3b0523041a since m*m.adjoint() is positive, so are its eigenvalues, so no need for
cwiseAbs()
2008-06-02 04:45:02 +00:00
Benoit Jacob
0444e3601a - add MatrixBase::eigenvalues() convenience method
- add MatrixBase::matrixNorm(); in the non-selfadjoint case, we reduce to the
  selfadjoint case by using the "C*-identity" a.k.a.
	norm of x = sqrt(norm of x * x.adjoint())
2008-06-02 04:42:45 +00:00
Benoit Jacob
92b7e2d6a1 fix a couple of issues making the eigensolver test compile and run without aborting
on an assert. Had to fix a stupid bug in Block -- very strange we hadn't hit it
before.

However the test still fails.
2008-06-02 02:06:33 +00:00
Gael Guennebaud
001b01a290 Rewrite from scratch of the eigen solver for symmetric matrices
which now supports selfadjoint matrix. The implementation follows
Golub's famous book.
2008-06-02 00:30:26 +00:00
Gael Guennebaud
06752b2b77 * added a Tridiagonalization class for selfadjoint matrices
* added MatrixBase::real()
* added the ability to extract a selfadjoint matrix from the
  lower or upper part of a matrix, e.g.:
    m.extract<Upper|SelfAdjoint>()
  will ignore the strict lower part and return a selfadjoint.
  This is compatible with ZeroDiag and UnitDiag.
2008-06-01 17:20:18 +00:00
Benoit Jacob
dc5fd8dfff meagre outcome for so much time spent!
* fix inverse() bug discovered by Gael's test
* fix warnings introduced by the new Diagonal stuff
* update Doxyfile to v1.5.6
2008-06-01 03:36:49 +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
fcf4457b78 added optimized matrix times diagonal matrix product via Diagonal flag shortcut. 2008-05-31 21:35:11 +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
a2f71f9d7e updated EigenSolver to use .coeff / .coeffRef 2008-05-31 16:31:10 +00:00
Gael Guennebaud
c9fb248c36 simply a bit the basic product moving dynamic loops
to the corresponding special case of the unrollers.
the latter ones are therefore re-named *product_impl.
2008-05-31 15:06:26 +00:00
Gael Guennebaud
f5e599e489 * replace compile-time-if by meta-selector in Assign.h
as it speed up compilation.
* fix minor typo introduced in the previous commit
2008-05-31 14:42:07 +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
b501e08d81 now the unit-tests (hence all of Eigen) don't depend on Qt at all
anymore.
2008-05-29 03:37:16 +00:00
Benoit Jacob
486fdb26a1 many small fixes and documentation improvements,
this should be alpha5.
2008-05-29 03:12:30 +00:00
Gael Guennebaud
c1559d3079 * updated the assignement operator macro so that overloads
in MatrixBase work
* removed product_selector and cleaned Product.h a bit
* cleaned Assign.h a bit
2008-05-28 22:56:19 +00:00
Gael Guennebaud
8711e26c8a * change Flagged to take into account NestByValue only
* bugfix in Assign and cache friendly product (weird that worked before)
* improved argument evaluation in Product
2008-05-28 22:11:47 +00:00
Gael Guennebaud
73084dc754 * added _*coeffRef members in NestedByValue
* added ConjugateReturnType and AdjointReturnType that are type-defined to Derived&
  and Transpose<Derived> if the scalar type is not complex: this avoids abusive copies in
  the cache friendly Product
2008-05-28 09:09:18 +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
Gael Guennebaud
559233c73e * fix the QR module to use extract/part instead of the previous triangular stuff
* added qr and eigensolver tests
* fix a compilation warning in Matrix copy constructor
2008-05-27 09:16:27 +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
Gael Guennebaud
8f1fc80a77 some documentation fixes (Cwise* and Cholesky) 2008-05-22 16:31:00 +00:00
Gael Guennebaud
94e1629a1b * improved product performance:
- fallback to normal product for small dynamic matrices
 - overloaded "c += (a * b).lazy()" to avoid the expensive and useless temporary and setZero()
   in such very common cases.
* fix a couple of issues with the flags
2008-05-22 14:51:25 +00:00
Gael Guennebaud
9ab6e186eb remove Like1DArrayBit in Transpose 2008-05-22 12:25:11 +00:00
Gael Guennebaud
c6789a279c Fix compilation issues with MSVC and NVCC.
Added a few typedef of complex return types in MatrixBase (Needed by MSVC)
2008-05-15 09:40:11 +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
fd2e9e5c3c * Clean a bit the eigenvalue solver: if the matrix is known to be
selfadjoint at compile time, then it returns real eigenvalues.
* Fix a couple of bugs with the new product.
2008-05-13 07:40:25 +00:00
Benoit Jacob
3eccfd1a78 -fix certain #includes
-fix CMakeLists, public headers weren't getting installed
2008-05-12 21:15:17 +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
Gael Guennebaud
64c49de7ba * split PacketMath.h to SSE and Altivec specific files
* improved the flexibility of the new product implementation,
  now all sizes seems to be properly handled.
2008-05-05 17:19:47 +00:00
Gael Guennebaud
46fa4c713f * Started support for unaligned vectorization.
* Introduce a new highly optimized matrix-matrix product for large
  matrices. The code is still highly experimental and it is activated
  only if you define EIGEN_WIP_PRODUCT at compile time.
  Currently the third dimension of the product must be a factor of
  the packet size (x4 for floats) and the right handed side matrix
  must be column major.
  Moreover, currently c = a*b; actually computes c += a*b !!
  Therefore, the code is provided for experimentation purpose only !
  These limitations will be fixed soon or later to become the default
  product implementation.
2008-05-05 10:23:29 +00:00
Benoit Jacob
8c6007f80e * Patch by Konstantinos Margaritis: AltiVec vectorization.
* Fix several warnings, temporarily disable determinant test.
2008-05-03 12:21:23 +00:00
Gael Guennebaud
0545df2149 slighly improved the cache friendly product to use mul-add only 2008-05-03 10:01:30 +00:00
Gael Guennebaud
a6655dd91a added packet mul-add function (ei_pmad) and updated Product to use it.
this change nothing for current SSE architecture but might be helpful
for altivec/cell and up comming AMD processors.
2008-05-03 00:45:08 +00:00
Gael Guennebaud
102e029dad Removed ei_pload1, use posix_memalign to allocate aligned memory,
and make Product ok when only one side is vectorizable (and the product
is still vectorized)
2008-05-02 13:30:12 +00:00
Benoit Jacob
890a8de962 Make products always eval into expressions. Improves performance
in benchmark. Still not as fasts as explicit eval(), strangely.
2008-05-02 08:53:23 +00:00
Gael Guennebaud
ef5b20bc50 fix flag and cost computations for nested expressions 2008-05-01 18:58:30 +00:00
Gael Guennebaud
5588def0cf nullary xpr are now vectorized 2008-05-01 14:28:53 +00:00
Gael Guennebaud
02f1615d2a Enable vectorization of product with dynamic matrices,
extended cache optimal product to work in any row/column
major situations, and a few bugfixes (forgot to add the
Cholesky header, vectorization of CwiseBinary)
2008-05-01 13:53:05 +00:00
Gael Guennebaud
6486991ac3 some cleaning in Cholesky and removed evil ei_sqrt of complex 2008-04-27 18:57:28 +00:00
Gael Guennebaud
64bacf1c3f * added ei_sqrt for complex
* updated Cholesky to support complex
* correct result_type for abs and abs2 functors
2008-04-27 14:05:40 +00:00
Gael Guennebaud
4ffffa670e added Cholesky module 2008-04-27 10:57:32 +00:00
Gael Guennebaud
1ec2d21ca5 Fixed a couple of issues introduced in previous commits.
Added a test for Triangular.
2008-04-26 20:28:27 +00:00
Gael Guennebaud
b4c974d059 Added triangular assignement, e.g.:
m.upper() = a+b;
only updates the upper triangular part of m.
Note that:
 m = (a+b).upper();
updates all coefficients of m (but half of the additions
will be skiped)

Updated back/forward substitution to better use Eigen's capability.
2008-04-26 19:20:26 +00:00
Gael Guennebaud
4c92150676 Added Triangular expression to extract upper or lower (strictly or not)
part of a matrix. Triangular also provide an optimised method for forward
and backward substitution. Further optimizations regarding assignments and
products might come later.

Updated determinant() to take into account triangular matrices.

Started the QR module with a QR decompostion algorithm.
Help needed to build a QR algorithm (eigen solver) based on it.
2008-04-26 18:26:05 +00:00
Gael Guennebaud
62bf0bbd59 fix a bug in determinant of 4x4 matrices and a small type issue in Inverse 2008-04-26 08:56:52 +00:00
Gael Guennebaud
6f2c72fb53 Various fixes in:
- vector to vector assign
 - PartialRedux
 - Vectorization criteria of Product
 - returned type of normalized
 - SSE integer mul
2008-04-25 23:10:37 +00:00
Gael Guennebaud
a451835bce Make the explicit vectorization much more flexible:
- support dynamic sizes
 - support arbitrary matrix size when the matrix can be seen as a 1D array
   (except for fixed size matrices where the size in Bytes must be a factor of 16,
    this is to allow compact storage of a vector of matrices)
Note that the explict vectorization is still experimental and far to be completely tested.
2008-04-25 15:46:18 +00:00
Gael Guennebaud
30d47b5250 forgot to add a file in the previous commit 2008-04-24 20:25:55 +00:00
Gael Guennebaud
9385793f71 Fix a couple of issue with the vectorization. In particular, default ei_p* functions
are provided to handle not suported types seemlessly.

Added a generic null-ary expression with null-ary functors. They replace
Zero, Ones, Identity and Random.
2008-04-24 18:35:39 +00:00
Benoit Jacob
6ae037dfb5 give up on OpenMP... for now 2008-04-18 07:57:46 +00:00
Benoit Jacob
acfd6f3bda - add _packetCoeff() to Inverse, allowing vectorization.
- let Inverse take template parameter MatrixType instead
  of ExpressionType, in order to reduce executable code size
  when taking inverses of xpr's.
- introduce ei_corrected_matrix_flags : the flags template
  parameter to the Matrix class is only a suggestion. This
  is also useful in ei_eval.
2008-04-16 07:18:27 +00:00
Benoit Jacob
43e2bc14fe +5% optimization in 4x4 inverse:
-only evaluate block expressions for which that is beneficial
-don't check for invertibility unless requested
2008-04-15 20:39:27 +00:00
Benoit Jacob
6747b45ae7 for 4x4 matrices implement the special algorithm that Markos proposed,
falling back to the general algorithm in the bad case.
2008-04-15 20:15:36 +00:00
Benoit Jacob
2a86f052a5 - optimized determinant calculations for small matrices (size <= 4)
(only 30 muls for size 4)
- rework the matrix inversion: now using cofactor technique for size<=3,
  so the ugly unrolling is only used for size 4 anymore, and even there
  I'm looking to get rid of it.
2008-04-14 17:07:12 +00:00
Benoit Jacob
9789c04467 when evaluating an xpr, the result can now be vectorizable
even if the xpr itself wasn't vectorizable.
2008-04-14 08:55:12 +00:00
Benoit Jacob
ea3ccb1e8c * Start of the LU module, with matrix inversion already there and
fully optimized.
* Even if LargeBit is set, only parallelize for large enough objects
  (controlled by EIGEN_PARALLELIZATION_TRESHOLD).
2008-04-14 08:20:24 +00:00
Benoit Jacob
ab4046970b * Add fixed-size template versions of corner(), start(), end().
* Use them to write an unrolled path in echelon.cpp, as an
  experiment before I do this LU module.
* For floating-point types, make ei_random() use an amplitude
  of 1.
2008-04-12 17:37:27 +00:00
Benoit Jacob
dcebc46cdc - cleaner use of OpenMP (no code duplication anymore)
using a macro and _Pragma.
- use OpenMP also in cacheOptimalProduct and in the
  vectorized paths as well
- kill the vector assignment unroller. implement in
  operator= the logic for assigning a row-vector in
  a col-vector.
- CMakeLists support for building tests/examples
  with -fopenmp and/or -msse2
- updates in bench/, especially replace identity()
  by ones() which prevents underflows from perturbing
  bench results.
2008-04-11 14:28:42 +00:00
Benoit Jacob
7bee90a62a Merge Gael's experimental OpenMP parallelization support into Assign.h. 2008-04-11 08:18:47 +00:00
Gael Guennebaud
187b1543ce added a vectorized version of Product::_cacheOptimalProduct,
added the possibility to disable the vectorization using EIGEN_DONT_VECTORIZE
(some architectures has SSE support by default)
2008-04-10 12:34:22 +00:00
Benoit Jacob
613c49b475 * add typedefs for matrices/vectors with LargeBit
* add -pedantic to CXXFLAGS
* cleanup intricated expressions with && and ||
  which gave warnings because of "missing" parentheses
* fix compile error in NumTraits, apparently discovered
  by -pedantic
2008-04-10 10:33:50 +00:00
Benoit Jacob
ca448d2537 split those files in util/
some more renaming
2008-04-10 09:41:13 +00:00
Benoit Jacob
9d8876ce82 * rename XprCopy -> Nested
* rename OperatorEquals -> Assign
* move Util.h and FwDecl.h to a util/ subdir
2008-04-10 09:01:28 +00:00
Gael Guennebaud
212da8ffe0 fix priority operator bugs in the computation
of the VectorizableBit flag, now benchmark.cpp is properly vectorized
2008-04-09 18:24:13 +00:00
Gael Guennebaud
8f957564ec a better bugfix in ei_matrix_operator_equals_packet_unroller 2008-04-09 18:04:26 +00:00
Gael Guennebaud
d95d952e92 bugfix in ei_matrix_operator_equals_packet_unroller 2008-04-09 17:44:59 +00:00
Gael Guennebaud
1985fb0551 Added initial experimental support for explicit vectorization.
Currently only the following platform/operations are supported:
 - SSE2 compatible architecture
 - compiler compatible with intel's SSE2 intrinsics
 - float, double and int data types
 - fixed size matrices with a storage major dimension multiple of 4 (or 2 for double)
 - scalar-matrix product, component wise: +,-,*,min,max
 - matrix-matrix product only if the left matrix is vectorizable and column major
   or the right matrix is vectorizable and row major, e.g.:
   a.transpose() * b is not vectorized with the default column major storage.
To use it you must define EIGEN_VECTORIZE and EIGEN_INTEL_PLATFORM.
2008-04-09 12:31:55 +00:00
Benoit Jacob
4920f2011e finish making use of CoeffReadCost and the new XprCopy everywhere
seems appropriate to me.
2008-04-08 14:15:01 +00:00
Benoit Jacob
371d302efb - merge ei_xpr_copy and ei_eval_if_needed_before_nesting
- make use of CoeffReadCost to determine when to unroll the loops,
  for now only in Product.h and in OperatorEquals.h
performance remains the same: generally still not as good as before the
big changes.
2008-04-06 18:01:03 +00:00
Benoit Jacob
30ec34de36 fix compilation (finish removal of EIGEN_UNROLLED_LOOPS) 2008-04-05 14:20:30 +00:00
Benoit Jacob
61e58cf602 fixes as discussed with Gael on IRC. Mainly, in Fuzzy.h, and Dot.h, use
ei_xpr_copy to evaluate args when needed. Had to introduce an ugly
trick with ei_unref as when the XprCopy type is a reference one can't
directly access member typedefs such as Scalar.
2008-04-05 14:15:02 +00:00
Gael Guennebaud
b4a156671f * make use of the EvalBeforeNestingBit and EvalBeforeAssigningBit
in ei_xpr_copy and operator=, respectively.
 * added Matrix::lazyAssign() when EvalBeforeAssigningBit must be skipped
   (mainly internal use only)
 * all expressions are now stored by const reference
 * added Temporary xpr: .temporary() must be called on any temporary expression
   not directly returned by a function (mainly internal use only)
 * moved all functors in the Functors.h header
 * added some preliminaries stuff for the explicit vectorization
2008-04-05 11:10:54 +00:00
Gael Guennebaud
048910caae * added cwise comparisons
* added "all" and "any" special redux operators
 * added support bool matrices
 * added support for cost model of STL functors via ei_functor_traits
  (By default ei_functor_traits query the functor member Cost)
2008-04-03 18:13:27 +00:00
Benoit Jacob
249dc4f482 current state of the mess. One line fails in the tests, and
useless copies are made when evaluating nested expressions.
Changes:
- kill LazyBit, introduce EvalBeforeNestingBit and EvalBeforeAssigningBit
- product and random don't evaluate immediately anymore
- eval() always evaluates
- change the value of Dynamic to some large positive value,
  in preparation of future simplifications
2008-04-03 16:54:19 +00:00
Benoit Jacob
b8900d0b80 More clever evaluation of arguments: now it occurs in earlier, in operator*,
before the Product<> type is constructed. This resets template depth on each
intermediate evaluation, and gives simpler code. Introducing
ei_eval_if_expensive<Derived, n> which evaluates Derived if it's worth it
given that each of its coeffs will be accessed n times. Operator*
uses this with adequate values of n to evaluate args exactly when needed.
2008-04-03 14:17:56 +00:00
Gael Guennebaud
4448f2620d fix a compilation issue with gcc-3.3 and ei_result_of 2008-04-03 12:39:39 +00:00
Benoit Jacob
d1a29d6319 -new: recursive costs system, useful to determine automatically
when to evaluate arguments and when to meta-unroll.
-use it in Product to determine when to eval args. not yet used
 to determine when to unroll. for now, not used anywhere else but
 that'll follow.
-fix badness of my last commit
2008-04-03 11:10:17 +00:00
Benoit Jacob
e74fbfb2bc - remove Eval/EvalOMP (moving them to a disabled/ subdir in order
to preserve SVN history). They are made useless by the new
  ei_eval_unless_lazy.
- introduce a generic Eval member typedef so one can do e.g.
  T t; U u; Product<T, U>::Eval m; m = t*u;
2008-03-31 17:24:09 +00:00
Benoit Jacob
cff5e3ce9c Make use of the LazyBit, introduce .lazy(), remove lazyProduct. 2008-03-31 16:20:06 +00:00
Benoit Jacob
f279162ec4 * introducte recursive Flags system for the expressions
-- currently 3 flags: RowMajor, Lazy and Large
 -- only RowMajor actually used for now
* many minor improvements
2008-03-30 18:43:22 +00:00
Benoit Jacob
758b26551a * fix compilation with gcc-4.0 which doesn't like "using" too much
* add Eigen:: in some macros to allow using them from outside
  of namespace Eigen
Problems and solutions communicated by Gael.
2008-03-29 16:48:04 +00:00
Benoit Jacob
c9b0dcd733 look at that subtle difference in Product.h...
the cacheOptimal is only good for large enough matrices.
When taking a block in a fixed-size (hence small) matrix,
the SizeAtCompileTime is Dynamic hence that's not a good
indicator. This example shows that the good indicator is
MaxSizeAtCompileTime.
Result: +10% speed in echelon.cpp
2008-03-26 09:29:29 +00:00
Benoit Jacob
a994e51c96 * add Gael copyright lines on 2 more files
* macro renaming: EIGEN_NDEBUG becomes EIGEN_NO_DEBUG
  as this is much better (and similar to Qt) and
  EIGEN_CUSTOM_ASSERT becomes EIGEN_USE_CUSTOM_ASSERT
* protect Core header by a EIGEN_CORE_H
2008-03-26 09:13:11 +00:00
Benoit Jacob
729618c945 * #define EIGEN_NDEBUG now also disables asserts. Useful
to disable eigen's asserts without disabling one's own program's
  asserts. Notice that Eigen code should now use ei_assert()
  instead of assert().
* Remove findBiggestCoeff() as it's now almost redundant.
* Improve echelon.cpp: inner for loop replaced by xprs.
* remove useless "(*this)." here and there. I think they were
  first introduced by automatic search&replace.
* fix compilation in Visitor.h (issue triggered by echelon.cpp)
* improve comment on swap().
2008-03-26 08:48:04 +00:00
Gael Guennebaud
4342f024d9 * support for matrix-scalar quotient with integer scalar types.
* added cache efficient matrix-matrix product.
   - provides a huge speed-up for large matrices.
   - currently it is enabled when an explicit unrolling is not possible.
2008-03-21 20:26:14 +00:00
Benoit Jacob
0ef1efdbdb * cleanup: in public api docs, don't put \sa links to \internal things.
(the global funcs in MathFunctions.h and Fuzzy.h don't count as internal).
* Mainpage.dox. Add a few prospective Eigen users; change the recommended
  -finline-limit from 10000 to 1000. The reason is: it could be harmful to have
  a too big value here, couldn't it? (e.g. exceedingly large executables, cache
  misses). Looking at gcc, a value of 900 would exactly mean "determine the inlining
  of all functions as if they were marked with 'inline' keyword". So a value of
  1000 seems a reasonable round number. In the benchmark that motivated this
  (TestEigenSolvers) a value of 400 is enough on my system.
2008-03-17 07:35:22 +00:00
Gael Guennebaud
612350e3f8 * Added a generic *redux* mini framework allowing custom redux operations
as well as partial redux (vertical or horizontal redux).
   Includes shortcuts for: sum, minCoeff and maxCoeff.
   There is no shortcut for the partial redux.

 * Added a generic *visitor* mini framework. A visitor is a custom object
   sequentially applied on each coefficient with knowledge of its value and
   coordinates.
   It is currentlly used to implement minCoeff(int*,int*) and maxCoeff(int*,int*).
   findBiggestCoeff is now a shortcut for "this->cwiseAbs().maxCoeff(i,j)"

 * Added coeff-wise min and max.
 * fixed an issue with ei_pow(int,int) and gcc < 4.3 or ICC
2008-03-16 14:36:25 +00:00
Benoit Jacob
29184ad27d - introduce sum() returning the sum of the coeffs of a vector
- reimplement trace() as just diagonal().sum()
- apidoc fixes
2008-03-15 11:05:38 +00:00
Benoit Jacob
fb3438e609 - expand MathFunctions.h to provide more functions, like exp, log...
- add cwiseExp(), cwiseLog()...
   --> for example, doing a gamma-correction on a bitmap image stored as
       an array of floats is a simple matter of:
         Eigen::Map<VectorXf> m = VectorXf::map(bitmap,size);
         m = m.cwisePow(gamma);
- apidoc improvements, reorganization of the \name's
- remove obsolete examples
- remove EIGEN_ALWAYS_INLINE on lazyProduct(), it seems useless.
2008-03-14 10:38:37 +00:00
Benoit Jacob
fe569b060c get rid of MatrixRef, simplifications. 2008-03-13 20:36:01 +00:00
Benoit Jacob
afc64f3332 a lot of renaming
internal classes: AaBb -> ei_aa_bb
IntAtRunTimeIfDynamic -> ei_int_if_dynamic
unify UNROLLING_LIMIT (there was no reason to have operator= use
a higher limit)
etc...
2008-03-13 09:33:26 +00:00
Gael Guennebaud
35bce20954 Removed Column and Row in favor of Block 2008-03-12 18:10:52 +00:00
Benoit Jacob
2ee68a074e generalized ei_traits<>.
Finally the importing macro is named EIGEN_BASIC_PUBLIC_INTERFACE
because it does not only import the ei_traits, it also makes the base class
a friend, etc.
2008-03-12 17:17:36 +00:00
Benoit Jacob
01572b9f54 big change: MatrixBase only takes one template parameter "Derived", the
template parameter "Scalar" is removed. This is achieved by introducting a
template <typename Derived> struct Scalar to achieve a forward-declaration of
the Scalar typedefs.
2008-03-10 17:23:11 +00:00
Gael Guennebaud
9d9d81ad71 * basic support for multicore CPU via a .evalOMP() which
internaly uses OpenMP if enabled at compile time.
 * added a bench/ folder with a couple benchmarks and benchmark tools.
2008-03-09 16:13:47 +00:00
Gael Guennebaud
f64311e07d Extended the comma initializer to support xpr on the right side:
Matrix3i mat; Vector2i vec(33,66);
  mat << vec.transpose(), 99,
         vec, Matrix2i::random();
2008-03-08 19:46:06 +00:00
Gael Guennebaud
721626dfc5 * Added support for a comma initializer: mat.block(i,j,2,2) << 1, 2, 3, 4;
If the number of coefficients does not match the matrix size, then an assertion is raised.
  No support for xpr on the right side for the moment.

* Added support for assertion checking. This allows to test that an assertion is indeed raised
  when it should be.

* Fixed a mistake in the CwiseUnary example.
2008-03-08 19:02:24 +00:00
Gael Guennebaud
138aad0ed0 * coefficient wise operators are more generic, with controllable result type.
- compatible with current STL's functors as well as with the extention proposal (TR1)
 * thanks to the above, Cast and ScalarMultiple have been removed
 * benchmark_suite is more flexible (compiler and matrix size)
2008-03-06 11:36:27 +00:00
Gael Guennebaud
8e0d548039 * Fix a compilation issue with large fixed-size matrices: the unrollers were always instanciated.
* the unrolling limits are configurable at compile time.
2008-03-05 13:18:19 +00:00
Benoit Jacob
861c6f4c9b renaming: ref() --> asArg() 2008-03-04 17:08:23 +00:00
Gael Guennebaud
f65cca5d1d * Eigen compiles with any GCC versions from, at least, 3.3 without the previous ugly hack :)
* Renamed the scalar functors with the "Scalar" prefix (instead of "Cwise")
2008-03-04 12:34:58 +00:00
Gael Guennebaud
46885d33bf Removed trailling spaces. 2008-03-03 11:02:52 +00:00
Gael Guennebaud
255689231d * Added generic unary operators (replace Opposite and Conjugate)
* functor templates are not template template parameter anymore
   (this allows to make templated functors !)
 * Main page: extented compiler discussion
 * A small hack to support gcc 3.4 and 4.0 (see the main page)
 * Fix a cast type issue in Cast
 * Various doxygen updates (mainly Cwise stuff and added doxygen groups
   in MatrixBase to split the huge memeber list, still not perfect though)
 * Updated Gael's email address
2008-03-03 10:52:44 +00:00
Benoit Jacob
ed20f64d68 release alpha4, Gael edition 2008-02-29 14:50:11 +00:00
Benoit Jacob
a2f8d4be6a Patch by Gael Guennebaud: coeff-wise binary operators.
This unifies + and - and moreover this patch introduces
coeff-wise * and / based on this. Also, corresponding test.
2008-02-29 14:35:14 +00:00
Benoit Jacob
f12e9c53ac Patch by Gael Guennebaud: unify fixed-size and dynamic-size Block
expressions, update documentation.
2008-02-29 13:56:40 +00:00
Benoit Jacob
b3268a6e2f -merge patch from Gael Guennebaud adding NumTraits for long long
and long double.
-define scalar-multiple operators only for the current Scalar type;
 thanks to Gael for expaining how to make the compiler understand
 when automatic casting is needed.
-take ScalarMultiple take only 1 template param, again.
 We lose some flexibility especially when dealing with complex numbers,
 but we gain a lot of extensibility to new scalar types.
2008-02-29 13:20:44 +00:00
Benoit Jacob
aa8e2bcbde Patch by Gael Guennebaud:
Rework the matrix storage to ensure optimal sizeof in all cases, while
keeping the decoupling of matrix sizes versus storage sizes.
Also fixing (recently introduced) bugs caused by unwanted
reallocations of the buffers.
2008-02-29 10:55:53 +00:00
Benoit Jacob
3698d8cf33 Relicense --> dual-license LGPL3+/GPL2+ 2008-02-28 15:44:45 +00:00
Benoit Jacob
6907886a15 prefix global functions with ei_ as previous solution was rather
fragile. also fix compilation with g++ 4.3.
2008-02-28 12:38:12 +00:00
Benoit Jacob
c67e717404 alpha 3.1. in this commit:
- finally get the Eval stuff right. get back to having Eval as
  a subclass of Matrix with limited functionality, and then,
  add a typedef MatrixType to get the actual matrix type.
- add swap(), findBiggestCoeff()
- bugfix by Ramon in Transpose
- new demo: doc/echelon.cpp
2008-01-15 13:55:47 +00:00
Benoit Jacob
9c9a42cc49 Eval is now implemented like the other expression types, it no longer
inherits Matrix. Remove the typedefs I added in Matrix.
2008-01-14 22:36:37 +00:00
Benoit Jacob
2ee7969f0a re-optimize Matrix::resize(), add some comments 2008-01-14 13:14:49 +00:00
Benoit Jacob
e20aceb6eb cleanup in Eval; instead introduce convenient typedefs in Matrix
for naming special related matrix types: RowType, ColumnType,
BlockType
2008-01-14 11:25:09 +00:00
Benoit Jacob
183bf54d27 final fixes and updates for alpha3 2008-01-13 23:38:48 +00:00
Benoit Jacob
57d7b7d97b documentation update for alpha 3 2008-01-13 23:17:51 +00:00
Benoit Jacob
6ce996f219 big improvement of the block-manipulation API
- reduction of sizeof(Block) for vector types
- variants of block() and fixedBlock() for vector blocks
- convenience methods start() and end() for vectors
- convenience method corner() for matrices
2008-01-13 22:48:57 +00:00
Benoit Jacob
95dc68dc86 renaming:
Block -> FixedBlock
DynBlock -> Block
indeed, previous commit solves the main issue with DynBlock so
is should now be the more commonly used one.
2008-01-13 20:19:14 +00:00
Benoit Jacob
89a134ba0b big architecture change dissociating "actual" dimensions from "maximum possible"
dimension. The advantage is that evaluating a dynamic-sized block in a fixed-size
matrix no longer causes a dynamic memory allocation. Other new thing:
IntAtRunTimeIfDynamic allows storing an integer at zero cost if it is known at
compile time.
2008-01-13 19:55:23 +00:00
Benoit Jacob
e05a1aba1d one bugfix and one optimization 2008-01-11 16:06:31 +00:00
Benoit Jacob
bcf7b29185 rework Identity API: no longer restricted to square matrices 2008-01-11 15:56:21 +00:00
Benoit Jacob
e092cbc75c -add set...() methods and their documentation; remove Generic
-use row-major traversal when the number of columns is fixed
 and the number of rows is dynamic
-other minor changes
2008-01-11 15:08:04 +00:00
Benoit Jacob
aae0667e1e reorganization/cleanup 2008-01-11 07:16:18 +00:00
Benoit Jacob
45a4b61b5f switch to enums everywhere 2008-01-10 20:45:35 +00:00
Benoit Jacob
47d354924b revert most of previous commit. It really is better to forbid default
constructor for dynamic-size matrices. Now why do I feel like a beheaded
chicken running around?
2008-01-08 10:39:36 +00:00
Benoit Jacob
b036eca902 Revert to allowing default Matrix constructor even for dynamic size (which is
then set to 1). Discussion with jonasp made me remember why we did so in Eigen1.
Also add default constructor to Eval
2008-01-07 21:19:36 +00:00
Benoit Jacob
8ba3055447 Ready for alpha2 release.
- complete documentation
- add TODO
- update copyright years
2008-01-07 09:34:21 +00:00
Benoit Jacob
5111ace0d6 move default parameter values from function definition to function declaration.
doxygen likes it and this fixes compilation on ICC.
2008-01-06 19:34:28 +00:00
Benoit Jacob
84934ea217 - move: DerivedTraits becomes MatrixBase::Traits
- the static constants are private again in the Derived classes
- more documentation and code snippets
- new isDiagonal() method
2008-01-06 16:35:21 +00:00
Benoit Jacob
aaf889e72b remove all the _Order mechanics, now we are always traversing matrices in
column-major order, even if storage is row-major. Benchmark showed that adapting
the traversal order to the storage order brought no benefit.

Also do some cleanup after Gael's big patch.
2008-01-06 13:57:29 +00:00
Benoit Jacob
495eb7053a Patch by Gael Guennebaud, making Eigen compatible with the Intel compiler (icc).
CCMAIL:eigen@lists.tuxfamily.org
2008-01-06 13:17:07 +00:00
Benoit Jacob
d1d55e67e9 - make MatrixBase and all expressions aware of their preferred traversal order.
Honor this preference in operator=.
- add several methods to the API
- rework API for diagonal matrices
- add benchmarking code
2008-01-05 10:57:14 +00:00
Benoit Jacob
23ffede3d0 more documentation, 12 more code snippets 2008-01-03 19:36:32 +00:00
Benoit Jacob
42f6590bb2 cleanup: remove copy contructors when the compiler is able to generate a satisfactory
default copy constructor; remove useless static_cast's; some misc cleanup.
2007-12-31 13:29:51 +00:00
Benoit Jacob
86220784b6 part 2 of the reorganization. Benefits/changes:
1) Eigen2 co-installable with Eigen1 without conflict, without affecting programs including either.
2) #include<Eigen/Core> without the .h without conflict with the Core/ directory
3) Uniformize coding style of the CMakeLists.
2007-12-28 16:20:00 +00:00
Benoit Jacob
dfdad129a3 move Core/ to a src/ subdir, in preparation for following changes 2007-12-28 16:00:55 +00:00
Benoit Jacob
e7bdbe2e6a matrix storage order can now also be row-dominant (choosable for each matrix separately)
map() moves from MatrixBase to Matrix
much more documentation/examples/snippets
2007-12-27 21:43:10 +00:00
Benoit Jacob
6b9370e0f0 more changes in ScalarMultiple, reintroduce FloatingPoint in NumTraits, improve
examples
2007-12-26 09:25:00 +00:00
Benoit Jacob
05a49547e1 in ScalarMultiple, make the factor type independent from the matrix scalar type.
This is an optimization for complex matrices, allowing to do only a real multiplication
when a complex multiplication is not needed, e.g. in normalized().
2007-12-26 08:30:21 +00:00
Benoit Jacob
dad245af56 - eigen2 now fully enforces constness! found a way to achieve that
with minimal code duplication. There now are only two (2)
  const_cast remaining in the whole source code.
- eigen2 now fully allows copying a row-vector into a column-vector.
  added a unit-test for that.
- split unit tests, improve docs, various improvements.
2007-12-25 17:20:58 +00:00
Benoit Jacob
3cd2a125b2 - rework the coefficients API
- make vectors use a separate loop unroller, so that copying a
row-vector into a col-vector is now possible
- add much more documentation
- misc improvements
2007-12-24 11:14:25 +00:00
Benoit Jacob
e937583655 everything works, make now runs doxygen once and only once, after all
the required files have been generated.
2007-12-21 11:29:04 +00:00
Benoit Jacob
c38156a217 now we also have a examples/ directory for self-contained examples,
and this is already used to document DynBlock
2007-12-21 10:35:00 +00:00
Benoit Jacob
a52c74095f rename src/ to Eigen/ so that we're able to #include<Eigen/Core.h>
in the examples instead of ugly things like #include"../../src/Core.h"
2007-12-20 21:25:13 +00:00