12#ifndef MFEM_SYMMETRICMAT
13#define MFEM_SYMMETRICMAT
104 const real_t &
Elem(
int i,
int j)
const override;
153 MFEM_ASSERT(data && i >= 0 && i < height && j >= 0 && j <
width,
"");
156 return data[(j*
height) - (((j-1)*j)/2) + i - j];
160 return data[(i*
height) - (((i-1)*i)/2) + j - i];
166 MFEM_ASSERT(data && i >= 0 && i < height && j >= 0 && j <
width,
"");
169 return data[(j*
height) - (((j-1)*j)/2) + i - j];
173 return data[(i*
height) - (((i-1)*i)/2) + j - i];
Memory< T > & GetMemory()
Return a reference to the Memory object used by the Array.
T * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), on_dev).
void LoseData()
NULL-ifies the data.
void MakeRef(T *data_, int size_, bool own_data=false)
Make this Array a reference to a pointer.
void DeleteAll()
Delete the whole array.
T * Write(bool on_dev=true)
Shortcut for mfem::Write(a.GetMemory(), a.Size(), on_dev).
bool OwnsData() const
Return true if the data will be deleted by the Array.
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
DenseSymmetricMatrix(real_t *d, int s)
Construct a DenseSymmetricMatrix using an existing data array.
const Memory< real_t > & GetMemory() const
real_t * HostWrite()
Shortcut for mfem::Write(GetMemory(), GetStoredSize(), false).
void SetSize(int s)
Change the size of the DenseSymmetricMatrix to s x s.
const real_t * HostRead() const
Shortcut for mfem::Read(GetMemory(), GetStoredSize(), false).
void UseExternalData(real_t *d, int s)
Change the data array and the size of the DenseSymmetricMatrix.
real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(GetMemory(), GetStoredSize(), on_dev).
DenseSymmetricMatrix & operator*=(real_t c)
int GetStoredSize() const
Return the number of stored nonzeros in the matrix.
real_t & operator()(int i, int j)
Returns reference to a_{ij}.
real_t * HostReadWrite()
Shortcut for mfem::ReadWrite(GetMemory(), GetStoredSize(), false).
std::size_t MemoryUsage() const
DenseSymmetricMatrix(DenseSymmetricMatrix &&)=default
Move constructor: default.
void Clear()
Delete the matrix data array (if owned) and reset the matrix state.
real_t * Data() const
Returns the matrix data array.
Memory< real_t > & GetMemory()
DenseSymmetricMatrix & operator=(const DenseSymmetricMatrix &m)=default
Copy assignment: default. Sets the matrix size and elements equal to those of m.
DenseSymmetricMatrix & operator=(DenseSymmetricMatrix &&)=default
Move assignment: default.
bool OwnsData() const
Return the DenseSymmetricMatrix data (host pointer) ownership flag.
MatrixInverse * Inverse() const override
Returns a pointer to (an approximation) of the matrix inverse.
real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(GetMemory(), GetStoredSize(), on_dev).
void Mult(const Vector &x, Vector &y) const override
Matrix vector multiplication.
DenseSymmetricMatrix(const DenseSymmetricMatrix &)=default
Copy constructor: default.
const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(GetMemory(), GetStoredSize(), on_dev).
real_t * GetData() const
Returns the matrix data array.
DenseSymmetricMatrix & operator=(real_t c)
Sets the matrix elements equal to constant c.
real_t & Elem(int i, int j) override
Returns reference to a_{ij}.
void Reset(real_t *d, int s)
Change the data array and the size of the DenseSymmetricMatrix.
Abstract data type for matrix inverse.
Abstract data type matrix.
Class used by MFEM to store pointers to host and/or device memory.
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.