Loading...
Searching...
No Matches
casacore::Matrix< T > Class Template Reference
casa package (libcasa_casa) » Arrays_module

More...

`#include <Matrix.h>`

## Public Member Functions

| Matrix ()
| A Matrix of length zero in each dimension; zero origin.
| Matrix (size_t l1, size_t l2, const T &initialValue=T())
| A Matrix with "l1" rows and "l2" columns.
| Matrix (size_t l1, size_t l2, typename Array< T >::uninitializedType)
| An uninitialized Matrix with "l1" rows and "l2" columns.
| Matrix (const IPosition &len, const T &initialValue=T())
| A matrix of shape with shape "len".
| Matrix (const IPosition &len, typename Array< T >::uninitializedType)
| An uninitialized matrix of shape with shape "len".
| Matrix (const Matrix< T > &source)
| The copy/move constructor uses reference semantics.
| Matrix (Matrix< T > &&source)
| Matrix (const Array< T > &source)
| Construct a Matrix by reference from "source".
| Matrix (Array< T > &&source)
| Matrix (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
| Create an Matrix of a given shape from a pointer.
| Matrix (const IPosition &shape, const T *storage)
| Create an Matrix of a given shape from a pointer.
void | resize (size_t nx, size_t ny, bool copyValues=false)
Matrix< T > & | operator= (const Matrix< T > &source)
Matrix< T > & | operator= (Matrix< T > &&source)
Matrix< T > & | operator= (const Array< T > &source)
Matrix< T > & | operator= (Array< T > &&source)
Matrix< T > & | assign_conforming (const Matrix< T > &source)
| Copy the values from other to this Matrix.
Matrix< T > & | assign_conforming (Matrix< T > &&source)
Matrix< T > & | assign_conforming (const Array< T > &source)
Matrix< T > & | assign_conforming (Array< T > &&source)
Array< T > & | operator= (const T &val)
| Copy val into every element of this Matrix; i.e.
Matrix< T > & | assign_conforming (const MaskedArray< T > &marray)
| Copy to this those values in marray whose corresponding elements in marray's mask are true.
T & | operator() (const IPosition &i)
| Single-pixel addressing.
const T & | operator() (const IPosition &i) const
T & | operator() (size_t i1, size_t i2)
const T & | operator() (size_t i1, size_t i2) const
MaskedArray< T > | operator() (const LogicalArray &mask) const
| The array is masked by the input LogicalArray.
MaskedArray< T > | operator() (const LogicalArray &mask)
| Return a MaskedArray.
MaskedArray< T > | operator() (const MaskedLogicalArray &mask) const
| The array is masked by the input MaskedLogicalArray.
MaskedArray< T > | operator() (const MaskedLogicalArray &mask)
| Return a MaskedArray.
Vector< T > | row (size_t i)
| Returns a reference to the i'th row.
const Vector< T > | row (size_t i) const
Vector< T > | column (size_t j)
| Returns a reference to the j'th column.
const Vector< T > | column (size_t j) const
Vector< T > | diagonal (long long n=0)
| Returns a diagonal from the Matrix.
const Vector< T > | diagonal (long long n=0) const
Matrix< T > | operator() (const Slice &sliceX, const Slice &sliceY)
| Take a slice of this matrix.
const Matrix< T > | operator() (const Slice &sliceX, const Slice &sliceY) const
Array< T > | operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr)
| Slice using IPositions.
const Array< T > | operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr) const
Array< T > | operator() (const IPosition &blc, const IPosition &trc)
const Array< T > | operator() (const IPosition &blc, const IPosition &trc) const
Array< T > | operator() (const Slicer &slicer)
const Array< T > | operator() (const Slicer &slicer) const
const IPosition & | shape () const
| The length of each axis of the Matrix.
void | shape (int &s1, int &s2) const
size_t | nrow () const
| The number of rows in the Matrix, i.e.
size_t | ncolumn () const
| The number of columns in the Matrix, i.e.
virtual bool | ok () const override
| Checks that the Matrix is consistent (invariants check out).
Public Member Functions inherited from casacore::Array< T >
| Array ()
| Result has dimensionality of zero, and nelements is zero.
| Array (const IPosition &shape)
| Create an array of the given shape, i.e.
| Array (const IPosition &shape, const T &initialValue)
| Create an array of the given shape and initialize it with the initial value.
| Array (const IPosition &shape, uninitializedType)
| Constructor to create an uninitialized array.
| Array (std::initializer_list< T > list)
| Construct a one-dimensional array from an initializer list.
| Array (const Array< T > &other)
| After construction, this and other reference the same storage.
| Array (Array< T > &&source) noexcept
| Source will be empty after this call.
| Array (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
| Create an Array of a given shape from a pointer.
| Array (const IPosition &shape, const T *storage)
| Create an Array of a given shape from a pointer.
template<typename InputIterator>
| Array (const IPosition &shape, InputIterator startIter)
| Construct an array from an iterator and a shape.
virtual | ~Array () noexcept
| Frees up storage only if this array was the last reference to it.
virtual std::unique_ptr< ArrayBase > | makeArray () const override
| Make an empty array of the same template type.
void | assign (const Array< T > &other)
| Assign the other array to this array.
void | assignBase (const ArrayBase &other, bool checkType=true) override
| Assign the source array to this array.
void | set (const T &value)
| Set every element of the array to "value." Also could use the assignment operator which assigns an array from a scalar.
template<typename Callable>
void | apply (Callable function)
| Apply the function to every element of the array.
virtual void | reference (const Array< T > &other)
| After invocation, this array and other reference the same storage.
Array< T > & | assign_conforming (const Array< T > &other)
| Copy the values in other to this.
Array< T > & | assign_conforming (const MaskedArray< T > &marray)
| Copy to this those values in marray whose corresponding elements in marray's mask are true.
Array< T > & | operator= (const Array< T > &other)
| TODO we should change the semantics.
Array< T > & | operator= (const MaskedArray< T > &marray)
| Calls assign_conforming().
Array< T > & | operator= (Array< T > &&other)
| The move operator takes the storage from the given array.
Array< T > & | operator= (const T &value)
| Set every element of this array to "value".
Array< T > | copy () const
| This makes a copy of the array and returns it.
void | copyMatchingPart (const Array< T > &from)
| This function copies the matching part of from array to this array.
void | unique ()
| This ensures that this array does not reference any other storage.
template<class U>
void | tovector (std::vector< T, U > &out) const
| Create an STL vector from an Array.
std::vector< T > | tovector () const
Array< T > | reform (const IPosition &shape) const
| It is occasionally useful to have an array which access the same storage appear to have a different shape.
bool | reformOrResize (const IPosition &newShape, size_t resizePercentage=0, bool resizeIfNeeded=true)
| Having an array that can be reused without requiring reallocation can be useful for large arrays.
bool | adjustLastAxis (const IPosition &newShape, size_t resizePercentage=0, bool resizeIfNeeded=true)
| Use this method to extend or reduce the last dimension of an array.
size_t | capacity () const
| Returns the number of elements allocated.
Array< T > | nonDegenerate (size_t startingAxis=0, bool throwIfError=true) const
| These member functions remove degenerate (ie.
Array< T > | nonDegenerate (const IPosition &ignoreAxes) const
void | nonDegenerate (const Array< T > &other, size_t startingAxis=0, bool throwIfError=true)
void | nonDegenerate (const Array< T > &other, const IPosition &ignoreAxes)
void | removeDegenerate (size_t startingAxis=0, bool throwIfError=true)
| Remove degenerate axes from this Array object.
void | removeDegenerate (const IPosition &ignoreAxes)
const Array< T > | addDegenerate (size_t numAxes) const
| This member function returns an Array reference with the specified number of extra axes, all of length one, appended to the end of the Array.
Array< T > | addDegenerate (size_t numAxes)
void | resize ()
| Make this array a different shape.
void | resize (const IPosition &newShape, bool copyValues=false) override
| Resize the array and optionally copy the values.
T & | operator() (const IPosition &)
| Access a single element of the array.
const T & | operator() (const IPosition &) const
Array< T > | operator() (const IPosition &start, const IPosition &end)
| Get a reference to an array section extending from start to end (inclusive).
const Array< T > | operator() (const IPosition &start, const IPosition &end) const
Array< T > | operator() (const IPosition &start, const IPosition &end, const IPosition &inc)
| Along the ith axis, every inc[i]'th element is chosen.
const Array< T > | operator() (const IPosition &start, const IPosition &end, const IPosition &inc) const
Array< T > | operator() (const Slicer &)
| Get a reference to an array section using a Slicer.
const Array< T > | operator() (const Slicer &) const
std::unique_ptr< ArrayBase > | getSection (const Slicer &) const override
| Get a reference to a section of an array.
Array< T > | operator[] (size_t i) const
| Get the subset given by the i-th value of the last axis.
Array< T > | diagonals (size_t firstAxis=0, long long diag=0) const
| Get the diagonal of each matrix part in the full array.
const MaskedArray< T > | operator() (const LogicalArray &mask) const
| The array is masked by the input LogicalArray.
MaskedArray< T > | operator() (const LogicalArray &mask)
const MaskedArray< T > | operator() (const MaskedLogicalArray &mask) const
| The array is masked by the input MaskedLogicalArray.
MaskedArray< T > | operator() (const MaskedLogicalArray &mask)
size_t | nrefs () const
| The number of references the underlying storage has assigned to it.
bool | conform (const Array< T > &other) const
| Are the shapes identical?
bool | conform (const MaskedArray< T > &other) const
T * | data ()
| Get a pointer to the beginning of the array.
const T * | data () const
T * | getStorage (bool &deleteIt)
| Generally use of this should be shunned, except to use a FORTRAN routine or something similar.
const T * | getStorage (bool &deleteIt) const
void * | getVStorage (bool &deleteIt) override
| The following functions behave the same as the corresponding getStorage functions in the derived templated Array class.
const void * | getVStorage (bool &deleteIt) const override
void | putStorage (T *&storage, bool deleteAndCopy)
| putStorage() is normally called after a call to getStorage() (cf).
void | putVStorage (void *&storage, bool deleteAndCopy) override
void | freeStorage (const T *&storage, bool deleteIt) const
| If deleteIt is set, delete "storage".
void | freeVStorage (const void *&storage, bool deleteIt) const override
virtual void | takeStorage (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
| Replace the data values with those in the pointer storage.
virtual void | takeStorage (const IPosition &shape, const T *storage)
| Since the pointer is const, a copy is always taken.
std::unique_ptr< ArrayPositionIterator > | makeIterator (size_t byDim) const override
| Create an ArrayIterator object of the correct type.
iterator | begin ()
| Get the begin iterator object for any array.
const_iterator | begin () const
iterator | end ()
const_iterator | end () const
contiter | cbegin ()
| Get the begin iterator object for a contiguous array.
const_contiter | cbegin () const
contiter | cend ()
const_contiter | cend () const
Public Member Functions inherited from casacore::ArrayBase
| ArrayBase () noexcept
| ArrayBase (const IPosition &shape)
| Create an array of the given shape, i.e.
| ArrayBase (const ArrayBase &other)
| Copy constructor.
| ArrayBase (ArrayBase &&source) noexcept
ArrayBase & | assign (const ArrayBase &)
| Assignment.
ArrayBase & | operator= (const ArrayBase &)=delete
ArrayBase & | operator= (ArrayBase &&) noexcept
virtual | ~ArrayBase () noexcept
| Destructor.
size_t | ndim () const
| The dimensionality of this array.
size_t | nelements () const
| How many elements does this array have?
size_t | size () const
bool | empty () const
| Is the array empty (i.e.
bool | contiguousStorage () const
| Are the array data contiguous?
const IPosition & | shape () const
| The length of each axis.
IPosition | endPosition () const
| A convenience function: endPosition(i) = shape(i) - 1; i.e.
const IPosition & | steps () const
| Return steps to be made if stepping one element in a dimension.
void | validateConformance (const ArrayBase &) const
| Various helper functions.
void | validateIndex (const IPosition &) const
void | validateIndex (size_t index) const
void | validateIndex (size_t index1, size_t index2) const
void | validateIndex (size_t index1, size_t index2, size_t index3) const

## Static Public Member Functions

static Matrix< T > | identity (size_t n)
| Create an identity matrix of side length n.
Static Public Member Functions inherited from casacore::ArrayBase
static unsigned | arrayVersion ()
| Array version for major change (used by ArrayIO).

## Protected Member Functions

virtual void | preTakeStorage (const IPosition &shape) override
| pre/post processing hook of takeStorage() for subclasses.
virtual void | doNonDegenerate (const Array< T > &other, const IPosition &ignoreAxes) override
| Remove the degenerate axes from other and store result in this matrix.
virtual size_t | fixedDimensionality () const override
| Subclasses can return their dimensionality.
Protected Member Functions inherited from casacore::Array< T >
| Array (Array< T > &&source, const IPosition &shapeForSource) noexcept
| Source will be empty with given shape after this call.
void | swap (Array< T > &other)
| Swap this array with another array.
virtual void | postTakeStorage ()
void | checkBeforeResize (const IPosition &newShape)
| This function is called when this array is about to be resized, before any work is done.
virtual void | checkAssignableType (ArrayBase &arrayBase) const
void | makeSteps ()
| Fill the steps and the end for a derived class.
void | setEndIter ()
| Set the end iterator.
Protected Member Functions inherited from casacore::ArrayBase
| ArrayBase (ArrayBase &&source, const IPosition &shapeForSource) noexcept
| For subclasses, this move constructor allows the moved-from object to obtain a given shape after resizing.
void | swap (ArrayBase &source) noexcept
bool | reformOrResize (const IPosition &newShape, bool resizeIfNeeded, size_t nReferences, long long nElementsAllocated, bool copyDataIfNeeded, size_t resizePercentage)
| Either reforms the array if size permits or resizes it to the new shape.
bool | isStorageContiguous () const
| Determine if the storage of a subset is contiguous.
void | checkVectorShape ()
| Check if the shape of a vector is correct.
void | checkMatrixShape ()
| Check if the shape of a matrix is correct.
void | checkCubeShape ()
| Check if the shape of a cube is correct.
void | baseReform (ArrayBase &tmp, const IPosition &shape, bool strict=true) const
| Reform the array to a shape with the same nr of elements.
void | baseNonDegenerate (const ArrayBase &other, const IPosition &ignoreAxes)
| Remove the degenerate axes from the Array object.
void | baseAddDegenerate (ArrayBase &, size_t numAxes)
| These member functions return an Array reference with the specified number of extra axes, all of length one, appended to the end of the Array.
size_t | makeSubset (ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
| Make a subset of an array.
size_t | makeDiagonal (size_t firstAxis, long long diag)
| Set the length and stride such that the diagonal of the matrices defined by two consecutive axes is formed.
bool | conform2 (const ArrayBase &other) const
| Are the shapes identical?
void | baseMakeSteps ()
| Make the indexing step sizes.
bool | copyVectorHelper (const ArrayBase &other)
| Helper function for templated Vector class.

## Private Member Functions

size_t | xinc () const
| Cached constants to improve indexing.
size_t | yinc () const

## Additional Inherited Members

Public Types inherited from casacore::Array< T >
typedef T | value_type
| Define the STL-style iterator functions (only forward iterator).
typedef const T & | const_reference
| TODO This is how std containers define a reference type, but the name 'reference' is already taken by a method.
typedef T * | pointer
| Pointer to an element type.
typedef const T * | const_pointer
| Constant pointer to the element type.
typedef IteratorSTL | iterator
typedef ConstIteratorSTL | const_iterator
typedef T * | contiter
typedef const T * | const_contiter
Static Public Attributes inherited from casacore::Array< T >
static struct casacore::Array::uninitializedType | uninitialized
Static Protected Member Functions inherited from casacore::Array< T >
static void | copyToContiguousStorage (T *dst, Array< T > const &src)
Protected Attributes inherited from casacore::Array< T >
std::shared_ptr< arrays_internal::Storage< T > > | data_p
| Shared pointer to a Storage that contains the data.
T * | begin_p
| This pointer is adjusted to point to the first element of the array.
T * | end_p
| The end for an STL-style iteration.
Protected Attributes inherited from casacore::ArrayBase
size_t | nels_p
| Number of elements in the array.
size_t | ndimen_p
| Dimensionality of the array.
bool | contiguous_p
| Are the data contiguous?
IPosition | length_p
| Used to hold the shape, increment into the underlying storage and originalLength of the array.
IPosition | inc_p
IPosition | originalLength_p
IPosition | steps_p
| Used to hold the step to next element in each dimension.

## Detailed Description

template<typename T>
class casacore::Matrix< T >

A 2-D Specialization of the Array class

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

Matrix objects are two-dimensional specializations (e.g., more convenient and efficient indexing) of the general Array class. You might also want to look at the Array documentation to see inherited functionality. A tutorial on using the array classes in general is available in the "AIPS++ Programming Manual".

Generally the member functions of Array are also available in Matrix versions which take a pair of integers where the array needs an IPosition. Since the Matrix is two-dimensional, the IPositions are overkill, although you may use those versions if you want to.

Matrix<int> mi(100,100); // Shape is 100x100
mi.resize(50,50); // Shape now 50x50
casacore::Matrix::Matrix
Matrix()
A Matrix of length zero in each dimension; zero origin.

Slices may be taken with the Slice class. To take a slice, one "indexes" with one Slice(start, length, inc) for each axis, where end and inc are optional. Additionally, there are row(), column() and diagonal() member functions which return Vector's which refer to the storage back in the Matrix:

Matrix<float> mf(100, 100);
mf.diagonal() = 1;

Correct indexing order of a matrix is:

Matrix<int> mi(n1,n2) // [nrow, ncolumn]
for (size_t j=0; j<mi.ncolumn(); j++) {
for (size_t i=0; i<mi.nrow(); i++) {
mi(i,j) = i*j;
}
}

Element-by-element arithmetic and logical operations are available (in aips/ArrayMath.h and aips/ArrayLogical.h). Other Matrix operations (e.g. LU decomposition) are available, and more appear periodically.

As with the Arrays, if the preprocessor symbol AIPS_DEBUG is defined at compile time invariants will be checked on entry to most member functions. Additionally, if AIPS_ARRAY_INDEX_CHECK is defined index operations will be bounds-checked. Neither of these should be defined for production code.

Definition at line 86 of file Matrix.h.

## Constructor & Destructor Documentation

## Matrix() [1/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( |  | ) |

A Matrix of length zero in each dimension; zero origin.

Referenced by casacore::Matrix< LogicalArrayElem >::assign_conforming(), and casacore::Matrix< LogicalArrayElem >::assign_conforming().

## Matrix() [2/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | size_t | l1,
|  | size_t | l2,
|  | const T & | initialValue = T() )

A Matrix with "l1" rows and "l2" columns.

Fill it with the initial value.

## Matrix() [3/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | size_t | l1,
|  | size_t | l2,
|  | typename Array< T >::uninitializedType | )

An uninitialized Matrix with "l1" rows and "l2" columns.

## Matrix() [4/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | const IPosition & | len,
|  | const T & | initialValue = T() )

A matrix of shape with shape "len".

Fill it with the initial value.

## Matrix() [5/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | const IPosition & | len,
|  | typename Array< T >::uninitializedType | )

An uninitialized matrix of shape with shape "len".

## Matrix() [6/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | const Matrix< T > & | source | ) |

The copy/move constructor uses reference semantics.

## Matrix() [7/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | Matrix< T > && | source | ) |

## Matrix() [8/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | const Array< T > & | source | ) |

Construct a Matrix by reference from "source".

"source must have ndim() of 2 or less.

## Matrix() [9/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | Array< T > && | source | ) |

## Matrix() [10/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | const IPosition & | shape,
|  | T * | storage,
|  | StorageInitPolicy | policy = COPY )

