AFLOW
 
Loading...
Searching...
No Matches
xmatrix< utype > Class Template Reference

#include <aurostd_xmatrix.h>

Public Member Functions

 xmatrix (int=3, int=3, int=1, int=1)
 
 xmatrix (const std::initializer_list< std::initializer_list< utype > >)
 
 xmatrix (int, int, utype *)
 
 xmatrix (const xmatrix< utype > &)
 
 xmatrix (const xvector< utype > &)
 
xmatrix< utype > & operator= (const xmatrix< utype > &)
 
xmatrix< utype > & operator= (const std::initializer_list< std::initializer_list< utype > >)
 
 ~xmatrix ()
 
utype * operator[] (int) const
 
xvector< utype > operator() (int) const
 
utype & operator() (int, int) const
 
utype & operator() (int, int, bool) const
 
xvector< utype > getcol (int) const
 
xvector< utype > getdiag (int k=0, int _lrows=1) const
 
xvector< utype > getxvec () const
 Convert xmatrix into xvector given a set of indices.
 
xvector< utype > getxvec (int lrow, int urow, int lcol, int ucol, int lrows_out=1) const
 Convert an xmatrix into an xvector given a set of indices.
 
void getxmatInPlace (xmatrix< utype > &mat_out, int lrow, int urow, int lcol, int ucol, int lrows_out=1, int lcols_out=1) const
 Convert xmatrix into a submatrix given a set of indices.
 
void getxvecInPlace (xvector< utype > &xv_out, int lrow, int urow, int lcol, int ucol, int lrows_out=1) const
 
xmatrix< utype > getxmat (int lrow, int urow, int lcol, int ucol, int lrows_out=1, int lcols_out=1) const
 
void setrow (const xvector< utype > &row, int irow=1)
 
void setcol (const xvector< utype > &col, int icol=1)
 
void setmat (const xmatrix< utype > &mat, int irow=1, int icol=1)
 
void setmat (const xvector< utype > &xv, int icol=1, bool col=true)
 
xmatrix< utype > & operator+= (const xmatrix< utype > &)
 
xmatrix< utype > & operator+= (const std::initializer_list< std::initializer_list< utype > >)
 
xmatrix< utype > & operator-= (const xmatrix< utype > &)
 
xmatrix< utype > & operator-= (const std::initializer_list< std::initializer_list< utype > >)
 
xmatrix< utype > & operator*= (const xmatrix< utype > &)
 
xmatrix< utype > & operator*= (utype r)
 
xmatrix< utype > & operator/= (utype r)
 
xmatrix< utype > & operator/= (const xmatrix< utype > &)
 
void set (const utype &)
 
void reset ()
 
void clear ()
 
void shift (int new_lrows, int new_lcols)
 shift the lower bounds of an xmatrix to new values
 
void shiftrow (int new_lrows)
 shift the lower row bound of an xmatrix to a new value
 
void shiftcol (int new_lcols)
 shift the lower column bound of an xmatrix to a new value
 
void reshape (uint new_rows, uint new_cols=0)
 reshape a xmatrix to given dimensions
 
void reshape (int new_urows, int new_ucols, int new_lrows, int new_lcols)
 reshape a xmatrix to given dimensions
 

Public Attributes

int rows
 
int lrows
 
int urows
 
int cols
 
int lcols
 
int ucols
 
bool issquare
 
bool isfloat
 
bool iscomplex
 

Private Types

typedef std::initializer_list< utype >::const_iterator ili
 
typedef std::initializer_list< std::initializer_list< utype > >::const_iterator il2i
 

Private Member Functions

void init ()
 
void free ()
 
void copy (const xmatrix< utype > &b)
 
void copy (const xvector< utype > &b)
 
void copy (const std::initializer_list< std::initializer_list< utype > > ll)
 
void refresh ()
 

Private Attributes

utype ** corpus
 
char size
 
long int msize
 

Detailed Description

