15 #include "../config/config.hpp" 16 #include "../general/globals.hpp" 36 void FNorm(
double &scale_factor,
double &scaled_fnorm2)
const;
63 template <
int M,
int N>
67 for (
int i = 0; i < M; i++)
69 for (
int j = 0; j < N; j++)
71 (*this)(i,j) = values[i][j];
82 data.
Wrap(d, h*w,
false);
90 void Reset(
double *d,
int h,
int w)
112 {
return const_cast<double*
>((
const double*)data);}
127 inline const double &
operator()(
int i,
int j)
const;
133 double Trace()
const;
136 virtual double &
Elem(
int i,
int j);
139 virtual const double &
Elem(
int i,
int j)
const;
142 void Mult(
const double *x,
double *y)
const;
173 const double a = 1.0)
const;
182 double InnerProduct(
const double *x,
const double *y)
const;
218 void Set(
double alpha,
const double *A);
231 void Add(
const double c,
const double *A);
253 void Norm2(
double *v)
const;
258 MFEM_ASSERT(v.
Size() ==
Width(),
"incompatible Vector size!");
277 { Eigensystem(ev, &evect); }
281 { Eigensystem(ev, &evect); }
286 { Eigensystem(
b, ev); }
290 { Eigensystem(
b, ev, &evect); }
295 { Eigensystem(
b, ev, &evect); }
298 int Rank(
double tol)
const;
315 void SetRow(
int r,
const double* row);
318 void SetCol(
int c,
const double* col);
323 void SetRow(
int row,
double value);
325 void SetCol(
int col,
double value);
335 void Diag(
double c,
int n);
337 void Diag(
double *diag,
int n);
377 int row_offset,
int col_offset);
379 void CopyMNDiag(
double c,
int n,
int row_offset,
int col_offset);
381 void CopyMNDiag(
double *diag,
int n,
int row_offset,
int col_offset);
466 const double *
Read(
bool on_dev =
true)
const 496 void Add(
const DenseMatrix &A,
const DenseMatrix &B,
497 double alpha, DenseMatrix &C);
500 void Add(
double alpha,
const double *A,
501 double beta,
const double *B, DenseMatrix &C);
504 void Add(
double alpha,
const DenseMatrix &A,
505 double beta,
const DenseMatrix &B, DenseMatrix &C);
521 bool LinearSolve(DenseMatrix& A,
double* X,
double TOL = 1.e-9);
524 void Mult(
const DenseMatrix &
b,
const DenseMatrix &c, DenseMatrix &
a);
527 void AddMult(
const DenseMatrix &
b,
const DenseMatrix &c, DenseMatrix &
a);
530 void AddMult_a(
double alpha,
const DenseMatrix &
b,
const DenseMatrix &c,
543 void CalcInverse(
const DenseMatrix &
a, DenseMatrix &inva);
551 void CalcOrtho(
const DenseMatrix &J, Vector &n);
554 void MultAAt(
const DenseMatrix &
a, DenseMatrix &aat);
557 void MultADAt(
const DenseMatrix &A,
const Vector &D, DenseMatrix &ADAt);
560 void AddMultADAt(
const DenseMatrix &A,
const Vector &D, DenseMatrix &ADAt);
563 void MultABt(
const DenseMatrix &A,
const DenseMatrix &B, DenseMatrix &ABt);
566 void MultADBt(
const DenseMatrix &A,
const Vector &D,
567 const DenseMatrix &B, DenseMatrix &ADBt);
570 void AddMultABt(
const DenseMatrix &A,
const DenseMatrix &B, DenseMatrix &ABt);
573 void AddMultADBt(
const DenseMatrix &A,
const Vector &D,
574 const DenseMatrix &B, DenseMatrix &ADBt);
577 void AddMult_a_ABt(
double a,
const DenseMatrix &A,
const DenseMatrix &B,
581 void MultAtB(
const DenseMatrix &A,
const DenseMatrix &B, DenseMatrix &AtB);
584 void AddMult_a_AAt(
double a,
const DenseMatrix &A, DenseMatrix &AAt);
587 void Mult_a_AAt(
double a,
const DenseMatrix &A, DenseMatrix &AAt);
590 void MultVVt(
const Vector &v, DenseMatrix &vvt);
592 void MultVWt(
const Vector &v,
const Vector &w, DenseMatrix &VWt);
595 void AddMultVWt(
const Vector &v,
const Vector &w, DenseMatrix &VWt);
598 void AddMultVVt(
const Vector &v, DenseMatrix &VWt);
601 void AddMult_a_VWt(
const double a,
const Vector &v,
const Vector &w,
605 void AddMult_a_VVt(
const double a,
const Vector &v, DenseMatrix &VVt);
609 void RAP(
const DenseMatrix &A,
const DenseMatrix &P, DenseMatrix &
RAP);
613 void RAP(
const DenseMatrix &Rt,
const DenseMatrix &A,
614 const DenseMatrix &P, DenseMatrix &
RAP);
628 virtual bool Factor(
int m,
double TOL = 0.0)
634 virtual double Det(
int m)
const 640 virtual void Solve(
int m,
int n,
double *X)
const 660 #ifdef MFEM_USE_LAPACK 684 virtual bool Factor(
int m,
double TOL = 0.0);
688 virtual double Det(
int m)
const;
692 void Mult(
int m,
int n,
double *X)
const;
696 void LSolve(
int m,
int n,
double *X)
const;
700 void USolve(
int m,
int n,
double *X)
const;
704 virtual void Solve(
int m,
int n,
double *X)
const;
708 void RightSolve(
int m,
int n,
double *X)
const;
715 static void SubMult(
int m,
int n,
int r,
const double *A21,
716 const double *X1,
double *X2);
728 void BlockFactor(
int m,
int n,
double *A12,
double *A21,
double *A22)
const;
746 double *B1,
double *B2)
const;
755 const double *X2,
double *Y1)
const;
783 virtual bool Factor(
int m,
double TOL = 0.0);
787 virtual double Det(
int m)
const;
791 void LMult(
int m,
int n,
double *X)
const;
795 void UMult(
int m,
int n,
double *X)
const;
799 void LSolve(
int m,
int n,
double *X)
const;
803 void USolve(
int m,
int n,
double *X)
const;
807 virtual void Solve(
int m,
int n,
double *X)
const;
811 void RightSolve(
int m,
int n,
double *X)
const;
830 bool own_data =
false;
854 void Mult(
const double *x,
double *y)
const;
880 #ifdef MFEM_USE_LAPACK 930 bool left_eigen_vectors =
false,
931 bool right_eigen_vectors =
false);
955 #ifdef MFEM_USE_LAPACK 978 bool left_singular_vectors=
false,
979 bool right_singular_vectors=
false);
996 bool left_singular_vectors=
false,
997 bool right_singular_vectors=
false);
1021 char left_singular_vectors=
'A',
1022 char right_singular_vectors=
'A');
1047 char left_singular_vectors=
'A',
1048 char right_singular_vectors=
'A');
1090 #endif // if MFEM_USE_LAPACK 1120 tdata.
Wrap(d, i*j*k,
false);
1127 tdata.
New(i*j*k, mt);
1132 : Mk(NULL, other.Mk.height, other.Mk.width), nk(other.nk)
1154 tdata.
New(i*j*k, mt);
1162 tdata.
Wrap(ext_data, i*j*k,
false);
1173 MFEM_ASSERT_INDEX_IN_RANGE(k, 0,
SizeK());
1179 MFEM_ASSERT_INDEX_IN_RANGE(k, 0,
SizeK());
1187 MFEM_ASSERT_INDEX_IN_RANGE(i, 0,
SizeI());
1188 MFEM_ASSERT_INDEX_IN_RANGE(j, 0,
SizeJ());
1189 MFEM_ASSERT_INDEX_IN_RANGE(k, 0,
SizeK());
1195 MFEM_ASSERT_INDEX_IN_RANGE(i, 0,
SizeI());
1196 MFEM_ASSERT_INDEX_IN_RANGE(j, 0,
SizeJ());
1197 MFEM_ASSERT_INDEX_IN_RANGE(k, 0,
SizeK());
1203 MFEM_ASSERT_INDEX_IN_RANGE(k, 0,
SizeK());
1209 MFEM_ASSERT_INDEX_IN_RANGE(k, 0,
SizeK());
1215 const double *
Data()
const {
return tdata; }
1230 const double *
Read(
bool on_dev =
true)
const 1272 void BatchLUFactor(DenseTensor &Mlu, Array<int> &P,
const double TOL = 0.0);
1283 void BatchLUSolve(
const DenseTensor &Mlu,
const Array<int> &P, Vector &X);
1290 MFEM_ASSERT(data && i >= 0 && i < height && j >= 0 && j <
width,
"");
1296 MFEM_ASSERT(data && i >= 0 && i < height && j >= 0 && j <
width,
"");
const double * GetColumn(int col) const
void Symmetrize()
(*this) = 1/2 ((*this) + (*this)^t)
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void MultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
Multiply a matrix A with the transpose of a matrix B: A*Bt.
DenseMatrix & operator-=(const DenseMatrix &m)
void SymmetricScaling(const Vector &s)
SymmetricScaling this = diag(sqrt(s)) * this * diag(sqrt(s))
void SquareRootInverse()
Replaces the current matrix with its square root inverse.
void RightSolve(int m, int n, double *X) const
void RightSolve(int m, int n, double *X) const
int CheckFinite(const double *v, const int n)
void BatchLUFactor(DenseTensor &Mlu, Array< int > &P, const double TOL)
Compute the LU factorization of a batch of matrices.
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
void Mult(DenseMatrix &X) const
Multiply the inverse matrix by another matrix: X <- A^{-1} X.
DenseMatrix & operator*=(double c)
void SetCol(int c, const double *col)
void UseExternalData(double *ext_data, int i, int j, int k)
DenseTensor & operator=(double c)
Sets the tensor elements equal to constant c.
void MultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
double * HostWrite()
Shortcut for mfem::Write(GetMemory(), TotalSize(), false).
Memory< double > & GetMemory()
void SetRow(int r, const double *row)
void InvRightScaling(const Vector &s)
InvRightScaling: this = this * diag(1./s);.
const DenseMatrix & operator()(int k) const
void Mult(int m, int n, double *X) const
void Eigenvalues(Vector &ev)
Compute eigenvalues of A x = ev x where A = *this.
void Mult(const double *x, double *y) const
Matrix vector multiplication with the inverse of dense matrix.
void GetInverseMatrix(DenseMatrix &Ainv) const
Compute and return the inverse matrix in Ainv.
virtual double Det(int m) const
void Delete()
Delete the owned pointers and reset the Memory object.
DenseMatrix & operator()(int k)
void Eigensystem(DenseMatrix &b, Vector &ev, DenseMatrix &evect)
void AddMultTranspose_a(double a, const Vector &x, Vector &y) const
y += a * A^t x
const double * HostRead() const
Shortcut for mfem::Read(GetMemory(), TotalSize(), false).
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
MFEM_DEPRECATED DenseMatrixSVD(DenseMatrix &M, bool left_singular_vectors=false, bool right_singular_vectors=false)
Constructor for the DenseMatrixSVD.
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
double MaxMaxNorm() const
Compute the norm ||A|| = max_{ij} |A_{ij}|.
const Memory< double > & GetMemory() const
virtual void GetInverseMatrix(int m, double *X) const
Assuming L.U = P.A factored data of size (m x m), compute X <- A^{-1}.
virtual void Solve(int m, int n, double *X) const
int Size() const
Returns the size of the vector.
double EigenvalueImagPart(int i)
T * Write(Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for write access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true...
void TestInversion()
Invert and print the numerical conditioning of the inversion.
Data type dense matrix using column-major storage.
DenseMatrix & LeftSingularvectors()
Return left singular vectors.
void CopyRows(const DenseMatrix &A, int row1, int row2)
Copy rows row1 through row2 from A to *this.
double * Data() const
Returns the matrix data array.
void Swap(DenseTensor &t)
void LSolve(int m, int n, double *X) const
void Eval(DenseMatrix &M)
Evaluate the SVD.
double CalcSingularvalue(const int i) const
Return the i-th singular value (decreasing order) of NxN matrix, N=1,2,3.
Abstract data type for matrix inverse.
double Det() const
Compute the determinant of the original DenseMatrix using the LU factors.
void AddMult_a_ABt(double a, const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += a * A * B^t.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
double * HostReadWrite()
Shortcut for mfem::ReadWrite(GetMemory(), TotalSize(), false).
void Factor()
Factor the current DenseMatrix, *a.
virtual void Solve(int m, int n, double *X) const
void CopyFrom(const Memory &src, int size)
Copy size entries from src to *this.
void GradToVectorCurl2D(DenseMatrix &curl)
const double * Data() const
Vector & EigenvaluesImagPart()
void CalcOrtho(const DenseMatrix &J, Vector &n)
DenseMatrix & operator=(double c)
Sets the matrix elements equal to constant c.
void Set(double alpha, const double *A)
Set the matrix to alpha * A, assuming that A has the same dimensions as the matrix and uses column-ma...
double Trace() const
Trace of a square matrix.
void Mult_a_AAt(double a, const DenseMatrix &A, DenseMatrix &AAt)
AAt = a * A * A^t.
void BlockForwSolve(int m, int n, int r, const double *L21, double *B1, double *B2) const
void GetRowSums(Vector &l) const
Compute the row sums of the DenseMatrix.
virtual double Det(int m) const
const Memory< double > & GetMemory() const
void Getl1Diag(Vector &l) const
Returns the l1 norm of the rows of the matrix v_i = sum_j |a_ij|.
virtual double Det(int m) const
static void SubMult(int m, int n, int r, const double *A21, const double *X1, double *X2)
virtual void GetInverseMatrix(int m, double *X) const
virtual void Solve(int m, int n, double *X) const
virtual void PrintMatlab(std::ostream &out=mfem::out) const
Prints operator in Matlab format.
const Vector & Eigenvector(int i)
void USolve(int m, int n, double *X) const
virtual void PrintT(std::ostream &out=mfem::out, int width_=4) const
Prints the transpose matrix to stream out.
void Set(double alpha, const DenseMatrix &A)
Set the matrix to alpha * A.
void Add(const DenseMatrix &A, const DenseMatrix &B, double alpha, DenseMatrix &C)
C = A + alpha*B.
double & operator()(int i, int j)
Returns reference to a_{ij}.
void Wrap(T *ptr, int size, bool own)
Wrap an externally allocated host pointer, ptr with the current host memory type returned by MemoryMa...
const double * Read(bool on_dev=true) const
Shortcut for mfem::Read( GetMemory(), TotalSize(), on_dev).
void CalcAdjugateTranspose(const DenseMatrix &a, DenseMatrix &adjat)
Calculate the transposed adjugate of a matrix (for NxN matrices, N=1,2,3)
double & operator()(int i, int j, int k)
DenseMatrix & RightEigenvectors()
double * GetData() const
Returns the matrix data array.
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
void Norm2(double *v) const
Take the 2-norm of the columns of A and store in v.
double Singularvalue(int i)
Return specific singular value.
void Reset(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
int Size() const
For backward compatibility define Size to be synonym of Width()
DenseMatrix(const double(&values)[M][N])
const double * HostRead() const
Shortcut for mfem::Read(GetMemory(), TotalSize(), false).
void Add(const double c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void AddMult_a_VWt(const double a, const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += a * v w^t.
void InvSymmetricScaling(const Vector &s)
InvSymmetricScaling this = diag(sqrt(1./s)) * this * diag(sqrt(1./s))
Abstract data type matrix.
double InnerProduct(const double *x, const double *y) const
Compute y^t A x.
virtual void Print(std::ostream &out=mfem::out, int width_=4) const
Prints matrix to stream out.
void MultADBt(const DenseMatrix &A, const Vector &D, const DenseMatrix &B, DenseMatrix &ADBt)
ADBt = A D B^t, where D is diagonal.
void Invert()
Replaces the current matrix with its inverse.
bool LinearSolve(DenseMatrix &A, double *X, double TOL)
Solves the dense linear system, A * X = B for X
virtual ~DenseMatrixInverse()
Destroys dense inverse matrix.
void UMult(int m, int n, double *X) const
void GetDiag(Vector &d) const
Returns the diagonal of the matrix.
DenseTensor(int i, int j, int k, MemoryType mt)
DenseTensor(double *d, int i, int j, int k)
DenseMatrixGeneralizedEigensystem(DenseMatrix &a, DenseMatrix &b, bool left_eigen_vectors=false, bool right_eigen_vectors=false)
void LeftScaling(const Vector &s)
LeftScaling this = diag(s) * this.
void AddMult_a(double a, const Vector &x, Vector &y) const
y += a * A.x
void AddMultVVt(const Vector &v, DenseMatrix &VVt)
VVt += v v^t.
void CopyMNDiag(double c, int n, int row_offset, int col_offset)
Copy c on the diagonal of size n to *this at row_offset, col_offset.
void SingularValues(Vector &sv) const
DenseMatrix & LeftEigenvectors()
~DenseMatrixEigensystem()
void AddMult_a_VVt(const double a, const Vector &v, DenseMatrix &VVt)
VVt += a * v v^t.
void Neg()
(*this) = -(*this)
void GetColumn(int c, Vector &col) const
void SetSize(int i, int j, int k, MemoryType mt_=MemoryType::PRESERVE)
virtual void SetOperator(const Operator &op)
Set/update the solver for the given operator.
double FNorm2() const
Compute the square of the Frobenius norm of the matrix.
int Capacity() const
Return the size of the allocated memory.
void LSolve(int m, int n, double *X) const
double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(GetMemory(), TotalSize(), on_dev).
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)
const T * Read(const Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for read access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true...
void Mult(const double *x, double *y) const
Matrix vector multiplication.
DenseMatrix & Eigenvectors()
void Reset()
Reset the memory to be empty, ensuring that Delete() will be a no-op.
void LMult(int m, int n, double *X) const
double * GetData() const
Return a pointer to the beginning of the Vector data.
void Threshold(double eps)
Replace small entries, abs(a_ij) <= eps, with zero.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
void TestInversion()
Print the numerical conditioning of the inversion: ||A^{-1} A - I||.
void Swap(Array< T > &, Array< T > &)
void CalcEigenvalues(double *lambda, double *vec) const
void Transpose()
(*this) = (*this)^t
virtual void AddMult(const Vector &x, Vector &y, const double a=1.0) const
y += a * A.x
void MultVVt(const Vector &v, DenseMatrix &vvt)
Make a matrix from a vector V.Vt.
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
void AddMultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += A * B^t.
void BatchLUSolve(const DenseTensor &Mlu, const Array< int > &P, Vector &X)
Solve batch linear systems.
int Size() const
Get the size of the inverse matrix.
void GetRow(int r, Vector &row) const
bool OwnsData() const
Return the DenseMatrix data (host pointer) ownership flag.
Class for Singular Value Decomposition of a DenseMatrix.
virtual bool Factor(int m, double TOL=0.0)
Compute the Cholesky factorization of the current matrix.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
MemoryType
Memory types supported by MFEM.
double InnerProduct(const Vector &x, const Vector &y) const
Compute y^t A x.
DenseTensor(int i, int j, int k)
Vector & EigenvaluesRealPart()
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
void GetColumnReference(int c, Vector &col)
void USolve(int m, int n, double *X) const
void Swap(DenseMatrix &other)
void AddMatrix(DenseMatrix &A, int ro, int co)
Perform (ro+i,co+j)+=A(i,j) for 0<=i<A.Height, 0<=j<A.Width.
DenseMatrix(double *d, int h, int w)
Construct a DenseMatrix using an existing data array.
double * HostWrite()
Shortcut for mfem::Write(GetMemory(), TotalSize(), false).
void Clear()
Delete the matrix data array (if owned) and reset the matrix state.
void CalcInverseTranspose(const DenseMatrix &a, DenseMatrix &inva)
Calculate the inverse transpose of a matrix (for NxN matrices, N=1,2,3)
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
double * HostReadWrite()
Shortcut for mfem::ReadWrite(GetMemory(), TotalSize(), false).
A class to initialize the size of a Tensor.
void SetDataAndSize(double *d, int s)
Set the Vector data and size.
void SetSubMatrix(const Array< int > &idx, const DenseMatrix &A)
Set (*this)(idx[i],idx[j]) = A(i,j)
void MultADAt(const DenseMatrix &A, const Vector &D, DenseMatrix &ADAt)
ADAt = A D A^t, where D is diagonal.
void Eigenvalues(DenseMatrix &b, Vector &ev)
int height
Dimension of the output / number of rows in the matrix.
double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(GetMemory(), TotalSize(), on_dev).
void CopyCols(const DenseMatrix &A, int col1, int col2)
Copy columns col1 through col2 from A to *this.
double * GetColumn(int col)
void AddMultADBt(const DenseMatrix &A, const Vector &D, const DenseMatrix &B, DenseMatrix &ADBt)
ADBt = A D B^t, where D is diagonal.
virtual ~DenseMatrix()
Destroys dense matrix.
T * ReadWrite(Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for read+write access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true, or the mfem::Device's HostMemoryClass, otherwise.
void CopyMNt(const DenseMatrix &A, int row_offset, int col_offset)
Copy matrix A^t to the location in *this at row_offset, col_offset.
void CopyExceptMN(const DenseMatrix &A, int m, int n)
Copy All rows and columns except m and n from A.
void GetSubMatrix(const Array< int > &idx, DenseMatrix &A) const
void New(int size)
Allocate host memory for size entries with the current host memory type returned by MemoryManager::Ge...
void Diag(double c, int n)
Creates n x n diagonal matrix with diagonal elements c.
std::size_t MemoryUsage() const
virtual bool Factor(int m, double TOL=0.0)
Compute the LU factorization of the current matrix.
DenseMatrixInverse(bool spd_=false)
Default constructor.
double EigenvalueRealPart(int i)
const double * GetData(int k) const
static const int ipiv_base
void GradToCurl(DenseMatrix &curl)
int Rank(double tol) const
virtual void GetInverseMatrix(int m, double *X) const
Assuming L.L^t = A factored data of size (m x m), compute X <- A^{-1}.
std::size_t MemoryUsage() const
virtual bool Factor(int m, double TOL=0.0)
virtual MatrixInverse * Inverse() const
Returns a pointer to the inverse matrix.
bool OwnsHostPtr() const
Return true if the host pointer is owned. Ownership indicates whether the pointer will be deleted by ...
void Norm2(Vector &v) const
Take the 2-norm of the columns of A and store in v.
DenseMatrix & RightSingularvectors()
Return right singular vectors.
void Eigenvalues(Vector &ev, DenseMatrix &evect)
Compute eigenvalues and eigenvectors of A x = ev x where A = *this.
DenseMatrixEigensystem(DenseMatrix &m)
double operator*(const DenseMatrix &m) const
Matrix inner product: tr(A^t B)
LUFactors(double *data_, int *ipiv_)
void RightScaling(const Vector &s)
RightScaling: this = this * diag(s);.
DenseTensor(const DenseTensor &other)
Copy constructor: deep copy.
void BlockFactor(int m, int n, double *A12, double *A21, double *A22) const
void BlockBackSolve(int m, int n, int r, const double *U12, const double *X2, double *Y1) const
void AddMultADAt(const DenseMatrix &A, const Vector &D, DenseMatrix &ADAt)
ADAt += A D A^t, where D is diagonal.
void GetFromVector(int offset, const Vector &v)
Get the matrix 'data' from the Vector 'v' at the given 'offset'.
void AddMult(const Table &elem_dof, const Vector &x, Vector &y) const
Memory< double > & GetMemory()
void CopyMN(const DenseMatrix &A, int m, int n, int Aro, int Aco)
Copy the m x n submatrix of A at row/col offsets Aro/Aco to *this.
double * Write(bool on_dev=true)
Shortcut for mfem::Write(GetMemory(), TotalSize(), on_dev).
const double & operator()(int i, int j, int k) const
double * Write(bool on_dev=true)
Shortcut for mfem::Write(GetMemory(), TotalSize(), on_dev).
~DenseMatrixGeneralizedEigensystem()
void InvLeftScaling(const Vector &s)
InvLeftScaling this = diag(1./s) * this.
void UseExternalData(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void Eigensystem(Vector &ev, DenseMatrix &evect)
Compute eigenvalues and eigenvectors of A x = ev x where A = *this.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void AddMult_a(double alpha, const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += alpha * B * C.
Vector & Singularvalues()
Return singular values.
Rank 3 tensor (array of matrices)
virtual double & Elem(int i, int j)
Returns reference to a_{ij}.
void AdjustDofDirection(Array< int > &dofs)
const double * Read(bool on_dev=true) const
Shortcut for mfem::Read( GetMemory(), TotalSize(), on_dev).
void GradToDiv(Vector &div)
void AddMult_a_AAt(double a, const DenseMatrix &A, DenseMatrix &AAt)
AAt += a * A * A^t.
int width
Dimension of the input / number of columns in the matrix.
virtual void AddMultTranspose(const Vector &x, Vector &y, const double a=1.0) const
y += a * A^t x
void AddSubMatrix(const Array< int > &idx, const DenseMatrix &A)
(*this)(idx[i],idx[j]) += A(i,j)
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...
void Eigenvalues(DenseMatrix &b, Vector &ev, DenseMatrix &evect)
Compute generalized eigenvalues of A x = ev B x, where A = *this.
void AddToVector(int offset, Vector &v) const
Add the matrix 'data' to the Vector 'v' at the given 'offset'.
double FNorm() const
Compute the Frobenius norm of the matrix.
DenseMatrix & operator+=(const double *m)
CholeskyFactors(double *data_)