26#ifndef CASA_MATRIX_2_H
27#define CASA_MATRIX_2_H
94 Matrix(
size_t l1,
size_t l2,
const T &initialValue = T());
128 void resize(
size_t nx,
size_t ny,
bool copyValues=
false);
156 if (source.
ndim() == 2) {
167 if (source.ndim() == 2) {
306 virtual bool ok()
const override;
327 extern template class Matrix<bool>;
328 extern template class Matrix<float>;
329 extern template class Matrix<double>;
size_t ndim() const
The dimensionality of this array.
bool contiguous_p
Are the data contiguous?
IPosition originalLength_p
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array.
Array< T > & operator=(const Array< T > &other)
TODO we should change the semantics.
T * begin_p
This pointer is adjusted to point to the first element of the array.
T & operator()(const IPosition &)
Access a single element of the array.
Array< T > & assign_conforming(const Array< T > &other)
Copy the values in other to this.
void resize()
Make this array a different shape.
size_t nrow() const
The number of rows in the Matrix, i.e.
Matrix< T > operator()(const Slice &sliceX, const Slice &sliceY)
Take a slice of this matrix.
const Vector< T > column(size_t j) const
const Array< T > operator()(const IPosition &blc, const IPosition &trc) const
Matrix(const Array< T > &source)
Construct a Matrix by reference from "source".
const T & operator()(const IPosition &i) const
Vector< T > diagonal(long long n=0)
Returns a diagonal from the Matrix.
size_t ncolumn() const
The number of columns in the Matrix, i.e.
Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
Matrix(Matrix< T > &&source)
const Vector< T > diagonal(long long n=0) const
Matrix< T > & operator=(const Matrix< T > &source)
const Vector< T > row(size_t i) const
Matrix< T > & assign_conforming(Array< T > &&source)
Matrix()
A Matrix of length zero in each dimension; zero origin.
Matrix< T > & operator=(const Array< T > &source)
Array< T > operator()(const Slicer &slicer)
Matrix< T > & operator=(Matrix< T > &&source)
Vector< T > row(size_t i)
Returns a reference to the i'th row.
Matrix(const IPosition &len, typename Array< T >::uninitializedType)
An uninitialized matrix of shape with shape "len".
void shape(int &s1, int &s2) const
Matrix(const IPosition &shape, const T *storage)
Create an Matrix of a given shape from a pointer.
T & operator()(const IPosition &i)
Single-pixel addressing.
const Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
Matrix< T > & operator=(Array< T > &&source)
Matrix(size_t l1, size_t l2, typename Array< T >::uninitializedType)
An uninitialized Matrix with "l1" rows and "l2" columns.
size_t xinc() const
Cached constants to improve indexing.
void resize(size_t nx, size_t ny, bool copyValues=false)
Matrix(const IPosition &len, const T &initialValue=T())
A matrix of shape with shape "len".
Vector< T > column(size_t j)
Returns a reference to the j'th column.
Array< T > & operator=(const T &val)
Copy val into every element of this Matrix; i.e.
T & operator()(size_t i1, size_t i2)
const Array< T > operator()(const Slicer &slicer) const
Matrix(Array< T > &&source)
virtual void preTakeStorage(const IPosition &shape) override
pre/post processing hook of takeStorage() for subclasses.
static Matrix< T > identity(size_t n)
Create an identity matrix of side length n.
virtual bool ok() const override
Checks that the Matrix is consistent (invariants check out).
Matrix< 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 IPosition &blc, const IPosition &trc)
const IPosition & shape() const
The length of each axis of the Matrix.
Matrix< T > & assign_conforming(const Array< T > &source)
Matrix(const Matrix< T > &source)
The copy/move constructor uses reference semantics.
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes) override
Remove the degenerate axes from other and store result in this matrix.
Matrix< T > & assign_conforming(Matrix< T > &&source)
Matrix< T > & assign_conforming(const Matrix< T > &source)
Copy the values from other to this Matrix.
Matrix(size_t l1, size_t l2, const T &initialValue=T())
A Matrix with "l1" rows and "l2" columns.
Matrix(const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
Create an Matrix of a given shape from a pointer.
const T & operator()(size_t i1, size_t i2) const
virtual size_t fixedDimensionality() const override
Subclasses can return their dimensionality.
const Matrix< T > operator()(const Slice &sliceX, const Slice &sliceY) const
@ COPY
COPY is used when an internal copy of the storage is to be made.
this file contains all the compiler specific defines
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
TableExprNode marray(const TableExprNode &array, const TableExprNode &mask)
Form a masked array.
This is a tag for the constructor that may be used to construct an uninitialized Array.