RNifti
Fast R and C++ Access to NIfTI Images
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RNifti::SquareMatrix< NiftiType, ElementType, Order > Class Template Reference

Class representing a numeric square matrix of a fixed order. More...

#include <NiftiImage.h>

Public Types

typedef NiftiType NativeType
 The niftilib structure type corresponding to this matrix.
 
typedef SquareMatrix< NiftiType, ElementType, Order > MatrixType
 Type alias for the current specialisation.
 
typedef Vector< ElementType, Order > VectorType
 Type of vectors for which this matrix is a linear operator.
 

Public Member Functions

 SquareMatrix (const ElementType value=0.0)
 Initialise with a fixed element value, defaulting to zero.
 
 SquareMatrix (const ElementType *source)
 Initialise from a C-style array of the appropriate type and length.
 
 SquareMatrix (const NiftiType &source)
 Initialise from the appropriate niftilib type.
 
 SquareMatrix (SEXP source)
 Initialise from an R object representing a numeric matrix.
 
 operator const NiftiType () const
 Implicit conversion to the corresponding niftilib type, which allows a SquareMatrix object to be used directly in library functions.
 
 operator NiftiType ()
 Implicit conversion to the corresponding niftilib type, which allows a SquareMatrix object to be used directly in library functions.
 
const ElementType * begin () const
 Return a pointer/iterator to the beginning of the data. More...
 
ElementType * begin ()
 Return a pointer/iterator to the beginning of the data. More...
 
const ElementType * end () const
 Return a pointer/iterator to the end of the data.
 
ElementType * end ()
 Return a pointer/iterator to the end of the data.
 
MatrixType inverse () const
 Matrix inverse.
 
MatrixType polar () const
 Polar decomposition, as implemented in niftilib (Order 3 only)
 
ElementType colnorm () const
 Maximum column norm, as implemented in niftilib (Order 3 only)
 
ElementType rownorm () const
 Maximum row norm, as implemented in niftilib (Order 3 only)
 
ElementType determ () const
 Matrix determinant, as implemented in niftilib (Order 3 only)
 
MatrixType multiply (const MatrixType &other) const
 Matrix-matrix multiplication.
 
VectorType multiply (const VectorType &vec) const
 Matrix-vector multiplication.
 
MatrixType operator* (const MatrixType &other) const
 Matrix-matrix multiplication (infix shorthand)
 
VectorType operator* (const VectorType &vec) const
 Matrix-vector multiplication (infix shorthand)
 
const ElementType & operator() (const int i, const int j) const
 Indexing operator. More...
 
ElementType & operator() (const int i, const int j)
 Indexing operator. More...
 
 operator SEXP () const
 SEXP cast operator, which converts to R's numeric matrix type
 

Static Public Member Functions

static MatrixType eye ()
 Construct an identity matrix of the appropriate size.
 

Protected Member Functions

NiftiType * niftiPointer () const
 Obtain a pointer to a NIfTI-style mat44 or dmat44 encapsulating the same data as this object.
 
NiftiType niftiCopy () const
 Copy the data elements into a new NIfTI-style mat44 or dmat44.
 

Protected Attributes

ElementType elements [Order *Order]
 The underlying raw data elements, stored row-major for consistency with niftilib.
 

Detailed Description

template<class NiftiType, typename ElementType, int Order>
class RNifti::SquareMatrix< NiftiType, ElementType, Order >

Class representing a numeric square matrix of a fixed order.

Provides object-based encapsulation and version agnosticism for certain NIfTI-relevant matrix operations, as well as other conveniences such as iterators and conversion to/from R matrices.

Author
Jon Clayden (code@.nosp@m.clay.nosp@m.den.o.nosp@m.rg)

Member Function Documentation

◆ begin() [1/2]

template<class NiftiType , typename ElementType , int Order>
ElementType* RNifti::SquareMatrix< NiftiType, ElementType, Order >::begin ( )
inline

Return a pointer/iterator to the beginning of the data.

Elements are accessed in row-major order

◆ begin() [2/2]

template<class NiftiType , typename ElementType , int Order>
const ElementType* RNifti::SquareMatrix< NiftiType, ElementType, Order >::begin ( ) const
inline

Return a pointer/iterator to the beginning of the data.

Elements are accessed in row-major order

◆ operator()() [1/2]

template<class NiftiType , typename ElementType , int Order>
ElementType& RNifti::SquareMatrix< NiftiType, ElementType, Order >::operator() ( const int  i,
const int  j 
)
inline

Indexing operator.

The first index is for column, and the second is for row

◆ operator()() [2/2]

template<class NiftiType , typename ElementType , int Order>
const ElementType& RNifti::SquareMatrix< NiftiType, ElementType, Order >::operator() ( const int  i,
const int  j 
) const
inline

Indexing operator.

The first index is for column, and the second is for row


The documentation for this class was generated from the following file: