sym_mat2 Class Template Reference

Symmetric 2x2 matrix class. More...

#include <sym_mat2.h>

Inheritance diagram for sym_mat2:

List of all members.

Public Types

typedef af::tiny_plain
< NumType, 3 > 
base_type

Public Member Functions

 sym_mat2 ()
 Default constructor. Elements are not initialized.
 sym_mat2 (NumType const &e00, NumType const &e11, NumType const &e01)
 Constructor.
 sym_mat2 (base_type const &a)
 Constructor.
 sym_mat2 (const NumType *a)
 Constructor.
 sym_mat2 (NumType const &diag)
 Constructor for diagonal matrix.
 sym_mat2 (af::tiny_plain< NumType, 2 > const &diag)
 Constructor for diagonal matrix.
 sym_mat2 (mat2< NumType > const &m)
 Construction from full 2x2 matrix.
 sym_mat2 (mat2< NumType > const &m, NumType const &relative_tolerance)
 Construction from full 2x2 matrix.
NumType const & operator() (std::size_t r, std::size_t c) const
 Access elements with 2-dimensional indices.
NumType & operator() (std::size_t r, std::size_t c)
 Access elements with 2-dimensional indices.
vec2< NumType > diagonal () const
 Return diagonal elements.
sym_mat2 transpose ()
 Return the transposed matrix.
NumType trace () const
 Return trace (sum of diagonal elements).
NumType determinant () const
 Return determinant.
sym_mat2 co_factor_matrix_transposed () const
 Return the transposed of the co-factor matrix.
sym_mat2 inverse () const
 Return the inverse matrix.
sym_mat2 tensor_transform (mat2< NumType > const &c) const
 Tensor transform: c * (*this) * c.transpose().
sym_mat2 antisymmetric_tensor_transform (NumType const &v0) const
 Antisymmetric tensor transform: c * (*this) * c.transpose().
sym_mat2 antisymmetric_tensor_transform (vec2< NumType > const &v) const
 Antisymmetric tensor transform: c * (*this) * c.transpose().
sym_mat2 tensor_transpose_transform (mat2< NumType > const &c) const
 Tensor transform: c.transpose() * (*this) * c.
NumType dot (sym_mat2 const &other) const
 Sum of 4 element-wise products.


Detailed Description

template<typename NumType>
class scitbx::sym_mat2< NumType >

Symmetric 2x2 matrix class.

Constructor & Destructor Documentation

sym_mat2 ( mat2< NumType > const &  m  )  [inline, explicit]

Construction from full 2x2 matrix.

The off-diagonal elements of the new sym_mat2 are copied from the upper-right triangle of m.

An exception is thrown if the absolute value of the difference between any pair of off-diagonal elements is different from zero.

See also: mat2<>::is_symmetric()

sym_mat2 ( mat2< NumType > const &  m,
NumType const &  relative_tolerance 
) [inline, explicit]

Construction from full 2x2 matrix.

The off-diagonal elements of the new sym_mat2 are determined as the averages of the corresponding off-diagonal elements of the input matrix m.

If relative_tolerance is greater than or equal to zero, it is used to check the input matrix m. An exception is thrown if the absolute value of the difference between any pair of off-diagonal elements is larger than max_abs*relative_tolerance, where max_abs is the maximum of the absolute values of the elements of m.

See also: mat2<>::is_symmetric()


Member Function Documentation

sym_mat2 transpose (  )  [inline]

Return the transposed matrix.

In analogy with mat2, return a new instance.

sym_mat2 co_factor_matrix_transposed (  )  const [inline]

Return the transposed of the co-factor matrix.

The inverse matrix is obtained by dividing the result by the determinant().

Referenced by principal_axes_of_inertia_2d::distance_to_inertia_ellipsoid_surface(), and sym_mat2< FloatType >::inverse().

sym_mat2 inverse (  )  const [inline]

Return the inverse matrix.

An exception is thrown if the matrix is not invertible, i.e. if the determinant() is zero.

sym_mat2< NumType > antisymmetric_tensor_transform ( NumType const &  v0  )  const [inline]

Antisymmetric tensor transform: c * (*this) * c.transpose().

c is the antisymmetric matrix {{ 0, v0, v1}, {-v0, 0, v2} {-v1, -v2, 0}}

Referenced by sym_mat2< FloatType >::antisymmetric_tensor_transform().

sym_mat2 antisymmetric_tensor_transform ( vec2< NumType > const &  v  )  const [inline]

Antisymmetric tensor transform: c * (*this) * c.transpose().

c is the antisymmetric matrix {{ 0, v[0], v[1]}, {-v[0], 0, v[2]} {-v[1], -v[2], 0 }}


The documentation for this class was generated from the following file:

Generated on Tue Sep 1 17:12:35 2009 for cctbx by  doxygen 1.5.6