Represents 2x2 symmetric matrix, used as weight matrix. More...
#include <msm_wt_mat_2d.h>
Public Member Functions | |
msm_wt_mat_2d () | |
msm_wt_mat_2d (double m11, double m12, double m22) | |
~msm_wt_mat_2d () | |
void | set_axes (double u1, double u2, double s1, double s2) |
Sets axis (eigenvector) of matrix and var along each. | |
double | m11 () const |
double | m12 () const |
double | m21 () const |
double | m22 () const |
double | det () const |
void | eigen_values (double &EV1, double &EV2) |
Calculate eigenvalues. | |
msm_wt_mat_2d | transform_by (double a, double b) const |
Calculates W2=T'WT where T is 2x2 matrix (a,-b;b,a). | |
double | xWx (double x, double y) const |
Compute (x y)W(x y)'. | |
msm_wt_mat_2d | operator* (msm_wt_mat_2d &W) const |
Post multiply by W. | |
msm_wt_mat_2d & | operator*= (double s) |
Multiply this by scalar. | |
msm_wt_mat_2d & | operator+= (const msm_wt_mat_2d &W) |
Add W to this. | |
msm_wt_mat_2d | inverse () const |
Returns inverse (or pseudo-inverse). | |
void | print_summary (vcl_ostream &os) const |
Print class to os. | |
void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
bool | operator== (const msm_wt_mat_2d &wt_mat) |
Equality test. | |
Private Attributes | |
double | m11_ |
double | m12_ |
double | m22_ |
Represents 2x2 symmetric matrix, used as weight matrix.
Stores the 3 unique elements and contains various utility functions.
Definition at line 16 of file msm_wt_mat_2d.h.
msm_wt_mat_2d::msm_wt_mat_2d | ( | ) | [inline] |
Definition at line 23 of file msm_wt_mat_2d.h.
msm_wt_mat_2d::msm_wt_mat_2d | ( | double | m11, |
double | m12, | ||
double | m22 | ||
) | [inline] |
Definition at line 27 of file msm_wt_mat_2d.h.
msm_wt_mat_2d::~msm_wt_mat_2d | ( | ) | [inline] |
Definition at line 32 of file msm_wt_mat_2d.h.
void msm_wt_mat_2d::b_read | ( | vsl_b_istream & | bfs | ) |
Load class from binary file stream.
Definition at line 117 of file msm_wt_mat_2d.cxx.
void msm_wt_mat_2d::b_write | ( | vsl_b_ostream & | bfs | ) | const |
Save class to binary file stream.
Definition at line 107 of file msm_wt_mat_2d.cxx.
double msm_wt_mat_2d::det | ( | ) | const [inline] |
Definition at line 47 of file msm_wt_mat_2d.h.
void msm_wt_mat_2d::eigen_values | ( | double & | EV1, |
double & | EV2 | ||
) |
Calculate eigenvalues.
Definition at line 42 of file msm_wt_mat_2d.cxx.
msm_wt_mat_2d msm_wt_mat_2d::inverse | ( | ) | const |
Returns inverse (or pseudo-inverse).
Definition at line 29 of file msm_wt_mat_2d.cxx.
double msm_wt_mat_2d::m11 | ( | ) | const [inline] |
Definition at line 41 of file msm_wt_mat_2d.h.
double msm_wt_mat_2d::m12 | ( | ) | const [inline] |
Definition at line 42 of file msm_wt_mat_2d.h.
double msm_wt_mat_2d::m21 | ( | ) | const [inline] |
Definition at line 43 of file msm_wt_mat_2d.h.
double msm_wt_mat_2d::m22 | ( | ) | const [inline] |
Definition at line 44 of file msm_wt_mat_2d.h.
msm_wt_mat_2d msm_wt_mat_2d::operator* | ( | msm_wt_mat_2d & | W | ) | const |
Post multiply by W.
Definition at line 61 of file msm_wt_mat_2d.cxx.
msm_wt_mat_2d & msm_wt_mat_2d::operator*= | ( | double | s | ) |
Multiply this by scalar.
Definition at line 69 of file msm_wt_mat_2d.cxx.
msm_wt_mat_2d & msm_wt_mat_2d::operator+= | ( | const msm_wt_mat_2d & | W | ) |
Add W to this.
Definition at line 78 of file msm_wt_mat_2d.cxx.
bool msm_wt_mat_2d::operator== | ( | const msm_wt_mat_2d & | wt_mat | ) |
Equality test.
Definition at line 87 of file msm_wt_mat_2d.cxx.
void msm_wt_mat_2d::print_summary | ( | vcl_ostream & | os | ) | const |
Print class to os.
Definition at line 99 of file msm_wt_mat_2d.cxx.
void msm_wt_mat_2d::set_axes | ( | double | u1, |
double | u2, | ||
double | s1, | ||
double | s2 | ||
) |
Sets axis (eigenvector) of matrix and var along each.
Sets to s1*u*u' + s2*v*v', where u is the unit vector (u1 u2)/|u1,u2|, and v is the unit vector orthogonal to this. u is then an eigenvector with associated eigenvalue s1, v is the other eigenvector, with eigenvalue s2
Definition at line 17 of file msm_wt_mat_2d.cxx.
msm_wt_mat_2d msm_wt_mat_2d::transform_by | ( | double | a, |
double | b | ||
) | const |
Calculates W2=T'WT where T is 2x2 matrix (a,-b;b,a).
Definition at line 52 of file msm_wt_mat_2d.cxx.
double msm_wt_mat_2d::xWx | ( | double | x, |
double | y | ||
) | const [inline] |
Compute (x y)W(x y)'.
Definition at line 56 of file msm_wt_mat_2d.h.
double msm_wt_mat_2d::m11_ [private] |
Definition at line 19 of file msm_wt_mat_2d.h.
double msm_wt_mat_2d::m12_ [private] |
Definition at line 19 of file msm_wt_mat_2d.h.
double msm_wt_mat_2d::m22_ [private] |
Definition at line 19 of file msm_wt_mat_2d.h.