SquareMatrix< N, T > Class Template Reference

An NxN matrix. More...

#include <SquareMatrix.h>

Inheritance diagram for SquareMatrix< N, T >:
TensorTypes< T >

List of all members.

Public Types

typedef base_type::value_type value_type
 The element type of the tensor.
typedef base_type::pointer pointer
 A pointer to a tensor element.
typedef base_type::const_pointer const_pointer
 A const pointer to a tensor element.
typedef base_type::iterator iterator
 An iterator in the tensor.
typedef base_type::const_iterator const_iterator
 A const iterator in the tensor.
typedef base_type::reference reference
 A reference to a tensor element.
typedef base_type::const_reference const_reference
 A const reference to a tensor element.
typedef base_type::size_type size_type
 The size type.
typedef base_type::difference_type difference_type
 Pointer difference type.
typedef base_type::index_type index_type
 An index into the tensor.

Public Member Functions

 SquareMatrix ()
 Default constructor. Leave the data uninitialized.
 ~SquareMatrix ()
 Trivial destructor.
 SquareMatrix (const SquareMatrix &x)
 Copy constructor.
template<typename T2 >
 SquareMatrix (const SquareMatrix< N, T2 > &x)
 Construct from a matrix with different number type.
 SquareMatrix (const_pointer x)
 Construct from an array.
 SquareMatrix (const value_type x)
 Initialize all the elements with the given value.
SquareMatrixoperator= (const SquareMatrix &x)
 Assignment operator.
SquareMatrixoperator= (const value_type x)
 Assignment operator. Assign all elements the given value.
template<typename T2 >
SquareMatrixoperator= (const SquareMatrix< N, T2 > &x)
 Assignment operator for a SquareMatrix with different number type.
iterator begin ()
 Return an iterator to the beginning of the data.
iterator end ()
 Return an iterator to the end of the data.
const_iterator begin () const
 Return a const_iterator to the beginning of the data.
const_iterator end () const
 Return a const_iterator to the end of the data.
pointer data ()
 Return a pointer to the data.
const_pointer data () const
 Return a const_pointer to the data.
size_type size () const
 Return the size of the tensor.
value_type operator() (const index_type i) const
 Subscripting. Return the i_th element.
reference operator() (const index_type i)
 Subscripting. Return a reference to the i_th element.
value_type operator[] (const index_type i) const
 Subscripting. Return the i_th element.
value_typeoperator[] (const index_type i)
 Subscripting. Return a reference to the i_th element.
value_type operator() (const index_type i, const index_type j) const
 Indexing. Return element in the i_th row and j_th column.
reference operator() (const index_type i, const index_type j)
 Indexing. Return a reference to the element in the i_th row and j_th column.
void get (pointer x) const
 Get the elements in row-major order.
void set (const_pointer x)
 Set the elements in row-major order.
void getMinor (const int i, const int j, SquareMatrix< N-1, T > &minor) const
 Get the specified minor of the matrix.
void negate ()
 Negate each element.
void transpose ()
 Transpose the matrix.
SquareMatrixoperator+= (const value_type x)
 Add x to each element.
SquareMatrixoperator-= (const value_type x)
 Subtract x from each element.
SquareMatrixoperator*= (const value_type x)
 Multiply each element by x.
SquareMatrixoperator/= (const value_type x)
 Divide each element by x.
SquareMatrixoperator%= (const value_type x)
 Mod each element by x.
template<typename T2 >
SquareMatrixoperator+= (const SquareMatrix< N, T2 > &x)
 Element-wise addition.
template<typename T2 >
SquareMatrixoperator-= (const SquareMatrix< N, T2 > &x)
 Element-wise subtraction.
template<typename T2 >
SquareMatrixoperator*= (const SquareMatrix< N, T2 > &x)
 Matrix product.
SquareMatrix operator+ ()
 Unary positive operator.
SquareMatrix operator- ()
 Unary negate operator.

Protected Attributes

value_type _elem [N][N]
 The elements of the matrix.

Detailed Description

template<int N, typename T = double>
class SquareMatrix< N, T >

An NxN matrix.

Parameters:
N,: The matrix is NxN.
T is the number type. By default it is double.

Member Function Documentation

template<int N, typename T = double>
void SquareMatrix< N, T >::getMinor ( const int  i,
const int  j,
SquareMatrix< N-1, T > &  minor 
) const

Get the specified minor of the matrix.

The matrix with the i_th row and the j_th column removed.


The documentation for this class was generated from the following file:
Generated on Thu Jun 30 02:14:52 2016 for Algorithms and Data Structures Package by  doxygen 1.6.3