Main MRPT website > C++ reference
MRPT logo

Constants.h

Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // Eigen is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public
00009 // License as published by the Free Software Foundation; either
00010 // version 3 of the License, or (at your option) any later version.
00011 //
00012 // Alternatively, you can redistribute it and/or
00013 // modify it under the terms of the GNU General Public License as
00014 // published by the Free Software Foundation; either version 2 of
00015 // the License, or (at your option) any later version.
00016 //
00017 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00019 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License and a copy of the GNU General Public License along with
00024 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00025 
00026 #ifndef EIGEN_CONSTANTS_H
00027 #define EIGEN_CONSTANTS_H
00028 
00029 /** This value means that a quantity is not known at compile-time, and that instead the value is
00030   * stored in some runtime variable.
00031   *
00032   * Changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix.
00033   */
00034 const int Dynamic = -1;
00035 
00036 /** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>().
00037   * The value Infinity there means the L-infinity norm.
00038   */
00039 const int Infinity = -1;
00040 
00041 /** \defgroup flags Flags
00042   * \ingroup Core_Module
00043   *
00044   * These are the possible bits which can be OR'ed to constitute the flags of a matrix or
00045   * expression.
00046   *
00047   * It is important to note that these flags are a purely compile-time notion. They are a compile-time property of
00048   * an expression type, implemented as enum's. They are not stored in memory at runtime, and they do not incur any
00049   * runtime overhead.
00050   *
00051   * \sa MatrixBase::Flags
00052   */
00053 
00054 /** \ingroup flags
00055   *
00056   * for a matrix, this means that the storage order is row-major.
00057   * If this bit is not set, the storage order is column-major.
00058   * For an expression, this determines the storage order of
00059   * the matrix created by evaluation of that expression. */
00060 const unsigned int RowMajorBit = 0x1;
00061 
00062 /** \ingroup flags
00063   *
00064   * means the expression should be evaluated by the calling expression */
00065 const unsigned int EvalBeforeNestingBit = 0x2;
00066 
00067 /** \ingroup flags
00068   *
00069   * means the expression should be evaluated before any assignment */
00070 const unsigned int EvalBeforeAssigningBit = 0x4;
00071 
00072 /** \ingroup flags
00073   *
00074   * Short version: means the expression might be vectorized
00075   *
00076   * Long version: means that the coefficients can be handled by packets
00077   * and start at a memory location whose alignment meets the requirements
00078   * of the present CPU architecture for optimized packet access. In the fixed-size
00079   * case, there is the additional condition that it be possible to access all the
00080   * coefficients by packets (this implies the requirement that the size be a multiple of 16 bytes,
00081   * and that any nontrivial strides don't break the alignment). In the dynamic-size case,
00082   * there is no such condition on the total size and strides, so it might not be possible to access
00083   * all coeffs by packets.
00084   *
00085   * \note This bit can be set regardless of whether vectorization is actually enabled.
00086   *       To check for actual vectorizability, see \a ActualPacketAccessBit.
00087   */
00088 const unsigned int PacketAccessBit = 0x8;
00089 
00090 #ifdef EIGEN_VECTORIZE
00091 /** \ingroup flags
00092   *
00093   * If vectorization is enabled (EIGEN_VECTORIZE is defined) this constant
00094   * is set to the value \a PacketAccessBit.
00095   *
00096   * If vectorization is not enabled (EIGEN_VECTORIZE is not defined) this constant
00097   * is set to the value 0.
00098   */
00099 const unsigned int ActualPacketAccessBit = PacketAccessBit;
00100 #else
00101 const unsigned int ActualPacketAccessBit = 0x0;
00102 #endif
00103 
00104 /** \ingroup flags
00105   *
00106   * Short version: means the expression can be seen as 1D vector.
00107   *
00108   * Long version: means that one can access the coefficients
00109   * of this expression by coeff(int), and coeffRef(int) in the case of a lvalue expression. These
00110   * index-based access methods are guaranteed
00111   * to not have to do any runtime computation of a (row, col)-pair from the index, so that it
00112   * is guaranteed that whenever it is available, index-based access is at least as fast as
00113   * (row,col)-based access. Expressions for which that isn't possible don't have the LinearAccessBit.
00114   *
00115   * If both PacketAccessBit and LinearAccessBit are set, then the
00116   * packets of this expression can be accessed by packet(int), and writePacket(int) in the case of a
00117   * lvalue expression.
00118   *
00119   * Typically, all vector expressions have the LinearAccessBit, but there is one exception:
00120   * Product expressions don't have it, because it would be troublesome for vectorization, even when the
00121   * Product is a vector expression. Thus, vector Product expressions allow index-based coefficient access but
00122   * not index-based packet access, so they don't have the LinearAccessBit.
00123   */
00124 const unsigned int LinearAccessBit = 0x10;
00125 
00126 /** \ingroup flags
00127   *
00128   * Means the expression has a coeffRef() method, i.e. is writable as its individual coefficients are directly addressable.
00129   * This rules out read-only expressions.
00130   *
00131   * Note that DirectAccessBit and LvalueBit are mutually orthogonal, as there are examples of expression having one but note
00132   * the other:
00133   *   \li writable expressions that don't have a very simple memory layout as a strided array, have LvalueBit but not DirectAccessBit
00134   *   \li Map-to-const expressions, for example Map<const Matrix>, have DirectAccessBit but not LvalueBit
00135   *
00136   * Expressions having LvalueBit also have their coeff() method returning a const reference instead of returning a new value.
00137   */
00138 const unsigned int LvalueBit = 0x20;
00139 
00140 /** \ingroup flags
00141   *
00142   * Means that the underlying array of coefficients can be directly accessed as a plain strided array. The memory layout
00143   * of the array of coefficients must be exactly the natural one suggested by rows(), cols(),
00144   * outerStride(), innerStride(), and the RowMajorBit. This rules out expressions such as Diagonal, whose coefficients,
00145   * though referencable, do not have such a regular memory layout.
00146   *
00147   * See the comment on LvalueBit for an explanation of how LvalueBit and DirectAccessBit are mutually orthogonal.
00148   */
00149 const unsigned int DirectAccessBit = 0x40;
00150 
00151 /** \ingroup flags
00152   *
00153   * means the first coefficient packet is guaranteed to be aligned */
00154 const unsigned int AlignedBit = 0x80;
00155 
00156 const unsigned int NestByRefBit = 0x100;
00157 
00158 // list of flags that are inherited by default
00159 const unsigned int HereditaryBits = RowMajorBit
00160                                   | EvalBeforeNestingBit
00161                                   | EvalBeforeAssigningBit;
00162 
00163 // Possible values for the Mode parameter of triangularView()
00164 enum {
00165   Lower=0x1, Upper=0x2, UnitDiag=0x4, ZeroDiag=0x8,
00166   UnitLower=UnitDiag|Lower, UnitUpper=UnitDiag|Upper,
00167   StrictlyLower=ZeroDiag|Lower, StrictlyUpper=ZeroDiag|Upper,
00168   SelfAdjoint=0x10};
00169 
00170 enum { Unaligned=0, Aligned=1 };
00171 enum { ConditionalJumpCost = 5 };
00172 
00173 // FIXME after the corner() API change, this was not needed anymore, except by AlignedBox
00174 // TODO: find out what to do with that. Adapt the AlignedBox API ?
00175 enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight };
00176 
00177 enum DirectionType { Vertical, Horizontal, BothDirections };
00178 enum ProductEvaluationMode { NormalProduct, CacheFriendlyProduct };
00179 
00180 enum {
00181   /** \internal Default traversal, no vectorization, no index-based access */
00182   DefaultTraversal,
00183   /** \internal No vectorization, use index-based access to have only one for loop instead of 2 nested loops */
00184   LinearTraversal,
00185   /** \internal Equivalent to a slice vectorization for fixed-size matrices having good alignment
00186     * and good size */
00187   InnerVectorizedTraversal,
00188   /** \internal Vectorization path using a single loop plus scalar loops for the
00189     * unaligned boundaries */
00190   LinearVectorizedTraversal,
00191   /** \internal Generic vectorization path using one vectorized loop per row/column with some
00192     * scalar loops to handle the unaligned boundaries */
00193   SliceVectorizedTraversal,
00194   /** \internal Special case to properly handle incompatible scalar types or other defecting cases*/
00195   InvalidTraversal
00196 };
00197 
00198 enum {
00199   NoUnrolling,
00200   InnerUnrolling,
00201   CompleteUnrolling
00202 };
00203 
00204 enum {
00205   ColMajor = 0,
00206   RowMajor = 0x1,  // it is only a coincidence that this is equal to RowMajorBit -- don't rely on that
00207   /** \internal Align the matrix itself if it is vectorizable fixed-size */
00208   AutoAlign = 0,
00209   /** \internal Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated, may still be requested to be aligned) */ // FIXME --- clarify the situation
00210   DontAlign = 0x2
00211 };
00212 
00213 /** \brief Enum for specifying whether to apply or solve on the left or right. 
00214   */
00215 enum {
00216   OnTheLeft = 1,  /**< \brief Apply transformation on the left. */
00217   OnTheRight = 2  /**< \brief Apply transformation on the right. */
00218 };
00219 
00220 /* the following could as well be written:
00221  *   enum NoChange_t { NoChange };
00222  * but it feels dangerous to disambiguate overloaded functions on enum/integer types.
00223  * If on some platform it is really impossible to get rid of "unused variable" warnings, then
00224  * we can always come back to that solution.
00225  */
00226 struct NoChange_t {};
00227 namespace {
00228   EIGEN_UNUSED NoChange_t NoChange;
00229 }
00230 
00231 struct Sequential_t {};
00232 namespace {
00233   EIGEN_UNUSED Sequential_t Sequential;
00234 }
00235 
00236 struct Default_t {};
00237 namespace {
00238   EIGEN_UNUSED Default_t Default;
00239 }
00240 
00241 enum {
00242   IsDense         = 0,
00243   IsSparse
00244 };
00245 
00246 enum AccessorLevels {
00247   ReadOnlyAccessors, WriteAccessors, DirectAccessors, DirectWriteAccessors
00248 };
00249 
00250 enum DecompositionOptions {
00251   Pivoting            = 0x01, // LDLT,
00252   NoPivoting          = 0x02, // LDLT,
00253   ComputeFullU        = 0x04, // SVD,
00254   ComputeThinU        = 0x08, // SVD,
00255   ComputeFullV        = 0x10, // SVD,
00256   ComputeThinV        = 0x20, // SVD,
00257   EigenvaluesOnly     = 0x40, // all eigen solvers
00258   ComputeEigenvectors = 0x80, // all eigen solvers
00259   EigVecMask = EigenvaluesOnly | ComputeEigenvectors,
00260   Ax_lBx              = 0x100,
00261   ABx_lx              = 0x200,
00262   BAx_lx              = 0x400,
00263   GenEigMask = Ax_lBx | ABx_lx | BAx_lx
00264 };
00265 
00266 enum QRPreconditioners {
00267   NoQRPreconditioner,
00268   HouseholderQRPreconditioner,
00269   ColPivHouseholderQRPreconditioner,
00270   FullPivHouseholderQRPreconditioner
00271 };
00272 
00273 /** \brief Enum for reporting the status of a computation.
00274   */
00275 enum ComputationInfo {
00276   Success = 0,        /**< \brief Computation was successful. */
00277   NumericalIssue = 1, /**< \brief The provided data did not satisfy the prerequisites. */
00278   NoConvergence = 2   /**< \brief Iterative procedure did not converge. */
00279 };
00280 
00281 enum TransformTraits {
00282   Isometry      = 0x1,
00283   Affine        = 0x2,
00284   AffineCompact = 0x10 | Affine,
00285   Projective    = 0x20
00286 };
00287 
00288 namespace Architecture
00289 {
00290   enum Type {
00291     Generic = 0x0,
00292     SSE = 0x1,
00293     AltiVec = 0x2,
00294 #if defined EIGEN_VECTORIZE_SSE
00295     Target = SSE
00296 #elif defined EIGEN_VECTORIZE_ALTIVEC
00297     Target = AltiVec
00298 #else
00299     Target = Generic
00300 #endif
00301   };
00302 }
00303 
00304 enum { CoeffBasedProductMode, LazyCoeffBasedProductMode, OuterProduct, InnerProduct, GemvProduct, GemmProduct };
00305 
00306 enum Action {GetAction, SetAction};
00307 
00308 /** The type used to identify a dense storage. */
00309 struct Dense {};
00310 
00311 /** The type used to identify a matrix expression */
00312 struct MatrixXpr {};
00313 
00314 /** The type used to identify an array expression */
00315 struct ArrayXpr {};
00316 
00317 #endif // EIGEN_CONSTANTS_H



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011