Create an Matrix of a given shape from a pointer.

## Matrix() [11/11]

template<typename T>

casacore::Matrix< T >::Matrix | ( | const IPosition & | shape,
|  | const T * | storage )

Create an Matrix of a given shape from a pointer.

Because the pointer is const, a copy is always made.

## Member Function Documentation

## assign_conforming() [1/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::assign_conforming | ( | Array< T > && | source | ) |

inline

Definition at line 165 of file Matrix.h.

## assign_conforming() [2/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::assign_conforming | ( | const Array< T > & | source | ) |

inline

TODO Should be supported by the Array class, see Cube::operator=(const Array&)

This might work if a.ndim == 1 or 2

Definition at line 151 of file Matrix.h.

## assign_conforming() [3/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::assign_conforming | ( | const MaskedArray< T > & | marray | ) |

inline

Copy to this those values in marray whose corresponding elements in marray's mask are true.

Definition at line 183 of file Matrix.h.

## assign_conforming() [4/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::assign_conforming | ( | const Matrix< T > & | source | ) |

inline

Copy the values from other to this Matrix.

If this matrix has zero elements then it will resize to be the same shape as other; otherwise other must conform to this. Note that the assign function can be used to assign a non-conforming matrix.

Definition at line 146 of file Matrix.h.

