Simbody  3.7
Matrix and Vector Utilities

Simbody contains an extensive library for manipulating Matrix and Vector objects, modeled after Matlab's similar features. More...

Modules

 Predefined typedefs
 These typedefs provide convenient synonyms for common matrix and vector types.
 

Classes

class  SimTK::Matrix_< ELT >
 This is the matrix class intended to appear in user code for large, variable size matrices. More...
 
class  SimTK::RowVector_< ELT >
 Represents a variable size row vector; much less common than the column vector type Vector_. More...
 
class  SimTK::Vector_< ELT >
 This is the vector class intended to appear in user code for large, variable size column vectors. More...
 
class  SimTK::Mat< M, N, ELT, CS, RS >
 This class represents a small matrix whose size is known at compile time, containing elements of any Composite Numerical Type (CNT) and engineered to have no runtime overhead whatsoever. More...
 
class  SimTK::Row< N, ELT, STRIDE >
 This is a fixed-length row vector designed for no-overhead inline computation. More...
 
class  SimTK::SymMat< M, ELT, RS >
 This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation. More...
 
class  SimTK::Vec< M, ELT, STRIDE >
 This is a fixed-length column vector designed for no-overhead inline computation. More...
 

Detailed Description

Simbody contains an extensive library for manipulating Matrix and Vector objects, modeled after Matlab's similar features.

Simbody's matrix library contains two separate but related sets of classes for vector and matrix objects, one set for small, fixed-size objects and the other for larger, run-time allocated objects.

First, there are classes to represent small, fixed size vectors and matrices with zero runtime overhead: Vec for column vectors, and Mat for matrices. There is also a Row type that does not normally appear in user programs. These classes are templatized based on size and element type. Synonyms (typedefs) are defined for common combinations; for example, Vec3 is a synonym for Vec<3,Real>, while Mat22 is a synonym for Mat<2,2,Real>. (Typedef Real is synonymous with C++ double unless Simbody was compiled with float as the default precision.) You can also create other combinations, such as Mat<2,10,Real> or Vec<4,std::complex<Real>>. However, the size must always be determinable at compile time. The in-memory representation of these small objects is minimal: only the data elements are stored.

Second, there are classes to represent large vectors and matrices whose sizes are determined at runtime: Vector_ for column vectors and Matrix_ for matrices. There is also a RowVector_ type that rarely appears in user programs. These classes are templatized based on element type. In user code, it is most common to see typedefs Vector and Matrix which are synonyms for Vector_<Real> and Matrix_<Real>. As for small matrices, you can use other element types. In fact, the element type can even be one of the fixed-size vector or matrix objects. For example, Vector_<Vec3> is a variable-length vector, where each element is itself a fixed-size, 3-component vector. The type Vec<2,Vec3>, called a spatial vector (SpatialVec), is useful for combining rotational and translational quantities into a single object representing a spatial velocity or spatial force, for example. However, it is not permissible to use the variable-size Vector_ or Matrix_ objects as element types. The in-memory representation of these objects includes, in addition to the data, an opaque descriptor containing the length and information on how the data is laid out; the declared objects actually consist only of a pointer (essentially a void*) to the descriptors. This has many advantages for implementation and binary compatibility, but makes it difficult to look through these objects in a debugger as you can with the small Vec and Mat classes.

Implementation

The intent of Simbody's matrix library, which we call Simmatrix, is similar to that of the Eigen library (http://eigen.tuxfamily.org). If you want to know more about the design goals and implementation of Simmatrix, see the design document here: https://simtk.org/home/simbody, Documents tab.