DiagonalMatrix< Size, Precision, Base > Class Template Reference
[Linear Algebra]

A diagonal matrix. More...

#include <diagmatrix.h>

List of all members.

Public Member Functions

Precision & operator[] (int i)
const Precision & operator[] (int i) const
Vector< Size, Precision, Base >
::as_slice_type 
diagonal_slice ()
const Vector< Size, Precision,
Base >::as_slice_type 
diagonal_slice () const
Constructors
 DiagonalMatrix ()
 DiagonalMatrix (int size_in)
 DiagonalMatrix (Precision *data)
 DiagonalMatrix (Precision *data, int size_in)
 DiagonalMatrix (Precision *data_in, int size_in, int stride_in, Internal::Slicing)
template<class Op >
 DiagonalMatrix (const Operator< Op > &op)
template<int Size2, typename Precision2 , typename Base2 >
 DiagonalMatrix (const Vector< Size2, Precision2, Base2 > &from)

Public Attributes

Vector< Size, Precision, Base > my_vector


Detailed Description

template<int Size = Dynamic, typename Precision = DefaultPrecision, typename Base = Internal::VBase>
class TooN::DiagonalMatrix< Size, Precision, Base >

A diagonal matrix.

Support is limited but diagonal matrices can be multiplied by vectors, matrices or diagonal matrices on either side.

Diagonal matrices can be created from vectors by using the as_diagonal() member function:

Vector<3> v = makeVector(1,2,3);
Vector<3> v2 = v.as_diagonal() * v;   // v2 = (1,4,9)

A vector can be obtained from the diagonal matrix by using the diagonal_slice() member function.


Constructor & Destructor Documentation

DiagonalMatrix ( const Operator< Op > &  op  ) 


Member Function Documentation

Precision& operator[] ( int  i  ) 

Index the leading elements on the diagonal.

References DiagonalMatrix< Size, Precision, Base >::my_vector.

const Precision& operator[] ( int  i  )  const

Index the leading elements on the diagonal.

References DiagonalMatrix< Size, Precision, Base >::my_vector.

Vector<Size, Precision, Base>::as_slice_type diagonal_slice (  ) 

Return the leading diagonal as a vector.

References DiagonalMatrix< Size, Precision, Base >::my_vector.

const Vector<Size, Precision, Base>::as_slice_type diagonal_slice (  )  const

Return the leading diagonal as a vector.

References DiagonalMatrix< Size, Precision, Base >::my_vector.


Member Data Documentation

Vector<Size,Precision,Base> my_vector


Generated on Tue Oct 27 16:09:25 2009 for TooN by  doxygen 1.5.9