Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Public Member Functions
TSQR::Matrix< Ordinal, Scalar > Class Template Reference

A column-oriented dense matrix. More...

#include <Tsqr_Matrix.hpp>

Inheritance diagram for TSQR::Matrix< Ordinal, Scalar >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Matrix (const Ordinal num_rows, const Ordinal num_cols)
 Constructor with dimensions.
 Matrix (const Ordinal num_rows, const Ordinal num_cols, const Scalar &value)
 Constructor with dimensions and fill datum.
 Matrix (const Matrix &in)
 Copy constructor.
 Matrix ()
 Default constructor (constructs an empty matrix).
 ~Matrix ()
 Trivial destructor.
template<class MatrixViewType >
 Matrix (const MatrixViewType &in)
 "Copy constructor" from a matrix view type.
template<class MatrixViewType >
void copy (MatrixViewType &B)
 Copy the matrix B into this matrix.
void fill (const Scalar value)
 Fill all entries of the matrix with the given value.
Scalar & operator() (const Ordinal i, const Ordinal j)
 Non-const reference to element (i,j) of the matrix.
const Scalar & operator() (const Ordinal i, const Ordinal j) const
 Const reference to element (i,j) of the matrix.
Scalar & operator[] (const Ordinal i)
 1-D std::vector - style access.
template<class MatrixViewType >
bool operator== (const MatrixViewType &B) const
 Equality test: compares dimensions and entries.
Ordinal nrows () const
 Number of rows in the matrix.
Ordinal ncols () const
 Number of columns in the matrix.
Ordinal lda () const
 Leading dimension (a.k.a. stride) of the matrix.
bool empty () const
 Whether the matrix is empty (has either zero rows or zero columns).
Scalar * get ()
 A non-const pointer to the matrix data.
const Scalar * get () const
 A const pointer to the matrix data.
MatView< Ordinal, Scalar > view ()
 A non-const view of the matrix.
ConstMatView< Ordinal, Scalar > const_view () const
 A const view of the matrix.
void reshape (const Ordinal num_rows, const Ordinal num_cols)

Detailed Description

template<class Ordinal, class Scalar>
class TSQR::Matrix< Ordinal, Scalar >

A column-oriented dense matrix.

Author:
Mark Hoemmen

A column-oriented dense matrix, with indices of type Ordinal and elements of type Scalar.

Note:
This class resembles Teuchos::SerialDenseMatrix. It existed originally because there was a need for TSQR to build independently of Teuchos. That requirement no longer exists, but for various reasons it has been helpful to keep Matrix around. In particular, I can change the interface of Matrix without affecting other Teuchos users.

Definition at line 59 of file Tsqr_Matrix.hpp.


Constructor & Destructor Documentation

template<class Ordinal, class Scalar>
TSQR::Matrix< Ordinal, Scalar >::Matrix ( const Ordinal  num_rows,
const Ordinal  num_cols 
) [inline]

Constructor with dimensions.

Definition at line 157 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
TSQR::Matrix< Ordinal, Scalar >::Matrix ( const Ordinal  num_rows,
const Ordinal  num_cols,
const Scalar &  value 
) [inline]

Constructor with dimensions and fill datum.

Definition at line 165 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
TSQR::Matrix< Ordinal, Scalar >::Matrix ( const Matrix< Ordinal, Scalar > &  in) [inline]

Copy constructor.

We need an explicit copy constructor, because otherwise the default copy constructor would override the generic matrix view "copy constructor" below.

Definition at line 178 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
TSQR::Matrix< Ordinal, Scalar >::Matrix ( ) [inline]

Default constructor (constructs an empty matrix).

Definition at line 188 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
TSQR::Matrix< Ordinal, Scalar >::~Matrix ( ) [inline]

Trivial destructor.

Definition at line 191 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
template<class MatrixViewType >
TSQR::Matrix< Ordinal, Scalar >::Matrix ( const MatrixViewType &  in) [inline]