template<class utype>
class xmatrix< utype >

Definition at line 40 of file aurostd_xmatrix.h.

Member Typedef Documentation

◆ ili

template<class utype>
typedef std::initializer_list<utype>::const_iterator aurostd::xmatrix< utype >::ili
private

Definition at line 104 of file aurostd_xmatrix.h.

◆ il2i

template<class utype>
typedef std::initializer_list<std::initializer_list<utype>>::const_iterator aurostd::xmatrix< utype >::il2i
private

Definition at line 105 of file aurostd_xmatrix.h.

Constructor & Destructor Documentation

◆ xmatrix() [1/5]

template<class utype>
aurostd::xmatrix< utype >::xmatrix ( int nrh = 3,
int nch = 3,
int nrl = 1,
int ncl = 1 )

Definition at line 60 of file aurostd_xmatrix.cpp.

◆ xmatrix() [2/5]

template<class utype>
aurostd::xmatrix< utype >::xmatrix ( const std::initializer_list< std::initializer_list< utype > > ll)

Definition at line 115 of file aurostd_xmatrix.cpp.

◆ xmatrix() [3/5]

template<class utype>
aurostd::xmatrix< utype >::xmatrix ( int vrows,
int vcols,
utype * a )

Definition at line 140 of file aurostd_xmatrix.cpp.

◆ xmatrix() [4/5]

template<class utype>
aurostd::xmatrix< utype >::xmatrix ( const xmatrix< utype > & b)

Definition at line 97 of file aurostd_xmatrix.cpp.

◆ xmatrix() [5/5]

template<class utype>
aurostd::xmatrix< utype >::xmatrix ( const xvector< utype > & b)

Definition at line 106 of file aurostd_xmatrix.cpp.

◆ ~xmatrix()

template<class utype>
aurostd::xmatrix< utype >::~xmatrix ( )

Definition at line 184 of file aurostd_xmatrix.cpp.

Member Function Documentation

