92 PetscScalar
norm = 0.;
102 PetscScalar
norm = 0.;
112 PetscScalar
norm = 0.;
194 "Normalization operation is not implemented yet for PETSc library! "
195 "Program terminated.");
226void set(EigenVector& x,
double const a)
228 x.getRawVector().setConstant(a);
231void copy(EigenVector
const& x, EigenVector& y)
236void scale(EigenVector& x,
double const a)
238 x.getRawVector() *= a;
242void aypx(EigenVector& y,
double const a, EigenVector
const& x)
245 y.getRawVector() = a * y.getRawVector() + x.getRawVector();
249void axpy(EigenVector& y,
double const a, EigenVector
const& x)
252 y.getRawVector() += a * x.getRawVector();
256void axpby(EigenVector& y,
double const a,
double const b, EigenVector
const& x)
259 y.getRawVector() = a * x.getRawVector() + b * y.getRawVector();
266 EigenVector
const& y)
268 w.getRawVector().noalias() = x.getRawVector().binaryExpr(
270 [](
auto const x,
auto const y) { return y == 0 ? 0.0 : x / y; });
276double norm1(EigenVector
const& x)
278 return x.getRawVector().lpNorm<1>();
284double norm2(EigenVector
const& x)
286 return x.getRawVector().norm();
292double normMax(EigenVector
const& x)
294 return x.getRawVector().lpNorm<Eigen::Infinity>();
299void copy(EigenMatrix
const& A, EigenMatrix& B)
305void scale(EigenMatrix& A,
double const a)
308 A.getRawMatrix() *= a;
312void aypx(EigenMatrix& Y,
double const a, EigenMatrix
const& X)
315 Y.getRawMatrix() = a * Y.getRawMatrix() + X.getRawMatrix();
319void axpy(EigenMatrix& Y,
double const a, EigenMatrix
const& X)
322 Y.getRawMatrix() = a * X.getRawMatrix() + Y.getRawMatrix();
328void matMult(EigenMatrix
const& A, EigenVector
const& x, EigenVector& y)
331 y.getRawVector() = A.getRawMatrix() * x.getRawVector();
335void matMultAdd(EigenMatrix
const& A, EigenVector
const& v1,
336 EigenVector
const& v2, EigenVector& v3)
341 v2.getRawVector() + A.getRawMatrix() * v1.getRawVector();
345 EigenVector
const& b, EigenVector& new_b)
348 assert(&A != &new_A);
349 assert(&b != &new_b);
351 if (A.getRawMatrix().rows() == A.getRawMatrix().cols())
354 "The number of rows and columns are the same for the LHS matrix."
355 "Are you sure you still need to normalize the LHS matrix and RHS "
359 new_b.getRawVector() = A.getRawMatrix().transpose() * b.getRawVector();
360 new_A.getRawMatrix() = A.getRawMatrix().transpose() * A.getRawMatrix();
365 x.getRawMatrix().makeCompressed();
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Declaration of class PETScMatrix, which provides an interface to PETSc matrix routines.
Declaration of class PETScVector, which provides an interface to PETSc vector routines.
Wrapper class for PETSc matrix routines for matrix.
Mat & getRawMatrix()
Get matrix reference.
void finalizeAssembly(const MatAssemblyType asm_type=MAT_FINAL_ASSEMBLY)
Perform MPI collection of assembled entries in buffer.
Wrapper class for PETSc vector.
void finalizeAssembly()
Perform MPI collection of assembled entries in buffer.
void setLocalAccessibleVector() const
void shallowCopy(const PETScVector &v)
PETSc_Vec & getRawVector()
Exposes the underlying PETSc vector.
double norm(MatrixOrVector const &x, MathLib::VecNormType type)
void linearSysNormalize(PETScMatrix const &, PETScMatrix &, PETScVector const &, PETScVector &)
void finalizeAssembly(PETScMatrix &A)
double norm1(PETScVector const &x)
double normMax(PETScVector const &x)
void copy(PETScVector const &x, PETScVector &y)
void componentwiseDivide(PETScVector &w, PETScVector const &x, PETScVector const &y)
void setLocalAccessibleVector(PETScVector const &x)
void set(PETScVector &x, PetscScalar const a)
void matMult(PETScMatrix const &A, PETScVector const &x, PETScVector &y)
void matMultAdd(PETScMatrix const &A, PETScVector const &v1, PETScVector const &v2, PETScVector &v3)
double norm2(PETScVector const &x)
void scale(PETScVector &x, PetscScalar const a)
void aypx(PETScVector &y, PetscScalar const a, PETScVector const &x)
void axpy(PETScVector &y, PetscScalar const a, PETScVector const &x)
void axpby(PETScVector &y, PetscScalar const a, PetscScalar const b, PETScVector const &x)