vm_math  1.0.7
The vm_Math C++ template Library

Copyright

Author
Terry Gaetz

Copyright (C) 2006 Smithsonian Astrophysical Observatory

This file is part of vm_math

vm_math is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

vm_Math is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA

Overview

The vm_math C++ library is a collection of templatized routines to deal efficiently with low-level floating point vectors, 3-vectors, and 3x3 matrices. It is split up into several sub-packages (see the Modules page for more information).

The vm_math package brings together a number of functions for operating on 3-vectors and 3-matrices, and for creating orthonormal 3-matrices corresponding to proper rotations (i.e., orthonormal matrices preserving the coordinate system parity).

These are implemented as inlined static member functions; the functions are bundled into classes in order to take them out of the global namespace. By making the functions static member functions, they can be called without recourse to a an instantiated object, e.g.

double v1[] = { 1.3, 2.4, 7.2, 9.7 };
double v2[] = { 7.2, 1.9, 3.1, 4.1 };
double foo = vm_VMath<double,4>::dot( v2, v1 );

The package currently contains 3 classes:

  • vm_VMath<T_fp,N_len>: common numerical operations on N_len-long one-dimensional arrays of floating point type T_fp. This class captures operations which do not depend on the explicit 3-vector or 3x3-matrix properties.
  • vm_V3math<T_fp>: common numerical operations on 3-vectors of floating point type T_fp. Publicly derives from vm_VMath<T_fp,3>. This class adds in specifically 3-vector functionality such as vector cross products.
  • vm_M3math<T_fp>: common numerical operations on 3x3 matrices of floating point type T_fp. The matrix is assumed to be stored as a contiguous one-dimensional array of 9 T_fp's. Publicly derives from vm_VMath<T_fp,9>. This class adds in specifically matrix properties such as multiplication and matrix-vector multiplication.

All members are inlined, so the package consists only of header files.

vm_VMath common numerical operations

on N_len-long * 1 dimensional arrays of T_fp

These routines provide the basic low-level support for 1-dimensional arrays of floating point values. The library is a C++ template library, with template parameters T_fp and N_len. T_fp is the floating point type. It must be a simple type (float or double), since it is assumed that the array can be copied as plain ol' data using memcpy. N_len is the dimension of the vector, assumed to be small, e.g., 9 for a flat representation of a 3x3 matrix. The class has no state information with all functionality implemented as (we hope) inlined functions.

To use these routines, ensure that you include the correct header file:

#include <vm_vmath/vm_vmath.h>

or

#include <vm_vmath/vm_math.h>

vm_V3Math common numerical operations

on 3-vectors of floating point values

These routines provide the basic low-level support for 3-vectors of floating point values of type T_fp (float or double). The library is a C++ template library, templatized on T_fp.

To use these routines, ensure that you include the correct header file:

#include <vm_vmath/vm_v3math.h>

or

#include <vm_vmath/vm_math.h>

vm_M3math common numerical operations

on 3x3 matrices of floating point values

These routines provide the basic low-level support for 3x3 matrices of floating point values of type T_fp (float or double). The library is a C++ template library, templatized on T_fp.

To use these routines, ensure that you include the correct header file:

#include <vm_vmath/vm_m3math.h>

or

#include <vm_vmath/vm_math.h>