Referenced by casacore::Matrix< LogicalArrayElem >::operator=(), casacore::Matrix< LogicalArrayElem >::operator=(), casacore::Matrix< LogicalArrayElem >::operator=(), and casacore::Matrix< LogicalArrayElem >::operator=().

## assign_conforming() [5/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::assign_conforming | ( | Matrix< T > && | source | ) |

inline

Definition at line 148 of file Matrix.h.

## column() [1/2]

template<typename T>

Vector< T > casacore::Matrix< T >::column | ( | size_t | j | ) |

Returns a reference to the j'th column.

## column() [2/2]

template<typename T>

const Vector< T > casacore::Matrix< T >::column | ( | size_t | j | ) | const

## diagonal() [1/2]

template<typename T>

Vector< T > casacore::Matrix< T >::diagonal | ( | long long | n = 0 | ) |

Returns a diagonal from the Matrix.

The Matrix must be square. n==0 is the main diagonal. n>0 is above the main diagonal, n<0 is below it.

## diagonal() [2/2]

template<typename T>

const Vector< T > casacore::Matrix< T >::diagonal | ( | long long | n = 0 | ) | const

## doNonDegenerate()

template<typename T>

virtual void casacore::Matrix< T >::doNonDegenerate | ( | const Array< T > & | other,
|  | const IPosition & | ignoreAxes )

