2 #ifndef vpdt_eigen_sym_matrix_h_ 3 #define vpdt_eigen_sym_matrix_h_ 21 # include <vcl_msvc_warnings.h> 27 template<
class T,
unsigned int n>
39 template<
class T,
unsigned int n=0>
113 for (
unsigned int i=0; i<dim; ++i)
126 for (
unsigned int i = 0; i < dim; ++i)
127 for (
unsigned int k = 0; k < dim; ++k){
129 for (
unsigned int j = i; j < dim; ++j)
134 for (
unsigned int i = 0; i < dim; ++i)
135 for (
unsigned int j = i+1; j < dim; ++j)
147 for (
unsigned int k = 0; k < dim; ++k){
150 for (
unsigned int i = 0; i < dim; ++i){
152 for (
unsigned int j = i; j < dim; ++j)
158 for (
unsigned int i = 0; i < dim; ++i)
159 for (
unsigned int j = i+1; j < dim; ++j)
169 for (
unsigned int i = 0; i < dim; ++i){
171 for (
unsigned int j = 0; j < dim; ++j){
175 for (
unsigned int j = 0; j < dim; ++j){
187 for (
unsigned int i = 0; i < dim; ++i){
189 for (
unsigned int j = 0; j < dim; ++j){
193 for (
unsigned int j = 0; j < dim; ++j){
204 for (
unsigned int i = 0; i < dim; ++i){
206 for (
unsigned int j = 0; j < dim; ++j){
219 for (
unsigned int i = 0; i < dim; ++i){
221 return std::numeric_limits<T>::infinity();
223 for (
unsigned int j = 0; j < dim; ++j){
236 for (
unsigned int i=0; i<dim; ++i)
267 template <
class F,
class Disambiguate=
void>
298 template <
class T,
unsigned int n>
304 m.set_eigenvalues(
v);
308 #endif // vpdt_eigen_sym_matrix_h_ void inverse_product(const vector &x, vector &y) const
evaluate y = M^-1 * x.
vpdt_field_default< T, n >::type vector
the data type used for vectors.
vnl_matrix_ref< T > as_ref()
T inverse_quad_form(const vector &x) const
evaluate the inverse Quadratic form x^t * M^-1 * x.
vpdt_eigen_sym_matrix< T, n > & operator *=(const T &val)
multiply the matrix by a scalar.
void vnl_symmetric_eigensystem_compute(const vnl_matrix_fixed< T, n, n > &A, vnl_matrix_fixed< T, n, n > &V, vnl_vector_fixed< T, n > &D)
wrapper for the vnl eigensystem function for fixed size data.
unsigned int dimension() const
Return the dimension.
void set_size(unsigned int dim)
Set the size (if variable) and reset to default.
void vpdt_fill(vpdt_eigen_sym_matrix< T, n > &m, const T &val)
Fill a vpdt_eigen_sym_matrix.
T const * data_block() const
vpdt_field_traits< F >::matrix_type type
A type generator for the default types (those used in vpdl)
unsigned int size() const
vnl_vector_fixed & fill(T const &v)
void product(const vector &x, vector &y) const
evaluate y = M * x.
vpdt_eigen_sym_matrix(const matrix &evec, const vector &eval)
Constructor - from eigenvectors and eigenvalues.
vpdt_field_traits< vector >::matrix_type matrix
the data type used for matrices.
matrix eigen_vec_
the matrix of eigenvectors.
void form_inverse(matrix &m) const
compute the matrix inverse.
bool are_evec_orthonormal() const
return true if the eigenvectors are (approximately) orthonormal.
void set_matrix(const matrix &m)
set the eigenvectors and eigen values by decomposing m.
T determinant() const
compute the determinant.
vpdt_eigen_sym_matrix(const matrix &m)
Constructor - from symmetric matrix.
T const * data_block() const
specialized template trait classes for properties of a field type
vpdt_eigen_sym_matrix< typename vpdt_field_traits< F >::scalar_type, vpdt_field_traits< F >::dimension > type
const matrix & eigenvectors() const
Access to the eigenvectors.
The field traits class (scalar).
generate the vpdt_eigen_sys_matrix type from a field type.
vpdt_eigen_sym_matrix(unsigned int var_dim=n)
Constructor.
void form_matrix(matrix &m) const
Reform the matrix.
Overloaded functions to allow uniform API access to various field types.
A symmetric matrix represented in eigenvalue decomposition.
void vpdt_set_size(vpdt_eigen_sym_matrix< T, 0 > &m, unsigned int s)
Set the size of a vpdt_eigen_sym_matrix.
unsigned int vpdt_size(const vnl_vector< T > &v)
Access the size of a vnl_vector.
void set_eigenvectors(const matrix &m)
Set the eigenvectors.
T quad_form(const vector &x) const
evaluate the Quadratic form x^t * M * x.
vector eigen_val_
the vector of eigenvalues.
const vector & eigenvalues() const
Access to the eigenvalues.
void set_eigenvalues(const vector &v)
set the eigenvalues.