◆ operator=() [1/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator= ( const xmatrix< utype > & b)

Definition at line 295 of file aurostd_xmatrix.cpp.

◆ operator=() [2/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator= ( const std::initializer_list< std::initializer_list< utype > > ll)

Definition at line 306 of file aurostd_xmatrix.cpp.

◆ operator[]()

template<class utype>
utype * aurostd::xmatrix< utype >::operator[] ( int ir) const

Definition at line 455 of file aurostd_xmatrix.cpp.

◆ operator()() [1/3]

template<class utype>
xvector< utype > aurostd::xmatrix< utype >::operator() ( int i) const

Definition at line 507 of file aurostd_xmatrix.cpp.

◆ operator()() [2/3]

template<class utype>
utype & aurostd::xmatrix< utype >::operator() ( int i,
int j ) const

Definition at line 477 of file aurostd_xmatrix.cpp.

◆ operator()() [3/3]

template<class utype>
utype & aurostd::xmatrix< utype >::operator() ( int i,
int j,
bool bc ) const

Definition at line 866 of file aurostd_xmatrix.cpp.

◆ getcol()

template<class utype>
xvector< utype > aurostd::xmatrix< utype >::getcol ( int i) const
nodiscard

Definition at line 521 of file aurostd_xmatrix.cpp.

◆ getdiag()

template<class utype>
xvector< utype > aurostd::xmatrix< utype >::getdiag ( int k = 0,
int _lrows = 1 ) const
nodiscard

Definition at line 534 of file aurostd_xmatrix.cpp.

◆ getxvec() [1/2]

template<class utype>
xvector< utype > aurostd::xmatrix< utype >::getxvec ( ) const
nodiscard

Convert xmatrix into xvector given a set of indices.

Parameters
void
Returns
xvector
Authors
20220711 | Adam Zettel - created

This function performs the same task as getxvecInPlace(), but it assumes that you have already passed it a 1-d slice of the xmatrix and then performs the type conversion.

See also
aurostd::getxvecInPlace()
aurostd::getxmatInPlace()

Definition at line 675 of file aurostd_xmatrix.cpp.

◆ getxvec() [2/2]

template<class utype>
xvector< utype > aurostd::xmatrix< utype >::getxvec ( int lrow,
int urow,
int lcol,
int ucol,
int lrows_out = 1 ) const
nodiscard

Convert an xmatrix into an xvector given a set of indices.

Parameters
xv_outthe xvector that will be changed InPlace
lrowlower row to include in xvector
urowupper row to include in xvector
lcollower column to include in xvector
ucolupper column to include in xvector
Returns
xvector

This function allocates the xvector then calls getxvecInPlace().

Authors
2019110 | Corey Oses - created as getxmatInPlace() + xmatrix2xvector()
20220711 | Adam Zettel - refactored into getxvecInPlace()
See also
aurostd::getxvecInPlace()
aurostd::getxmatInPlace()

Definition at line 653 of file aurostd_xmatrix.cpp.

◆ getxmatInPlace()

template<class utype>
void aurostd::xmatrix< utype >::getxmatInPlace ( xmatrix< utype > & mat_out,
int lrow,
int urow,
int lcol,
int ucol,
int lrows_out = 1,
int lcols_out = 1 ) const

Convert xmatrix into a submatrix given a set of indices.

Parameters
mat_outthe matrix that will be changed InPlace
lrowlower row to include in submatrix
urowupper row to include in submatrix
lcollower column to include in submatrix
ucolupper column to include in submatrix
lrows_outthe lower row of the matrix that will be written over mat_out (if it is not the same it will allocate a new matrix)
lcols_outthe lower column of the matrix that will be written over mat_out (if it is not the same it will allocate a new matrix)
Returns
void
Authors
2019110 | Corey Oses - created
20220711 | Adam Zettel - modified

This is a function that slices an xmatrix into into a submatrix, originally written by CO. When slicing the xmatrix. lrow is lower row. urow is upper row. lcol is lower column and ucol is upper column. Note that the indices are inclusive. i.e any index given will be returned. Also lcol == ucol or lrow == urow in order to be a vector. This function is designed so the base "InPlace" function drives the rest of the functions. The InPlace designation means you must supply a matrix that will then be changed InPlace to the matrix elements that are specified by the arguments.

Note

CO: this function returns a submatrix mat_out spanning urow:lrow,ucol:lcol of the original matrix lrows_out,lcols_out specifies lrows,lcols of mat_out this is different than submatrix(), which returns back a submatrix by cutting out irow,jcol

Definition at line 711 of file aurostd_xmatrix.cpp.

◆ getxvecInPlace()

template<class utype>
void aurostd::xmatrix< utype >::getxvecInPlace ( xvector< utype > & xv_out,
int lrow,
int urow,
int lcol,
int ucol,
int lrows_out = 1 ) const

Convert an xmatrix into an xvector given a set of indices.

Parameters
xv_outthe xvector that will be changed InPlace
lrowlower row to include in xvector
urowupper row to include in xvector
lcollower column to include in xvector
ucolupper column to include in xvector
lrows_outthe lower rows of the output xvector (if it does not match the xvector will be resized)
Returns
void
Authors
2019110 | Corey Oses - created as getxmatInPlace (xvector overload) + xmatrix2xvector
20220711 | Adam Zettel - refactored into getxvecInPlace

This is a function that slices an xmatrix into an xvector, It checks that the vector is 1-dimensional when slicing the xmatrix. Note that the indices are inclusive.

See also
aurostd::getxmatInplace

Definition at line 560 of file aurostd_xmatrix.cpp.

◆ getxmat()

template<class utype>
xmatrix< utype > aurostd::xmatrix< utype >::getxmat ( int lrow,
int urow,
int lcol,
int ucol,
int lrows_out = 1,
int lcols_out = 1 ) const
nodiscard

Definition at line 747 of file aurostd_xmatrix.cpp.

◆ setrow()

template<class utype>
void aurostd::xmatrix< utype >::setrow ( const xvector< utype > & row,
int irow = 1 )

Definition at line 756 of file aurostd_xmatrix.cpp.

◆ setcol()

template<class utype>
void aurostd::xmatrix< utype >::setcol ( const xvector< utype > & col,
int icol = 1 )

Definition at line 768 of file aurostd_xmatrix.cpp.

◆ setmat() [1/2]

template<class utype>
void aurostd::xmatrix< utype >::setmat ( const xmatrix< utype > & mat,
int irow = 1,
int icol = 1 )

Definition at line 780 of file aurostd_xmatrix.cpp.

◆ setmat() [2/2]

template<class utype>
void aurostd::xmatrix< utype >::setmat ( const xvector< utype > & xv,
int icol = 1,
bool col = true )

Definition at line 809 of file aurostd_xmatrix.cpp.

◆ operator+=() [1/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator+= ( const xmatrix< utype > & r)

Definition at line 950 of file aurostd_xmatrix.cpp.

◆ operator+=() [2/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator+= ( const std::initializer_list< std::initializer_list< utype > > ll)

Definition at line 971 of file aurostd_xmatrix.cpp.

◆ operator-=() [1/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator-= ( const xmatrix< utype > & r)

Definition at line 997 of file aurostd_xmatrix.cpp.

◆ operator-=() [2/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator-= ( const std::initializer_list< std::initializer_list< utype > > ll)

Definition at line 1018 of file aurostd_xmatrix.cpp.

◆ operator*=() [1/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator*= ( const xmatrix< utype > & b)

Definition at line 1045 of file aurostd_xmatrix.cpp.

◆ operator*=() [2/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator*= ( utype r)

Definition at line 1093 of file aurostd_xmatrix.cpp.

◆ operator/=() [1/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator/= ( utype r)

Definition at line 1113 of file aurostd_xmatrix.cpp.

◆ operator/=() [2/2]

template<class utype>
xmatrix< utype > & aurostd::xmatrix< utype >::operator/= ( const xmatrix< utype > & a)

Definition at line 1130 of file aurostd_xmatrix.cpp.

◆ set()

template<class utype>
void aurostd::xmatrix< utype >::set ( const utype & s)

Definition at line 2455 of file aurostd_xmatrix.cpp.

◆ reset()

template<class utype>
void aurostd::xmatrix< utype >::reset ( )

Definition at line 2397 of file aurostd_xmatrix.cpp.

◆ clear()

template<class utype>
void aurostd::xmatrix< utype >::clear ( )

Definition at line 2429 of file aurostd_xmatrix.cpp.

◆ shift()

template<class utype>
void aurostd::xmatrix< utype >::shift ( int new_lrows,
int new_lcols )

shift the lower bounds of an xmatrix to new values

Parameters
new_lrowsnew lower bound for rows
new_lcolsnew lower bound for columns
Authors
20220915 | Hagen Eckert - created function
Note
modifies the pointers but not the underlying data field

Definition at line 342 of file aurostd_xmatrix.cpp.

◆ shiftrow()

template<class utype>
void aurostd::xmatrix< utype >::shiftrow ( int new_lrows)

shift the lower row bound of an xmatrix to a new value

Parameters
new_lrowsnew lower bound for rows
Note
modifies the pointers but not the underlying data field

Definition at line 362 of file aurostd_xmatrix.cpp.

◆ shiftcol()

template<class utype>
void aurostd::xmatrix< utype >::shiftcol ( int new_lcols)

shift the lower column bound of an xmatrix to a new value

Parameters
new_lcolsnew lower bound for columns
Note
modifies the pointers but not the underlying data field

Definition at line 369 of file aurostd_xmatrix.cpp.

◆ reshape() [1/2]

template<class utype>
void aurostd::xmatrix< utype >::reshape ( uint new_rows,
uint new_cols = 0 )

reshape a xmatrix to given dimensions

Parameters
new_rowsrow count
new_colscolumn count
Authors
20220915 | Hagen Eckert - created function
Note
When new_rows or new_cols is set to 0, it is automatically calculated. This is also true when new_cols is not given.
lower bound for rows and columns is not changed
modifies the pointers but not the underlying data field

Definition at line 383 of file aurostd_xmatrix.cpp.

◆ reshape() [2/2]

template<class utype>
void aurostd::xmatrix< utype >::reshape ( int new_urows,
int new_ucols,
int new_lrows,
int new_lcols )

reshape a xmatrix to given dimensions

Parameters
new_urowsnew upper bound for rows
new_ucolsnew upper bound for columns
new_lrowsnew lower bound for rows
new_lcolsnew lower bound for columns
Authors
20220915 | Hagen Eckert - created function
Note
modifies the pointers but not the underlying data field

Definition at line 410 of file aurostd_xmatrix.cpp.

◆ init()

template<class utype>
void aurostd::xmatrix< utype >::init ( )
private

Definition at line 122 of file aurostd_xmatrix.cpp.

◆ free()

template<class utype>
void aurostd::xmatrix< utype >::free ( )
private

Definition at line 201 of file aurostd_xmatrix.cpp.

◆ copy() [1/3]

template<class utype>
void aurostd::xmatrix< utype >::copy ( const xmatrix< utype > & b)
private

Definition at line 212 of file aurostd_xmatrix.cpp.

◆ copy() [2/3]

template<class utype>
void aurostd::xmatrix< utype >::copy ( const xvector< utype > & b)
private

Definition at line 262 of file aurostd_xmatrix.cpp.

◆ copy() [3/3]

template<class utype>
void aurostd::xmatrix< utype >::copy ( const std::initializer_list< std::initializer_list< utype > > ll)
private

Definition at line 270 of file aurostd_xmatrix.cpp.

◆ refresh()

template<class utype>
void aurostd::xmatrix< utype >::refresh ( )
private

Definition at line 316 of file aurostd_xmatrix.cpp.

Member Data Documentation

◆ rows

template<class utype>
int aurostd::xmatrix< utype >::rows

Definition at line 83 of file aurostd_xmatrix.h.

◆ lrows

template<class utype>
int aurostd::xmatrix< utype >::lrows

Definition at line 83 of file aurostd_xmatrix.h.

◆ urows

template<class utype>
int aurostd::xmatrix< utype >::urows

Definition at line 83 of file aurostd_xmatrix.h.

◆ cols

template<class utype>
int aurostd::xmatrix< utype >::cols

Definition at line 84 of file aurostd_xmatrix.h.

◆ lcols

template<class utype>
int aurostd::xmatrix< utype >::lcols

Definition at line 84 of file aurostd_xmatrix.h.

◆ ucols

template<class utype>
int aurostd::xmatrix< utype >::ucols

Definition at line 84 of file aurostd_xmatrix.h.

◆ issquare

template<class utype>
bool aurostd::xmatrix< utype >::issquare

Definition at line 85 of file aurostd_xmatrix.h.

◆ isfloat

template<class utype>
bool aurostd::xmatrix< utype >::isfloat

Definition at line 85 of file aurostd_xmatrix.h.

◆ iscomplex

template<class utype>
bool aurostd::xmatrix< utype >::iscomplex

Definition at line 85 of file aurostd_xmatrix.h.

◆ corpus

template<class utype>
utype** aurostd::xmatrix< utype >::corpus
private

Definition at line 100 of file aurostd_xmatrix.h.

◆ size

template<class utype>
char aurostd::xmatrix< utype >::size
private

Definition at line 102 of file aurostd_xmatrix.h.

◆ msize

template<class utype>
long int aurostd::xmatrix< utype >::msize
private

Definition at line 103 of file aurostd_xmatrix.h.


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