override protected virtual

Remove the degenerate axes from other and store result in this matrix.

An exception is thrown if removing degenerate axes does not result in a matrix.

Reimplemented from casacore::Array< T >.

## fixedDimensionality()

template<typename T>

virtual size_t casacore::Matrix< T >::fixedDimensionality | ( |  | ) | const

inline override protected virtual

Subclasses can return their dimensionality.

The Array class will make sure that whenever it is resized, the dimensionality is checked. Array's constructors do not check the dimensionality, because the subclass hasn't been created yet at that point. Subclasses should therefore make sure to call the constructors appropriately. For classes that return 0, any resize will be allowed.

Reimplemented from casacore::Array< T >.

Definition at line 316 of file Matrix.h.

## identity()

template<typename T>

Matrix< T > casacore::Matrix< T >::identity | ( | size_t | n | ) |

static

Create an identity matrix of side length n.

(Could not do this as a constructor because of ambiguities with other constructors).

## ncolumn()

template<typename T>

size_t casacore::Matrix< T >::ncolumn | ( |  | ) | const

inline

The number of columns in the Matrix, i.e.

the length of the 2nd axis.

Definition at line 302 of file Matrix.h.

## nrow()

template<typename T>

size_t casacore::Matrix< T >::nrow | ( |  | ) | const

inline

The number of rows in the Matrix, i.e.

the length of the first axis.

Definition at line 298 of file Matrix.h.

## ok()

template<typename T>

virtual bool casacore::Matrix< T >::ok | ( |  | ) | const

override virtual

Checks that the Matrix is consistent (invariants check out).

Reimplemented from casacore::Array< T >.

## operator()() [1/16]

template<typename T>

Array< T > casacore::Matrix< T >::operator() | ( | const IPosition & | blc,
|  | const IPosition & | trc )

inline

Definition at line 281 of file Matrix.h.

## operator()() [2/16]

template<typename T>

const Array< T > casacore::Matrix< T >::operator() | ( | const IPosition & | blc,
|  | const IPosition & | trc ) const

inline

Definition at line 283 of file Matrix.h.

## operator()() [3/16]

template<typename T>

Array< T > casacore::Matrix< T >::operator() | ( | const IPosition & | blc,
|  | const IPosition & | trc,
|  | const IPosition & | incr )

inline

Slice using IPositions.

Required to be defined, otherwise the base class versions are hidden.

Definition at line 275 of file Matrix.h.

## operator()() [4/16]

template<typename T>

const Array< T > casacore::Matrix< T >::operator() | ( | const IPosition & | blc,
|  | const IPosition & | trc,
|  | const IPosition & | incr ) const