"Copy constructor" from a matrix view type.

This constructor allocates a new matrix and copies the elements of the input view into the resulting new matrix. MatrixViewType must have nrows(), ncols(), get(), and lda() methods that match MatView's methods.

Definition at line 200 of file Tsqr_Matrix.hpp.


Member Function Documentation

template<class Ordinal, class Scalar>
template<class MatrixViewType >
void TSQR::Matrix< Ordinal, Scalar >::copy ( MatrixViewType &  B) [inline]

Copy the matrix B into this matrix.

Parameters:
B[in] A matrix with the same dimensions (numbers of rows and columns) as this matrix.

Definition at line 215 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
void TSQR::Matrix< Ordinal, Scalar >::fill ( const Scalar  value) [inline]

Fill all entries of the matrix with the given value.

Definition at line 232 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
Scalar& TSQR::Matrix< Ordinal, Scalar >::operator() ( const Ordinal  i,
const Ordinal  j 
) [inline]

Non-const reference to element (i,j) of the matrix.

Parameters:
i[in] Zero-based row index of the matrix.
j[in] Zero-based column index of the matrix.

Definition at line 241 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
const Scalar& TSQR::Matrix< Ordinal, Scalar >::operator() ( const Ordinal  i,
const Ordinal  j 
) const [inline]

Const reference to element (i,j) of the matrix.

Parameters:
i[in] Zero-based row index of the matrix.
j[in] Zero-based column index of the matrix.

Definition at line 249 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
Scalar& TSQR::Matrix< Ordinal, Scalar >::operator[] ( const Ordinal  i) [inline]

1-D std::vector - style access.

Definition at line 254 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
template<class MatrixViewType >
bool TSQR::Matrix< Ordinal, Scalar >::operator== ( const MatrixViewType &  B) const [inline]

Equality test: compares dimensions and entries.

The test is templated so that B may have a different Ordinal type or even a different Scalar type than *this.

Definition at line 263 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
Ordinal TSQR::Matrix< Ordinal, Scalar >::nrows ( ) const [inline]

Number of rows in the matrix.

Definition at line 287 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
Ordinal TSQR::Matrix< Ordinal, Scalar >::ncols ( ) const [inline]

Number of columns in the matrix.

Definition at line 290 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
Ordinal TSQR::Matrix< Ordinal, Scalar >::lda ( ) const [inline]

Leading dimension (a.k.a. stride) of the matrix.

Definition at line 293 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
bool TSQR::Matrix< Ordinal, Scalar >::empty ( ) const [inline]

Whether the matrix is empty (has either zero rows or zero columns).

Definition at line 296 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
Scalar* TSQR::Matrix< Ordinal, Scalar >::get ( ) [inline]

A non-const pointer to the matrix data.

Definition at line 300 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
const Scalar* TSQR::Matrix< Ordinal, Scalar >::get ( ) const [inline]

A const pointer to the matrix data.

Definition at line 310 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
MatView<Ordinal, Scalar> TSQR::Matrix< Ordinal, Scalar >::view ( ) [inline]

A non-const view of the matrix.

Definition at line 319 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
ConstMatView<Ordinal, Scalar> TSQR::Matrix< Ordinal, Scalar >::const_view ( ) const [inline]

A const view of the matrix.

Definition at line 324 of file Tsqr_Matrix.hpp.

template<class Ordinal, class Scalar>
void TSQR::Matrix< Ordinal, Scalar >::reshape ( const Ordinal  num_rows,
const Ordinal  num_cols 
) [inline]

Change the dimensions of the matrix. Reallocate if necessary. Existing data in the matrix is invalidated.

Parameters:
num_rows[in] New number of rows in the matrix
num_cols[in] New number of columns in the matrix
Warning:
This does <it>not</it> do the same thing as the Matlab function of the same name. In particular, it does not reinterpret the existing matrix data using different dimensions.

Definition at line 341 of file Tsqr_Matrix.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends