Simbody
3.3
|
This file is the user-includeable header to be included in user programs to provide fixed-length Vec & Mat classes. More...
#include "SimTKcommon/Scalar.h"
#include "SimTKcommon/TemplatizedLapack.h"
#include "SimTKcommon/internal/ResultType.h"
#include "SimTKcommon/internal/Vec.h"
#include "SimTKcommon/internal/Row.h"
#include "SimTKcommon/internal/Mat.h"
#include "SimTKcommon/internal/SymMat.h"
#include "SimTKcommon/internal/SmallMatrixMixed.h"
Go to the source code of this file.
Namespaces | |
SimTK | |
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols. | |
Typedefs | |
typedef Vec< 1 > | SimTK::Vec1 |
typedef Vec< 2 > | SimTK::Vec2 |
typedef Vec< 3 > | SimTK::Vec3 |
typedef Vec< 4 > | SimTK::Vec4 |
typedef Vec< 5 > | SimTK::Vec5 |
typedef Vec< 6 > | SimTK::Vec6 |
typedef Vec< 7 > | SimTK::Vec7 |
typedef Vec< 8 > | SimTK::Vec8 |
typedef Vec< 9 > | SimTK::Vec9 |
typedef Vec< 1, float > | SimTK::fVec1 |
typedef Vec< 2, float > | SimTK::fVec2 |
typedef Vec< 3, float > | SimTK::fVec3 |
typedef Vec< 4, float > | SimTK::fVec4 |
typedef Vec< 5, float > | SimTK::fVec5 |
typedef Vec< 6, float > | SimTK::fVec6 |
typedef Vec< 7, float > | SimTK::fVec7 |
typedef Vec< 8, float > | SimTK::fVec8 |
typedef Vec< 9, float > | SimTK::fVec9 |
typedef Row< 1 > | SimTK::Row1 |
typedef Row< 2 > | SimTK::Row2 |
typedef Row< 3 > | SimTK::Row3 |
typedef Row< 4 > | SimTK::Row4 |
typedef Row< 5 > | SimTK::Row5 |
typedef Row< 6 > | SimTK::Row6 |
typedef Row< 7 > | SimTK::Row7 |
typedef Row< 8 > | SimTK::Row8 |
typedef Row< 9 > | SimTK::Row9 |
typedef Row< 1, float > | SimTK::fRow1 |
typedef Row< 2, float > | SimTK::fRow2 |
typedef Row< 3, float > | SimTK::fRow3 |
typedef Row< 4, float > | SimTK::fRow4 |
typedef Row< 5, float > | SimTK::fRow5 |
typedef Row< 6, float > | SimTK::fRow6 |
typedef Row< 7, float > | SimTK::fRow7 |
typedef Row< 8, float > | SimTK::fRow8 |
typedef Row< 9, float > | SimTK::fRow9 |
typedef SymMat< 1 > | SimTK::SymMat11 |
typedef SymMat< 2 > | SimTK::SymMat22 |
typedef SymMat< 3 > | SimTK::SymMat33 |
typedef SymMat< 4 > | SimTK::SymMat44 |
typedef SymMat< 5 > | SimTK::SymMat55 |
typedef SymMat< 6 > | SimTK::SymMat66 |
typedef SymMat< 7 > | SimTK::SymMat77 |
typedef SymMat< 8 > | SimTK::SymMat88 |
typedef SymMat< 9 > | SimTK::SymMat99 |
typedef SymMat< 1, float > | SimTK::fSymMat11 |
typedef SymMat< 2, float > | SimTK::fSymMat22 |
typedef SymMat< 3, float > | SimTK::fSymMat33 |
typedef SymMat< 4, float > | SimTK::fSymMat44 |
typedef SymMat< 5, float > | SimTK::fSymMat55 |
typedef SymMat< 6, float > | SimTK::fSymMat66 |
typedef SymMat< 7, float > | SimTK::fSymMat77 |
typedef SymMat< 8, float > | SimTK::fSymMat88 |
typedef SymMat< 9, float > | SimTK::fSymMat99 |
typedef Mat< 1, 1 > | SimTK::Mat11 |
typedef Mat< 1, 2 > | SimTK::Mat12 |
typedef Mat< 1, 3 > | SimTK::Mat13 |
typedef Mat< 1, 4 > | SimTK::Mat14 |
typedef Mat< 1, 5 > | SimTK::Mat15 |
typedef Mat< 1, 6 > | SimTK::Mat16 |
typedef Mat< 1, 7 > | SimTK::Mat17 |
typedef Mat< 1, 8 > | SimTK::Mat18 |
typedef Mat< 1, 9 > | SimTK::Mat19 |
typedef Mat< 2, 1 > | SimTK::Mat21 |
typedef Mat< 2, 2 > | SimTK::Mat22 |
typedef Mat< 2, 3 > | SimTK::Mat23 |
typedef Mat< 2, 4 > | SimTK::Mat24 |
typedef Mat< 2, 5 > | SimTK::Mat25 |
typedef Mat< 2, 6 > | SimTK::Mat26 |
typedef Mat< 2, 7 > | SimTK::Mat27 |
typedef Mat< 2, 8 > | SimTK::Mat28 |
typedef Mat< 2, 9 > | SimTK::Mat29 |
typedef Mat< 3, 1 > | SimTK::Mat31 |
typedef Mat< 3, 2 > | SimTK::Mat32 |
typedef Mat< 3, 3 > | SimTK::Mat33 |
typedef Mat< 3, 4 > | SimTK::Mat34 |
typedef Mat< 3, 5 > | SimTK::Mat35 |
typedef Mat< 3, 6 > | SimTK::Mat36 |
typedef Mat< 3, 7 > | SimTK::Mat37 |
typedef Mat< 3, 8 > | SimTK::Mat38 |
typedef Mat< 3, 9 > | SimTK::Mat39 |
typedef Mat< 4, 1 > | SimTK::Mat41 |
typedef Mat< 4, 2 > | SimTK::Mat42 |
typedef Mat< 4, 3 > | SimTK::Mat43 |
typedef Mat< 4, 4 > | SimTK::Mat44 |
typedef Mat< 4, 5 > | SimTK::Mat45 |
typedef Mat< 4, 6 > | SimTK::Mat46 |
typedef Mat< 4, 7 > | SimTK::Mat47 |
typedef Mat< 4, 8 > | SimTK::Mat48 |
typedef Mat< 4, 9 > | SimTK::Mat49 |
typedef Mat< 5, 1 > | SimTK::Mat51 |
typedef Mat< 5, 2 > | SimTK::Mat52 |
typedef Mat< 5, 3 > | SimTK::Mat53 |
typedef Mat< 5, 4 > | SimTK::Mat54 |
typedef Mat< 5, 5 > | SimTK::Mat55 |
typedef Mat< 5, 6 > | SimTK::Mat56 |
typedef Mat< 5, 7 > | SimTK::Mat57 |
typedef Mat< 5, 8 > | SimTK::Mat58 |
typedef Mat< 5, 9 > | SimTK::Mat59 |
typedef Mat< 6, 1 > | SimTK::Mat61 |
typedef Mat< 6, 2 > | SimTK::Mat62 |
typedef Mat< 6, 3 > | SimTK::Mat63 |
typedef Mat< 6, 4 > | SimTK::Mat64 |
typedef Mat< 6, 5 > | SimTK::Mat65 |
typedef Mat< 6, 6 > | SimTK::Mat66 |
typedef Mat< 6, 7 > | SimTK::Mat67 |
typedef Mat< 6, 8 > | SimTK::Mat68 |
typedef Mat< 6, 9 > | SimTK::Mat69 |
typedef Mat< 7, 1 > | SimTK::Mat71 |
typedef Mat< 7, 2 > | SimTK::Mat72 |
typedef Mat< 7, 3 > | SimTK::Mat73 |
typedef Mat< 7, 4 > | SimTK::Mat74 |
typedef Mat< 7, 5 > | SimTK::Mat75 |
typedef Mat< 7, 6 > | SimTK::Mat76 |
typedef Mat< 7, 7 > | SimTK::Mat77 |
typedef Mat< 7, 8 > | SimTK::Mat78 |
typedef Mat< 7, 9 > | SimTK::Mat79 |
typedef Mat< 8, 1 > | SimTK::Mat81 |
typedef Mat< 8, 2 > | SimTK::Mat82 |
typedef Mat< 8, 3 > | SimTK::Mat83 |
typedef Mat< 8, 4 > | SimTK::Mat84 |
typedef Mat< 8, 5 > | SimTK::Mat85 |
typedef Mat< 8, 6 > | SimTK::Mat86 |
typedef Mat< 8, 7 > | SimTK::Mat87 |
typedef Mat< 8, 8 > | SimTK::Mat88 |
typedef Mat< 8, 9 > | SimTK::Mat89 |
typedef Mat< 9, 1 > | SimTK::Mat91 |
typedef Mat< 9, 2 > | SimTK::Mat92 |
typedef Mat< 9, 3 > | SimTK::Mat93 |
typedef Mat< 9, 4 > | SimTK::Mat94 |
typedef Mat< 9, 5 > | SimTK::Mat95 |
typedef Mat< 9, 6 > | SimTK::Mat96 |
typedef Mat< 9, 7 > | SimTK::Mat97 |
typedef Mat< 9, 8 > | SimTK::Mat98 |
typedef Mat< 9, 9 > | SimTK::Mat99 |
typedef Mat< 1, 1, float > | SimTK::fMat11 |
typedef Mat< 2, 2, float > | SimTK::fMat22 |
typedef Mat< 3, 3, float > | SimTK::fMat33 |
typedef Mat< 3, 4, float > | SimTK::fMat34 |
typedef Mat< 4, 3, float > | SimTK::fMat43 |
typedef Mat< 4, 4, float > | SimTK::fMat44 |
typedef Mat< 5, 5, float > | SimTK::fMat55 |
typedef Mat< 6, 6, float > | SimTK::fMat66 |
typedef Mat< 7, 7, float > | SimTK::fMat77 |
typedef Mat< 8, 8, float > | SimTK::fMat88 |
typedef Mat< 9, 9, float > | SimTK::fMat99 |
This file is the user-includeable header to be included in user programs to provide fixed-length Vec & Mat classes.
The included internal headers declare templates needed for zero-overhead handling of small vectors and matrices. The idea is to convey all needed information, including the size, at compile time through the templatized types. These classes have well-defined minimal storage layouts and can be easily interconverted to/from arrays of scalar types, with zero conversion overhead.
There are three generic types required: a column vector Vec, a row vector (a.k.a. "covector") Row, and a matrix Mat. Real and Complex elements at single, double, and quad precision are supported. Almost all operations are inline – this package is intended to provide performance as good as one could achieve by special-purpose C code.
When the element type is a "basic numerical type" then the resulting Vec, Row or Mat is also a basic numerical type, so these can be built up with structured elements so that Vec< 2,Vec<3> > for example is a 2-element vector whose elements are Vec<3>'s.
These classes are designed so that many operations that look like computations are free. These include: negation, conjugation, extraction of real and imaginary parts from complex numerical types, and hermitian or positional transpose. These are performed by type casting rather than computation. That is, these operations can be viewed as a change in perspective rather than an actual computation.
To achieve zero overhead, separate types are needed to convey special matrix structure, although appropriate interconversions are defined. So symmetric matrices are SymMat's and diagonal matrices are DiagMat's. Note that symmetric matrices are more properly called Hermitian in that the reflected elements are conjugates of one another.
Supported operations
Class member functions for Vec<M>: Unary: -, +, ~ (Hermitian transpose) Assignment: copy assignment of identical object elementwise assignment from any M-row Vec or Mat scalar assignment to each element TODO
Global operations involving only Vecs or Vec and scalar, yielding a vector result. (Row has the same set.) v+s, s+v, v+v v-s, s-v, v-v v*s, s*v (can't multiply a vector by another vector) v/s v==s, s==v, v==v (same for !=)
Global operations mixing Row, Vec, Mat s=r*v (dot product) m=v*r (outer product) v=m*v, r=r*m m=m*m (with compatible dimensions)