inline

Definition at line 278 of file Matrix.h.

## operator()() [5/16]

template<typename T>

T & casacore::Matrix< T >::operator() | ( | const IPosition & | i | ) |

inline

Single-pixel addressing.

If AIPS_ARRAY_INDEX_CHECK is defined, bounds checking is performed.

Definition at line 189 of file Matrix.h.

## operator()() [6/16]

template<typename T>

const T & casacore::Matrix< T >::operator() | ( | const IPosition & | i | ) | const

inline

Definition at line 191 of file Matrix.h.

## operator()() [7/16]

template<typename T>

MaskedArray< T > casacore::Matrix< T >::operator() | ( | const LogicalArray & | mask | ) |

inline

Return a MaskedArray.

Definition at line 216 of file Matrix.h.

## operator()() [8/16]

template<typename T>

MaskedArray< T > casacore::Matrix< T >::operator() | ( | const LogicalArray & | mask | ) | const

inline

The array is masked by the input LogicalArray.

This mask must conform to the array.

Return a MaskedArray.

Definition at line 212 of file Matrix.h.

## operator()() [9/16]

template<typename T>

MaskedArray< T > casacore::Matrix< T >::operator() | ( | const MaskedLogicalArray & | mask | ) |

inline

Return a MaskedArray.

Definition at line 233 of file Matrix.h.

## operator()() [10/16]

template<typename T>

MaskedArray< T > casacore::Matrix< T >::operator() | ( | const MaskedLogicalArray & | mask | ) | const

inline

The array is masked by the input MaskedLogicalArray.

The mask is effectively the AND of the internal LogicalArray and the internal mask of the MaskedLogicalArray. The MaskedLogicalArray must conform to the array.

Return a MaskedArray.

Definition at line 229 of file Matrix.h.

## operator()() [11/16]

template<typename T>

Matrix< T > casacore::Matrix< T >::operator() | ( | const Slice & | sliceX,
|  | const Slice & | sliceY )

Take a slice of this matrix.

Slices are always indexed starting at zero. This uses reference semantics, i.e. changing a value in the slice changes the original.

Matrix<double> vd(100,100);
//..\.
vd(Slice(0,10),Slice(10,10)) = -1.0; // 10x10 sub-matrix set to -1.0
casacore::Slice
Definition Slice.h:89

## operator()() [12/16]

template<typename T>

const Matrix< T > casacore::Matrix< T >::operator() | ( | const Slice & | sliceX,
|  | const Slice & | sliceY ) const

## operator()() [13/16]

template<typename T>

Array< T > casacore::Matrix< T >::operator() | ( | const Slicer & | slicer | ) |

inline

Definition at line 285 of file Matrix.h.

## operator()() [14/16]

template<typename T>

const Array< T > casacore::Matrix< T >::operator() | ( | const Slicer & | slicer | ) | const

inline

Definition at line 287 of file Matrix.h.

## operator()() [15/16]

template<typename T>

T & casacore::Matrix< T >::operator() | ( | size_t | i1,
|  | size_t | i2 )

inline

Definition at line 193 of file Matrix.h.

## operator()() [16/16]

template<typename T>

const T & casacore::Matrix< T >::operator() | ( | size_t | i1,
|  | size_t | i2 ) const

inline

Definition at line 199 of file Matrix.h.

## operator=() [1/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::operator= | ( | Array< T > && | source | ) |

inline

Definition at line 137 of file Matrix.h.

## operator=() [2/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::operator= | ( | const Array< T > & | source | ) |

inline

Definition at line 135 of file Matrix.h.

## operator=() [3/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::operator= | ( | const Matrix< T > & | source | ) |

inline

Definition at line 131 of file Matrix.h.

## operator=() [4/5]

template<typename T>

Array< T > & casacore::Matrix< T >::operator= | ( | const T & | val | ) |

inline

Copy val into every element of this Matrix; i.e.

behaves as if val were a constant conformant matrix.

Definition at line 178 of file Matrix.h.

## operator=() [5/5]

template<typename T>

Matrix< T > & casacore::Matrix< T >::operator= | ( | Matrix< T > && | source | ) |

inline

Definition at line 133 of file Matrix.h.

## preTakeStorage()

template<typename T>

virtual void casacore::Matrix< T >::preTakeStorage | ( | const IPosition & |  | ) |

override protected virtual

pre/post processing hook of takeStorage() for subclasses.

Reimplemented from casacore::Array< T >.

## resize()

template<typename T>

void casacore::Matrix< T >::resize | ( | size_t | nx,
|  | size_t | ny,
|  | bool | copyValues = false )

## row() [1/2]

template<typename T>

Vector< T > casacore::Matrix< T >::row | ( | size_t | i | ) |

Returns a reference to the i'th row.

## row() [2/2]

template<typename T>

const Vector< T > casacore::Matrix< T >::row | ( | size_t | i | ) | const

## shape() [1/2]

template<typename T>

const IPosition & casacore::Matrix< T >::shape | ( |  | ) | const

inline

The length of each axis of the Matrix.

Definition at line 292 of file Matrix.h.

## shape() [2/2]

template<typename T>

void casacore::Matrix< T >::shape | ( | int & | s1,
|  | int & | s2 ) const

inline

Definition at line 294 of file Matrix.h.

## xinc()

template<typename T>

size_t casacore::Matrix< T >::xinc | ( |  | ) | const

inline private

Cached constants to improve indexing.

size_t xinc_p, yinc_p;

Definition at line 322 of file Matrix.h.

Referenced by casacore::Matrix< LogicalArrayElem >::operator()(), and casacore::Matrix< LogicalArrayElem >::operator()().

## yinc()

template<typename T>

size_t casacore::Matrix< T >::yinc | ( |  | ) | const

inline private

Definition at line 323 of file Matrix.h.

Referenced by casacore::Matrix< LogicalArrayElem >::operator()(), and casacore::Matrix< LogicalArrayElem >::operator()().

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

- casa/Arrays/ArrayFwd.h
- casa/Arrays/Matrix.h