Mat - Low-level Interface

This page documents the low-level, automatically wrapped PETSc Mat (matrix) functions available through LibPETSc. These functions provide direct access to the PETSc C API.

For the high-level Julia interface, see Mat.

Overview

The Mat interface includes:

  • Core Mat operations: Creation, manipulation, and mathematical operations on matrices (~632 functions in Mat_wrappers.jl)
  • Mat utilities: Additional matrix operations and conversions (~124 functions in Mataddons_wrappers.jl)

Usage

All low-level Mat functions require a petsclib parameter as the first argument:

using PETSc

# Get the library instance
petsclib = PETSc.petsclibs[1]
PETSc.initialize(petsclib)

# Get PETSc types
PetscInt = petsclib.PetscInt
PetscScalar = petsclib.PetscScalar

# Create a sparse matrix
mat = LibPETSc.MatCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
LibPETSc.MatSetSizes(petsclib, mat, PetscInt(10), PetscInt(10), PetscInt(10), PetscInt(10))
LibPETSc.MatSetType(petsclib, mat, "seqaij")
LibPETSc.MatSetUp(petsclib, mat)

# Set values (0-based indexing!)
row = PetscInt[0]
cols = PetscInt[0, 1]
vals = PetscScalar[2.0, -1.0]
LibPETSc.MatSetValues(petsclib, mat, PetscInt(1), row, PetscInt(2), cols, vals, LibPETSc.INSERT_VALUES)

# Assemble
LibPETSc.MatAssemblyBegin(petsclib, mat, LibPETSc.MAT_FINAL_ASSEMBLY)
LibPETSc.MatAssemblyEnd(petsclib, mat, LibPETSc.MAT_FINAL_ASSEMBLY)

# Clean up
LibPETSc.MatDestroy(petsclib, mat)
PETSc.finalize(petsclib)

Function Reference

PETSc.LibPETSc.MatADot — Method
val::PetscScalar = MatADot(petsclib::PetscLibType, mat::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

Computes the inner product with respect to a matrix, i.e., (x, y)_A = y^H A x where A is symmetric (Hermitian when using complex) positive definite.

Collective

Input Parameters:

  • mat - matrix used to define the inner product
  • x - first vector
  • y - second vector

Output Parameter:

  • val - the dot product with respect to A

Level: intermediate

See also: Mat, MatANorm(), VecDot(), VecNorm(), MatMult(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatAIJGetLocalMat — Method
A_loc::PetscMat = MatAIJGetLocalMat(petsclib::PetscLibType, A::AbstractPetscMat)

Creates a MATSEQAIJ from a MATAIJ matrix.

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • A_loc - the local sequential matrix generated

Level: developer

See also: Mat, MatMPIAIJGetLocalMat()

External Links

source
PETSc.LibPETSc.MatANorm — Method
val::PetscReal = MatANorm(petsclib::PetscLibType, mat::AbstractPetscMat, x::AbstractPetscVec)

Computes the norm with respect to a matrix, i.e., (x, x)_A^{1/2} = (x^H A x)^{1/2} where A is symmetric (Hermitian when using complex) positive definite.

Collective

Input Parameters:

  • mat - matrix used to define norm
  • x - the vector to compute the norm of

Output Parameter:

  • val - the norm with respect to A

Level: intermediate

See also: Mat, MatADot(), VecDot(), VecNorm(), MatMult(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatAXPY — Method
MatAXPY(petsclib::PetscLibType, Y::AbstractPetscMat, a::PetscScalar, X::AbstractPetscMat, str::MatStructure)

Computes Y = a*X + Y.

Logically Collective

Input Parameters:

  • a - the scalar multiplier
  • X - the first matrix
  • Y - the second matrix
  • str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN, UNKNOWN_NONZERO_PATTERN, or SUBSET_NONZERO_PATTERN (nonzeros of X is a subset of Y's)

Level: intermediate

See also: Mat, MatAYPX()

External Links

source
PETSc.LibPETSc.MatAYPX — Method
MatAYPX(petsclib::PetscLibType, Y::AbstractPetscMat, a::PetscScalar, X::AbstractPetscMat, str::MatStructure)

Computes Y = a*Y + X.

Logically Collective

Input Parameters:

  • a - the PetscScalar multiplier
  • Y - the first matrix
  • X - the second matrix
  • str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN, UNKNOWN_NONZERO_PATTERN, or SUBSET_NONZERO_PATTERN (nonzeros of X is a subset of Y's)

Level: intermediate

See also: Mat, MatAXPY()

External Links

source
PETSc.LibPETSc.MatAppendOptionsPrefix — Method
MatAppendOptionsPrefix(petsclib::PetscLibType, A::AbstractPetscMat, prefix::String)

Appends to the prefix used for searching for all matrix options in the database.

Logically Collective

Input Parameters:

  • A - the matrix
  • prefix - the prefix to prepend to all option names

Level: advanced

See also: Mat, MatGetOptionsPrefix(), MatAppendOptionsPrefixFactor(), MatSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.MatAppendOptionsPrefixFactor — Method
MatAppendOptionsPrefixFactor(petsclib::PetscLibType, A::AbstractPetscMat, prefix::String)

Appends to the prefix used for searching for all matrix factor options in the database for for matrices created with MatGetFactor()

Logically Collective

Input Parameters:

  • A - the matrix
  • prefix - the prefix to prepend to all option names for the factored matrix

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), PetscOptionsCreate(), PetscOptionsDestroy(), PetscObjectSetOptionsPrefix(), PetscObjectPrependOptionsPrefix(), PetscObjectGetOptionsPrefix(), TSAppendOptionsPrefix(), SNESAppendOptionsPrefix(), KSPAppendOptionsPrefix(), MatSetOptionsPrefixFactor(), MatSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.MatAssembled — Method
assembled::PetscBool = MatAssembled(petsclib::PetscLibType, mat::AbstractPetscMat)

Indicates if a matrix has been assembled and is ready for use; for example, in matrix-vector product.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • assembled - PETSC_TRUE or PETSC_FALSE

Level: advanced

See also: Mat, MatAssemblyEnd(), MatSetValues(), MatAssemblyBegin()

External Links

source
PETSc.LibPETSc.MatAssemblyBegin — Method
MatAssemblyBegin(petsclib::PetscLibType, mat::AbstractPetscMat, type::MatAssemblyType)

Begins assembling the matrix. This routine should be called after completing all calls to MatSetValues().

Collective

Input Parameters:

  • mat - the matrix
  • type - type of assembly, either MAT_FLUSH_ASSEMBLY or MAT_FINAL_ASSEMBLY

Level: beginner

See also: Mat, MatAssemblyEnd(), MatSetValues(), MatAssembled()

External Links

source
PETSc.LibPETSc.MatAssemblyEnd — Method
MatAssemblyEnd(petsclib::PetscLibType, mat::AbstractPetscMat, type::MatAssemblyType)

Completes assembling the matrix. This routine should be called after MatAssemblyBegin().

Collective

Input Parameters:

  • mat - the matrix
  • type - type of assembly, either MAT_FLUSH_ASSEMBLY or MAT_FINAL_ASSEMBLY

Options Database Key:

  • -mat_view [viewertype][:...] - option name and values. See MatViewFromOptions()/PetscObjectViewFromOptions() for the possible arguments

Level: beginner

See also: Mat, MatAssemblyBegin(), MatSetValues(), PetscDrawOpenX(), PetscDrawCreate(), MatView(), MatAssembled(), PetscViewerSocketOpen(), MatViewFromOptions(), PetscObjectViewFromOptions()

External Links

source
PETSc.LibPETSc.MatBackwardSolve — Method
MatBackwardSolve(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, x::AbstractPetscVec)

Solves U x = b, given a factored matrix, A = LU. D^(1/2) U x = b, given a factored symmetric matrix, A = U^TDU,

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix
  • b - the right-hand-side vector

Output Parameter:

  • x - the result vector

Level: developer

See also: Mat, MatForwardSolve(), MatGetFactor(), MatSolve()

External Links

source
PETSc.LibPETSc.MatBindToCPU — Method
MatBindToCPU(petsclib::PetscLibType, A::AbstractPetscMat, flg::PetscBool)

marks a matrix to temporarily stay on the CPU and perform computations on the CPU

Logically Collective

Input Parameters:

  • A - the matrix
  • flg - bind to the CPU if value of PETSC_TRUE

Level: intermediate

See also: Mat, MatBoundToCPU()

External Links

source
PETSc.LibPETSc.MatBlockMatSetPreallocation — Method
MatBlockMatSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt})

For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz). By setting these parameters accurately, performance during matrix assembly can be increased by more than a factor of 50.

Collective

Input Parameters:

  • B - The matrix
  • bs - size of each block in matrix
  • nz - number of nonzeros per block row (same for all rows)
  • nnz - array containing the number of nonzeros in the various block rows

(possibly different for each row) or NULL

Level: intermediate

See also: Mat, MatCreate(), MatCreateBlockMat(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatBoundToCPU — Method
flg::PetscBool = MatBoundToCPU(petsclib::PetscLibType, A::AbstractPetscMat)

query if a matrix is bound to the CPU

Input Parameter:

  • A - the matrix

Output Parameter:

  • flg - the logical flag

Level: intermediate

See also: Mat, MatBindToCPU()

External Links

source
PETSc.LibPETSc.MatCholeskyFactor — Method
MatCholeskyFactor(petsclib::PetscLibType, mat::AbstractPetscMat, perm::AbstractIS, info::Vector{MatFactorInfo})

Performs in-place Cholesky factorization of a symmetric matrix.

Collective

Input Parameters:

  • mat - the matrix
  • perm - row and column permutations
  • info - expected fill as ratio of original fill

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatFactorInfo, MatLUFactor(), MatCholeskyFactorSymbolic(), MatCholeskyFactorNumeric(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatCholeskyFactorNumeric — Method
MatCholeskyFactorNumeric(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, info::Vector{MatFactorInfo})

Performs numeric Cholesky factorization of a symmetric matrix. Call this routine after first calling MatGetFactor() and MatCholeskyFactorSymbolic().

Collective

Input Parameters:

  • fact - the factor matrix obtained with MatGetFactor(), where the factored values are stored
  • mat - the initial matrix that is to be factored
  • info - options for factorization

Level: developer

See also: Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatCholeskyFactorSymbolic(), MatCholeskyFactor(), MatLUFactorNumeric()

External Links

source
PETSc.LibPETSc.MatCholeskyFactorSymbolic — Method
MatCholeskyFactorSymbolic(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, perm::AbstractIS, info::Vector{MatFactorInfo})

Performs symbolic Cholesky factorization of a symmetric matrix.

Collective

Input Parameters:

  • fact - the factor matrix obtained with MatGetFactor()
  • mat - the matrix
  • perm - row and column permutations
  • info - options for factorization, includes

$fill - expected fill as ratio of original fill. dtcol - pivot tolerance (0 no pivot, 1 full column pivoting) Run with the option -info to determine an optimal value to use$

Level: developer

See also: Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactor(), MatCholeskyFactorNumeric(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatCompositeAddMat — Method
MatCompositeAddMat(petsclib::PetscLibType, mat::AbstractPetscMat, smat::AbstractPetscMat)

Add another matrix to a composite matrix.

Collective

Input Parameters:

  • mat - the composite matrix
  • smat - the partial matrix

Level: advanced

See also: Mat, MatCreateComposite(), MatCompositeGetMat(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetMat — Method
Ai::PetscMat = MatCompositeGetMat(petsclib::PetscLibType, mat::AbstractPetscMat, i::PetscInt)

Returns the ith matrix from the composite matrix.

Logically Collective

Input Parameters:

  • mat - the composite matrix
  • i - the number of requested matrix

Output Parameter:

  • Ai - ith matrix in composite

Level: advanced

See also: Mat, MatCreateComposite(), MatCompositeGetNumberMat(), MatCompositeAddMat(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetMatStructure — Method
str::MatStructure = MatCompositeGetMatStructure(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the structure of matrices in the composite matrix.

Not Collective

Input Parameter:

  • mat - the composite matrix

Output Parameter:

  • str - structure of the matrices

Level: advanced

See also: Mat, MatCreateComposite(), MatCompositeSetMatStructure(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetNumberMat — Method
nmat::PetscInt = MatCompositeGetNumberMat(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the number of matrices in the composite matrix.

Not Collective

Input Parameter:

  • mat - the composite matrix

Output Parameter:

  • nmat - number of matrices in the composite matrix

Level: advanced

See also: Mat, MatCreateComposite(), MatCompositeGetMat(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetType — Method
type::MatCompositeType = MatCompositeGetType(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns type of composite.

Not Collective

Input Parameter:

  • mat - the composite matrix

Output Parameter:

  • type - type of composite

Level: advanced

See also: Mat, MatCreateComposite(), MatCompositeSetType(), MATCOMPOSITE, MatCompositeType

External Links

source
PETSc.LibPETSc.MatCompositeMerge — Method
MatCompositeMerge(petsclib::PetscLibType, mat::AbstractPetscMat)

Given a composite matrix, replaces it with a "regular" matrix by summing or computing the product of all the matrices inside the composite matrix.

Collective

Input Parameter:

  • mat - the composite matrix

Options Database Keys:

  • -mat_composite_merge - merge in MatAssemblyEnd()
  • -mat_composite_merge_type - set merge direction

Level: advanced

See also: Mat, MatDestroy(), MatMult(), MatCompositeAddMat(), MatCreateComposite(), MatCompositeSetMatStructure(), MatCompositeSetMergeType(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetMatStructure — Method
MatCompositeSetMatStructure(petsclib::PetscLibType, mat::AbstractPetscMat, str::MatStructure)

Indicates structure of matrices in the composite matrix.

Not Collective

Input Parameters:

  • mat - the composite matrix
  • str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN (default) or SUBSET_NONZERO_PATTERN

Level: advanced

See also: Mat, MatAXPY(), MatCreateComposite(), MatCompositeMerge(), MatCompositeGetMatStructure(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetMergeType — Method
MatCompositeSetMergeType(petsclib::PetscLibType, mat::AbstractPetscMat, type::MatCompositeMergeType)

Sets order of MatCompositeMerge().

Logically Collective

Input Parameters:

  • mat - the composite matrix
  • type - MAT_COMPOSITE_MERGE RIGHT (default) to start merge from right with the first added matrix (mat[0]),

MAT_COMPOSITE_MERGE_LEFT to start merge from left with the last added matrix (mat[nmat-1])

Level: advanced

See also: Mat, MatCreateComposite(), MatCompositeMerge(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetScalings — Method
MatCompositeSetScalings(petsclib::PetscLibType, mat::AbstractPetscMat, scalings::Vector{PetscScalar})

Sets separate scaling factors for component matrices.

Logically Collective

Input Parameters:

  • mat - the composite matrix
  • scalings - array of scaling factors with scalings[i] being factor of i-th matrix, for i in [0, nmat)

Level: advanced

See also: Mat, MatScale(), MatDiagonalScale(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetType — Method
MatCompositeSetType(petsclib::PetscLibType, mat::AbstractPetscMat, type::MatCompositeType)

Indicates if the matrix is defined as the sum of a set of matrices or the product.

Logically Collective

Input Parameters:

  • mat - the composite matrix
  • type - the MatCompositeType to use for the matrix

Level: advanced

See also: Mat, MatDestroy(), MatMult(), MatCompositeAddMat(), MatCreateComposite(), MatCompositeGetType(), MATCOMPOSITE, MatCompositeType

External Links

source
PETSc.LibPETSc.MatComputeBandwidth — Method
bw::PetscInt = MatComputeBandwidth(petsclib::PetscLibType, A::AbstractPetscMat, fraction::PetscReal)

Calculate the full bandwidth of the matrix, meaning the width 2k+1 where k diagonals on either side are sufficient to contain all the matrix nonzeros.

Collective

Input Parameters:

  • A - The Mat
  • fraction - An optional percentage of the Frobenius norm of the matrix that the bandwidth should enclose

Output Parameter:

  • bw - The matrix bandwidth

Level: beginner

See also: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart()

External Links

source
PETSc.LibPETSc.MatComputeOperator — Method
mat::PetscMat = MatComputeOperator(petsclib::PetscLibType, inmat::AbstractPetscMat, mattype::String)

Computes the explicit matrix

Collective

Input Parameters:

  • inmat - the matrix
  • mattype - the matrix type for the explicit operator

Output Parameter:

  • mat - the explicit operator

Level: advanced

See also: Mat, MatConvert(), MatMult(), MatComputeOperatorTranspose()

External Links

source
PETSc.LibPETSc.MatComputeOperatorTranspose — Method
mat::PetscMat = MatComputeOperatorTranspose(petsclib::PetscLibType, inmat::AbstractPetscMat, mattype::String)

Computes the explicit matrix representation of a give matrix that can apply MatMultTranspose()

Collective

Input Parameters:

  • inmat - the matrix
  • mattype - the matrix type for the explicit operator

Output Parameter:

  • mat - the explicit operator transposed

Level: advanced

See also: Mat, MatConvert(), MatMult(), MatComputeOperator()

External Links

source
PETSc.LibPETSc.MatComputeVariableBlockEnvelope — Method
MatComputeVariableBlockEnvelope(petsclib::PetscLibType, mat::AbstractPetscMat)

Given a matrix whose nonzeros are in blocks along the diagonal this computes and stores the sizes of these blocks in the matrix. An individual block may lie over several processes.

Collective

Input Parameter:

  • mat - the matrix

Level: intermediate

See also: Mat, MatInvertVariableBlockEnvelope(), MatSetVariableBlockSizes()

External Links

source
PETSc.LibPETSc.MatConjugate — Method
MatConjugate(petsclib::PetscLibType, mat::AbstractPetscMat)

replaces the matrix values with their complex conjugates

Logically Collective

Input Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MatRealPart(), MatImaginaryPart(), VecConjugate(), MatTranspose()

External Links

source
PETSc.LibPETSc.MatConstantDiagonalGetConstant — Method
value::PetscScalar = MatConstantDiagonalGetConstant(petsclib::PetscLibType, mat::AbstractPetscMat)

Get the scalar constant of a constant diagonal matrix

Not collective

Input Parameter:

  • mat - a MATCONSTANTDIAGONAL

Output Parameter:

  • value - the scalar value

Level: developer

See also: Mat, MatDestroy(), MATCONSTANTDIAGONAL

External Links

source
PETSc.LibPETSc.MatConvert — Method
M::PetscMat = MatConvert(petsclib::PetscLibType, mat::AbstractPetscMat, newtype::String, reuse::MatReuse)

Converts a matrix to another matrix, either of the same or different type.

Collective

Input Parameters:

  • mat - the matrix
  • newtype - new matrix type. Use MATSAME to create a new matrix of the

same type as the original matrix.

  • reuse - denotes if the destination matrix is to be created or reused.

Use MAT_INPLACE_MATRIX for inplace conversion (that is when you want the input Mat to be changed to contain the matrix in the new format), otherwise use MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX (can only be used after the first call was made with MAT_INITIAL_MATRIX, causes the matrix space in M to be reused).

Output Parameter:

  • M - pointer to place new matrix

Level: intermediate

See also: Mat, MatCopy(), MatDuplicate(), MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX

External Links

source
PETSc.LibPETSc.MatCopy — Method
MatCopy(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, str::MatStructure)

Copies a matrix to another matrix.

Collective

Input Parameters:

  • A - the matrix
  • str - SAME_NONZERO_PATTERN or DIFFERENT_NONZERO_PATTERN

Output Parameter:

  • B - where the copy is put

Level: intermediate

See also: Mat, MatConvert(), MatDuplicate()

External Links

source
PETSc.LibPETSc.MatCopyHashToXAIJ — Method
MatCopyHashToXAIJ(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat)

copy hash table entries into an XAIJ matrix type

Logically Collective

Input Parameter:

  • A - A matrix in unassembled, hash table form

Output Parameter:

  • B - The XAIJ matrix. This can either be A or some matrix of equivalent size, e.g. obtained from A via MatDuplicate()

Example: $PetscCall(MatDuplicate(A, MAT_DO_NOT_COPY_VALUES, &B)); PetscCall(MatCopyHashToXAIJ(A, B));$

Level: advanced

See also: Mat, MAT_USE_HASH_TABLE

External Links

source
PETSc.LibPETSc.MatCreate — Method
A::PetscMat = MatCreate(petsclib::PetscLibType, comm::MPI_Comm)

Creates a matrix where the type is determined from either a call to MatSetType() or from the options database with a call to MatSetFromOptions().

Collective

Input Parameter:

  • comm - MPI communicator

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_type seqaij - MATSEQAIJ type, uses MatCreateSeqAIJ()
  • -mat_type mpiaij - MATMPIAIJ type, uses MatCreateAIJ()
  • -mat_type seqdense - MATSEQDENSE, uses MatCreateSeqDense()
  • -mat_type mpidense - MATMPIDENSE type, uses MatCreateDense()
  • -mat_type seqbaij - MATSEQBAIJ type, uses MatCreateSeqBAIJ()
  • -mat_type mpibaij - MATMPIBAIJ type, uses MatCreateBAIJ()

See the manpages for particular formats (e.g., MATSEQAIJ) for additional format-specific options.

Level: beginner

See also: Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert()

External Links

source
PETSc.LibPETSc.MatCreateAIJ — Method
A::PetscMat = MatCreateAIJ(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse parallel matrix in MATAIJ format (the default parallel PETSc format). For good matrix assembly performance the user should preallocate the matrix storage by setting the parameters d_nz (or d_nnz) and o_nz (or o_nnz).

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'.

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_no_inode - Do not use inodes
  • -mat_inode_limit limit - Sets inode limit (max limit=5)
  • -matmult_vecscatter_view viewer - View the vecscatter (i.e., communication pattern) used in MatMult() of sparse parallel matrices.

See viewer types in manual of MatView(). Of them, ascii_matlab, draw or binary cause the VecScatter to be viewed as a matrix. Entry (i,j) is the size of message (in bytes) rank i sends to rank j in one MatMult() call.

Level: intermediate

See also: Mat, Sparse Matrix Creation, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateMPIAIJWithArrays(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout

External Links

source
PETSc.LibPETSc.MatCreateAIJKokkos — Method
A::PetscMat = MatCreateAIJKokkos(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

External Links

source
PETSc.LibPETSc.MatCreateBAIJ — Method
A::PetscMat = MatCreateBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse parallel matrix in MATBAIJ format (block compressed row).

Collective

Input Parameters:

  • comm - MPI communicator
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)

This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of nonzero blocks per block row in diagonal portion of local

submatrix (same for all local rows)

  • d_nnz - array containing the number of nonzero blocks in the various block rows

of the in diagonal portion of the local (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room for the diagonal entry and set it even if it is zero.

  • o_nz - number of nonzero blocks per block row in the off-diagonal portion of local

submatrix (same for all local rows).

  • o_nnz - array containing the number of nonzero blocks in the various block rows of the

off-diagonal portion of the local submatrix (possibly different for each block row) or NULL.

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_block_size - size of the blocks to use
  • -mat_use_hash_table fact - set hash table factor

Level: intermediate

See also: Mat, MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatMPIBAIJSetPreallocationCSR(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout

External Links

source
PETSc.LibPETSc.MatCreateBAIJMKL — Method
A::PetscMat = MatCreateBAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse parallel matrix in MATBAIJMKL format (block compressed row).

Collective

Input Parameters:

  • comm - MPI communicator
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)

This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of nonzero blocks per block row in diagonal portion of local

submatrix (same for all local rows)

  • d_nnz - array containing the number of nonzero blocks in the various block rows

of the in diagonal portion of the local (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room for the diagonal entry and set it even if it is zero.

  • o_nz - number of nonzero blocks per block row in the off-diagonal portion of local

submatrix (same for all local rows).

  • o_nnz - array containing the number of nonzero blocks in the various block rows of the

off-diagonal portion of the local submatrix (possibly different for each block row) or NULL.

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_block_size - size of the blocks to use
  • -mat_use_hash_table fact - set hash table factor

Level: intermediate

See also: Mat, MATBAIJMKL, MATBAIJ, MatCreate(), MatCreateSeqBAIJMKL(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatMPIBAIJSetPreallocationCSR()

External Links

source
PETSc.LibPETSc.MatCreateBlockMat — Method
nnz::PetscInt,A::PetscMat = MatCreateBlockMat(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, bs::PetscInt, nz::PetscInt)

Creates a new matrix in which each block contains a uniform-size sequential Mat object

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of rows
  • n - number of columns
  • bs - size of each submatrix
  • nz - expected maximum number of nonzero blocks in row (use PETSC_DEFAULT if not known)
  • nnz - expected number of nonzers per block row if known (use NULL otherwise)

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MATBLOCKMAT, MatCreateNest()

External Links

source
PETSc.LibPETSc.MatCreateCentering — Method
C::PetscMat = MatCreateCentering(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a new matrix object that implements the (symmetric and idempotent) centering matrix, I - (1/N) * 1^T * 1

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows (or PETSC_DECIDE to have calculated if N is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • N - number of global rows (or PETSC_DETERMINE to have calculated if n is given)

Output Parameter:

  • C - the matrix

See also: Mat, MatCreateLRC(), MatCreateComposite()

External Links

source
PETSc.LibPETSc.MatCreateComposite — Method
mat::PetscMat = MatCreateComposite(petsclib::PetscLibType, comm::MPI_Comm, nmat::PetscInt, mats::AbstractPetscMat)

Creates a matrix as the sum or product of one or more matrices

Collective

Input Parameters:

  • comm - MPI communicator
  • nmat - number of matrices to put in
  • mats - the matrices

Output Parameter:

  • mat - the matrix

Options Database Keys:

  • -mat_composite_merge - merge in MatAssemblyEnd()
  • -mat_composite_merge_mvctx - merge Mvctx of component matrices to optimize communication in MatMult() for ADDITIVE matrices
  • -mat_composite_merge_type - set merge direction

Level: advanced

See also: Mat, MatDestroy(), MatMult(), MatCompositeAddMat(), MatCompositeGetMat(), MatCompositeMerge(), MatCompositeSetType(), MATCOMPOSITE, MatCompositeType

External Links

source
PETSc.LibPETSc.MatCreateConstantDiagonal — Method
J::PetscMat = MatCreateConstantDiagonal(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, diag::PetscScalar)

Creates a matrix with a uniform value along the diagonal

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • diag - the diagonal value

Output Parameter:

  • J - the diagonal matrix

Level: advanced

See also: Mat, MatDestroy(), MATCONSTANTDIAGONAL, MatScale(), MatShift(), MatMult(), MatGetDiagonal(), MatGetFactor(), MatSolve()

External Links

source
PETSc.LibPETSc.MatCreateDense — Method
A::PetscMat = MatCreateDense(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, data::Union{Ptr, Vector{PetscScalar}})

Creates a matrix in MATDENSE format.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
  • M - number of global rows (or PETSC_DECIDE to have calculated if m is given)
  • N - number of global columns (or PETSC_DECIDE to have calculated if n is given)
  • data - optional location of matrix data. Set data to NULL (PETSC_NULL_SCALAR_ARRAY for Fortran users) for PETSc

to control all matrix memory allocation.

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MATDENSE, MatCreate(), MatCreateSeqDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateDenseFromVecType — Method
data::PetscScalar,A::PetscMat = MatCreateDenseFromVecType(petsclib::PetscLibType, comm::MPI_Comm, vtype::String, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, lda::PetscInt)

Create a matrix that matches the type of a Vec.

Collective

Input Parameters:

  • comm - the communicator
  • vtype - the vector type
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
  • M - number of global rows (or PETSC_DECIDE to have calculated if m is given)
  • N - number of global columns (or PETSC_DECIDE to have calculated if n is given)
  • lda - leading dimension (or PETSC_DECIDE to use the default)
  • data - optional location of matrix data, which should have the same memory type as the vector. Pass NULL to have PETSc take care of matrix memory allocation.

Output Parameter:

  • A - the dense matrix

Level: advanced

See also: Mat, MatCreateDense(), MatCreateDenseCUDA(), MatCreateDenseHIP(), MatCreateDenseWithMemType(), PetscMemType

External Links

source
PETSc.LibPETSc.MatCreateDenseWithMemType — Method
data::PetscScalar,A::PetscMat = MatCreateDenseWithMemType(petsclib::PetscLibType, comm::MPI_Comm, mtype::PetscMemType, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, lda::PetscInt)

Create a matrix that matches the supplied PetscMemType.

Collective

Input Parameters:

  • comm - the communicator
  • mtype - the memory type
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
  • M - number of global rows (or PETSC_DECIDE to have calculated if m is given)
  • N - number of global columns (or PETSC_DECIDE to have calculated if n is given)
  • lda - leading dimension (or PETSC_DECIDE to use the default)
  • data - optional location of matrix data, which should match the specified mtype. Pass NULL to have PETSc take care of matrix memory allocation.

Output Parameter:

  • A - the dense matrix

Level: advanced

See also: Mat, MatCreateDense(), MatCreateDenseCUDA(), MatCreateDenseHIP(), MatCreateDenseFromVecType(), PetscMemType

External Links

source
PETSc.LibPETSc.MatCreateDiagonal — Method
J::PetscMat = MatCreateDiagonal(petsclib::PetscLibType, diag::AbstractPetscVec)

Creates a matrix defined by a given vector along its diagonal.

Collective

Input Parameter:

  • diag - vector for the diagonal

Output Parameter:

  • J - the diagonal matrix

Level: advanced

See also: Mat, MatDestroy(), MATDIAGONAL, MatScale(), MatShift(), MatMult(), MatGetDiagonal(), MatSolve(), MatDiagonalRestoreInverseDiagonal(), MatDiagonalGetDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal(), MATCONSTANTDIAGONAL

External Links

source
PETSc.LibPETSc.MatCreateFFT — Method
A::PetscMat = MatCreateFFT(petsclib::PetscLibType, comm::MPI_Comm, ndim::PetscInt, dim::Vector{PetscInt}, mattype::String)

Creates a matrix object that provides FFT via an external package

Collective

Input Parameters:

  • comm - MPI communicator
  • ndim - the ndim-dimensional transform
  • dim - array of size ndim, dim[i] contains the vector length in the i-dimension
  • mattype - package type, e.g., MATFFTW or MATSEQCUFFT

Output Parameter:

  • A - the matrix

Options Database Key:

  • -mat_fft_type - set FFT type fft or seqcufft

Level: intermediate

See also: Mat, MATFFTW, MATSEQCUFFT, MatCreateVecsFFTW()

External Links

source
PETSc.LibPETSc.MatCreateFromOptions — Method
A::PetscMat = MatCreateFromOptions(petsclib::PetscLibType, comm::MPI_Comm, prefix::String, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt)

Creates a matrix whose type is set from the options database

Collective

Input Parameters:

  • comm - MPI communicator
  • prefix - [optional] prefix for the options database
  • bs - the blocksize (commonly 1)
  • m - the local number of rows (or PETSC_DECIDE)
  • n - the local number of columns (or PETSC_DECIDE or PETSC_DETERMINE)
  • M - the global number of rows (or PETSC_DETERMINE)
  • N - the global number of columns (or PETSC_DETERMINE)

Output Parameter:

  • A - the matrix

Options Database Key:

  • -mat_type - see MatType, for example aij, aijcusparse, baij, sbaij, dense, defaults to aij

Level: beginner

See also: Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert(), MatCreate()

External Links

source
PETSc.LibPETSc.MatCreateGraph — Method
graph::PetscMat = MatCreateGraph(petsclib::PetscLibType, A::AbstractPetscMat, sym::PetscBool, scale::PetscBool, filter::PetscReal, num_idx::PetscInt, index::Vector{PetscInt})

create a scalar matrix (that is a matrix with one vertex for each block vertex in the original matrix), for use in graph algorithms and possibly removes small values from the graph structure.

Collective

Input Parameters:

  • A - the matrix
  • sym - PETSC_TRUE indicates that the graph should be symmetrized
  • scale - PETSC_TRUE indicates that the graph edge weights should be symmetrically scaled with the diagonal entry
  • filter - filter value - < 0: does nothing; == 0: removes only 0.0 entries; otherwise: removes entries with abs(entries) <= value
  • num_idx - size of index array
  • index - array of block indices to use for graph strength of connection weight

Output Parameter:

  • graph - the resulting graph

Level: advanced

See also: Mat, MatCreate(), PCGAMG

External Links

source
PETSc.LibPETSc.MatCreateH2OpusFromKernel — Method
nA::PetscMat = MatCreateH2OpusFromKernel(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, spacedim::PetscInt, coords::Vector{PetscReal}, cdist::PetscBool, kernel::Ptr{Cvoid}, kernelctx::Ptr{Cvoid}, eta::PetscReal, leafsize::PetscInt, basisord::PetscInt)

External Links

source
PETSc.LibPETSc.MatCreateHermitianTranspose — Method
N::PetscMat = MatCreateHermitianTranspose(petsclib::PetscLibType, A::AbstractPetscMat)

Creates a new matrix object of MatType MATHERMITIANTRANSPOSEVIRTUAL that behaves like A'*

Collective

Input Parameter:

  • A - the (possibly rectangular) matrix

Output Parameter:

  • N - the matrix that represents A'*

Level: intermediate

See also: Mat, MatCreateNormal(), MatMult(), MatMultHermitianTranspose(), MatCreate(), MATTRANSPOSEVIRTUAL, MatCreateTranspose(), MatHermitianTransposeGetMat(), MATNORMAL, MATNORMALHERMITIAN

External Links

source
PETSc.LibPETSc.MatCreateHtoolFromKernel — Method
B::PetscMat = MatCreateHtoolFromKernel(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, spacedim::PetscInt, coords_target::Vector{PetscReal}, coords_source::Vector{PetscReal}, kernel::Ptr{Cvoid}, kernelctx::Ptr{Cvoid})

External Links

source
PETSc.LibPETSc.MatCreateIS — Method
A::PetscMat = MatCreateIS(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, rmap::ISLocalToGlobalMapping, cmap::ISLocalToGlobalMapping)

Creates a "process" unassembled matrix.

Collective.

Input Parameters:

  • comm - MPI communicator that will share the matrix
  • bs - block size of the matrix
  • m - local size of left vector used in matrix vector products
  • n - local size of right vector used in matrix vector products
  • M - global size of left vector used in matrix vector products
  • N - global size of right vector used in matrix vector products
  • rmap - local to global map for rows
  • cmap - local to global map for cols

Output Parameter:

  • A - the resulting matrix

Level: intermediate

See also: Mat, MATIS, MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatCreateKAIJ — Method
kaij::PetscMat = MatCreateKAIJ(petsclib::PetscLibType, A::AbstractPetscMat, p::PetscInt, q::PetscInt, S::Union{Ptr, Vector{PetscScalar}}, T::Union{Ptr, Vector{PetscScalar}})

Creates a matrix of type MATKAIJ.

Collective

Input Parameters:

  • A - the MATAIJ matrix
  • p - number of rows in S and T
  • q - number of columns in S and T
  • S - the S matrix (can be NULL), stored as a PetscScalar array (column-major)
  • T - the T matrix (can be NULL), stored as a PetscScalar array (column-major)

Output Parameter:

  • kaij - the new MATKAIJ matrix

Level: advanced

See also: Mat, MatKAIJSetAIJ(), MatKAIJSetS(), MatKAIJSetT(), MatKAIJGetAIJ(), MatKAIJGetS(), MatKAIJGetT(), MATKAIJ

External Links

source
PETSc.LibPETSc.MatCreateLMVMBFGS — Method
B::PetscMat = MatCreateLMVMBFGS(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory Broyden-Fletcher-Goldfarb-Shano (BFGS) matrix used for approximating Jacobians. L-BFGS is symmetric positive-definite by construction, and is commonly used to approximate Hessians in optimization problems.

To use the L-BFGS matrix with other vector types, the matrix must be created using MatCreate() and MatSetType(), followed by MatLMVMAllocate(). This ensures that the internal storage and work vectors are duplicated from the correct type of vector.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_scale_type - (developer) type of scaling applied to J0 (none, scalar, diagonal)
  • -mat_lmvm_theta - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling
  • -mat_lmvm_rho - (developer) update limiter for the J0 scaling
  • -mat_lmvm_alpha - (developer) coefficient factor for the quadratic subproblem in J0 scaling
  • -mat_lmvm_beta - (developer) exponential factor for the diagonal J0 scaling
  • -mat_lmvm_sigma_hist - (developer) number of past updates to use in J0 scaling

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMBFGS, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMBadBroyden — Method
B::PetscMat = MatCreateLMVMBadBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory modified (aka "bad") Broyden-type approximation matrix used for a Jacobian. L-BadBrdn is not guaranteed to be symmetric or positive-definite.

To use the L-BadBrdn matrix with other vector types, the matrix must be created using MatCreate() and MatSetType(), followed by MatLMVMAllocate(). This ensures that the internal storage and work vectors are duplicated from the correct type of vector.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_hist_size - the number of history vectors to keep
  • -mat_lmvm_mult_algorithm - the algorithm to use for multiplication (recursive, dense, compact_dense)
  • -mat_lmvm_cache_J0_products - whether products between the base Jacobian J0 and history vectors should be cached or recomputed
  • -mat_lmvm_debug - (developer) perform internal debugging checks

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMBADBRDN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMBroyden — Method
B::PetscMat = MatCreateLMVMBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory "good" Broyden-type approximation matrix used for a Jacobian. L-Brdn is not guaranteed to be symmetric or positive-definite.

To use the L-Brdn matrix with other vector types, the matrix must be created using MatCreate() and MatSetType(), followed by MatLMVMAllocate(). This ensures that the internal storage and work vectors are duplicated from the correct type of vector.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_hist_size - the number of history vectors to keep
  • -mat_lmvm_mult_algorithm - the algorithm to use for multiplication (recursive, dense, compact_dense)
  • -mat_lmvm_cache_J0_products - whether products between the base Jacobian J0 and history vectors should be cached or recomputed
  • -mat_lmvm_debug - (developer) perform internal debugging checks

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMBRDN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDBFGS — Method
B::PetscMat = MatCreateLMVMDBFGS(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a dense representation of the limited-memory Broyden-Fletcher-Goldfarb-Shanno (BFGS) approximation to a Hessian.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Level: advanced

See also: MatCreate(), MATLMVM, MATLMVMDBFGS, MatCreateLMVMBFGS()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDDFP — Method
B::PetscMat = MatCreateLMVMDDFP(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a dense representation of the limited-memory Davidon-Fletcher-Powell (DFP) approximation to a Hessian.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Level: advanced

See also: MatCreate(), MATLMVM, MATLMVMDDFP, MatCreateLMVMDFP()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDFP — Method
B::PetscMat = MatCreateLMVMDFP(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory Davidon-Fletcher-Powell (DFP) matrix used for approximating Jacobians. L-DFP is symmetric positive-definite by construction, and is the dual of L-BFGS where Y and S vectors swap roles.

To use the L-DFP matrix with other vector types, the matrix must be created using MatCreate() and MatSetType(), followed by MatLMVMAllocate(). This ensures that the internal storage and work vectors are duplicated from the correct type of vector.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_scale_type - (developer) type of scaling applied to J0 (none, scalar, diagonal)
  • -mat_lmvm_theta - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling
  • -mat_lmvm_rho - (developer) update limiter for the J0 scaling
  • -mat_lmvm_alpha - (developer) coefficient factor for the quadratic subproblem in J0 scaling
  • -mat_lmvm_beta - (developer) exponential factor for the diagonal J0 scaling
  • -mat_lmvm_sigma_hist - (developer) number of past updates to use in J0 scaling

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMDFP, MatCreateLMVMBFGS(), MatCreateLMVMSR1(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDQN — Method
B::PetscMat = MatCreateLMVMDQN(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a dense representation of the limited-memory Quasi-Newton approximation to a Hessian.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Level: advanced

See also: MatCreate(), MATLMVM, MATLMVMDBFGS, MATLMVMDDFP, MatCreateLMVMDDFP(), MatCreateLMVMDBFGS()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDiagBroyden — Method
B::PetscMat = MatCreateLMVMDiagBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

DiagBrdn creates a symmetric Broyden-type diagonal matrix used for approximating Hessians.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_theta - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling
  • -mat_lmvm_rho - (developer) update limiter for the J0 scaling
  • -mat_lmvm_alpha - (developer) coefficient factor for the quadratic subproblem in J0 scaling
  • -mat_lmvm_beta - (developer) exponential factor for the diagonal J0 scaling
  • -mat_lmvm_sigma_hist - (developer) number of past updates to use in J0 scaling.
  • -mat_lmvm_tol - (developer) tolerance for bounding the denominator of the rescaling away from 0.
  • -mat_lmvm_forward - (developer) whether or not to use the forward or backward Broyden update to the diagonal

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMDIAGBRDN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMSR1 — Method
B::PetscMat = MatCreateLMVMSR1(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory Symmetric-Rank-1 approximation matrix used for a Jacobian. L-SR1 is symmetric by construction, but is not guaranteed to be positive-definite.

To use the L-SR1 matrix with other vector types, the matrix must be created using MatCreate() and MatSetType(), followed by MatLMVMAllocate(). This ensures that the internal storage and work vectors are duplicated from the correct type of vector.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_hist_size - the number of history vectors to keep
  • -mat_lmvm_mult_algorithm - the algorithm to use for multiplication (recursive, dense, compact_dense)
  • -mat_lmvm_cache_J0_products - whether products between the base Jacobian J0 and history vectors should be cached or recomputed
  • -mat_lmvm_eps - (developer) numerical zero tolerance for testing when an update should be skipped
  • -mat_lmvm_debug - (developer) perform internal debugging checks

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMSR1, MatCreateLMVMBFGS(), MatCreateLMVMDFP(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMSymBadBroyden — Method
B::PetscMat = MatCreateLMVMSymBadBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory Symmetric "Bad" Broyden-type matrix used for approximating Jacobians.

Collective

Input Parameters:

  • comm - MPI communicator
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_hist_size - the number of history vectors to keep
  • -mat_lmvm_psi - convex ratio between BFGS and DFP components of the update
  • -mat_lmvm_scale_type - type of scaling applied to J0 (none, scalar, diagonal)
  • -mat_lmvm_mult_algorithm - the algorithm to use for multiplication (recursive, dense, compact_dense)
  • -mat_lmvm_cache_J0_products - whether products between the base Jacobian J0 and history vectors should be cached or recomputed
  • -mat_lmvm_eps - (developer) numerical zero tolerance for testing when an update should be skipped
  • -mat_lmvm_debug - (developer) perform internal debugging checks
  • -mat_lmvm_theta - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling
  • -mat_lmvm_rho - (developer) update limiter for the J0 scaling
  • -mat_lmvm_alpha - (developer) coefficient factor for the quadratic subproblem in J0 scaling
  • -mat_lmvm_beta - (developer) exponential factor for the diagonal J0 scaling
  • -mat_lmvm_sigma_hist - (developer) number of past updates to use in J0 scaling

Level: intermediate

See also: LMVM Matrices, MatCreate(), MATLMVM, MATLMVMSYMBROYDEN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMSymBroyden — Method
B::PetscMat = MatCreateLMVMSymBroyden(petsclib::PetscLibType, comm::MPI_Comm, n::PetscInt, M_N::PetscInt)

Creates a limited-memory Symmetric Broyden-type matrix used for approximating Jacobians.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • n - number of local rows for storage vectors
  • N - global size of the storage vectors

Output Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_lmvm_hist_size - the number of history vectors to keep
  • -mat_lmvm_phi - convex ratio between BFGS and DFP components of the update
  • -mat_lmvm_scale_type - type of scaling applied to J0 (none, scalar, diagonal)
  • -mat_lmvm_mult_algorithm - the algorithm to use for multiplication (recursive, dense, compact_dense)
  • -mat_lmvm_cache_J0_products - whether products between the base Jacobian J0 and history vectors should be cached or recomputed
  • -mat_lmvm_eps - (developer) numerical zero tolerance for testing when an update should be skipped
  • -mat_lmvm_debug - (developer) perform internal debugging checks
  • -mat_lmvm_theta - (developer) convex ratio between BFGS and DFP components of the diagonal J0 scaling
  • -mat_lmvm_rho - (developer) update limiter for the J0 scaling
  • -mat_lmvm_alpha - (developer) coefficient factor for the quadratic subproblem in J0 scaling
  • -mat_lmvm_beta - (developer) exponential factor for the diagonal J0 scaling
  • -mat_lmvm_sigma_hist - (developer) number of past updates to use in J0 scaling

Level: intermediate

See also: MatCreate(), MATLMVM, MATLMVMSYMBROYDEN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLRC — Method
N::PetscMat = MatCreateLRC(petsclib::PetscLibType, A::AbstractPetscMat, U::AbstractPetscMat, c::Union{Ptr, AbstractPetscVec}, V::AbstractPetscMat)

Creates a new matrix object that behaves like A + UCV' of type MATLRC

Collective

Input Parameters:

  • A - the (sparse) matrix (can be NULL)
  • U - dense rectangular (tall and skinny) matrix
  • V - dense rectangular (tall and skinny) matrix
  • c - a vector containing the diagonal of C (can be NULL)

Output Parameter:

  • N - the matrix that represents A + UCV'

Level: intermediate

See also: Mat, MATLRC, MatLRCGetMats()

External Links

source
PETSc.LibPETSc.MatCreateLaplacian — Method
L::PetscMat = MatCreateLaplacian(petsclib::PetscLibType, A::AbstractPetscMat, tol::PetscReal, weighted::PetscBool)

Create the matrix Laplacian, with all values in the matrix less than the tolerance set to zero

Input Parameters:

  • A - The matrix
  • tol - The zero tolerance
  • weighted - Flag for using edge weights

Output Parameter:

  • L - The graph Laplacian matrix

Level: intermediate

See also: MatFilter(), MatGetGraph()

External Links

source
PETSc.LibPETSc.MatCreateLocalRef — Method
newmat::PetscMat = MatCreateLocalRef(petsclib::PetscLibType, A::AbstractPetscMat, isrow::AbstractIS, iscol::AbstractIS)

Gets a logical reference to a local submatrix, for use in assembly, that is to set values into the matrix

Not Collective

Input Parameters:

  • A - full matrix, generally parallel
  • isrow - Local index set for the rows
  • iscol - Local index set for the columns

Output Parameter:

  • newmat - new serial Mat

Level: developer

See also: Mat, MATSUBMATRIX, MatCreateSubMatrixVirtual(), MatSetValuesLocal(), MatSetValuesBlockedLocal(), MatGetLocalSubMatrix(), MatCreateSubMatrix()

External Links

source
PETSc.LibPETSc.MatCreateMAIJ — Method
maij::PetscMat = MatCreateMAIJ(petsclib::PetscLibType, A::AbstractPetscMat, dof::PetscInt)

Creates a matrix type providing restriction and interpolation operations for multicomponent problems. It interpolates each component the same way independently. The matrix type is based on MATSEQAIJ for sequential matrices, and MATMPIAIJ for distributed matrices.

Collective

Input Parameters:

  • A - the MATAIJ matrix describing the action on blocks
  • dof - the block size (number of components per node)

Output Parameter:

  • maij - the new MATMAIJ matrix

Level: advanced

See also: Mat, MATAIJ, MATMAIJ, MatMAIJGetAIJ(), MatMAIJRedimension()

External Links

source
PETSc.LibPETSc.MatCreateMFFD — Method
J::PetscMat = MatCreateMFFD(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt)

Creates a matrix-free matrix of type MATMFFD that uses finite differences on a provided function to approximately multiply a vector by the matrix (Jacobian) . See also MatCreateSNESMF()

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)

Output Parameter:

  • J - the matrix-free matrix

Options Database Keys:

  • -mat_mffd_type - wp or ds (see MATMFFD_WP or MATMFFD_DS)
  • -mat_mffd_err - square root of estimated relative error in function evaluation
  • -mat_mffd_period - how often h is recomputed, defaults to 1, every time
  • -mat_mffd_check_positivity - possibly decrease h until U + h*a has only positive values
  • -mat_mffd_umin umin - Sets umin (for default PETSc routine that computes h only)
  • -mat_mffd_complex - use the Lyness trick with complex numbers to compute the matrix-vector product instead of differencing

(requires real valued functions but that PETSc be configured for complex numbers)

  • -snes_mf - use the finite difference based matrix-free matrix with SNESSolve() and no preconditioner
  • -snes_mf_operator - use the finite difference based matrix-free matrix with SNESSolve() but construct a preconditioner

using the matrix passed as pmat to SNESSetJacobian().

Level: advanced

See also: Mat, MATMFFD, MatDestroy(), MatMFFDSetFunctionError(), MatMFFDDSSetUmin(), MatMFFDSetFunction(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), MatCreateSNESMF(), MatCreateShell(), MATSHELL, MatMFFDGetH(), MatMFFDRegister(), MatMFFDComputeJacobian()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJCRL — Method
A::PetscMat = MatCreateMPIAIJCRL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt}, onz::PetscInt, onnz::Vector{PetscInt})

Creates a sparse matrix of type MATMPIAIJCRL.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • nz - number of nonzeros per row (same for all rows), for the "diagonal" submatrix
  • nnz - array containing the number of nonzeros in the various rows (possibly different for each row) or NULL, for the "diagonal" submatrix
  • onz - number of nonzeros per row (same for all rows), for the "off-diagonal" submatrix
  • onnz - array containing the number of nonzeros in the various rows (possibly different for each row) or NULL, for the "off-diagonal" submatrix

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, Sparse Matrix Creation, MATAIJ, MATAIJSELL, MATAIJPERM, MATAIJMKL, MatCreate(), MatCreateMPIAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJMKL — Method
A::PetscMat = MatCreateMPIAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

Creates a sparse parallel matrix whose local portions are stored as MATSEQAIJMKL matrices (a matrix class that inherits from MATSEQAIJ but uses some operations provided by Intel MKL).

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m. For matrices you plan to factor you must leave room for the diagonal entry and put in the entry even if it is zero.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

Output Parameter:

  • A - the matrix

Options Database Key:

  • -mat_aijmkl_no_spmv2 - disables use of the SpMV2 inspector-executor routines

Level: intermediate

See also: Mat, Sparse Matrix Creation, MATMPIAIJMKL, MatCreate(), MatCreateSeqAIJMKL(), MatSetValues(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJPERM — Method
A::PetscMat = MatCreateMPIAIJPERM(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse parallel matrix whose local portions are stored as MATSEQAIJPERM matrices (a matrix class that inherits from SEQAIJ but includes some optimizations to allow more effective vectorization).

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m. For matrices you plan to factor you must leave room for the diagonal entry and put in the entry even if it is zero.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_no_inode - Do not use inodes
  • -mat_inode_limit limit - Sets inode limit (max limit=5)

Level: intermediate

See also: Mat, Sparse Matrix Creation, MATMPIAIJPERM, MatCreate(), MatCreateSeqAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJSELL — Method
A::PetscMat = MatCreateMPIAIJSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

Creates a sparse parallel matrix whose local portions are stored as MATSEQAIJSELL matrices (a matrix class that inherits from SEQAIJ but performs some operations in SELL format).

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m. For matrices you plan to factor you must leave room for the diagonal entry and put in the entry even if it is zero.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

Output Parameter:

  • A - the matrix

Options Database Key:

  • -mat_aijsell_eager_shadow - Construct shadow matrix upon matrix assembly; default is to take a "lazy" approach, performing this step the first

time the matrix is applied

Level: intermediate

See also: Mat, Sparse Matrix Creation, MATSEQAIJSELL, MATMPIAIJSELL, MATAIJSELL, MatCreate(), MatCreateSeqAIJSELL(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJSumSeqAIJ — Method
mpimat::PetscMat = MatCreateMPIAIJSumSeqAIJ(petsclib::PetscLibType, comm::MPI_Comm, seqmat::AbstractPetscMat, m::PetscInt, n::PetscInt, scall::MatReuse)

Creates a MATMPIAIJ matrix by adding sequential matrices from each processor

Collective

Input Parameters:

  • comm - the communicators the parallel matrix will live on
  • seqmat - the input sequential matrices
  • m - number of local rows (or PETSC_DECIDE)
  • n - number of local columns (or PETSC_DECIDE)
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • mpimat - the parallel matrix generated

Level: advanced

See also: Mat, MatCreateAIJ()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJSumSeqAIJNumeric — Method
MatCreateMPIAIJSumSeqAIJNumeric(petsclib::PetscLibType, seqmat::AbstractPetscMat, mpimat::AbstractPetscMat)

Fill the numerical values of an MATMPIAIJ matrix previously created by MatCreateMPIAIJSumSeqAIJSymbolic() by summing the local MATSEQAIJ contributions from each process.

Collective

Input Parameters:

  • seqmat - the local MATSEQAIJ contribution from this process
  • mpimat - the target MATMPIAIJ matrix created by MatCreateMPIAIJSumSeqAIJSymbolic()

Level: developer

See also: Mat, MATMPIAIJ, MATSEQAIJ, MatCreateMPIAIJSumSeqAIJSymbolic(), MatCreateMPIAIJSumSeqAIJ()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJSumSeqAIJSymbolic — Method
mpimat::PetscMat = MatCreateMPIAIJSumSeqAIJSymbolic(petsclib::PetscLibType, comm::MPI_Comm, seqmat::AbstractPetscMat, m::PetscInt, n::PetscInt)

Create the symbolic (nonzero-pattern) portion of an MATMPIAIJ matrix obtained by summing local MATSEQAIJ contributions from each process.

Collective

Input Parameters:

  • comm - the communicator
  • seqmat - the local MATSEQAIJ contribution from this process
  • m - the number of local rows for the resulting MATMPIAIJ matrix, or PETSC_DECIDE
  • n - the number of local columns for the resulting MATMPIAIJ matrix, or PETSC_DECIDE

Output Parameter:

  • mpimat - the newly created MATMPIAIJ matrix

Level: developer

See also: Mat, MATMPIAIJ, MATSEQAIJ, MatCreateMPIAIJSumSeqAIJNumeric(), MatCreateMPIAIJSumSeqAIJ()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJWithArrays — Method
mat::PetscMat = MatCreateMPIAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar})

creates a MATMPIAIJ matrix using arrays that contain in standard CSR format for the local rows.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (Cannot be PETSC_DECIDE)
  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • i - row indices (of length m+1); that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix
  • j - global column indices
  • a - optional matrix values

Output Parameter:

  • mat - the matrix

Level: intermediate

See also: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays(), MatUpdateMPIAIJWithArray(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJWithSeqAIJ — Method
garray::PetscInt,mat::PetscMat = MatCreateMPIAIJWithSeqAIJ(petsclib::PetscLibType, comm::MPI_Comm, M::PetscInt, N::PetscInt, A::AbstractPetscMat, B::AbstractPetscMat)

creates a MATMPIAIJ matrix using MATSEQAIJ matrices that contain the "diagonal" and "off-diagonal" part of the matrix in CSR format.

Collective

Input Parameters:

  • comm - MPI communicator
  • M - the global row size
  • N - the global column size
  • A - "diagonal" portion of matrix
  • B - if garray is NULL, B should be the offdiag matrix using global col ids and of size N - if garray is not NULL, B should be the offdiag matrix using local col ids and of size garray
  • garray - either NULL or the global index of B columns. If not NULL, it should be allocated by PetscMalloc1() and will be owned by mat thereafter.

Output Parameter:

  • mat - the matrix, with input A as its local diagonal matrix

Level: advanced

See also: Mat, MATMPIAIJ, MATSEQAIJ, MatCreateMPIAIJWithSplitArrays()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJWithSplitArrays — Method
mat::PetscMat = MatCreateMPIAIJWithSplitArrays(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}, oi::Vector{PetscInt}, oj::Vector{PetscInt}, oa::Vector{PetscScalar})

creates a MATMPIAIJ matrix using arrays that contain the "diagonal" and "off-diagonal" part of the matrix in CSR format.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (Cannot be PETSC_DECIDE)
  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • i - row indices for "diagonal" portion of matrix; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix
  • j - column indices, which must be local, i.e., based off the start column of the diagonal portion
  • a - matrix values
  • oi - row indices for "off-diagonal" portion of matrix; that is oi[0] = 0, oi[row] = oi[row-1] + number of elements in that row of the matrix
  • oj - column indices, which must be global, representing global columns in the MATMPIAIJ matrix
  • oa - matrix values

Output Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithArrays()

External Links

source
PETSc.LibPETSc.MatCreateMPIAdj — Method
A::PetscMat = MatCreateMPIAdj(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, values::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix representing an adjacency list. The matrix need not have numerical values associated with it, it is intended for ordering (to reduce bandwidth etc) and partitioning.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows
  • N - number of global columns
  • i - the indices into j for the start of each row
  • j - the column indices for each row (sorted for each row).
  • values - the values, optional, use NULL if not provided

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MatCreate(), MatConvert(), MatGetOrdering(), MATMPIADJ, MatMPIAdjSetPreallocation()

External Links

source
PETSc.LibPETSc.MatCreateMPIBAIJWithArrays — Method
mat::PetscMat = MatCreateMPIBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar})

creates a MATMPIBAIJ matrix using arrays that contain in standard block CSR format for the local rows.

Collective

Input Parameters:

  • comm - MPI communicator
  • bs - the block size, only a block size of 1 is supported
  • m - number of local rows (Cannot be PETSC_DECIDE)
  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax . (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that rowth block row of the matrix
  • j - column indices
  • a - matrix values

Output Parameter:

  • mat - the matrix

Level: intermediate

See also: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays()

External Links

source
PETSc.LibPETSc.MatCreateMPIMatConcatenateSeqMat — Method
mpimat::PetscMat = MatCreateMPIMatConcatenateSeqMat(petsclib::PetscLibType, comm::MPI_Comm, seqmat::AbstractPetscMat, n::PetscInt, reuse::MatReuse)

Creates a single large PETSc matrix by concatenating sequential matrices from each processor

Collective

Input Parameters:

  • comm - the communicators the parallel matrix will live on
  • seqmat - the input sequential matrices
  • n - number of local columns (or PETSC_DECIDE)
  • reuse - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • mpimat - the parallel matrix generated

Level: developer

See also: Mat

External Links

source
PETSc.LibPETSc.MatCreateMPISBAIJWithArrays — Method
mat::PetscMat = MatCreateMPISBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar})

creates a MATMPISBAIJ matrix using arrays that contain in standard CSR format for the local rows.

Collective

Input Parameters:

  • comm - MPI communicator
  • bs - the block size, only a block size of 1 is supported
  • m - number of local rows (Cannot be PETSC_DECIDE)
  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax . (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix
  • j - column indices
  • a - matrix values

Output Parameter:

  • mat - the matrix

Level: intermediate

See also: Mat, MATMPISBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays(), MatMPISBAIJSetPreallocationCSR()

External Links

source
PETSc.LibPETSc.MatCreateNest — Method
B::PetscMat = MatCreateNest(petsclib::PetscLibType, comm::MPI_Comm, nr::PetscInt, is_row::Vector{<:AbstractIS}, nc::PetscInt, is_col::Vector{<:AbstractIS}, a::Vector{<:AbstractPetscMat})

Creates a new MATNEST matrix containing several nested submatrices, each stored separately

Collective

Input Parameters:

  • comm - Communicator for the new MATNEST
  • nr - number of nested row blocks
  • is_row - index sets for each nested row block, or NULL to make contiguous
  • nc - number of nested column blocks
  • is_col - index sets for each nested column block, or NULL to make contiguous
  • a - array of nr \times nc submatrices, empty submatrices can be passed using NULL

Output Parameter:

  • B - new matrix

Level: advanced

See also: Mat, MATNEST, MatCreate(), VecCreateNest(), DMCreateMatrix(), MatNestSetSubMat(), MatNestGetSubMat(), MatNestGetLocalISs(), MatNestGetSize(), MatNestGetISs(), MatNestSetSubMats(), MatNestGetSubMats()

External Links

source
PETSc.LibPETSc.MatCreateNormal — Method
N::PetscMat = MatCreateNormal(petsclib::PetscLibType, A::AbstractPetscMat)

Creates a new MATNORMAL matrix object that behaves like A^T A.

Collective

Input Parameter:

  • A - the (possibly rectangular) matrix

Output Parameter:

  • N - the matrix that represents A^T A

Level: intermediate

See also: Mat, MATNORMAL, MatMult(), MatNormalGetMat(), MATNORMALHERMITIAN, MatCreateNormalHermitian()

External Links

source
PETSc.LibPETSc.MatCreateNormalHermitian — Method
N::PetscMat = MatCreateNormalHermitian(petsclib::PetscLibType, A::AbstractPetscMat)

Creates a new matrix object MATNORMALHERMITIAN that behaves like A^* A.

Collective

Input Parameter:

  • A - the (possibly rectangular complex) matrix

Output Parameter:

  • N - the matrix that represents A^* A

Level: intermediate

See also: Mat, MATNORMAL, MATNORMALHERMITIAN, MatNormalHermitianGetMat()

External Links

source
PETSc.LibPETSc.MatCreateRedundantMatrix — Method
matredundant::PetscMat = MatCreateRedundantMatrix(petsclib::PetscLibType, mat::AbstractPetscMat, nsubcomm::PetscInt, subcomm::MPI_Comm, reuse::MatReuse)

Create redundant matrices and put them into processors of subcommunicators.

Collective

Input Parameters:

  • mat - the matrix
  • nsubcomm - the number of subcommunicators (= number of redundant parallel or sequential matrices)
  • subcomm - MPI communicator split from the communicator where mat resides in (or MPI_COMM_NULL if nsubcomm is used)
  • reuse - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • matredundant - redundant matrix

Level: advanced

See also: Mat, MatDestroy(), PetscSubcommCreate(), PetscSubcomm

External Links

source
PETSc.LibPETSc.MatCreateSBAIJ — Method
A::PetscMat = MatCreateSBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse parallel matrix in symmetric block AIJ format, MATSBAIJ, (block compressed row). For good matrix assembly performance the user should preallocate the matrix storage by setting the parameters d_nz (or d_nnz) and o_nz (or o_nnz).

Collective

Input Parameters:

  • comm - MPI communicator
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)

This value should be the same as the local size used in creating the x vector for the matrix-vector product y = Ax.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_nz - number of block nonzeros per block row in diagonal portion of local

submatrix (same for all local rows)

  • d_nnz - array containing the number of block nonzeros in the various block rows

in the upper triangular portion of the in diagonal portion of the local (possibly different for each block block row) or NULL. If you plan to factor the matrix you must leave room for the diagonal entry and set its value even if it is zero.

  • o_nz - number of block nonzeros per block row in the off-diagonal portion of local

submatrix (same for all local rows).

  • o_nnz - array containing the number of nonzeros in the various block rows of the

off-diagonal portion of the local submatrix (possibly different for each block row) or NULL.

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the

block calculations (much slower)

  • -mat_block_size - size of the blocks to use
  • -mat_mpi - use the parallel matrix data structures even on one processor

(defaults to using SeqBAIJ format on one processor)

Level: intermediate

See also: Mat, MATSBAIJ, MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout

External Links

source
PETSc.LibPETSc.MatCreateSELL — Method
A::PetscMat = MatCreateSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_rlenmax::PetscInt, d_rlen::Union{Ptr, Vector{PetscInt}}, o_rlenmax::PetscInt, o_rlen::Union{Ptr, Vector{PetscInt}})

Creates a sparse parallel matrix in MATSELL format.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)

This value should be the same as the local size used in creating the y vector for the matrix-vector product y = Ax.

  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • d_rlenmax - max number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_rlen - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_rlenmax is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

  • o_rlenmax - max number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_rlen - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_rlenmax is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

Output Parameter:

  • A - the matrix

Options Database Key:

  • -mat_sell_oneindex - Internally use indexing starting at 1

rather than 0. When calling MatSetValues(), the user still MUST index entries starting at 0!

Example: Consider the following 8x8 matrix with 34 non-zero values, that is assembled across 3 processors. Lets assume that proc0 owns 3 rows, proc1 owns 3 rows, proc2 owns 2 rows. This division can be shown as follows

$1 2 0 | 0 3 0 | 0 4 Proc0 0 5 6 | 7 0 0 | 8 0 9 0 10 | 11 0 0 | 12 0 ------------------------------------- 13 0 14 | 15 16 17 | 0 0 Proc1 0 18 0 | 19 20 21 | 0 0 0 0 0 | 22 23 0 | 24 0 ------------------------------------- Proc2 25 26 27 | 0 0 28 | 29 0 30 0 0 | 31 32 33 | 0 34$

This can be represented as a collection of submatrices as $A B C D E F G H I$

Where the submatrices A,B,C are owned by proc0, D,E,F are owned by proc1, G,H,I are owned by proc2.

The 'm' parameters for proc0,proc1,proc2 are 3,3,2 respectively. The 'n' parameters for proc0,proc1,proc2 are 3,3,2 respectively. The 'M','N' parameters are 8,8, and have the same values on all procs.

The DIAGONAL submatrices corresponding to proc0,proc1,proc2 are submatrices [A], [E], [I] respectively. The OFF-DIAGONAL submatrices corresponding to proc0,proc1,proc2 are [BC], [DF], [GH] respectively. Internally, each processor stores the DIAGONAL part, and the OFF-DIAGONAL part as MATSEQSELL matrices. For example, proc1 will store [E] as a MATSEQSELL matrix, and [DF] as another MATSEQSELL matrix.

When drlenmax, orlenmax parameters are specified, drlenmax storage elements are allocated for every row of the local DIAGONAL submatrix, and orlenmax storage locations are allocated for every row of the OFF-DIAGONAL submatrix. One way to choose d_rlenmax and o_rlenmax is to use the maximum number of nonzeros over the local rows for each of the local DIAGONAL, and the OFF-DIAGONAL submatrices. In this case, the values of drlenmax,orlenmax are $proc0 - d_rlenmax = 2, o_rlenmax = 2 proc1 - d_rlenmax = 3, o_rlenmax = 2 proc2 - d_rlenmax = 1, o_rlenmax = 4$ We are allocating m(drlenmax+orlenmax) storage locations for every proc. This translates to 3(2+2)=12 for proc0, 3(3+2)=15 for proc1, 2(1+4)=10 for proc3. i.e we are using 12+15+10=37 storage locations to store 34 values.

When d_rlen, o_rlen parameters are specified, the storage is specified for every row, corresponding to both DIAGONAL and OFF-DIAGONAL submatrices. In the above case the values for d_nnz, o_nnz are $proc0 - d_nnz = [2,2,2] and o_nnz = [2,2,2] proc1 - d_nnz = [3,3,2] and o_nnz = [2,1,1] proc2 - d_nnz = [1,1] and o_nnz = [4,4]$ Here the space allocated is still 37 though there are 34 nonzeros because the allocation is always done according to rlenmax.

Level: intermediate

See also: Mat, MATSELL, MatCreate(), MatCreateSeqSELL(), MatSetValues(), MatMPISELLSetPreallocation(), MATMPISELL

External Links

source
PETSc.LibPETSc.MatCreateSELLCUDA — Method
A::PetscMat = MatCreateSELLCUDA(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

External Links

source
PETSc.LibPETSc.MatCreateSELLHIP — Method
A::PetscMat = MatCreateSELLHIP(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

External Links

source
PETSc.LibPETSc.MatCreateSNESMF — Method
J::PetscMat = MatCreateSNESMF(petsclib::PetscLibType, snes::AbstractSNES)

Creates a finite differencing based matrix-free matrix context for use with a SNES solver. This matrix can be used as the Jacobian argument for the routine SNESSetJacobian(). See MatCreateMFFD() for details on how the finite difference computation is done.

Collective

Input Parameters:

  • snes - the SNES context

Output Parameter:

  • J - the matrix-free matrix which is of type MATMFFD

Level: advanced

See also: SNES, MATMFFD, MatDestroy(), MatMFFDSetFunction(), MatMFFDSetFunctionError(), MatMFFDDSSetUmin(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), MatCreateMFFD(), MatCreateShell(), MatMFFDGetH(), MatMFFDRegister(), MatMFFDComputeJacobian(), MatSNESMFSetReuseBase(), MatSNESMFGetReuseBase()

External Links

source
PETSc.LibPETSc.MatCreateSNESMFMore — Method
J::PetscMat = MatCreateSNESMFMore(petsclib::PetscLibType, snes::AbstractSNES, x::AbstractPetscVec)

Creates a matrix-free matrix context for use with a SNES solver that uses the More method to compute an optimal h based on the noise of the function. This matrix can be used as the Jacobian argument for the routine SNESSetJacobian().

Input Parameters:

  • snes - the SNES context
  • x - vector where SNES solution is to be stored.

Output Parameter:

  • J - the matrix-free matrix

Options Database Keys:

  • -snes_mf_err error_rel - see MatCreateSNESMF()
  • -snes_mf_umin umin - see MatCreateSNESMF()
  • -snes_mf_compute_err - compute the square root or relative error in function
  • -snes_mf_freq_err freq - set the frequency to recompute the parameters
  • -snes_mf_jorge - use the method of Jorge More

Level: advanced

See also: SNESCreateMF(), MatCreateMFFD(), MatDestroy(), MatMFFDSetFunctionError()

External Links

source
PETSc.LibPETSc.MatCreateScaLAPACK — Method
A::PetscMat = MatCreateScaLAPACK(petsclib::PetscLibType, comm::MPI_Comm, mb::PetscInt, nb::PetscInt, M::PetscInt, N::PetscInt, rsrc::PetscInt, csrc::PetscInt)

Creates a dense parallel matrix in ScaLAPACK format (2D block cyclic distribution) for a MATSCALAPACK matrix

Collective

Input Parameters:

  • comm - MPI communicator
  • mb - row block size (or PETSC_DECIDE to have it set)
  • nb - column block size (or PETSC_DECIDE to have it set)
  • M - number of global rows
  • N - number of global columns
  • rsrc - coordinate of process that owns the first row of the distributed matrix
  • csrc - coordinate of process that owns the first column of the distributed matrix

Output Parameter:

  • A - the matrix

Options Database Key:

  • -mat_scalapack_block_sizes - size of the blocks to use (one or two integers separated by comma)

Level: intermediate

See also: Mat, MATSCALAPACK, MATDENSE, MATELEMENTAL, MatCreate(), MatCreateDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateScatter — Method
A::PetscMat = MatCreateScatter(petsclib::PetscLibType, comm::MPI_Comm, scatter::VecScatter)

Creates a new matrix of MatType MATSCATTER, based on a VecScatter

Collective

Input Parameters:

  • comm - MPI communicator
  • scatter - a VecScatter

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MatScatterSetVecScatter(), MatScatterGetVecScatter(), MATSCATTER

External Links

source
PETSc.LibPETSc.MatCreateSchurComplement — Method
S::PetscMat = MatCreateSchurComplement(petsclib::PetscLibType, A00::AbstractPetscMat, Ap00::AbstractPetscMat, A01::AbstractPetscMat, A10::AbstractPetscMat, A11::AbstractPetscMat)

Creates a new Mat that behaves like the Schur complement of a matrix

Collective

Input Parameters:

  • A00 - the upper-left block of the original matrix A = [A00 A01; A10 A11]
  • Ap00 - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A00^{-1}
  • A01 - the upper-right block of the original matrix A = [A00 A01; A10 A11]
  • A10 - the lower-left block of the original matrix A = [A00 A01; A10 A11]
  • A11 - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11]

Output Parameter:

  • S - the matrix that behaves as the Schur complement S = A11 - A10 ksp(A00,Ap00) A01

Level: intermediate

See also: MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatSchurComplementUpdateSubMatrices(), MatCreateTranspose(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementSetSubMatrices()

External Links

source
PETSc.LibPETSc.MatCreateSchurComplementPmat — Method
Sp::PetscMat = MatCreateSchurComplementPmat(petsclib::PetscLibType, A00::AbstractPetscMat, A01::AbstractPetscMat, A10::AbstractPetscMat, A11::AbstractPetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse)

create a matrix for preconditioning the Schur complement by explicitly assembling the sparse matrix Sp = A11 - A10 inv(DIAGFORM(A00)) A01

Collective

Input Parameters:

  • A00 - the upper-left part of the original matrix A = [A00 A01; A10 A11]
  • A01 - (optional) the upper-right part of the original matrix A = [A00 A01; A10 A11]
  • A10 - (optional) the lower-left part of the original matrix A = [A00 A01; A10 A11]
  • A11 - (optional) the lower-right part of the original matrix A = [A00 A01; A10 A11]
  • ainvtype - type of approximation for DIAGFORM(A00) used when forming Sp = A11 - A10 inv(DIAGFORM(A00)) A01. See MatSchurComplementAinvType.
  • preuse - MAT_INITIAL_MATRIX for a new Sp, or MAT_REUSE_MATRIX to reuse an existing Sp, or MAT_IGNORE_MATRIX to put nothing in Sp

Output Parameter:

  • Sp - approximate Schur complement suitable for constructing a preconditioner for the true Schur complement S = A11 - A10 inv(A00) A01

Level: advanced

See also: MatCreateSchurComplement(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementAinvType

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJ — Method
A::PetscMat = MatCreateSeqAIJ(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix in MATSEQAIJ (compressed row) format (the default parallel PETSc format). For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz).

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • nz - number of nonzeros per row (same for all rows)
  • nnz - array containing the number of nonzeros in the various rows

(possibly different for each row) or NULL

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_no_inode - Do not use inodes
  • -mat_inode_limit limit - Sets inode limit (max limit=5)

Level: intermediate

See also: Mat, Sparse Matrix Creation, MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJCRL — Method
A::PetscMat = MatCreateSeqAIJCRL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix of type MATSEQAIJCRL.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • nz - number of nonzeros per row (same for all rows), ignored if nnz is given
  • nnz - array containing the number of nonzeros in the various rows

(possibly different for each row) or NULL

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MatCreate(), MatCreateMPIAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJFromTriple — Method
mat::PetscMat = MatCreateSeqAIJFromTriple(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar}, nz::PetscCount, idx::PetscBool)

Creates an sequential MATSEQAIJ matrix using matrix elements (in COO format) provided by the user.

Collective

Input Parameters:

  • comm - must be an MPI communicator of size 1
  • m - number of rows
  • n - number of columns
  • i - row indices
  • j - column indices
  • a - matrix values
  • nz - number of nonzeros
  • idx - if the i and j indices start with 1 use PETSC_TRUE otherwise use PETSC_FALSE

Output Parameter:

  • mat - the matrix

Level: intermediate

Example: For the following matrix, the input data expected is as shown (using 0 based indexing) `` 1 0 0 2 0 3 4 5 6

i = {0,1,1,2,2,2} j = {0,0,2,0,1,2} v = {1,2,3,4,5,6} ``

See also: Mat, MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR(), MatSetValuesCOO(), MatSetPreallocationCOO()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJMKL — Method
A::PetscMat = MatCreateSeqAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt})

Creates a sparse matrix of type MATSEQAIJMKL.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • nz - number of nonzeros per row (same for all rows)
  • nnz - array containing the number of nonzeros in the various rows

(possibly different for each row) or NULL

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_aijmkl_no_spmv2 - disable use of the SpMV2 inspector-executor routines
  • -mat_aijmkl_eager_inspection - perform MKL "inspection" phase upon matrix assembly; default is to do "lazy" inspection,

performing this step the first time the matrix is applied

Level: intermediate

See also: Mat, MatCreate(), MatCreateMPIAIJMKL(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJPERM — Method
A::PetscMat = MatCreateSeqAIJPERM(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Vector{PetscInt})

Creates a sparse matrix of type MATSEQAIJPERM.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • nz - number of nonzeros per row (same for all rows), ignored if nnz is given
  • nnz - array containing the number of nonzeros in the various rows (possibly different for each row) or NULL

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MatCreate(), MatCreateMPIAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJSELL — Method
A::PetscMat = MatCreateSeqAIJSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix of type MATSEQAIJSELL.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • nz - number of nonzeros per row (same for all rows)
  • nnz - array containing the number of nonzeros in the various rows

(possibly different for each row) or NULL

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_aijsell_eager_shadow - Construct shadow matrix upon matrix assembly; default is to take a "lazy" approach,

performing this step the first time the matrix is applied

Level: intermediate

See also: Mat, MatCreate(), MatCreateMPIAIJSELL(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJWithArrays — Method
mat::PetscMat = MatCreateSeqAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar})

Creates an sequential MATSEQAIJ matrix using matrix elements (in CSR format) provided by the user.

Collective

Input Parameters:

  • comm - must be an MPI communicator of size 1
  • m - number of rows
  • n - number of columns
  • i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix
  • j - column indices
  • a - matrix values

Output Parameter:

  • mat - the matrix

Level: intermediate

See also: Mat, MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateMPIAIJWithArrays(), MatMPIAIJSetPreallocationCSR()

External Links

source
PETSc.LibPETSc.MatCreateSeqBAIJ — Method
A::PetscMat = MatCreateSeqBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix in MATSEQAIJ (block compressed row) format. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz).

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • m - number of rows
  • n - number of columns
  • nz - number of nonzero blocks per block row (same for all rows)
  • nnz - array containing the number of nonzero blocks in the various block rows

(possibly different for each block row) or NULL

Output Parameter:

  • A - the matrix

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the block calculations (much slower)
  • -mat_block_size - size of the blocks to use

Level: intermediate

See also: Mat, Sparse Matrices, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqBAIJMKL — Method
A::PetscMat = MatCreateSeqBAIJMKL(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix of type MATSEQBAIJMKL. This type inherits from MATSEQBAIJ and is largely identical, but uses sparse BLAS routines from Intel MKL whenever possible.

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • m - number of rows
  • n - number of columns
  • nz - number of nonzero blocks per block row (same for all rows)
  • nnz - array containing the number of nonzero blocks in the various block rows

(possibly different for each block row) or NULL

Output Parameter:

  • A - the matrix

It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), MatXXXXSetPreallocation() paradigm instead of this routine directly. [MatXXXXSetPreallocation() is, for example, MatSeqBAIJSetPreallocation()]

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the block calculations (much slower)
  • -mat_block_size - size of the blocks to use

Level: intermediate

See also: Sparse Matrices, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqBAIJWithArrays — Method
mat::PetscMat = MatCreateSeqBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar})

Creates a MATSEQBAIJ matrix using matrix elements provided by the user.

Collective

Input Parameters:

  • comm - must be an MPI communicator of size 1
  • bs - size of block
  • m - number of rows
  • n - number of columns
  • i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row block row of the matrix
  • j - column indices
  • a - matrix values

Output Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MatCreate(), MatCreateBAIJ(), MatCreateSeqBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqDense — Method
A::PetscMat = MatCreateSeqDense(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, data::Union{Ptr, Vector{PetscScalar}})

Creates a MATSEQDENSE that is stored in column major order (the usual Fortran format).

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • data - optional location of matrix data in column major order. Use NULL for PETSc

to control all matrix memory allocation.

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MATSEQDENSE, MatCreate(), MatCreateDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqSBAIJ — Method
A::PetscMat = MatCreateSeqSBAIJ(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Creates a sparse symmetric matrix in (block compressed row) MATSEQSBAIJ format. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz).

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • m - number of rows
  • n - number of columns
  • nz - number of block nonzeros per block row (same for all rows)
  • nnz - array containing the number of block nonzeros in the upper triangular plus

diagonal portion of each block (possibly different for each block row) or NULL

Output Parameter:

  • A - the symmetric matrix

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the block calculations (much slower)
  • -mat_block_size - size of the blocks to use

Level: intermediate

See also: Mat, Sparse Matrices, MATSEQSBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateSBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqSBAIJWithArrays — Method
mat::PetscMat = MatCreateSeqSBAIJWithArrays(petsclib::PetscLibType, comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, a::Vector{PetscScalar})

Creates an sequential MATSEQSBAIJ matrix using matrix elements (upper triangular entries in CSR format) provided by the user.

Collective

Input Parameters:

  • comm - must be an MPI communicator of size 1
  • bs - size of block
  • m - number of rows
  • n - number of columns
  • i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix
  • j - column indices
  • a - matrix values

Output Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MATSEQSBAIJ, MatCreate(), MatCreateSBAIJ(), MatCreateSeqSBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqSELL — Method
A::PetscMat = MatCreateSeqSELL(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, rlenmax::PetscInt, rlen::Union{Ptr, Vector{PetscInt}})

Creates a sparse matrix in MATSEQSELL format.

Collective

Input Parameters:

  • comm - MPI communicator, set to PETSC_COMM_SELF
  • m - number of rows
  • n - number of columns
  • rlenmax - maximum number of nonzeros in a row, ignored if rlen is provided
  • rlen - array containing the number of nonzeros in the various rows (possibly different for each row) or NULL

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MATSEQSELL, MatCreate(), MatCreateSELL(), MatSetValues(), MatSeqSELLSetPreallocation(), MATSELL, MATMPISELL

External Links

source
PETSc.LibPETSc.MatCreateShell — Method
A::PetscMat = MatCreateShell(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, ctx::Ptr{Cvoid})

Creates a new matrix of MatType MATSHELL for use with a user-defined private matrix data storage format.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
  • M - number of global rows (may be PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (may be PETSC_DETERMINE to have calculated if n is given)
  • ctx - pointer to data needed by the shell matrix routines

Output Parameter:

  • A - the matrix

Level: advanced

See also: Mat, MATSHELL, MatShellSetOperation(), MatHasOperation(), MatShellGetContext(), MatShellSetContext(), MatShellSetManageScalingShifts(), MatShellSetMatProductOperation()

External Links

source
PETSc.LibPETSc.MatCreateSubMatrices — Function
submat::Vector{PetscMat} = MatCreateSubMatrices(petsclib::PetscLibType, mat::AbstractPetscMat, n::PetscInt, irow::Vector{<:AbstractIS}, icol::Vector{<:AbstractIS}, scall::MatReuse, submat = nothing)

Extracts several submatrices from a matrix.

Collective

Input Parameters:

  • mat - the matrix
  • n - the number of submatrixes to be extracted (on this processor, may be zero)
  • irow - index set of rows to extract
  • icol - index set of columns to extract
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • submat - with MAT_REUSE_MATRIX, the vector an earlier call returned, which is refilled and returned

Output Parameter:

  • submat - the submatrices, owned by the caller

PETSc keeps the submatrices in an array it allocated, and MatDestroySubMatrices() needs that array back. Release the submatrices by passing the returned vector to MatDestroySubMatrices(), not by destroying them one at a time.

Level: advanced

See also: Mat, MatDestroySubMatrices(), MatCreateSubMatrix(), MatGetRow(), MatGetDiagonal(), MatReuse

External Links

source
PETSc.LibPETSc.MatCreateSubMatricesMPI — Function
submat::Vector{PetscMat} = MatCreateSubMatricesMPI(petsclib::PetscLibType, mat::AbstractPetscMat, n::PetscInt, irow::Vector{<:AbstractIS}, icol::Vector{<:AbstractIS}, scall::MatReuse, submat = nothing)

Extracts MPI submatrices across a sub communicator of mat (by pairs of IS that may live on subcomms).

Collective

Input Parameters:

  • mat - the matrix
  • n - the number of submatrixes to be extracted
  • irow - index set of rows to extract
  • icol - index set of columns to extract
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • submat - with MAT_REUSE_MATRIX, the vector an earlier call returned, which is refilled and returned

Output Parameter:

  • submat - the submatrices, owned by the caller

PETSc keeps the submatrices in an array it allocated, and MatDestroySubMatrices() needs that array back. Release the submatrices by passing the returned vector to MatDestroySubMatrices(), not by destroying them one at a time.

Level: advanced

See also: Mat, PCGASM, MatCreateSubMatrices(), MatDestroySubMatrices(), MatCreateSubMatrix(), MatReuse

External Links

source
PETSc.LibPETSc.MatCreateSubMatrix — Method
newmat::PetscMat = MatCreateSubMatrix(petsclib::PetscLibType, mat::AbstractPetscMat, isrow::AbstractIS, iscol::AbstractIS, cll::MatReuse)

Gets a single submatrix on the same number of processors as the original matrix.

Collective

Input Parameters:

  • mat - the original matrix
  • isrow - parallel IS containing the rows this processor should obtain
  • iscol - parallel IS containing all columns you wish to keep. Each process should list the columns that will be in IT's "diagonal part" in the new matrix.
  • cll - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • newmat - the new submatrix, of the same type as the original matrix

Level: advanced

See also: Mat, MatCreateSubMatrices(), MatCreateSubMatricesMPI(), MatCreateSubMatrixVirtual(), MatSubMatrixVirtualUpdate()

External Links

source
PETSc.LibPETSc.MatCreateSubMatrixFree — Method
J::PetscMat = MatCreateSubMatrixFree(petsclib::PetscLibType, mat::AbstractPetscMat, Rows::AbstractIS, Cols::AbstractIS)

Creates a reduced matrix by masking a full matrix.

Collective

Input Parameters:

  • mat - matrix of arbitrary type
  • Rows - the rows that will be in the submatrix
  • Cols - the columns that will be in the submatrix

Output Parameter:

  • J - New matrix

Level: developer

See also: MatCreate()

External Links

source
PETSc.LibPETSc.MatCreateSubMatrixVirtual — Method
newmat::PetscMat = MatCreateSubMatrixVirtual(petsclib::PetscLibType, A::AbstractPetscMat, isrow::AbstractIS, iscol::AbstractIS)

Creates a virtual matrix MATSUBMATRIX that acts as a submatrix

Collective

Input Parameters:

  • A - matrix that we will extract a submatrix of
  • isrow - rows to be present in the submatrix
  • iscol - columns to be present in the submatrix

Output Parameter:

  • newmat - new matrix

Level: developer

See also: Mat, MATSUBMATRIX, MATLOCALREF, MatCreateLocalRef(), MatCreateSubMatrix(), MatSubMatrixVirtualUpdate()

External Links

source
PETSc.LibPETSc.MatCreateTranspose — Method
N::PetscMat = MatCreateTranspose(petsclib::PetscLibType, A::AbstractPetscMat)

Creates a new matrix MATTRANSPOSEVIRTUAL object that behaves like A'

Collective

Input Parameter:

  • A - the (possibly rectangular) matrix

Output Parameter:

  • N - the matrix that represents A'

Level: intermediate

See also: Mat, MATTRANSPOSEVIRTUAL, MatCreateNormal(), MatMult(), MatMultTranspose(), MatCreate(), MATNORMALHERMITIAN

External Links

source
PETSc.LibPETSc.MatCreateVecs — Method
right::PetscVec,left::PetscVec = MatCreateVecs(petsclib::PetscLibType, mat::AbstractPetscMat)

Get vector(s) compatible with the matrix, i.e. with the same parallel layout, PetscLayout for rows and columns

Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • right - (optional) vector that the matrix can be multiplied against
  • left - (optional) vector that the matrix vector product can be stored in

Options Database Key:

  • -mat_vec_type type - set the VecType of the created vectors during MatSetFromOptions()

Level: advanced

See also: Mat, Vec, VecCreate(), VecDestroy(), DMCreateGlobalVector(), MatSetVecType()

External Links

source
PETSc.LibPETSc.MatCreateVecsFFTW — Method
x::PetscVec,y::PetscVec,z::PetscVec = MatCreateVecsFFTW(petsclib::PetscLibType, A::AbstractPetscMat)

Get vector(s) compatible with the matrix, i.e. with the parallel layout determined by MATFFTW

Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • x - (optional) input vector of forward FFTW
  • y - (optional) output vector of forward FFTW
  • z - (optional) output vector of backward FFTW

Options Database Key:

  • -mat_fftw_plannerflags - set FFTW planner flags

Level: advanced

See also: Mat, MATFFTW, MatCreateFFT(), MatCreateVecs()

External Links

source
PETSc.LibPETSc.MatDFischer — Method
MatDFischer(petsclib::PetscLibType, jac::AbstractPetscMat, X::AbstractPetscVec, Con::AbstractPetscVec, XL::AbstractPetscVec, XU::AbstractPetscVec, T1::AbstractPetscVec, T2::AbstractPetscVec, Da::AbstractPetscVec, Db::AbstractPetscVec)

Calculates an element of the B-subdifferential of the Fischer-Burmeister function for complementarity problems.

Collective

Input Parameters:

  • jac - the jacobian of f at X
  • X - current point
  • Con - constraints function evaluated at X
  • XL - lower bounds
  • XU - upper bounds
  • T1 - work vector
  • T2 - work vector

Output Parameters:

  • Da - diagonal perturbation component of the result
  • Db - row scaling component of the result

Level: developer

See also: Mat, VecFischer(), VecSFischer(), MatDSFischer()

External Links

source
PETSc.LibPETSc.MatDSFischer — Method
MatDSFischer(petsclib::PetscLibType, jac::AbstractPetscMat, X::AbstractPetscVec, Con::AbstractPetscVec, XL::AbstractPetscVec, XU::AbstractPetscVec, mu::PetscReal, T1::AbstractPetscVec, T2::AbstractPetscVec, Da::AbstractPetscVec, Db::AbstractPetscVec, Dm::AbstractPetscVec)

Calculates an element of the B-subdifferential of the smoothed Fischer-Burmeister function for complementarity problems.

Collective

Input Parameters:

  • jac - the jacobian of f at X
  • X - current point
  • Con - constraint function evaluated at X
  • XL - lower bounds
  • XU - upper bounds
  • mu - smoothing parameter
  • T1 - work vector
  • T2 - work vector

Output Parameters:

  • Da - diagonal perturbation component of the result
  • Db - row scaling component of the result
  • Dm - derivative with respect to scaling parameter

Level: developer

See also: Mat, VecFischer(), VecSFischer(), MatDFischer()

External Links

source
PETSc.LibPETSc.MatDenseGetArray — Method
array::Array{PetscScalar,2} = MatDenseGetArray(petsclib::PetscLibType, A::AbstractPetscMat)

gives read-write access to the array where the data for a MATDENSE matrix is stored

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayAndMemType — Method
array::Array{PetscScalar,2},mtype::PetscMemType = MatDenseGetArrayAndMemType(petsclib::PetscLibType, A::AbstractPetscMat)

gives read-write access to the array where the data for a MATDENSE matrix is stored

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameters:

  • array - pointer to the data
  • mtype - memory type of the returned pointer

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreArrayAndMemType(), MatDenseGetArrayReadAndMemType(), MatDenseGetArrayWriteAndMemType(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite(), MatSeqAIJGetCSRAndMemType()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayRead — Method
array::Array{PetscScalar,2} = MatDenseGetArrayRead(petsclib::PetscLibType, A::AbstractPetscMat)

gives read-only access to the array where the data for a MATDENSE matrix is stored

Not Collective

Input Parameter:

  • A - a dense matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreArrayRead(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayReadAndMemType — Method
array::Array{PetscScalar,2},mtype::PetscMemType = MatDenseGetArrayReadAndMemType(petsclib::PetscLibType, A::AbstractPetscMat)

gives read-only access to the array where the data for a MATDENSE matrix is stored

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameters:

  • array - pointer to the data
  • mtype - memory type of the returned pointer

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreArrayReadAndMemType(), MatDenseGetArrayWriteAndMemType(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite(), MatSeqAIJGetCSRAndMemType()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayWrite — Method
array::Array{PetscScalar,2} = MatDenseGetArrayWrite(petsclib::PetscLibType, A::AbstractPetscMat)

gives write-only access to the array where the data for a MATDENSE matrix is stored

Not Collective

Input Parameter:

  • A - a dense matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreArrayWrite(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayWriteAndMemType — Method
array::Array{PetscScalar,2},mtype::PetscMemType = MatDenseGetArrayWriteAndMemType(petsclib::PetscLibType, A::AbstractPetscMat)

gives write-only access to the array where the data for a MATDENSE matrix is stored

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameters:

  • array - pointer to the data
  • mtype - memory type of the returned pointer

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreArrayWriteAndMemType(), MatDenseGetArrayReadAndMemType(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite(), MatSeqAIJGetCSRAndMemType()

External Links

source
PETSc.LibPETSc.MatDenseGetColumn — Method
vals::Ptr{PetscScalar} = MatDenseGetColumn(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt)

gives access to a column of a dense matrix. This is only the local part of the column. You MUST call MatDenseRestoreColumn() to avoid memory bleeding.

Not Collective

Input Parameters:

  • A - a MATSEQDENSE or MATMPIDENSE matrix
  • col - column index

Output Parameter:

  • vals - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseRestoreColumn(), MatDenseGetColumnVec()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnVec — Method
v::PetscVec = MatDenseGetColumnVec(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt)

Gives read-write access to a column of a MATDENSE matrix, represented as a Vec.

Collective

Input Parameters:

  • A - the Mat object
  • col - the column index

Output Parameter:

  • v - the vector

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite(), MatDenseGetColumn()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnVecRead — Method
v::PetscVec = MatDenseGetColumnVecRead(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt)

Gives read-only access to a column of a dense matrix, represented as a Vec.

Collective

Input Parameters:

  • A - the Mat object
  • col - the column index

Output Parameter:

  • v - the vector

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnVecWrite — Method
v::PetscVec = MatDenseGetColumnVecWrite(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt)

Gives write-only access to a column of a dense matrix, represented as a Vec.

Collective

Input Parameters:

  • A - the Mat object
  • col - the column index

Output Parameter:

  • v - the vector

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetLDA — Method
lda::PetscInt = MatDenseGetLDA(petsclib::PetscLibType, A::AbstractPetscMat)

gets the leading dimension of the array returned from MatDenseGetArray()

Not Collective

Input Parameter:

  • A - a MATDENSE or MATDENSECUDA matrix

Output Parameter:

  • lda - the leading dimension

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseSetLDA()

External Links

source
PETSc.LibPETSc.MatDenseGetLocalMatrix — Method
B::PetscMat = MatDenseGetLocalMatrix(petsclib::PetscLibType, A::AbstractPetscMat)

For a MATMPIDENSE or MATSEQDENSE matrix returns the sequential matrix that represents the operator. For sequential matrices it returns itself.

Input Parameter:

  • A - the sequential or MPI MATDENSE matrix

Output Parameter:

  • B - the inner matrix

Level: intermediate

See also: Mat, MATDENSE, MATMPIDENSE, MATSEQDENSE

External Links

source
PETSc.LibPETSc.MatDenseGetSubMatrix — Method
v::PetscMat = MatDenseGetSubMatrix(petsclib::PetscLibType, A::AbstractPetscMat, rbegin::PetscInt, rend::PetscInt, cbegin::PetscInt, cend::PetscInt)

Gives access to a block of rows and columns of a dense matrix, represented as a Mat.

Collective

Input Parameters:

  • A - the Mat object
  • rbegin - the first global row index in the block (if PETSC_DECIDE, is 0)
  • rend - the global row index past the last one in the block (if PETSC_DECIDE, is M)
  • cbegin - the first global column index in the block (if PETSC_DECIDE, is 0)
  • cend - the global column index past the last one in the block (if PETSC_DECIDE, is N)

Output Parameter:

  • v - the matrix

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseRestoreColumnVec(), MatDenseRestoreSubMatrix()

External Links

source
PETSc.LibPETSc.MatDensePlaceArray — Method
MatDensePlaceArray(petsclib::PetscLibType, mat::AbstractPetscMat, array::Vector{PetscScalar})

Allows one to replace the array in a MATDENSE matrix with an array provided by the user. This is useful to avoid copying an array into a matrix

Not Collective

Input Parameters:

  • mat - the matrix
  • array - the array in column major order

Level: developer

See also: Mat, MATDENSE, MatDenseGetArray(), MatDenseResetArray(), VecPlaceArray(), VecGetArray(), VecRestoreArray(), VecReplaceArray(), VecResetArray(), MatDenseReplaceArray()

External Links

source
PETSc.LibPETSc.MatDenseReplaceArray — Method
MatDenseReplaceArray(petsclib::PetscLibType, mat::AbstractPetscMat, array::Vector{PetscScalar})

Allows one to replace the array in a dense matrix with an array provided by the user. This is useful to avoid copying an array into a matrix

Not Collective

Input Parameters:

  • mat - the matrix
  • array - the array in column major order

Level: developer

See also: Mat, MatDensePlaceArray(), MatDenseGetArray(), VecReplaceArray()

External Links

source
PETSc.LibPETSc.MatDenseReplaceArrayWithMemType — Method
MatDenseReplaceArrayWithMemType(petsclib::PetscLibType, mat::AbstractPetscMat, mtype::PetscMemType, array::Vector{PetscScalar})

Allows one to replace the array in a MATDENSE, MATDENSECUDA, or MATDENSEHIP with an array provided by the user and a matching PetscMemType. This is useful to avoid copying an array into a matrix.

Not Collective

Input Parameters:

  • mat - the matrix
  • mtype - the PetscMemType of the array
  • array - the array in column major order

Level: developer

See also: MatDenseReplaceArray(), MatDenseCUDAReplaceArray(), MatDenseHIPReplaceArray()

External Links

source
PETSc.LibPETSc.MatDenseResetArray — Method
MatDenseResetArray(petsclib::PetscLibType, mat::AbstractPetscMat)

Resets the matrix array to that it previously had before the call to MatDensePlaceArray()

Not Collective

Input Parameter:

  • mat - the matrix

Level: developer

See also: Mat, MATDENSE, MatDenseGetArray(), MatDensePlaceArray(), VecPlaceArray(), VecGetArray(), VecRestoreArray(), VecReplaceArray(), VecResetArray()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArray — Method
MatDenseRestoreArray(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array where the data for a MATDENSE matrix is stored obtained by MatDenseGetArray()

Logically Collective

Input Parameters:

  • A - a dense matrix
  • array - pointer to the data (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayAndMemType — Method
MatDenseRestoreArrayAndMemType(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array that is obtained by MatDenseGetArrayAndMemType()

Logically Collective

Input Parameters:

  • A - a dense matrix
  • array - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetArrayAndMemType(), MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayRead — Method
MatDenseRestoreArrayRead(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array where the data for a MATDENSE matrix is stored obtained by MatDenseGetArrayRead()

Not Collective

Input Parameters:

  • A - a dense matrix
  • array - pointer to the data (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetArrayRead(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayReadAndMemType — Method
MatDenseRestoreArrayReadAndMemType(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array that is obtained by MatDenseGetArrayReadAndMemType()

Logically Collective

Input Parameters:

  • A - a dense matrix
  • array - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetArrayReadAndMemType(), MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayWrite — Method
MatDenseRestoreArrayWrite(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array where the data for a MATDENSE matrix is stored obtained by MatDenseGetArrayWrite()

Not Collective

Input Parameters:

  • A - a dense matrix
  • array - pointer to the data (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetArrayWrite(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayWriteAndMemType — Method
MatDenseRestoreArrayWriteAndMemType(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array that is obtained by MatDenseGetArrayReadAndMemType()

Logically Collective

Input Parameters:

  • A - a dense matrix
  • array - pointer to the data

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetArrayWriteAndMemType(), MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumn — Method
MatDenseRestoreColumn(petsclib::PetscLibType, A::AbstractPetscMat, vals::Union{Ptr, AbstractArray{PetscScalar}})

returns access to a column of a MATDENSE matrix which is returned by MatDenseGetColumn().

Not Collective

Input Parameters:

  • A - a MATSEQDENSE or MATMPIDENSE matrix
  • vals - pointer to the data (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MatDenseGetColumn()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnVec — Method
MatDenseRestoreColumnVec(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt, v::AbstractPetscVec)

Returns access to a column of a dense matrix obtained from MatDenseGetColumnVec().

Collective

Input Parameters:

  • A - the Mat object
  • col - the column index
  • v - the Vec object (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnVecRead — Method
MatDenseRestoreColumnVecRead(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt, v::AbstractPetscVec)

Returns access to a column of a dense matrix obtained from MatDenseGetColumnVecRead().

Collective

Input Parameters:

  • A - the Mat object
  • col - the column index
  • v - the Vec object (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnVecWrite — Method
MatDenseRestoreColumnVecWrite(petsclib::PetscLibType, A::AbstractPetscMat, col::PetscInt, v::AbstractPetscVec)

Returns access to a column of a dense matrix obtained from MatDenseGetColumnVecWrite().

Collective

Input Parameters:

  • A - the Mat object
  • col - the column index
  • v - the Vec object (may be NULL)

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead()

External Links

source
PETSc.LibPETSc.MatDenseRestoreSubMatrix — Method
MatDenseRestoreSubMatrix(petsclib::PetscLibType, A::AbstractPetscMat, v::AbstractPetscMat)

Returns access to a block of columns of a dense matrix obtained from MatDenseGetSubMatrix().

Collective

Input Parameters:

  • A - the Mat object
  • v - the Mat object (cannot be NULL)

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseRestoreColumnVec(), MatDenseGetSubMatrix()

External Links

source
PETSc.LibPETSc.MatDenseSetLDA — Method
MatDenseSetLDA(petsclib::PetscLibType, A::AbstractPetscMat, lda::PetscInt)

Sets the leading dimension of the array used by the MATDENSE matrix

Collective if the matrix layouts have not yet been setup

Input Parameters:

  • A - a MATDENSE or MATDENSECUDA matrix
  • lda - the leading dimension

Level: intermediate

See also: Mat, MATDENSE, MATDENSECUDA, MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetLDA()

External Links

source
PETSc.LibPETSc.MatDestroy — Method
MatDestroy(petsclib::PetscLibType, A::AbstractPetscMat)

Frees space taken by a matrix.

Collective

Input Parameter:

  • A - the matrix

Level: beginner

See also: Mat, MatCreate()

External Links

source
PETSc.LibPETSc.MatDestroyMatrices — Method
MatDestroyMatrices(petsclib::PetscLibType, n::PetscInt, mat::Union{Ptr, AbstractVector{<:AbstractPetscMat}})

Destroys an array of matrices, and frees the array PETSc allocated for them.

Collective

Input Parameters:

  • n - the number of local matrices
  • mat - the vector of matrices MatCreateSubMatrices() or MatCreateSubMatricesMPI() returned, or the raw pointer to PETSc's array of them

PETSc frees its own array of the matrices, so only a vector a PETSc function returned is accepted: any other vector throws an ArgumentError. The matrices in the vector are left with a null pointer.

Level: advanced

See also: Mat, MatCreateSubMatrices(), MatDestroySubMatrices()

External Links

source
PETSc.LibPETSc.MatDestroySubMatrices — Method
MatDestroySubMatrices(petsclib::PetscLibType, n::PetscInt, mat::Union{Ptr, AbstractVector{<:AbstractPetscMat}})

Destroys a set of matrices obtained with MatCreateSubMatrices().

Collective

Input Parameters:

  • n - the number of local matrices
  • mat - the vector of matrices MatCreateSubMatrices() or MatCreateSubMatricesMPI() returned, or the raw pointer to PETSc's array of them

PETSc frees its own array of the matrices, so only a vector a PETSc function returned is accepted: any other vector throws an ArgumentError. The matrices in the vector are left with a null pointer.

Level: advanced

See also: Mat, MatCreateSubMatrices(), MatDestroyMatrices()

External Links

source
PETSc.LibPETSc.MatDiagonalGetDiagonal — Method
diag::PetscVec = MatDiagonalGetDiagonal(petsclib::PetscLibType, A::AbstractPetscMat)

Get the diagonal of a MATDIAGONAL

Input Parameter:

  • A - the MATDIAGONAL

Output Parameter:

  • diag - the Vec that defines the diagonal

Level: developer

See also: MATDIAGONAL, MatCreateDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal(), MatGetDiagonal()

External Links

source
PETSc.LibPETSc.MatDiagonalGetInverseDiagonal — Method
inv_diag::PetscVec = MatDiagonalGetInverseDiagonal(petsclib::PetscLibType, A::AbstractPetscMat)

Get the inverse diagonal of a MATDIAGONAL

Input Parameter:

  • A - the MATDIAGONAL

Output Parameter:

  • inv_diag - the Vec that defines the inverse diagonal

Level: developer

See also: MATDIAGONAL, MatCreateDiagonal(), MatDiagonalRestoreInverseDiagonal(), MatDiagonalGetDiagonal(), MATLMVMBROYDEN, MatSolve()

External Links

source
PETSc.LibPETSc.MatDiagonalRestoreDiagonal — Method
MatDiagonalRestoreDiagonal(petsclib::PetscLibType, A::AbstractPetscMat, diag::AbstractPetscVec)

Restore the diagonal of a MATDIAGONAL

Input Parameters:

  • A - the MATDIAGONAL
  • diag - the Vec obtained from MatDiagonalGetDiagonal()

Level: developer

See also: MATDIAGONAL, MatCreateDiagonal(), MatDiagonalGetDiagonal()

External Links

source
PETSc.LibPETSc.MatDiagonalRestoreInverseDiagonal — Method
MatDiagonalRestoreInverseDiagonal(petsclib::PetscLibType, A::AbstractPetscMat, inv_diag::AbstractPetscVec)

Restore the inverse diagonal of a MATDIAGONAL

Input Parameters:

  • A - the MATDIAGONAL
  • inv_diag - the Vec obtained from MatDiagonalGetInverseDiagonal()

Level: developer

See also: MATDIAGONAL, MatCreateDiagonal(), MatDiagonalGetInverseDiagonal()

External Links

source
PETSc.LibPETSc.MatDiagonalScale — Method
MatDiagonalScale(petsclib::PetscLibType, mat::AbstractPetscMat, l::Union{Ptr, AbstractPetscVec}, r::Union{Ptr, AbstractPetscVec})

Scales a matrix on the left and right by diagonal matrices that are stored as vectors. Either of the two scaling matrices can be NULL.

Collective

Input Parameters:

  • mat - the matrix to be scaled
  • l - the left scaling vector (or NULL)
  • r - the right scaling vector (or NULL)

Level: intermediate

See also: Mat, MatScale(), MatShift(), MatDiagonalSet()

External Links

source
PETSc.LibPETSc.MatDiagonalScaleLocal — Method
MatDiagonalScaleLocal(petsclib::PetscLibType, mat::AbstractPetscMat, diag::AbstractPetscVec)

Scales columns of a matrix given the scaling values including the ghosted ones.

Not Collective

Input Parameters:

  • mat - the matrix
  • diag - the diagonal values, including ghost ones

Level: developer

See also: Mat, MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatDiagonalSet — Method
MatDiagonalSet(petsclib::PetscLibType, Y::AbstractPetscMat, D::AbstractPetscVec, is::InsertMode)

Computes Y = Y + D, where D is a diagonal matrix that is represented as a vector. Or Y[i,i] = D[i] if InsertMode is INSERT_VALUES.

Neighbor-wise Collective

Input Parameters:

  • Y - the input matrix
  • D - the diagonal matrix, represented as a vector
  • is - INSERT_VALUES or ADD_VALUES

Level: intermediate

See also: Mat, MatShift(), MatScale(), MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatDiagonalSetDiagonal — Method
MatDiagonalSetDiagonal(petsclib::PetscLibType, J::AbstractPetscMat, diag::AbstractPetscVec)

Sets the diagonal for a MATDIAGONAL

Collective

Input Parameter:

  • J - the MATDIAGONAL matrix
  • diag - the vector for the diagonal

Level: advanced

See also: Mat, MatDestroy(), MatCreateDiagonal(), MATDIAGONAL, MatScale(), MatShift(), MatMult(), MatGetDiagonal(), MatSolve(), MatDiagonalRestoreInverseDiagonal(), MatDiagonalGetDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal(), MATCONSTANTDIAGONAL

External Links

source
PETSc.LibPETSc.MatDuplicate — Method
M::PetscMat = MatDuplicate(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatDuplicateOption)

Duplicates a matrix including the non-zero structure.

Collective

Input Parameters:

  • mat - the matrix
  • op - One of MAT_DO_NOT_COPY_VALUES, MAT_COPY_VALUES, or MAT_SHARE_NONZERO_PATTERN.

See the manual page for MatDuplicateOption() for an explanation of these options.

Output Parameter:

  • M - pointer to place new matrix

Level: intermediate

See also: Mat, MatCopy(), MatConvert(), MatDuplicateOption

External Links

source
PETSc.LibPETSc.MatEliminateZeros — Method
MatEliminateZeros(petsclib::PetscLibType, A::AbstractPetscMat, keep::PetscBool)

eliminate the nondiagonal zero entries in place from the nonzero structure of a sparse Mat in place, meaning the same memory is used for the matrix, and no new memory is allocated.

Collective

Input Parameters:

  • A - the matrix
  • keep - if for a given row of A, the diagonal coefficient is zero, indicates whether it should be left in the structure or eliminated as well

Level: intermediate

See also: Mat, MatCreate(), MatCreateGraph(), MatFilter()

External Links

source
PETSc.LibPETSc.MatEqual — Method
flg::PetscBool = MatEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat)

Compares two matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix

Output Parameter:

  • flg - PETSC_TRUE if the matrices are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMultEqual()

External Links

source
PETSc.LibPETSc.MatFactorClearError — Method
MatFactorClearError(petsclib::PetscLibType, mat::AbstractPetscMat)

clears the error code in a factorization

Logically Collective

Input Parameter:

  • mat - the factored matrix

Level: developer

See also: Mat, MatZeroEntries(), MatFactor(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatFactorGetError(), MatFactorGetErrorZeroPivot(), MatGetErrorCode(), MatFactorError

External Links

source
PETSc.LibPETSc.MatFactorCreateSchurComplement — Method
S::PetscMat,status::MatFactorSchurStatus = MatFactorCreateSchurComplement(petsclib::PetscLibType, F::AbstractPetscMat)

Create a Schur complement matrix object using Schur data computed during the factorization step

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • S - location where to return the Schur complement, can be NULL
  • status - the status of the Schur complement matrix, can be NULL

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorGetSchurComplement(), MatFactorSchurStatus, MATSOLVERMUMPS, MATSOLVERMKL_PARDISO

External Links

source
PETSc.LibPETSc.MatFactorFactorizeSchurComplement — Method
MatFactorFactorizeSchurComplement(petsclib::PetscLibType, F::AbstractPetscMat)

Factorize the Schur complement matrix computed during the factorization step

Logically Collective

Input Parameter:

  • F - the factored matrix obtained by calling MatGetFactor()

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorInvertSchurComplement()

External Links

source
PETSc.LibPETSc.MatFactorGetCanUseOrdering — Method
flg::PetscBool = MatFactorGetCanUseOrdering(petsclib::PetscLibType, mat::AbstractPetscMat)

Indicates if the factorization can use the ordering provided in MatLUFactorSymbolic(), MatCholeskyFactorSymbolic()

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • flg - PETSC_TRUE if uses the ordering

Level: developer

See also: Mat, Matrix Factorization, MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic()

External Links

source
PETSc.LibPETSc.MatFactorGetError — Method
err::MatFactorError = MatFactorGetError(petsclib::PetscLibType, mat::AbstractPetscMat)

gets the error code from a factorization

Logically Collective

Input Parameter:

  • mat - the factored matrix

Output Parameter:

  • err - the error code

Level: advanced

See also: Mat, MatZeroEntries(), MatFactor(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatFactorClearError(), MatFactorGetErrorZeroPivot(), MatFactorError

External Links

source
PETSc.LibPETSc.MatFactorGetErrorZeroPivot — Method
pivot::PetscReal,row::PetscInt = MatFactorGetErrorZeroPivot(petsclib::PetscLibType, mat::AbstractPetscMat)

returns the pivot value that was determined to be zero and the row it occurred in

Logically Collective

Input Parameter:

  • mat - the factored matrix

Output Parameters:

  • pivot - the pivot value computed
  • row - the row that the zero pivot occurred. This row value must be interpreted carefully due to row reorderings and which processes

the share the matrix

Level: advanced

See also: Mat, MatZeroEntries(), MatFactor(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatFactorClearError(), MAT_FACTOR_NUMERIC_ZEROPIVOT

External Links

source
PETSc.LibPETSc.MatFactorGetPreferredOrdering — Method
otype::String = MatFactorGetPreferredOrdering(petsclib::PetscLibType, mat::AbstractPetscMat, ftype::MatFactorType)

The preferred ordering for a particular matrix factor object

Logically Collective

Input Parameters:

  • mat - the matrix obtained with MatGetFactor()
  • ftype - the factorization type to be used

Output Parameter:

  • otype - the preferred ordering type

Level: developer

See also: Mat, Matrix Factorization, MatFactorType, MatOrderingType, MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic()

External Links

source
PETSc.LibPETSc.MatFactorGetSchurComplement — Method
status::MatFactorSchurStatus = MatFactorGetSchurComplement(petsclib::PetscLibType, F::AbstractPetscMat, S::Union{Ptr, AbstractPetscMat})

Gets access to a Schur complement matrix using the current Schur data within a factored matrix

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • S - location where to return the Schur complement, can be NULL
  • status - the status of the Schur complement matrix, can be NULL

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorRestoreSchurComplement(), MatFactorCreateSchurComplement(), MatFactorSchurStatus

External Links

source
PETSc.LibPETSc.MatFactorGetSolverType — Method
type::String = MatFactorGetSolverType(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns name of the package providing the factorization routines

Not Collective

Input Parameter:

  • mat - the matrix, must be a factored matrix

Output Parameter:

  • type - the string name of the package (do not free this string)

Level: intermediate

See also: Mat, Matrix Factorization, MatGetFactor(), MatSolverType, MatCopy(), MatDuplicate(), MatGetFactorAvailable()

External Links

source
PETSc.LibPETSc.MatFactorInfoInitialize — Method
MatFactorInfoInitialize(petsclib::PetscLibType, info::Vector{MatFactorInfo})

Initializes a MatFactorInfo data structure with default values.

Not Collective

Input Parameter:

  • info - the MatFactorInfo data structure

Level: developer

See also: Mat, MatGetFactor(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatFactorInvertSchurComplement — Method
MatFactorInvertSchurComplement(petsclib::PetscLibType, F::AbstractPetscMat)

Invert the Schur complement matrix computed during the factorization step

Logically Collective

Input Parameter:

  • F - the factored matrix obtained by calling MatGetFactor()

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorGetSchurComplement(), MatFactorCreateSchurComplement()

External Links

source
PETSc.LibPETSc.MatFactorRestoreSchurComplement — Method
MatFactorRestoreSchurComplement(petsclib::PetscLibType, F::AbstractPetscMat, S::AbstractPetscMat, status::MatFactorSchurStatus)

Restore the Schur complement matrix object obtained from a call to MatFactorGetSchurComplement()

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • S - location where the Schur complement is stored
  • status - the status of the Schur complement matrix (see MatFactorSchurStatus)

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorCreateSchurComplement(), MatFactorSchurStatus

External Links

source
PETSc.LibPETSc.MatFactorSetSchurIS — Method
MatFactorSetSchurIS(petsclib::PetscLibType, mat::AbstractPetscMat, is::AbstractIS)

Set indices corresponding to the Schur complement you wish to have computed

Collective

Input Parameters:

  • mat - the factored matrix
  • is - the index set defining the Schur indices (0-based)

Level: advanced

See also: Mat, MatGetFactor(), MatFactorGetSchurComplement(), MatFactorRestoreSchurComplement(), MatFactorCreateSchurComplement(), MatFactorSolveSchurComplement(), MatFactorSolveSchurComplementTranspose(), MATSOLVERMUMPS, MATSOLVERMKL_PARDISO

External Links

source
PETSc.LibPETSc.MatFactorSolveSchurComplement — Method
MatFactorSolveSchurComplement(petsclib::PetscLibType, F::AbstractPetscMat, rhs::AbstractPetscVec, sol::AbstractPetscVec)

Solve the Schur complement system computed during the factorization step

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • rhs - location where the right-hand side of the Schur complement system is stored
  • sol - location where the solution of the Schur complement system has to be returned

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorSolveSchurComplementTranspose()

External Links

source
PETSc.LibPETSc.MatFactorSolveSchurComplementTranspose — Method
MatFactorSolveSchurComplementTranspose(petsclib::PetscLibType, F::AbstractPetscMat, rhs::AbstractPetscVec, sol::AbstractPetscVec)

Solve the transpose of the Schur complement system computed during the factorization step

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • rhs - location where the right-hand side of the Schur complement system is stored
  • sol - location where the solution of the Schur complement system has to be returned

Level: advanced

See also: Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorSolveSchurComplement()

External Links

source
PETSc.LibPETSc.MatFilter — Method
MatFilter(petsclib::PetscLibType, A::AbstractPetscMat, tol::PetscReal, compress::PetscBool, keep::PetscBool)

Set all values in the matrix with an absolute value less than or equal to the tolerance to zero, and optionally compress the underlying storage

Input Parameters:

  • A - The matrix
  • tol - The zero tolerance
  • compress - Whether the storage from the input matrix A should be compressed once values less than or equal to tol are set to zero
  • keep - If compress is true and for a given row of A, the diagonal coefficient is less than or equal to tol, indicates whether it should be left in the structure or eliminated as well

Level: intermediate

See also: Mat, MatCreate(), MatZeroEntries(), MatEliminateZeros(), VecFilter()

External Links

source
PETSc.LibPETSc.MatFinalizePackage — Method
MatFinalizePackage(petsclib::PetscLibType)

This function destroys everything in the PETSc interface to the Mat package. It is called from PetscFinalize().

Level: developer

See also: Mat, PetscFinalize(), MatInitializePackage()

External Links

source
PETSc.LibPETSc.MatFindNonzeroRows — Method
keptrows::IS = MatFindNonzeroRows(petsclib::PetscLibType, mat::AbstractPetscMat)

Locate all rows that are not completely zero in the matrix

Input Parameter:

  • mat - the matrix

Output Parameter:

  • keptrows - the rows that are not completely zero

Level: intermediate

See also: Mat, MatFindZeroRows()

External Links

source
PETSc.LibPETSc.MatFindOffBlockDiagonalEntries — Method
is::IS = MatFindOffBlockDiagonalEntries(petsclib::PetscLibType, mat::AbstractPetscMat)

Finds all the rows of a matrix that have entries outside of the main diagonal block (defined by the matrix block size)

Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • is - contains the list of rows with off block diagonal entries

Level: developer

See also: Mat, MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatFindZeroDiagonals — Method
is::IS = MatFindZeroDiagonals(petsclib::PetscLibType, mat::AbstractPetscMat)

Finds all the rows of a matrix that have zero or no diagonal entry in the matrix

Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • is - if any rows have zero diagonals this contains the list of them

Level: developer

See also: Mat, MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatFindZeroRows — Method
zerorows::IS = MatFindZeroRows(petsclib::PetscLibType, mat::AbstractPetscMat)

Locate all rows that are completely zero in the matrix

Input Parameter:

  • mat - the matrix

Output Parameter:

  • zerorows - the rows that are completely zero

Level: intermediate

See also: Mat, MatFindNonzeroRows()

External Links

source
PETSc.LibPETSc.MatForwardSolve — Method
MatForwardSolve(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, x::AbstractPetscVec)

Solves L x = b , given a factored matrix, A = LU , or U^TD^(1/2) x = b, given a factored symmetric matrix, A = U^TD*U,

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix
  • b - the right-hand-side vector

Output Parameter:

  • x - the result vector

Level: developer

See also: Mat, MatBackwardSolve(), MatGetFactor(), MatSolve()

External Links

source
PETSc.LibPETSc.MatGalerkin — Method
A::PetscMat = MatGalerkin(petsclib::PetscLibType, restrct::AbstractPetscMat, dA::AbstractPetscMat, interpolate::AbstractPetscMat, reuse::MatReuse, fill::PetscReal)

Constructs the coarse grid problem matrix via Galerkin projection.

If the interpolation and restriction operators are the same, uses MatPtAP(). If they are not the same, uses MatMatMatMult().

Once the coarse grid problem is constructed, correct for interpolation operators that are not of full rank, which can legitimately happen in the case of non-nested geometric multigrid.

Input Parameters:

  • restrct - restriction operator
  • dA - fine grid matrix
  • interpolate - interpolation operator
  • reuse - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill, use PETSC_DETERMINE or PETSC_DETERMINE if you do not have a good estimate

Output Parameter:

  • A - the Galerkin coarse matrix

Options Database Key:

  • -pc_mg_galerkin (both|pmat|mat|none) - for what matrices the Galerkin process should be used

Level: developer

See also: Mat, MatPtAP(), MatMatMatMult()

External Links

source
PETSc.LibPETSc.MatGetBindingPropagates — Method
flg::PetscBool = MatGetBindingPropagates(petsclib::PetscLibType, A::AbstractPetscMat)

Gets whether the state of being bound to the CPU for a GPU matrix type propagates to child and some other associated objects

Input Parameter:

  • A - the matrix

Output Parameter:

  • flg - flag indicating whether the boundtocpu flag will be propagated

Level: developer

See also: Mat, MatSetBindingPropagates()

External Links

source
PETSc.LibPETSc.MatGetBlockSize — Method
bs::PetscInt = MatGetBlockSize(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the matrix block size.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • bs - block size

Level: intermediate

See also: Mat, MATBAIJ, MATSBAIJ, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatGetBlockSizes — Method
rbs::PetscInt,cbs::PetscInt = MatGetBlockSizes(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the matrix block row and column sizes.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • rbs - row block size
  • cbs - column block size

Level: intermediate

See also: Mat, MATBAIJ, MATSBAIJ, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSize(), MatSetBlockSizes()

External Links

source
PETSc.LibPETSc.MatGetBrowsOfAcols — Method
rowb::IS,colb::IS,B_seq::PetscMat = MatGetBrowsOfAcols(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, scall::MatReuse)

Returns IS that contain rows of B that equal to nonzero columns of local A

Collective

Input Parameters:

  • A - the first matrix in MATMPIAIJ format
  • B - the second matrix in MATMPIAIJ format
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameters:

  • rowb - On input index sets of rows of B to extract (or NULL), modified on output
  • colb - On input index sets of columns of B to extract (or NULL), modified on output
  • B_seq - the sequential matrix generated

Level: developer

See also: Mat, MATMPIAIJ, IS, MatReuse

External Links

source
PETSc.LibPETSc.MatGetColumnIJ — Method
n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatGetColumnIJ(petsclib::PetscLibType, mat::AbstractPetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool)

Returns the compressed column storage i and j indices for sequential matrices.

Collective

Input Parameters:

  • mat - the matrix
  • shift - 1 or zero indicating we want the indices starting at 0 or 1
  • symmetric - PETSC_TRUE or PETSC_FALSE indicating the matrix data structure should be

symmetrized

  • inodecompressed - PETSC_TRUE or PETSC_FALSE indicating if the nonzero structure of the

inodes or the nonzero elements is wanted. For MATBAIJ matrices the compressed version is always used.

Output Parameters:

  • n - number of columns in the (possibly compressed) matrix
  • ia - the column pointers; that is ia[0] = 0, ia[col] = i[col-1] + number of elements in that col of the matrix
  • ja - the row indices
  • done - PETSC_TRUE or PETSC_FALSE, indicating whether the values have been returned

Level: developer

See also: Mat, MatGetRowIJ(), MatRestoreColumnIJ()

External Links

source
PETSc.LibPETSc.MatGetColumnMeans — Method
MatGetColumnMeans(petsclib::PetscLibType, A::AbstractPetscMat, means::Vector{PetscScalar})

Gets the arithmetic means of each column of a sparse or dense matrix.

Input Parameter:

  • A - the matrix

Output Parameter:

  • means - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, VecSum(), MatGetColumnSums(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnMeansImaginaryPart — Method
MatGetColumnMeansImaginaryPart(petsclib::PetscLibType, A::AbstractPetscMat, means::Vector{PetscReal})

Gets the arithmetic means of the imaginary part of each column of a sparse or dense matrix.

Input Parameter:

  • A - the matrix

Output Parameter:

  • means - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, MatGetColumnMeansRealPart(), VecSum(), MatGetColumnSums(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnMeansRealPart — Method
MatGetColumnMeansRealPart(petsclib::PetscLibType, A::AbstractPetscMat, means::Vector{PetscReal})

Gets the arithmetic means of the real part of each column of a sparse or dense matrix.

Input Parameter:

  • A - the matrix

Output Parameter:

  • means - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, MatGetColumnMeansImaginaryPart(), VecSum(), MatGetColumnSums(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnNorms — Method
MatGetColumnNorms(petsclib::PetscLibType, A::AbstractPetscMat, type::NormType, norms::Vector{PetscReal})

Gets the norms of each column of a sparse or dense matrix.

Input Parameters:

  • A - the matrix
  • type - NORM_2, NORM_1 or NORM_INFINITY

Output Parameter:

  • norms - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, NormType, MatNorm()

External Links

source
PETSc.LibPETSc.MatGetColumnReductions — Method
MatGetColumnReductions(petsclib::PetscLibType, A::AbstractPetscMat, type::PetscInt, reductions::Vector{PetscReal})

Gets the reductions of each column of a sparse or dense matrix.

Input Parameters:

  • A - the matrix
  • type - A constant defined in NormType or ReductionType: NORM_2, NORM_1, NORM_INFINITY, REDUCTION_SUM_REALPART,

REDUCTION_SUM_IMAGINARYPART, REDUCTION_MEAN_REALPART, REDUCTION_MEAN_IMAGINARYPART

Output Parameter:

  • reductions - an array as large as the TOTAL number of columns in the matrix

Level: developer

See also: Mat, ReductionType, NormType, MatGetColumnNorms(), MatGetColumnSums(), MatGetColumnMeans()

External Links

source
PETSc.LibPETSc.MatGetColumnSums — Method
MatGetColumnSums(petsclib::PetscLibType, A::AbstractPetscMat, sums::Vector{PetscScalar})

Gets the sums of each column of a sparse or dense matrix.

Input Parameter:

  • A - the matrix

Output Parameter:

  • sums - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, VecSum(), MatGetColumnMeans(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnSumsImaginaryPart — Method
MatGetColumnSumsImaginaryPart(petsclib::PetscLibType, A::AbstractPetscMat, sums::Vector{PetscReal})

Gets the sums of the imaginary part of each column of a sparse or dense matrix.

Input Parameter:

  • A - the matrix

Output Parameter:

  • sums - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, MatGetColumnSumsRealPart(), VecSum(), MatGetColumnMeans(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnSumsRealPart — Method
MatGetColumnSumsRealPart(petsclib::PetscLibType, A::AbstractPetscMat, sums::Vector{PetscReal})

Gets the sums of the real part of each column of a sparse or dense matrix.

Input Parameter:

  • A - the matrix

Output Parameter:

  • sums - an array as large as the TOTAL number of columns in the matrix

Level: intermediate

See also: Mat, MatGetColumnSumsImaginaryPart(), VecSum(), MatGetColumnMeans(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnVector — Method
MatGetColumnVector(petsclib::PetscLibType, A::AbstractPetscMat, yy::AbstractPetscVec, col::PetscInt)

Gets the values from a given column of a matrix.

Not Collective

Input Parameters:

  • A - the matrix
  • yy - the vector
  • col - the column requested (in global numbering)

Level: advanced

See also: Mat, MatGetRow(), MatGetDiagonal(), MatMult()

External Links

source
PETSc.LibPETSc.MatGetCurrentMemType — Method
m::PetscMemType = MatGetCurrentMemType(petsclib::PetscLibType, A::AbstractPetscMat)

Get the memory location of the matrix

Not Collective, but the result will be the same on all MPI processes

Input Parameter:

  • A - the matrix whose memory type we are checking

Output Parameter:

  • m - the memory type

Level: intermediate

See also: Mat, MatBoundToCPU(), PetscMemType

External Links

source
PETSc.LibPETSc.MatGetDM — Method
dm::PetscDM = MatGetDM(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the DM defining the data layout of the matrix

Not Collective

Input Parameter:

  • A - The Mat

Output Parameter:

  • dm - The DM

Level: intermediate

See also: DM, MatSetDM(), DMCreateMatrix(), DMSetMatType()

External Links

source
PETSc.LibPETSc.MatGetDiagonal — Method
MatGetDiagonal(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec)

Gets the diagonal of a matrix as a Vec

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • v - the diagonal of the matrix

Level: intermediate

See also: Mat, Vec, MatGetRow(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMaxAbs()

External Links

source
PETSc.LibPETSc.MatGetDiagonalBlock — Method
MatGetDiagonalBlock(petsclib::PetscLibType, A::AbstractPetscMat, M_a::AbstractPetscMat)

Returns the part of the matrix associated with the on-process coupling

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • a - the diagonal part (which is a SEQUENTIAL matrix)

Level: advanced

See also: Mat, MatCreateAIJ(), MATAIJ, MATBAIJ, MATSBAIJ

External Links

source
PETSc.LibPETSc.MatGetFactor — Method
f::PetscMat = MatGetFactor(petsclib::PetscLibType, mat::AbstractPetscMat, type::String, ftype::MatFactorType)

Returns a matrix suitable to calls to routines such as MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatILUFactorSymbolic(), MatICCFactorSymbolic(), MatLUFactorNumeric(), and MatCholeskyFactorNumeric()

Collective

Input Parameters:

  • mat - the matrix
  • type - name of solver type, for example, superlu_dist, petsc (to use PETSc's solver if it is available), if this is NULL, then the first result that satisfies

the other criteria is returned

  • ftype - factor type, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ICC, MAT_FACTOR_ILU, MAT_FACTOR_QR

Output Parameter:

  • f - the factor matrix used with MatXXFactorSymbolic,Numeric() calls. Can be NULL in some cases, see notes below.

Options Database Keys:

  • -pc_factor_mat_solver_type type - choose the type at run time. When using KSP solvers
  • -pc_factor_mat_factor_on_host (true|false) - do matrix factorization on host (with device matrices). Default is doing it on device
  • -pc_factor_mat_solve_on_host (true|false) - do matrix solve on host (with device matrices). Default is doing it on device

Level: intermediate

See also: Mat, Matrix Factorization, KSP, MatSolverType, MatFactorType, MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatFactorGetCanUseOrdering(), MatSolverTypeRegister(), MatSolverTypeGet(), MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ICC, MAT_FACTOR_ILU, MAT_FACTOR_QR, MatInitializePackage(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatILUFactorSymbolic(), MatICCFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactorNumeric()

External Links

source
PETSc.LibPETSc.MatGetFactorAvailable — Method
flg::PetscBool = MatGetFactorAvailable(petsclib::PetscLibType, mat::AbstractPetscMat, type::String, ftype::MatFactorType)

Returns a flag if matrix supports particular type and factor type

Not Collective

Input Parameters:

  • mat - the matrix
  • type - name of solver type, for example, superlu, petsc (to use PETSc's default)
  • ftype - factor type, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ICC, MAT_FACTOR_ILU, MAT_FACTOR_QR

Output Parameter:

  • flg - PETSC_TRUE if the factorization is available

Level: intermediate

See also: Mat, Matrix Factorization, MatSolverType, MatFactorType, MatGetFactor(), MatCopy(), MatDuplicate(), MatSolverTypeRegister(), MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ICC, MAT_FACTOR_ILU, MAT_FACTOR_QR, MatSolverTypeGet()

External Links

source
PETSc.LibPETSc.MatGetFactorType — Method
t::MatFactorType = MatGetFactorType(petsclib::PetscLibType, mat::AbstractPetscMat)

gets the type of factorization a matrix is

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • t - the type, one of MAT_FACTOR_NONE, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ILU, MAT_FACTOR_ICC,MAT_FACTOR_ILUDT, MAT_FACTOR_QR

Level: intermediate

See also: Mat, Matrix Factorization, MatFactorType, MatGetFactor(), MatSetFactorType(), MAT_FACTOR_NONE, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ILU, MAT_FACTOR_ICC, MAT_FACTOR_ILUDT, MAT_FACTOR_QR

External Links

source
PETSc.LibPETSc.MatGetGhosts — Method
nghosts::PetscInt,ghosts::Vector{PetscInt} = MatGetGhosts(petsclib::PetscLibType, mat::AbstractPetscMat)

Get the global indices of all ghost nodes defined by the sparse matrix

Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • nghosts - number of ghosts (for MATBAIJ and MATSBAIJ matrices there is one ghost for each matrix block)
  • ghosts - the global indices of the ghost points

Level: advanced

See also: Mat, VecCreateGhost(), VecCreateGhostBlock()

External Links

source
PETSc.LibPETSc.MatGetInertia — Method
nneg::PetscInt,nzero::PetscInt,npos::PetscInt = MatGetInertia(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets the inertia from a factored matrix

Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • nneg - number of negative eigenvalues
  • nzero - number of zero eigenvalues
  • npos - number of positive eigenvalues

Level: advanced

See also: Mat, MatGetFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatGetInfo — Method
info::MatInfo = MatGetInfo(petsclib::PetscLibType, mat::AbstractPetscMat, flag::MatInfoType)

Returns information about matrix storage (number of nonzeros, memory, etc.).

Collective if MAT_GLOBAL_MAX or MAT_GLOBAL_SUM is used as the flag

Input Parameters:

  • mat - the matrix
  • flag - flag indicating the type of parameters to be returned (MAT_LOCAL - local matrix, MAT_GLOBAL_MAX - maximum over all processors, MAT_GLOBAL_SUM - sum over all processors)

Output Parameter:

  • info - matrix information context

Options Database Key:

  • -mat_view ::ascii_info - print matrix info to PETSC_STDOUT

Level: intermediate

See also: Mat, MatInfo, MatStashGetInfo()

External Links

source
PETSc.LibPETSc.MatGetLayouts — Method
rmap::PetscLayout,cmap::PetscLayout = MatGetLayouts(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the PetscLayout objects for rows and columns

Not Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • rmap - row layout
  • cmap - column layout

Level: advanced

See also: Mat, Matrix Layouts, PetscLayout, MatCreateVecs(), MatGetLocalToGlobalMapping(), MatSetLayouts()

External Links

source
PETSc.LibPETSc.MatGetLocalSize — Method
m::PetscInt,n::PetscInt = MatGetLocalSize(petsclib::PetscLibType, mat::AbstractPetscMat)

For most matrix formats, excluding MATELEMENTAL and MATSCALAPACK, Returns the number of local rows and local columns of a matrix. For all matrices this is the local size of the left and right vectors as returned by MatCreateVecs().

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • m - the number of local rows, use NULL to not obtain this value
  • n - the number of local columns, use NULL to not obtain this value

Level: beginner

See also: Mat, MatSetSizes(), MatGetSize()

External Links

source
PETSc.LibPETSc.MatGetLocalSubMatrix — Method
submat::PetscMat = MatGetLocalSubMatrix(petsclib::PetscLibType, mat::AbstractPetscMat, isrow::AbstractIS, iscol::AbstractIS)

Gets a reference to a submatrix specified in local numbering

Not Collective

Input Parameters:

  • mat - matrix to extract local submatrix from
  • isrow - local row indices for submatrix
  • iscol - local column indices for submatrix

Output Parameter:

  • submat - the submatrix

Level: intermediate

See also: Mat, MatRestoreLocalSubMatrix(), MatCreateLocalRef(), MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatGetLocalToGlobalMapping — Method
rmapping::ISLocalToGlobalMapping,cmapping::ISLocalToGlobalMapping = MatGetLocalToGlobalMapping(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the local-to-global numbering set by MatSetLocalToGlobalMapping()

Not Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • rmapping - row mapping
  • cmapping - column mapping

Level: advanced

See also: Mat, MatSetLocalToGlobalMapping(), MatSetValuesLocal()

External Links

source
PETSc.LibPETSc.MatGetMultiProcBlock — Method
subMat::PetscMat = MatGetMultiProcBlock(petsclib::PetscLibType, mat::AbstractPetscMat, subComm::MPI_Comm, scall::MatReuse)

Create multiple 'parallel submatrices' from a given Mat. Each submatrix can span multiple procs.

Collective

Input Parameters:

  • mat - the matrix
  • subComm - the sub communicator obtained as if by MPI_Comm_split(PetscObjectComm((PetscObject)mat))
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • subMat - parallel sub-matrices each spanning a given subcomm

Level: advanced

See also: Mat, MatCreateRedundantMatrix(), MatCreateSubMatrices(), PCBJACOBI

External Links

source
PETSc.LibPETSc.MatGetNearNullSpace — Method
nullsp::MatNullSpace = MatGetNearNullSpace(petsclib::PetscLibType, mat::AbstractPetscMat)

Get null space attached with MatSetNearNullSpace()

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • nullsp - the null space object, NULL if not set

Level: advanced

See also: Mat, MatNullSpace, MatSetNearNullSpace(), MatGetNullSpace(), MatNullSpaceCreate()

External Links

source
PETSc.LibPETSc.MatGetNonzeroState — Method
state::PetscObjectState = MatGetNonzeroState(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns a 64-bit integer representing the current state of nonzeros in the matrix. If the matrix has had new nonzero locations added to (or removed from) the matrix since the previous call, the value will be larger.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • state - the current state

Level: intermediate

See also: Mat, PetscObjectStateGet(), PetscObjectGetId()

External Links

source
PETSc.LibPETSc.MatGetNullSpace — Method
MatGetNullSpace(petsclib::PetscLibType, mat::AbstractPetscMat, nullsp::MatNullSpace)

retrieves the null space of a matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: developer

See also: Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatSetNullSpace(), MatNullSpace

External Links

source
PETSc.LibPETSc.MatGetNullSpaces — Method
nullsp::Vector{MatNullSpace} = MatGetNullSpaces(petsclib::PetscLibType, n::PetscInt, mat::Vector{<:AbstractPetscMat})

gets the null spaces, transpose null spaces, and near null spaces from an array of matrices

Logically Collective

Input Parameters:

  • n - the number of matrices
  • mat - the array of matrices

Output Parameters:

  • nullsp - an array of null spaces, NULL for each matrix that does not have a null space, length 3 * n

Level: developer

See also: Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), MatRestoreNullSpaces()

External Links

source
PETSc.LibPETSc.MatGetOperation — Method
f::Ptr{Cvoid} = MatGetOperation(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOperation)

Gets a matrix operation for any matrix type.

Not Collective

Input Parameters:

  • mat - the matrix
  • op - the name of the operation

Output Parameter:

  • f - the function that provides the operation

Level: developer

See also: Mat, MatSetOperation(), MatCreateShell(), MatShellGetContext(), MatShellGetOperation()

External Links

source
PETSc.LibPETSc.MatGetOption — Method
flg::PetscBool = MatGetOption(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOption)

Gets a parameter option that has been set for a matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • op - the option, this only responds to certain options, check the code for which ones

Output Parameter:

  • flg - turn the option on (PETSC_TRUE) or off (PETSC_FALSE)

Level: intermediate

See also: Mat, MatOption, MatSetOption(), MatIsSymmetric(), MatIsHermitian(), MatIsStructurallySymmetric(), MatIsSymmetricKnown(), MatIsHermitianKnown(), MatIsStructurallySymmetricKnown()

External Links

source
PETSc.LibPETSc.MatGetOptionsPrefix — Method
prefix::String = MatGetOptionsPrefix(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the prefix used for searching for all matrix options in the database.

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • prefix - pointer to the prefix string used

Level: advanced

See also: Mat, MatAppendOptionsPrefix(), MatSetOptionsPrefix(), MatAppendOptionsPrefixFactor(), MatSetOptionsPrefixFactor()

External Links

source
PETSc.LibPETSc.MatGetOrdering — Method
rperm::IS,cperm::IS = MatGetOrdering(petsclib::PetscLibType, mat::AbstractPetscMat, type::String)

Gets a reordering for a matrix to reduce fill or to improve numerical stability of LU factorization.

Collective

Input Parameters:

  • mat - the matrix
  • type - type of reordering, one of the following

$MATORDERINGNATURAL_OR_ND - Nested dissection unless matrix is SBAIJ then it is natural MATORDERINGNATURAL - Natural MATORDERINGND - Nested Dissection MATORDERING1WD - One-way Dissection MATORDERINGRCM - Reverse Cuthill-McKee MATORDERINGQMD - Quotient Minimum Degree MATORDERINGEXTERNAL - Use an ordering internal to the factorzation package and do not compute or use PETSc's$

Output Parameters:

  • rperm - row permutation indices
  • cperm - column permutation indices

Options Database Key:

  • -mat_view_ordering draw - plots matrix nonzero structure in new ordering
  • -pc_factor_mat_ordering_type type - ordering to use with PCs based on factorization see MatOrderingType

Level: intermediate

See also: MatOrderingRegister(), PCFactorSetMatOrderingType(), MatColoring, MatColoringCreate(), MatOrderingType, Mat

External Links

source
PETSc.LibPETSc.MatGetOrderingList — Method
list::PetscFunctionList = MatGetOrderingList(petsclib::PetscLibType)

Get the PetscFunctionList of registered matrix ordering methods.

Not Collective

Output Parameter:

  • list - the function list

Level: developer

See also: Mat, MatOrderingType, MatOrderingRegister(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatGetOwnershipIS — Method
rows::IS,cols::IS = MatGetOwnershipIS(petsclib::PetscLibType, A::AbstractPetscMat)

Get row and column ownership of a matrices' values as index sets.

Not Collective

Input Parameter:

  • A - matrix

Output Parameters:

  • rows - rows in which this process owns elements, , use NULL to not obtain this value
  • cols - columns in which this process owns elements, use NULL to not obtain this value

Level: intermediate

See also: IS, Mat, MatGetOwnershipRanges(), MatSetValues(), MATELEMENTAL, MATSCALAPACK

External Links

source
PETSc.LibPETSc.MatGetOwnershipRange — Method
m::PetscInt,n::PetscInt = MatGetOwnershipRange(petsclib::PetscLibType, mat::AbstractPetscMat)

For matrices that own values by row, excludes MATELEMENTAL and MATSCALAPACK, returns the range of matrix rows owned by this MPI process.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • m - the global index of the first local row, use NULL to not obtain this value
  • n - one more than the global index of the last local row, use NULL to not obtain this value

Level: beginner

See also: Mat, MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscSplitOwnership(), PetscSplitOwnershipBlock(), PetscLayout, MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetOwnershipRangeColumn — Method
m::PetscInt,n::PetscInt = MatGetOwnershipRangeColumn(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the range of matrix columns associated with rows of a vector one multiplies this matrix by that are owned by this processor.

Not Collective, unless matrix has not been allocated, then collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • m - the global index of the first local column, use NULL to not obtain this value
  • n - one more than the global index of the last local column, use NULL to not obtain this value

Level: developer

See also: Mat, MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangesColumn(), PetscLayout, MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetOwnershipRanges — Method
ranges::Vector{PetscInt} = MatGetOwnershipRanges(petsclib::PetscLibType, mat::AbstractPetscMat)

For matrices that own values by row, excludes MATELEMENTAL and MATSCALAPACK, returns the range of matrix rows owned by each process.

Not Collective, unless matrix has not been allocated

Input Parameter:

  • mat - the matrix

Output Parameter:

  • ranges - start of each processors portion plus one more than the total length at the end, of length size + 1

where size is the number of MPI processes used by mat

Level: beginner

See also: Mat, MatGetOwnershipRange(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout, PetscSplitOwnership(), PetscSplitOwnershipBlock(), MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetOwnershipRangesColumn — Method
ranges::Vector{PetscInt} = MatGetOwnershipRangesColumn(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the ranges of matrix columns associated with rows of a vector one multiplies this vector by that are owned by each processor.

Not Collective, unless matrix has not been allocated

Input Parameter:

  • mat - the matrix

Output Parameter:

  • ranges - start of each processors portion plus one more than the total length at the end

Level: beginner

See also: Mat, MatGetOwnershipRange(), MatGetOwnershipRangeColumn(), MatGetOwnershipRanges(), PetscSplitOwnership(), PetscSplitOwnershipBlock(), PetscLayout, MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetRow — Method
ncols::PetscInt,cols::Vector{PetscInt},vals::Vector{PetscScalar} = MatGetRow(petsclib::PetscLibType, mat::AbstractPetscMat, row::PetscInt)

Gets a row of a matrix. You MUST call MatRestoreRow() for each row that you get to ensure that your application does not bleed memory.

Not Collective

Input Parameters:

  • mat - the matrix
  • row - the row to get

Output Parameters:

  • ncols - if not NULL, the number of nonzeros in row
  • cols - if not NULL, the column numbers
  • vals - if not NULL, the numerical values

Level: advanced

See also: Mat, MatRestoreRow(), MatSetValues(), MatGetValues(), MatCreateSubMatrices(), MatGetDiagonal(), MatGetRowIJ(), MatRestoreRowIJ()

External Links

source
PETSc.LibPETSc.MatGetRowIJ — Method
n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatGetRowIJ(petsclib::PetscLibType, mat::AbstractPetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool)

Returns the compressed row storage i and j indices for the local rows of a sparse matrix

Collective

Input Parameters:

  • mat - the matrix
  • shift - 0 or 1 indicating we want the indices starting at 0 or 1
  • symmetric - PETSC_TRUE or PETSC_FALSE indicating the matrix data structure should be symmetrized
  • inodecompressed - PETSC_TRUE or PETSC_FALSE indicating if the nonzero structure of the

inodes or the nonzero elements is wanted. For MATBAIJ matrices the compressed version is always used.

Output Parameters:

  • n - number of local rows in the (possibly compressed) matrix, use NULL if not needed
  • ia - the row pointers; that is ia[0] = 0, ia[row] = ia[row-1] + number of elements in that row of the matrix, use NULL if not needed
  • ja - the column indices, use NULL if not needed
  • done - indicates if the routine actually worked and returned appropriate ia[] and ja[] arrays; callers

are responsible for handling the case when done == PETSC_FALSE and ia and ja are not set

Level: developer

See also: Mat, MATAIJ, MatGetColumnIJ(), MatRestoreRowIJ(), MatSeqAIJGetArray()

External Links

source
PETSc.LibPETSc.MatGetRowMax — Method
MatGetRowMax(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec, idx::Vector{PetscInt})

Gets the maximum value (of the real part) of each row of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • v - the vector for storing the maximums
  • idx - the indices of the column found for each row (optional, otherwise pass NULL)

Level: intermediate

See also: Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMaxAbs(), MatGetRowMin(), MatGetRowMinAbs()

External Links

source
PETSc.LibPETSc.MatGetRowMaxAbs — Method
MatGetRowMaxAbs(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec, idx::Vector{PetscInt})

Gets the maximum value (in absolute value) of each row of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • v - the vector for storing the maximums
  • idx - the indices of the column found for each row (or NULL if not needed)

Level: intermediate

See also: Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowSum(), MatGetRowMin(), MatGetRowMinAbs()

External Links

source
PETSc.LibPETSc.MatGetRowMin — Method
MatGetRowMin(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec, idx::Vector{PetscInt})

Gets the minimum value (of the real part) of each row of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • v - the vector for storing the maximums
  • idx - the indices of the column found for each row (optional, pass NULL if not needed)

Level: intermediate

See also: Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMaxAbs(), MatGetRowMinAbs(), MatGetRowMax()

External Links

source
PETSc.LibPETSc.MatGetRowMinAbs — Method
MatGetRowMinAbs(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec, idx::Vector{PetscInt})

Gets the minimum value (in absolute value) of each row of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • v - the vector for storing the minimums
  • idx - the indices of the column found for each row (or NULL if not needed)

Level: intermediate

See also: Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMax(), MatGetRowMaxAbs(), MatGetRowMin()

External Links

source
PETSc.LibPETSc.MatGetRowSum — Method
MatGetRowSum(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec)

Gets the sum of each row of the matrix

Logically or Neighborhood Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • v - the vector for storing the sum of rows

Level: intermediate

See also: Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMax(), MatGetRowMin(), MatGetRowMaxAbs(), MatGetRowMinAbs(), MatGetRowSumAbs()

External Links

source
PETSc.LibPETSc.MatGetRowSumAbs — Method
MatGetRowSumAbs(petsclib::PetscLibType, mat::AbstractPetscMat, v::AbstractPetscVec)

Gets the sum value (in absolute value) of each row of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • v - the vector for storing the sum

Level: intermediate

This code is only implemented for a couple of matrix formats.

See also: Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMax(), MatGetRowMin(), MatGetRowMinAbs()

External Links

source
PETSc.LibPETSc.MatGetRowUpperTriangular — Method
MatGetRowUpperTriangular(petsclib::PetscLibType, mat::AbstractPetscMat)

Sets a flag to enable calls to MatGetRow() for matrix in MATSBAIJ format. You should call MatRestoreRowUpperTriangular() after callingMatGetRow() and MatRestoreRow() to disable the flag.

Not Collective

Input Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MATSBAIJ, MatRestoreRowUpperTriangular()

External Links

source
PETSc.LibPETSc.MatGetSchurComplement — Method
S::PetscMat,Sp::PetscMat = MatGetSchurComplement(petsclib::PetscLibType, A::AbstractPetscMat, isrow0::AbstractIS, iscol0::AbstractIS, isrow1::AbstractIS, iscol1::AbstractIS, mreuse::MatReuse, ainvtype::MatSchurComplementAinvType, preuse::MatReuse)

Obtain the Schur complement from eliminating part of the matrix in another part.

Collective

Input Parameters:

  • A - matrix in which the complement is to be taken
  • isrow0 - rows to eliminate
  • iscol0 - columns to eliminate, (isrow0,iscol0) should be square and nonsingular
  • isrow1 - rows in which the Schur complement is formed
  • iscol1 - columns in which the Schur complement is formed
  • mreuse - MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX, use MAT_IGNORE_MATRIX to put nothing in S
  • ainvtype - the type of approximation used for the inverse of the (0,0) block used in forming Sp:

MAT_SCHUR_COMPLEMENT_AINV_DIAG, MAT_SCHUR_COMPLEMENT_AINV_LUMP, MAT_SCHUR_COMPLEMENT_AINV_BLOCK_DIAG, or MAT_SCHUR_COMPLEMENT_AINV_FULL

  • preuse - MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX, use MAT_IGNORE_MATRIX to put nothing in Sp

Output Parameters:

  • S - exact Schur complement, often of type MATSCHURCOMPLEMENT which is difficult to use for preconditioning
  • Sp - approximate Schur complement from which a preconditioner can be built A11 - A10 inv(DIAGFORM(A00)) A01

Level: advanced

See also: MatCreateSubMatrix(), PCFIELDSPLIT, MatCreateSchurComplement(), MatSchurComplementAinvType

External Links

source
PETSc.LibPETSc.MatGetSeqNonzeroStructure — Method
matstruct::PetscMat = MatGetSeqNonzeroStructure(petsclib::PetscLibType, mat::AbstractPetscMat)

Extracts the nonzero structure from a matrix and stores it, in its entirety, on each process

Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • matstruct - the sequential matrix with the nonzero structure of mat

Level: developer

See also: Mat, MatDestroySeqNonzeroStructure(), MatCreateSubMatrices(), MatDestroyMatrices()

External Links

source
PETSc.LibPETSc.MatGetSize — Method
m::PetscInt,n::PetscInt = MatGetSize(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the numbers of rows and columns in a matrix.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • m - the number of global rows
  • n - the number of global columns

Level: beginner

See also: Mat, MatSetSizes(), MatGetLocalSize()

External Links

source
PETSc.LibPETSc.MatGetState — Method
state::PetscObjectState = MatGetState(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the state of a Mat. Same value as returned by PetscObjectStateGet()

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • state - the object state

Level: advanced

See also: Mat, MatCreate(), PetscObjectStateGet(), MatGetNonzeroState()

External Links

source
PETSc.LibPETSc.MatGetTrace — Method
trace::PetscScalar = MatGetTrace(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets the trace of a matrix. The sum of the diagonal entries.

Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • trace - the sum of the diagonal entries

Level: advanced

See also: Mat

External Links

source
PETSc.LibPETSc.MatGetTransposeNullSpace — Method
MatGetTransposeNullSpace(petsclib::PetscLibType, mat::AbstractPetscMat, nullsp::MatNullSpace)

retrieves the null space of the transpose of a matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: developer

See also: Mat, MatNullSpace, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatSetTransposeNullSpace(), MatSetNullSpace(), MatGetNullSpace()

External Links

source
PETSc.LibPETSc.MatGetType — Method
type::MatType = MatGetType(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets the matrix type as a string from the matrix object.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • type - name of matrix type

Level: intermediate

See also: Mat, MatType, MatSetType()

External Links

source
PETSc.LibPETSc.MatGetValues — Method
MatGetValues(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar})

Gets a block of local values from a matrix.

Not Collective; can only return values that are owned by the give process

Input Parameters:

  • mat - the matrix
  • v - a logically two-dimensional array for storing the values
  • m - the number of rows
  • idxm - the global indices of the rows
  • n - the number of columns
  • idxn - the global indices of the columns

Level: advanced

See also: Mat, MatGetRow(), MatCreateSubMatrices(), MatSetValues(), MatGetOwnershipRange(), MatGetValuesLocal(), MatGetValue()

External Links

source
PETSc.LibPETSc.MatGetValuesLocal — Method
MatGetValuesLocal(petsclib::PetscLibType, mat::AbstractPetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::Vector{PetscScalar})

retrieves values from certain locations in a matrix using the local numbering of the indices defined previously by MatSetLocalToGlobalMapping()

Not Collective

Input Parameters:

  • mat - the matrix
  • nrow - number of rows
  • irow - the row local indices
  • ncol - number of columns
  • icol - the column local indices

Output Parameter:

  • y - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

Level: advanced

See also: Mat, MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetLocalToGlobalMapping(), MatSetValuesLocal(), MatGetValues()

External Links

source
PETSc.LibPETSc.MatGetVariableBlockSizes — Method
nblocks::PetscInt,bsizes::Vector{PetscInt} = MatGetVariableBlockSizes(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets a diagonal blocks of the matrix that need not be of the same size

Not Collective; No Fortran Support

Input Parameter:

  • mat - the matrix

Output Parameters:

  • nblocks - the number of blocks on this process
  • bsizes - the block sizes

Level: intermediate

See also: Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes(), MatGetBlockSizes(), MatSetVariableBlockSizes(), MatComputeVariableBlockEnvelope()

External Links

source
PETSc.LibPETSc.MatGetVecType — Method
vtype::String = MatGetVecType(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets the vector type the matrix will return with MatCreateVecs()

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • vtype - name of vector type

Level: intermediate

See also: Mat, MatType, MatSetVecType(), VecType

External Links

source
PETSc.LibPETSc.MatHYPREGetParCSR — Method
parcsr::Ptr{hypre_ParCSRMatrix} = MatHYPREGetParCSR(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the pointer to the ParCSR matrix

Not Collective, No Fortran Support

Input Parameter:

  • A - the MATHYPRE object

Output Parameter:

  • parcsr - the pointer to the hypre_ParCSRMatrix

Level: intermediate

See also: Mat, MATHYPRE, PetscCopyMode

External Links

source
PETSc.LibPETSc.MatHYPRESetPreallocation — Method
MatHYPRESetPreallocation(petsclib::PetscLibType, A::AbstractPetscMat, dnz::PetscInt, dnnz::Vector{PetscInt}, onz::PetscInt, onnz::Vector{PetscInt})

Preallocates memory for a sparse parallel matrix in HYPRE IJ format

Collective

Input Parameters:

  • A - the matrix
  • dnz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • dnnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL (PETSC_NULL_INTEGER in Fortran), if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m. For matrices that will be factored, you must leave room for (and set) the diagonal entry even if it is zero.

  • onz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • onnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL (PETSC_NULL_INTEGER in Fortran), if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

Level: intermediate

See also: Mat, MatCreate(), MatMPIAIJSetPreallocation(), MATHYPRE, MATAIJ

External Links

source
PETSc.LibPETSc.MatHasCongruentLayouts — Method
cong::PetscBool = MatHasCongruentLayouts(petsclib::PetscLibType, mat::AbstractPetscMat)

Determines whether the rows and columns layouts of the matrix are congruent

Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • cong - either PETSC_TRUE or PETSC_FALSE

Level: beginner

See also: Mat, MatCreate(), MatSetSizes(), PetscLayout

External Links

source
PETSc.LibPETSc.MatHasOperation — Method
has::PetscBool = MatHasOperation(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOperation)

Determines whether the given matrix supports the particular operation.

Not Collective

Input Parameters:

  • mat - the matrix
  • op - the operation, for example, MATOP_GET_DIAGONAL

Output Parameter:

  • has - either PETSC_TRUE or PETSC_FALSE

Level: advanced

See also: Mat, MatCreateShell(), MatGetOperation(), MatSetOperation()

External Links

source
PETSc.LibPETSc.MatHeaderMerge — Method
MatHeaderMerge(petsclib::PetscLibType, A::AbstractPetscMat, C::AbstractPetscMat)

Merges some information from the header of C to A; the C object is then destroyed

Collective, No Fortran Support

Input Parameters:

  • A - a Mat being merged into
  • C - the Mat providing the merge information

Level: developer

See also: Mat, MatHeaderReplace()

External Links

source
PETSc.LibPETSc.MatHeaderReplace — Method
MatHeaderReplace(petsclib::PetscLibType, A::AbstractPetscMat, C::AbstractPetscMat)

Replaces the internal data of matrix A by the internal data of matrix C while deleting the outer wrapper of C

Input Parameters:

  • A - a Mat whose internal data is to be replaced
  • C - the Mat providing new internal data for A

Level: advanced

See also: Mat, MatHeaderMerge()

External Links

source
PETSc.LibPETSc.MatHermitianTranspose — Method
B::PetscMat = MatHermitianTranspose(petsclib::PetscLibType, mat::AbstractPetscMat, reuse::MatReuse)

Computes an in-place or out-of-place Hermitian transpose of a matrix in complex conjugate.

Collective

Input Parameters:

  • mat - the matrix to transpose and complex conjugate
  • reuse - either MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, or MAT_INPLACE_MATRIX

Output Parameter:

  • B - the Hermitian transpose

Level: intermediate

See also: Mat, MatTranspose(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse

External Links

source
PETSc.LibPETSc.MatHermitianTransposeGetMat — Method
M::PetscMat = MatHermitianTransposeGetMat(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the Mat object stored inside a MATHERMITIANTRANSPOSEVIRTUAL

Logically Collective

Input Parameter:

  • A - the MATHERMITIANTRANSPOSEVIRTUAL matrix

Output Parameter:

  • M - the matrix object stored inside A

Level: intermediate

See also: Mat, MATHERMITIANTRANSPOSEVIRTUAL, MatCreateHermitianTranspose()

External Links

source
PETSc.LibPETSc.MatICCFactor — Method
MatICCFactor(petsclib::PetscLibType, mat::AbstractPetscMat, row::AbstractIS, info::Vector{MatFactorInfo})

Performs in-place incomplete Cholesky factorization of matrix.

Collective

Input Parameters:

  • mat - the matrix
  • row - row/column permutation
  • info - information on desired factorization process

Level: developer

See also: Mat, MatFactorInfo, MatGetFactor(), MatICCFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatICCFactorSymbolic — Method
MatICCFactorSymbolic(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, perm::AbstractIS, info::Vector{MatFactorInfo})

Performs symbolic incomplete Cholesky factorization for a symmetric matrix. Use MatCholeskyFactorNumeric() to complete the factorization.

Collective

Input Parameters:

  • fact - the factorized matrix obtained with MatGetFactor()
  • mat - the matrix to be factored
  • perm - row and column permutation
  • info - structure containing

$levels - number of levels of fill. expected fill - as ratio of original fill.$

Level: developer

See also: Mat, MatGetFactor(), MatCholeskyFactorNumeric(), MatCholeskyFactor(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatILUFactor — Method
MatILUFactor(petsclib::PetscLibType, mat::AbstractPetscMat, row::AbstractIS, col::AbstractIS, info::Vector{MatFactorInfo})

Performs in-place ILU factorization of matrix.

Collective

Input Parameters:

  • mat - the matrix
  • row - row permutation
  • col - column permutation
  • info - structure containing

$levels - number of levels of fill. expected fill - as ratio of original fill. 1 or 0 - indicating force fill on diagonal (improves robustness for matrices missing diagonal entries)$

Level: developer

See also: Mat, Matrix Factorization, MatILUFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatILUFactorSymbolic — Method
MatILUFactorSymbolic(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, row::AbstractIS, col::AbstractIS, info::Vector{MatFactorInfo})

Performs symbolic ILU factorization of a matrix obtained with MatGetFactor() Uses levels of fill only, not drop tolerance. Use MatLUFactorNumeric() to complete the factorization.

Collective

Input Parameters:

  • fact - the factorized matrix obtained with MatGetFactor()
  • mat - the matrix
  • row - row permutation
  • col - column permutation
  • info - structure containing

$levels - number of levels of fill. expected fill - as ratio of original fill. 1 or 0 - indicating force fill on diagonal (improves robustness for matrices missing diagonal entries)$

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatLUFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor(), MatGetOrdering(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatISFixLocalEmpty — Method
MatISFixLocalEmpty(petsclib::PetscLibType, A::AbstractPetscMat, fix::PetscBool)

Compress out zero local rows from the local matrices

Logically Collective

Input Parameters:

  • A - the matrix
  • fix - the boolean flag

Level: advanced

See also: Mat, MATIS, MatCreate(), MatCreateIS(), MatISSetPreallocation(), MatAssemblyEnd(), MAT_FINAL_ASSEMBLY

External Links

source
PETSc.LibPETSc.MatISGetAllowRepeated — Method
flg::PetscBool = MatISGetAllowRepeated(petsclib::PetscLibType, A::AbstractPetscMat)

Get the flag to allow repeated entries in the local to global map

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • flg - the boolean flag

Level: intermediate

See also: Mat, MatCreate(), MatCreateIS(), MatSetLocalToGlobalMapping(), MatISSetAllowRepeated()

External Links

source
PETSc.LibPETSc.MatISGetLocalMat — Method
MatISGetLocalMat(petsclib::PetscLibType, mat::AbstractPetscMat, loc::AbstractPetscMat)

Gets the local matrix stored inside a MATIS matrix.

Not Collective.

Input Parameter:

  • mat - the matrix

Output Parameter:

  • local - the local matrix

Level: intermediate

See also: Mat, MATIS, MatISRestoreLocalMat()

External Links

source
PETSc.LibPETSc.MatISGetLocalToGlobalMapping — Method
rmapping::ISLocalToGlobalMapping,cmapping::ISLocalToGlobalMapping = MatISGetLocalToGlobalMapping(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the local-to-global numbering of the MATIS object

Not Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • rmapping - row mapping
  • cmapping - column mapping

Level: advanced

See also: Mat, MATIS, MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatISRestoreLocalMat — Method
MatISRestoreLocalMat(petsclib::PetscLibType, mat::AbstractPetscMat, loc::AbstractPetscMat)

Restores the local matrix obtained with MatISGetLocalMat()

Not Collective.

Input Parameters:

  • mat - the matrix
  • local - the local matrix

Level: intermediate

See also: Mat, MATIS, MatISGetLocalMat()

External Links

source
PETSc.LibPETSc.MatISSetAllowRepeated — Method
MatISSetAllowRepeated(petsclib::PetscLibType, A::AbstractPetscMat, flg::PetscBool)

Set the flag to allow repeated entries in the local to global map

Logically Collective

Input Parameters:

  • A - the matrix
  • flg - the boolean flag

Level: intermediate

See also: Mat, MatCreate(), MatCreateIS(), MatSetLocalToGlobalMapping(), MatISGetAllowRepeated()

External Links

source
PETSc.LibPETSc.MatISSetLocalMat — Method
MatISSetLocalMat(petsclib::PetscLibType, mat::AbstractPetscMat, loc::AbstractPetscMat)

Replace the local matrix stored inside a MATIS object.

Not Collective

Input Parameters:

  • mat - the matrix
  • local - the local matrix

Level: intermediate

See also: Mat, MATIS, MatISSetLocalMatType, MatISGetLocalMat()

External Links

source
PETSc.LibPETSc.MatISSetLocalMatType — Method
MatISSetLocalMatType(petsclib::PetscLibType, mat::AbstractPetscMat, mtype::String)

Specifies the type of local matrix inside the MATIS

Logically Collective.

Input Parameters:

  • mat - the matrix
  • mtype - the local matrix type

Level: intermediate

See also: Mat, MATIS, MatSetType(), MatType

External Links

source
PETSc.LibPETSc.MatISSetPreallocation — Method
MatISSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Preallocates memory for a MATIS parallel matrix.

Collective

Input Parameters:

  • B - the matrix
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m. For matrices that will be factored, you must leave room for (and set) the diagonal entry even if it is zero.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL, if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e m.

If the *nnz parameter is given then the *nz parameter is ignored

Level: intermediate

See also: Mat, MatCreate(), MatCreateIS(), MatMPIAIJSetPreallocation(), MatISGetLocalMat(), MATIS

External Links

source
PETSc.LibPETSc.MatISStoreL2L — Method
MatISStoreL2L(petsclib::PetscLibType, A::AbstractPetscMat, store::PetscBool)

Store local-to-local operators during the Galerkin process of computing MatPtAP()

Logically Collective

Input Parameters:

  • A - the matrix
  • store - the boolean flag

Level: advanced

See also: Mat, MatCreate(), MatCreateIS(), MatISSetPreallocation(), MatPtAP()

External Links

source
PETSc.LibPETSc.MatImaginaryPart — Method
MatImaginaryPart(petsclib::PetscLibType, mat::AbstractPetscMat)

Moves the imaginary part of the matrix to the real part and zeros the imaginary part

Logically Collective

Input Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MatRealPart()

External Links

source
PETSc.LibPETSc.MatIncreaseOverlap — Method
MatIncreaseOverlap(petsclib::PetscLibType, mat::AbstractPetscMat, n::PetscInt, is::Vector{<:AbstractIS}, ov::PetscInt)

Given a set of submatrices indicated by index sets, replaces the index sets by larger ones that represent submatrices with additional overlap.

Collective

Input Parameters:

  • mat - the matrix
  • n - the number of index sets
  • is - the array of index sets (these index sets will changed during the call)
  • ov - the additional overlap requested

Options Database Key:

  • -mat_increase_overlap_scalable - use a scalable algorithm to compute the overlap (supported by MPIAIJ matrix)

Level: developer

See also: Mat, PCASM, MatSetBlockSize(), MatIncreaseOverlapSplit(), MatCreateSubMatrices()

External Links

source
PETSc.LibPETSc.MatIncreaseOverlapSplit — Method
MatIncreaseOverlapSplit(petsclib::PetscLibType, mat::AbstractPetscMat, n::PetscInt, is::Vector{<:AbstractIS}, ov::PetscInt)

Given a set of submatrices indicated by index sets across a sub communicator, replaces the index sets by larger ones that represent submatrices with additional overlap.

Collective

Input Parameters:

  • mat - the matrix
  • n - the number of index sets
  • is - the array of index sets (these index sets will changed during the call)
  • ov - the additional overlap requested

` Options Database Key:

  • -mat_increase_overlap_scalable - use a scalable algorithm to compute the overlap (supported by MPIAIJ matrix)

Level: developer

See also: Mat, MatCreateSubMatrices(), MatIncreaseOverlap()

External Links

source
PETSc.LibPETSc.MatInitializePackage — Method
MatInitializePackage(petsclib::PetscLibType)

This function initializes everything in the Mat package. It is called from PetscDLLibraryRegister_petscmat() when using dynamic libraries, and on the first call to MatCreate() when using shared or static libraries.

Level: developer

See also: Mat, PetscInitialize(), MatFinalizePackage()

External Links

source
PETSc.LibPETSc.MatInodeAdjustForInodes — Method
rperm::IS,cperm::IS = MatInodeAdjustForInodes(petsclib::PetscLibType, A::AbstractPetscMat)

If the matrix uses identical-node (inode) blocks, replace the given permutations, which are expressed on inode blocks, with permutations expressed on the individual rows and columns.

Not Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • rperm - the row permutation, updated in place
  • cperm - the column permutation, updated in place

Level: developer

See also: Mat, MATSEQAIJ, MatInodeGetInodeSizes(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatInodeGetInodeSizes — Method
node_count::PetscInt,sizes::Vector{PetscInt},limit::PetscInt = MatInodeGetInodeSizes(petsclib::PetscLibType, A::AbstractPetscMat)

Returns the inode information of a matrix with inodes

Not Collective

Input Parameter:

  • A - the Inode matrix or matrix derived from the Inode class – e.g., MATSEQAIJ

Output Parameters:

  • node_count - no of inodes present in the matrix.
  • sizes - an array of size node_count, with the sizes of each inode.
  • limit - the max size used to generate the inodes.

Level: advanced

See also: Mat, MatGetInfo()

External Links

source
PETSc.LibPETSc.MatInterpolate — Method
MatInterpolate(petsclib::PetscLibType, A::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

y = Ax or A^Tx depending on the shape of the matrix

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • x - the vector to be interpolated

Output Parameter:

  • y - the resulting vector

Level: intermediate

See also: Mat, MatMultAdd(), MatMultTransposeAdd(), MatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatInterpolateAdd — Method
MatInterpolateAdd(petsclib::PetscLibType, A::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec, w::AbstractPetscVec)

w = y + Ax or A^Tx depending on the shape of the matrix

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • x - the vector to be multiplied by the interpolation operator
  • y - the vector to be added to the result

Output Parameter:

  • w - the resulting vector

Level: intermediate

See also: Mat, MatMultAdd(), MatMultTransposeAdd(), MatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatInvertBlockDiagonal — Method
values::Ptr{PetscScalar} = MatInvertBlockDiagonal(petsclib::PetscLibType, mat::AbstractPetscMat)

Inverts the block diagonal entries.

Collective; No Fortran Support

Input Parameter:

  • mat - the matrix

Output Parameter:

  • values - the block inverses in column major order (FORTRAN-like)

Level: advanced

See also: Mat, MatInvertVariableBlockEnvelope(), MatInvertBlockDiagonalMat()

External Links

source
PETSc.LibPETSc.MatInvertBlockDiagonalMat — Method
MatInvertBlockDiagonalMat(petsclib::PetscLibType, A::AbstractPetscMat, C::AbstractPetscMat)

set the values of matrix C to be the inverted block diagonal of matrix A

Collective

Input Parameters:

  • A - the matrix
  • C - matrix with inverted block diagonal of A. This matrix should be created and may have its type set.

Level: advanced

See also: Mat, MatInvertBlockDiagonal()

External Links

source
PETSc.LibPETSc.MatInvertVariableBlockDiagonal — Method
MatInvertVariableBlockDiagonal(petsclib::PetscLibType, mat::AbstractPetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt}, values::Vector{PetscScalar})

Inverts the point block diagonal entries.

Collective; No Fortran Support

Input Parameters:

  • mat - the matrix
  • nblocks - the number of blocks on the process, set with MatSetVariableBlockSizes()
  • bsizes - the size of each block on the process, set with MatSetVariableBlockSizes()

Output Parameter:

  • values - the block inverses in column major order (FORTRAN-like)

Level: advanced

See also: Mat, MatInvertBlockDiagonal(), MatSetVariableBlockSizes(), MatInvertVariableBlockEnvelope()

External Links

source
PETSc.LibPETSc.MatInvertVariableBlockEnvelope — Method
C::PetscMat = MatInvertVariableBlockEnvelope(petsclib::PetscLibType, A::AbstractPetscMat, reuse::MatReuse)

set matrix C to be the inverted block diagonal of matrix A

Collective

Input Parameters:

  • A - the matrix
  • reuse - indicates if the C matrix was obtained from a previous call to this routine

Output Parameter:

  • C - matrix with inverted block diagonal of A

Level: advanced

See also: Mat, MatInvertBlockDiagonal(), MatComputeBlockDiagonal()

External Links

source
PETSc.LibPETSc.MatIsHermitian — Method
flg::PetscBool = MatIsHermitian(petsclib::PetscLibType, A::AbstractPetscMat, tol::PetscReal)

Test whether a matrix is Hermitian

Collective

Input Parameters:

  • A - the matrix to test
  • tol - difference between value and its transpose less than this amount counts as equal (use 0.0 for exact Hermitian)

Output Parameter:

  • flg - the result

Level: intermediate

See also: Mat, MatTranspose(), MatIsTranspose(), MatIsHermitianKnown(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetricKnown(), MatIsSymmetric(), MAT_HERMITIAN, MAT_SYMMETRY_ETERNAL

External Links

source
PETSc.LibPETSc.MatIsHermitianKnown — Method
set::PetscBool,flg::PetscBool = MatIsHermitianKnown(petsclib::PetscLibType, A::AbstractPetscMat)

Checks if a matrix knows if it is Hermitian or not and its Hermitian state

Not Collective

Input Parameter:

  • A - the matrix to check

Output Parameters:

  • set - PETSC_TRUE if the matrix knows its Hermitian state (this tells you if the next flag is valid)
  • flg - the result (only valid if set is PETSC_TRUE)

Level: advanced

See also: Mat, MAT_SYMMETRY_ETERNAL, MAT_HERMITIAN, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric()

External Links

source
PETSc.LibPETSc.MatIsHermitianTranspose — Method
flg::PetscBool = MatIsHermitianTranspose(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, tol::PetscReal)

Test whether a matrix is another one's Hermitian transpose,

Collective

Input Parameters:

  • A - the matrix to test
  • B - the matrix to test against, this can equal the first parameter
  • tol - tolerance, differences between entries smaller than this are counted as zero

Output Parameter:

  • flg - the result

Level: intermediate

See also: Mat, MatTranspose(), MatIsSymmetric(), MatIsHermitian(), MatIsTranspose()

External Links

source
PETSc.LibPETSc.MatIsLinear — Method
flg::PetscBool = MatIsLinear(petsclib::PetscLibType, A::AbstractPetscMat, n::PetscInt)

Check if a shell matrix A is a linear operator.

Collective

Input Parameters:

  • A - the shell matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the shell matrix is linear; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatIsSPDKnown — Method
set::PetscBool,flg::PetscBool = MatIsSPDKnown(petsclib::PetscLibType, A::AbstractPetscMat)

Checks if a matrix knows if it is symmetric positive definite or not and its symmetric positive definite state

Not Collective

Input Parameter:

  • A - the matrix to check

Output Parameters:

  • set - PETSC_TRUE if the matrix knows its symmetric positive definite state (this tells you if the next flag is valid)
  • flg - the result (only valid if set is PETSC_TRUE)

Level: advanced

See also: Mat, MAT_SPD_ETERNAL, MAT_SPD, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric(), MatIsHermitianKnown()

External Links

source
PETSc.LibPETSc.MatIsShell — Method
flg::PetscBool = MatIsShell(petsclib::PetscLibType, mat::AbstractPetscMat)

Inquires if a matrix is derived from MATSHELL

Input Parameter:

  • mat - the matrix

Output Parameter:

  • flg - the Boolean value

Level: developer

See also: Mat, MATSHELL, MATMFFD, MatCreateShell(), MATTRANSPOSEVIRTUAL, MATSCHURCOMPLEMENT

External Links

source
PETSc.LibPETSc.MatIsStructurallySymmetric — Method
flg::PetscBool = MatIsStructurallySymmetric(petsclib::PetscLibType, A::AbstractPetscMat)

Test whether a matrix is structurally symmetric

Collective

Input Parameter:

  • A - the matrix to test

Output Parameter:

  • flg - the result

Level: intermediate

See also: Mat, MAT_STRUCTURALLY_SYMMETRIC, MAT_STRUCTURAL_SYMMETRY_ETERNAL, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsSymmetric(), MatSetOption(), MatIsStructurallySymmetricKnown()

External Links

source
PETSc.LibPETSc.MatIsStructurallySymmetricKnown — Method
set::PetscBool,flg::PetscBool = MatIsStructurallySymmetricKnown(petsclib::PetscLibType, A::AbstractPetscMat)

Checks if a matrix knows if it is structurally symmetric or not and its structurally symmetric state

Not Collective

Input Parameter:

  • A - the matrix to check

Output Parameters:

  • set - PETSC_TRUE if the matrix knows its structurally symmetric state (this tells you if the next flag is valid)
  • flg - the result (only valid if set is PETSC_TRUE)

Level: advanced

See also: Mat, MAT_STRUCTURALLY_SYMMETRIC, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric(), MatIsHermitianKnown()

External Links

source
PETSc.LibPETSc.MatIsSymmetric — Method
flg::PetscBool = MatIsSymmetric(petsclib::PetscLibType, A::AbstractPetscMat, tol::PetscReal)

Test whether a matrix is symmetric

Collective

Input Parameters:

  • A - the matrix to test
  • tol - difference between value and its transpose less than this amount counts as equal (use 0.0 for exact transpose)

Output Parameter:

  • flg - the result

Level: intermediate

See also: Mat, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetricKnown(), MAT_SYMMETRIC, MAT_SYMMETRY_ETERNAL

External Links

source
PETSc.LibPETSc.MatIsSymmetricKnown — Method
set::PetscBool,flg::PetscBool = MatIsSymmetricKnown(petsclib::PetscLibType, A::AbstractPetscMat)

Checks if a matrix knows if it is symmetric or not and its symmetric state

Not Collective

Input Parameter:

  • A - the matrix to check

Output Parameters:

  • set - PETSC_TRUE if the matrix knows its symmetry state (this tells you if the next flag is valid)
  • flg - the result (only valid if set is PETSC_TRUE)

Level: advanced

See also: Mat, MAT_SYMMETRY_ETERNAL, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric(), MatIsHermitianKnown()

External Links

source
PETSc.LibPETSc.MatIsTranspose — Method
flg::PetscBool = MatIsTranspose(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, tol::PetscReal)

Test whether a matrix is another one's transpose, or its own, in which case it tests symmetry.

Collective

Input Parameters:

  • A - the matrix to test
  • B - the matrix to test against, this can equal the first parameter
  • tol - tolerance, differences between entries smaller than this are counted as zero

Output Parameter:

  • flg - the result

Level: intermediate

See also: Mat, MatTranspose(), MatIsSymmetric(), MatIsHermitian()

External Links

source
PETSc.LibPETSc.MatKAIJGetAIJ — Method
B::PetscMat = MatKAIJGetAIJ(petsclib::PetscLibType, A::AbstractPetscMat)

Get the MATAIJ matrix describing the blockwise action of the MATKAIJ matrix

Not Collective, but if the MATKAIJ matrix is parallel, the MATAIJ matrix is also parallel

Input Parameter:

  • A - the MATKAIJ matrix

Output Parameter:

  • B - the MATAIJ matrix

Level: advanced

See also: Mat, MatCreateKAIJ(), MATKAIJ, MATAIJ

External Links

source
PETSc.LibPETSc.MatKAIJGetS — Method
m::PetscInt,n::PetscInt,S::Vector{PetscScalar} = MatKAIJGetS(petsclib::PetscLibType, A::AbstractPetscMat)

Get the S matrix describing the shift action of the MATKAIJ matrix

Not Collective; the entire S is stored and returned independently on all processes.

Input Parameter:

  • A - the MATKAIJ matrix

Output Parameters:

  • m - the number of rows in S
  • n - the number of columns in S
  • S - the S matrix, in form of a scalar array in column-major format

Level: advanced

See also: Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJGetSRead — Method
m::PetscInt,n::PetscInt,S::Vector{PetscScalar} = MatKAIJGetSRead(petsclib::PetscLibType, A::AbstractPetscMat)

Get a read-only pointer to the S matrix describing the shift action of the MATKAIJ matrix

Not Collective; the entire S is stored and returned independently on all processes.

Input Parameter:

  • A - the MATKAIJ matrix

Output Parameters:

  • m - the number of rows in S
  • n - the number of columns in S
  • S - the S matrix, in form of a scalar array in column-major format

Level: advanced

See also: Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJGetScaledIdentity — Method
identity::PetscBool = MatKAIJGetScaledIdentity(petsclib::PetscLibType, A::AbstractPetscMat)

Check if both S and T are scaled identities.

Logically Collective.

Input Parameter:

  • A - the MATKAIJ matrix

Output Parameter:

  • identity - the Boolean value

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetS(), MatKAIJGetT()

External Links

source
PETSc.LibPETSc.MatKAIJGetT — Method
m::PetscInt,n::PetscInt,T::Vector{PetscScalar} = MatKAIJGetT(petsclib::PetscLibType, A::AbstractPetscMat)

Get the transformation matrix T associated with the MATKAIJ matrix

Not Collective; the entire T is stored and returned independently on all processes

Input Parameter:

  • A - the MATKAIJ matrix

Output Parameters:

  • m - the number of rows in T
  • n - the number of columns in T
  • T - the T matrix, in form of a scalar array in column-major format

Level: advanced

See also: Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJGetTRead — Method
m::PetscInt,n::PetscInt,T::Vector{PetscScalar} = MatKAIJGetTRead(petsclib::PetscLibType, A::AbstractPetscMat)

Get a read-only pointer to the transformation matrix T associated with the MATKAIJ matrix

Not Collective; the entire T is stored and returned independently on all processes

Input Parameter:

  • A - the MATKAIJ matrix

Output Parameters:

  • m - the number of rows in T
  • n - the number of columns in T
  • T - the T matrix, in form of a scalar array in column-major format

Level: advanced

See also: Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreS — Method
MatKAIJRestoreS(petsclib::PetscLibType, A::AbstractPetscMat, S::Union{Ptr, AbstractArray{PetscScalar}})

Restore array obtained with MatKAIJGetS()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • S - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetS(), MatKAIJGetSRead(), MatKAIJRestoreSRead()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreSRead — Method
MatKAIJRestoreSRead(petsclib::PetscLibType, A::AbstractPetscMat, S::Union{Ptr, AbstractArray{PetscScalar}})

Restore array obtained with MatKAIJGetSRead()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • S - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetS(), MatKAIJGetSRead()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreT — Method
MatKAIJRestoreT(petsclib::PetscLibType, A::AbstractPetscMat, T::Union{Ptr, AbstractArray{PetscScalar}})

Restore array obtained with MatKAIJGetT()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • T - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetT(), MatKAIJGetTRead(), MatKAIJRestoreTRead()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreTRead — Method
MatKAIJRestoreTRead(petsclib::PetscLibType, A::AbstractPetscMat, T::Union{Ptr, AbstractArray{PetscScalar}})

Restore array obtained with MatKAIJGetTRead()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • T - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetT(), MatKAIJGetTRead()

External Links

source
PETSc.LibPETSc.MatKAIJSetAIJ — Method
MatKAIJSetAIJ(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat)

Set the MATAIJ matrix describing the blockwise action of the MATKAIJ matrix

Logically Collective; if the MATAIJ matrix is parallel, the MATKAIJ matrix is also parallel

Input Parameters:

  • A - the MATKAIJ matrix
  • B - the MATAIJ matrix

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetAIJ(), MatKAIJSetS(), MatKAIJSetT()

External Links

source
PETSc.LibPETSc.MatKAIJSetS — Method
MatKAIJSetS(petsclib::PetscLibType, A::AbstractPetscMat, p::PetscInt, q::PetscInt, S::Vector{PetscScalar})

Set the S matrix describing the shift action of the MATKAIJ matrix

Logically Collective; the entire S is stored independently on all processes.

Input Parameters:

  • A - the MATKAIJ matrix
  • p - the number of rows in S
  • q - the number of columns in S
  • S - the S matrix, in form of a scalar array in column-major format

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetS(), MatKAIJSetT(), MatKAIJSetAIJ()

External Links

source
PETSc.LibPETSc.MatKAIJSetT — Method
MatKAIJSetT(petsclib::PetscLibType, A::AbstractPetscMat, p::PetscInt, q::PetscInt, T::Vector{PetscScalar})

Set the transformation matrix T associated with the MATKAIJ matrix

Logically Collective; the entire T is stored independently on all processes.

Input Parameters:

  • A - the MATKAIJ matrix
  • p - the number of rows in S
  • q - the number of columns in S
  • T - the T matrix, in form of a scalar array in column-major format

Level: advanced

See also: Mat, MATKAIJ, MatKAIJGetT(), MatKAIJSetS(), MatKAIJSetAIJ()

External Links

source
PETSc.LibPETSc.MatLMVMAllocate — Method
MatLMVMAllocate(petsclib::PetscLibType, B::AbstractPetscMat, X::AbstractPetscVec, F::AbstractPetscVec)

Produces all necessary common memory for LMVM approximations based on the solution and function vectors provided.

Input Parameters:

  • B - A MATLMVM matrix
  • X - Solution vector
  • F - Function vector

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMReset(), MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMApplyJ0Fwd — Method
MatLMVMApplyJ0Fwd(petsclib::PetscLibType, B::AbstractPetscMat, X::AbstractPetscVec, Y::AbstractPetscVec)

Applies an approximation of the forward matrix-vector product with the initial Jacobian.

Input Parameters:

  • B - A MATLMVM matrix
  • X - vector to multiply with J0

Output Parameter:

  • Y - resulting vector for the operation

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0(), MatLMVMSetJ0Scale(), MatLMVMSetJ0ScaleDiag(), MatLMVMSetJ0PC(), MatLMVMSetJ0KSP(), MatLMVMApplyJ0Inv()

External Links

source
PETSc.LibPETSc.MatLMVMApplyJ0Inv — Method
MatLMVMApplyJ0Inv(petsclib::PetscLibType, B::AbstractPetscMat, X::AbstractPetscVec, Y::AbstractPetscVec)

Applies some estimation of the initial Jacobian inverse to the given vector.

Input Parameters:

  • B - A MATLMVM matrix
  • X - vector to "multiply" with J0^{-1}

Output Parameter:

  • Y - resulting vector for the operation

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0(), MatLMVMSetJ0Scale(), MatLMVMSetJ0ScaleDiag(), MatLMVMSetJ0PC(), MatLMVMSetJ0KSP(), MatLMVMApplyJ0Fwd()

External Links

source
PETSc.LibPETSc.MatLMVMClearJ0 — Method
MatLMVMClearJ0(petsclib::PetscLibType, B::AbstractPetscMat)

Removes all definitions of J0 and reverts to an identity matrix (scale = 1.0).

Input Parameter:

  • B - A MATLMVM matrix

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMDenseSetType — Method
MatLMVMDenseSetType(petsclib::PetscLibType, B::AbstractPetscMat, type::MatLMVMDenseType)

Sets the memory storage type for dense MATLMVM

Input Parameters:

  • B - the MATLMVM matrix
  • type - scale type, see MatLMVMDenseSetType

Options Database Keys:

  • -mat_lqn_type (reorder|inplace) - set the strategy
  • -mat_lbfgs_type (reorder|inplace) - set the strategy
  • -mat_ldfp_type (reorder|inplace) - set the strategy

Level: intermediate

MatLMVMDenseTypes:

  • MAT_LMVM_DENSE_REORDER - reorders memory to minimize kernel launch
  • MAT_LMVM_DENSE_INPLACE - launches kernel inplace to minimize memory movement

See also: MATLMVMDQN, MATLMVMDBFGS, MATLMVMDDFP, MatLMVMDenseType

External Links

source
PETSc.LibPETSc.MatLMVMGetHistorySize — Method
hist_size::PetscInt = MatLMVMGetHistorySize(petsclib::PetscLibType, B::AbstractPetscMat)

Get the number of past iterates stored for the construction of the limited-memory quasi-Newton update

Not Collective

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • hist_size - number of past iterates stored

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMSetHistorySize(), MatLMVMGetUpdateCount()

External Links

source
PETSc.LibPETSc.MatLMVMGetJ0 — Method
J0::PetscMat = MatLMVMGetJ0(petsclib::PetscLibType, B::AbstractPetscMat)

Returns a pointer to the internal J0 matrix.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • J0 - Mat object for defining the initial Jacobian

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMGetJ0KSP — Method
J0ksp::KSP = MatLMVMGetJ0KSP(petsclib::PetscLibType, B::AbstractPetscMat)

Returns a pointer to the internal KSP solver associated with the initial Jacobian.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • J0ksp - KSP solver for defining the initial inverse-Jacobian

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0KSP()

External Links

source
PETSc.LibPETSc.MatLMVMGetJ0PC — Method
J0pc::PC = MatLMVMGetJ0PC(petsclib::PetscLibType, B::AbstractPetscMat)

Returns a pointer to the internal PC object associated with the initial Jacobian.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • J0pc - PC object for defining the initial inverse-Jacobian

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0PC()

External Links

source
PETSc.LibPETSc.MatLMVMGetLastUpdate — Method
x_prev::PetscVec,f_prev::PetscVec = MatLMVMGetLastUpdate(petsclib::PetscLibType, B::AbstractPetscMat)

Get the last vectors passed to MatLMVMUpdate()

Not collective

Input Parameter:

  • B - a MatLMVM matrix

Output Parameters:

  • x_prev - the last solution vector
  • f_prev - the last function vector

Level: intermediate

See also: MatLMVM, MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMGetMultAlgorithm — Method
alg::MatLMVMMultAlgorithm = MatLMVMGetMultAlgorithm(petsclib::PetscLibType, B::AbstractPetscMat)

Get the algorithm used by a MatLMVM for products

Not collective

Input Parameter:

  • B - a MatLMVM matrix

Output Parameter:

  • alg - one of the algorithm classes (MAT_LMVM_MULT_RECURSIVE, MAT_LMVM_MULT_DENSE, MAT_LMVM_MULT_COMPACT_DENSE)

Level: advanced

See also: MatLMVM, MatLMVMMultAlgorithm, MatLMVMSetMultAlgorithm()

External Links

source
PETSc.LibPETSc.MatLMVMGetRejectCount — Method
nrejects::PetscInt = MatLMVMGetRejectCount(petsclib::PetscLibType, B::AbstractPetscMat)

Returns the number of rejected updates. The counters are reset when MatLMVMReset() is called.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • nrejects - number of rejected updates

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMReset()

External Links

source
PETSc.LibPETSc.MatLMVMGetUpdateCount — Method
nupdates::PetscInt = MatLMVMGetUpdateCount(petsclib::PetscLibType, B::AbstractPetscMat)

Returns the number of accepted updates.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • nupdates - number of accepted updates

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMGetRejectCount(), MatLMVMReset()

External Links

source
PETSc.LibPETSc.MatLMVMIsAllocated — Method
flg::PetscBool = MatLMVMIsAllocated(petsclib::PetscLibType, B::AbstractPetscMat)

Returns a boolean flag that shows whether the necessary data structures for the underlying matrix is allocated.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • flg - PETSC_TRUE if allocated, PETSC_FALSE otherwise

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMAllocate(), MatLMVMReset()

External Links

source
PETSc.LibPETSc.MatLMVMReset — Method
MatLMVMReset(petsclib::PetscLibType, B::AbstractPetscMat, destructive::PetscBool)

Flushes all of the accumulated updates out of the MATLMVM approximation.

Input Parameters:

  • B - A MATLMVM matrix
  • destructive - flag for enabling destruction of data structures

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMAllocate(), MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMResetShift — Method
MatLMVMResetShift(petsclib::PetscLibType, B::AbstractPetscMat)

Zero the shift factor for a MATLMVM.

Input Parameter:

  • B - A MATLMVM matrix

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMAllocate(), MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMSetHistorySize — Method
MatLMVMSetHistorySize(petsclib::PetscLibType, B::AbstractPetscMat, hist_size::PetscInt)

Set the number of past iterates to be stored for the construction of the limited-memory quasi-Newton update.

Input Parameters:

  • B - A MATLMVM matrix
  • hist_size - number of past iterates (default 5)

Options Database Key:

  • -mat_lmvm_hist_size m - set number of past iterates

Level: beginner

See also: LMVM Matrices, MATLMVM, MatLMVMGetUpdateCount()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0 — Method
MatLMVMSetJ0(petsclib::PetscLibType, B::AbstractPetscMat, J0::AbstractPetscMat)

Allows the user to define the initial Jacobian matrix from which the LMVM-type approximation is built up.

Input Parameters:

  • B - An LMVM-type matrix
  • J0 - The initial Jacobian matrix, will be referenced by B.

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetJ0PC(), MatLMVMSetJ0KSP()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0Diag — Method
MatLMVMSetJ0Diag(petsclib::PetscLibType, B::AbstractPetscMat, V::AbstractPetscVec)

Allows the user to define a vector V such that J0 = diag(V).

Input Parameters:

  • B - An LMVM-type matrix
  • V - Vector that defines the diagonal of the initial Jacobian: values are copied, V is not referenced

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetScale(), MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0KSP — Method
MatLMVMSetJ0KSP(petsclib::PetscLibType, B::AbstractPetscMat, J0ksp::AbstractKSP)

Allows the user to provide a pre-configured KSP solver for the initial inverse-Jacobian approximation.

Input Parameters:

  • B - A MATLMVM matrix
  • J0ksp - KSP solver for the initial inverse-Jacobian application

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMGetJ0KSP()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0PC — Method
MatLMVMSetJ0PC(petsclib::PetscLibType, B::AbstractPetscMat, J0pc::AbstractPC)

Allows the user to define a PC object that acts as the initial inverse-Jacobian matrix.

Input Parameters:

  • B - A MATLMVM matrix
  • J0pc - PC object where PCApply() defines an inverse application for J0

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMGetJ0PC()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0Scale — Method
MatLMVMSetJ0Scale(petsclib::PetscLibType, B::AbstractPetscMat, scale::PetscReal)

Allows the user to define a scalar value mu such that J0 = mu*I.

Input Parameters:

  • B - A MATLMVM matrix
  • scale - Scalar value mu that defines the initial Jacobian

Level: advanced

See also: LMVM Matrices, MATLMVM, MatLMVMSetDiagScale(), MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMSetMultAlgorithm — Method
MatLMVMSetMultAlgorithm(petsclib::PetscLibType, B::AbstractPetscMat, alg::MatLMVMMultAlgorithm)

Set the algorithm used by a MatLMVM for products

Logically collective

Input Parameters:

  • B - a MatLMVM matrix
  • alg - one of the algorithm classes (MAT_LMVM_MULT_RECURSIVE, MAT_LMVM_MULT_DENSE, MAT_LMVM_MULT_COMPACT_DENSE)

Level: advanced

See also: MatLMVM, MatLMVMMultAlgorithm, MatLMVMGetMultAlgorithm()

External Links

source
PETSc.LibPETSc.MatLMVMSymBadBroydenGetPsi — Method
psi::PetscReal = MatLMVMSymBadBroydenGetPsi(petsclib::PetscLibType, B::AbstractPetscMat)

Get the psi parameter for a Broyden class quasi-Newton update matrix

Input Parameter:

  • B - The matrix

Output Parameter:

  • psi - a number defining an update that is an affine combination of the BFGS update (psi = 1) and DFP update (psi = 0)

Level: advanced

Note: If B does not have a constant value of psi for all iterations this will return psi = PETSC_DETERMINE = -1, a negative value that psi cannot attain for a valid general Broyden update. This is the case if B is a MATLMVMSYMBROYDEN, where psi's dual value phi is constant and psi changes from iteration to iteration.

MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBadBroydenSetPsi(), MatLMVMSymBroydenGetPhi(), MatLMVMSymBroydenSetPhi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBadBroydenSetPsi — Method
MatLMVMSymBadBroydenSetPsi(petsclib::PetscLibType, B::AbstractPetscMat, psi::PetscReal)

Get the psi parameter for a Broyden class quasi-Newton update matrix

Input Parameters:

  • B - The matrix
  • psi - a number defining an update that is a convex combination of the BFGS update (psi = 1) and DFP update (psi = 0)

Level: developer

Note: If B cannot have a constant value of psi for all iterations this will be ignored. This is the case if B is a MATLMVMSYMBROYDEN, where psi's dual value phi is constant and psi changes from iteration to iteration.

MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBadBroydenGetPsi(), MatLMVMSymBroydenGetPhi(), MatLMVMSymBroydenSetPhi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenGetPhi — Method
phi::PetscReal = MatLMVMSymBroydenGetPhi(petsclib::PetscLibType, B::AbstractPetscMat)

Get the phi parameter for a Broyden class quasi-Newton update matrix

Input Parameter:

  • B - The matrix

Output Parameter:

  • phi - a number defining an update that is an affine combination of the BFGS update (phi = 0) and DFP update (phi = 1)

Level: advanced

Note: If B does not have a constant value of phi for all iterations this will return phi = PETSC_DETERMINE = -1, a negative value that phi cannot attain for a valid general Broyden update. This is the case if B is a MATLMVMSYMBADBROYDEN, where phi's dual value psi is constant and phi changes from iteration to iteration.

MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBroydenSetPhi(), MatLMVMSymBadBroydenGetPsi(), MatLMVMSymBadBroydenSetPsi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenSetDelta — Method
MatLMVMSymBroydenSetDelta(petsclib::PetscLibType, B::AbstractPetscMat, delta::PetscScalar)

Sets the starting value for the diagonal scaling vector computed in the SymBrdn approximations (also works for BFGS and DFP).

Input Parameters:

  • B - MATLMVM matrix
  • delta - initial value for diagonal scaling

Level: intermediate

See also: MATLMVMSYMBROYDEN

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenSetPhi — Method
MatLMVMSymBroydenSetPhi(petsclib::PetscLibType, B::AbstractPetscMat, phi::PetscReal)

Get the phi parameter for a Broyden class quasi-Newton update matrix

Input Parameters:

  • B - The matrix
  • phi - a number defining an update that is a convex combination of the BFGS update (phi = 0) and DFP update (phi = 1)

Level: advanced

Note: If B cannot have a constant value of phi for all iterations this will be ignored. This is the case if B is a MATLMVMSYMBADBROYDEN, where phi's dual value psi is constant and phi changes from iteration to iteration.

MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBroydenGetPhi(), MatLMVMSymBadBroydenGetPsi(), MatLMVMSymBadBroydenSetPsi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenSetScaleType — Method
MatLMVMSymBroydenSetScaleType(petsclib::PetscLibType, B::AbstractPetscMat, stype::MatLMVMSymBroydenScaleType)

Sets the scale type for symmetric Broyden-type updates.

Input Parameters:

  • B - the MATLMVM matrix
  • stype - scale type, see MatLMVMSymBroydenScaleType

Options Database Key:

  • -mat_lmvm_scale_type (none|scalar|diagonal) - set the scaling type

Level: intermediate

MatLMVMSymBrdnScaleTypes:

  • MAT_LMVM_SYMBROYDEN_SCALE_NONE - use whatever initial Hessian is already there (will be the identity if the user does nothing)
  • MAT_LMVM_SYMBROYDEN_SCALE_SCALAR - use the Shanno scalar as the initial Hessian
  • MAT_LMVM_SYMBROYDEN_SCALE_DIAGONAL - use a diagonalized BFGS update as the initial Hessian
  • MAT_LMVM_SYMBROYDEN_SCALE_USER - same as MAT_LMVM_SYMBROYDEN_NONE
  • MAT_LMVM_SYMBROYDEN_SCALE_DECIDE - let PETSc decide

See also: MATLMVMSYMBROYDEN, MatCreateLMVMSymBroyden(), MatLMVMSymBroydenScaleType

External Links

source
PETSc.LibPETSc.MatLMVMUpdate — Method
MatLMVMUpdate(petsclib::PetscLibType, B::AbstractPetscMat, X::AbstractPetscVec, F::AbstractPetscVec)

Adds (X-Xprev) and (F-Fprev) updates to a MATLMVM matrix.

Input Parameters:

  • B - A MATLMVM matrix
  • X - Solution vector
  • F - Function vector

Level: intermediate

See also: LMVM Matrices, MATLMVM, MatLMVMReset(), MatLMVMAllocate()

External Links

source
PETSc.LibPETSc.MatLRCGetMats — Method
A::PetscMat,U::PetscMat,c::PetscVec,V::PetscMat = MatLRCGetMats(petsclib::PetscLibType, N::AbstractPetscMat)

Returns the constituents of an LRC matrix

Not collective

Input Parameter:

  • N - matrix of type MATLRC

Output Parameters:

  • A - the (sparse) matrix
  • U - first dense rectangular (tall and skinny) matrix
  • c - a sequential vector containing the diagonal of C
  • V - second dense rectangular (tall and skinny) matrix

Level: intermediate

See also: MatLRCSetMats(), Mat, MATLRC, MatCreateLRC()

External Links

source
PETSc.LibPETSc.MatLRCSetMats — Method
MatLRCSetMats(petsclib::PetscLibType, N::AbstractPetscMat, A::AbstractPetscMat, U::AbstractPetscMat, c::AbstractPetscVec, V::AbstractPetscMat)

Sets the constituents of an LRC matrix

Logically collective

Input Parameters:

  • N - matrix of type MATLRC
  • A - the (sparse) matrix
  • U - first dense rectangular (tall and skinny) matrix
  • c - a sequential vector containing the diagonal of C
  • V - second dense rectangular (tall and skinny) matrix

Level: intermediate

See also: MatLRCGetMats(), Mat, MATLRC, MatCreateLRC()

External Links

source
PETSc.LibPETSc.MatLUFactor — Method
MatLUFactor(petsclib::PetscLibType, mat::AbstractPetscMat, row::AbstractIS, col::AbstractIS, info::Vector{MatFactorInfo})

Performs in-place LU factorization of matrix.

Collective

Input Parameters:

  • mat - the matrix
  • row - row permutation
  • col - column permutation
  • info - options for factorization, includes

$fill - expected fill as ratio of original fill. dtcol - pivot tolerance (0 no pivot, 1 full column pivoting) Run with the option -info to determine an optimal value to use$

Level: developer

See also: Matrix Factorization, Mat, MatFactorType, MatLUFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor(), MatGetOrdering(), MatSetUnfactored(), MatFactorInfo, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatLUFactorNumeric — Method
MatLUFactorNumeric(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, info::Vector{MatFactorInfo})

Performs numeric LU factorization of a matrix. Call this routine after first calling MatLUFactorSymbolic() and MatGetFactor().

Collective

Input Parameters:

  • fact - the factor matrix obtained with MatGetFactor()
  • mat - the matrix
  • info - options for factorization

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatFactorInfo, MatLUFactorSymbolic(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatLUFactorSymbolic — Method
MatLUFactorSymbolic(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, row::AbstractIS, col::AbstractIS, info::Vector{MatFactorInfo})

Performs symbolic LU factorization of matrix. Call this routine before calling MatLUFactorNumeric() and after MatGetFactor().

Collective

Input Parameters:

  • fact - the factor matrix obtained with MatGetFactor()
  • mat - the matrix
  • row - the row permutation
  • col - the column permutation
  • info - options for factorization, includes

$fill - expected fill as ratio of original fill. Run with the option -info to determine an optimal value to use dtcol - pivot tolerance (0 no pivot, 1 full column pivoting)$

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatLUFactor(), MatLUFactorNumeric(), MatCholeskyFactor(), MatFactorInfo, MatFactorInfoInitialize()

External Links

source
PETSc.LibPETSc.MatLoad — Method
MatLoad(petsclib::PetscLibType, mat::AbstractPetscMat, viewer::PetscViewer)

Loads a matrix that has been stored in binary/HDF5 format with MatView(). The matrix format is determined from the options database. Generates a parallel MPI matrix if the communicator has more than one processor. The default matrix type is MATAIJ.

Collective

Input Parameters:

  • mat - the newly loaded matrix, this needs to have been created with MatCreate()

or some related function before a call to MatLoad()

  • viewer - PETSCVIEWERBINARY/PETSCVIEWERHDF5 file viewer

Options Database Key:

  • -matload_block_size bs - set block size

Level: beginner

See also: Mat, PetscViewerBinaryOpen(), PetscViewerSetType(), MatView(), VecLoad()

External Links

source
PETSc.LibPETSc.MatMAIJGetAIJ — Method
B::PetscMat = MatMAIJGetAIJ(petsclib::PetscLibType, A::AbstractPetscMat)

Get the MATAIJ matrix describing the blockwise action of the MATMAIJ matrix

Not Collective, but if the MATMAIJ matrix is parallel, the MATAIJ matrix is also parallel

Input Parameter:

  • A - the MATMAIJ matrix

Output Parameter:

  • B - the MATAIJ matrix

Level: advanced

See also: Mat, MATMAIJ, MATAIJ, MatCreateMAIJ()

External Links

source
PETSc.LibPETSc.MatMAIJRedimension — Method
B::PetscMat = MatMAIJRedimension(petsclib::PetscLibType, A::AbstractPetscMat, dof::PetscInt)

Get a new MATMAIJ matrix with the same action, but for a different block size

Logically Collective

Input Parameters:

  • A - the MATMAIJ matrix
  • dof - the block size for the new matrix

Output Parameter:

  • B - the new MATMAIJ matrix

Level: advanced

See also: Mat, MATMAIJ, MatCreateMAIJ()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetLocalMat — Method
A_loc::PetscMat = MatMPIAIJGetLocalMat(petsclib::PetscLibType, A::AbstractPetscMat, scall::MatReuse)

Creates a MATSEQAIJ from a MATMPIAIJ matrix.

Not Collective

Input Parameters:

  • A - the matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • A_loc - the local sequential matrix generated

Level: developer

See also: Mat, MATMPIAIJ, MatGetOwnershipRange(), MatMPIAIJGetLocalMatCondensed(), MatMPIAIJGetLocalMatMerge()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetLocalMatCondensed — Method
A_loc::PetscMat = MatMPIAIJGetLocalMatCondensed(petsclib::PetscLibType, A::AbstractPetscMat, scall::MatReuse, row::AbstractIS, col::AbstractIS)

Creates a MATSEQAIJ matrix from an MATMPIAIJ matrix by taking all its local rows and NON-ZERO columns

Not Collective

Input Parameters:

  • A - the matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • row - index set of rows to extract (or NULL)
  • col - index set of columns to extract (or NULL)

Output Parameter:

  • A_loc - the local sequential matrix generated

Level: developer

See also: Mat, MATMPIAIJ, MatGetOwnershipRange(), MatMPIAIJGetLocalMat()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetLocalMatMerge — Method
glob::IS,A_loc::PetscMat = MatMPIAIJGetLocalMatMerge(petsclib::PetscLibType, A::AbstractPetscMat, scall::MatReuse)

Creates a MATSEQAIJ from a MATMPIAIJ matrix by taking all its local rows and putting them into a sequential matrix with mlocal rows and n columns. Where n is the sum of the number of columns of the diagonal and off-diagonal part

Not Collective

Input Parameters:

  • A - the matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameters:

  • glob - sequential IS with global indices associated with the columns of the local sequential matrix generated (can be NULL)
  • A_loc - the local sequential matrix generated

Level: developer

See also: Mat, MATMPIAIJ, MatGetOwnershipRange(), MatMPIAIJGetLocalMat(), MatMPIAIJGetLocalMatCondensed()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetNumberNonzeros — Method
nz::PetscCount = MatMPIAIJGetNumberNonzeros(petsclib::PetscLibType, A::AbstractPetscMat)

gets the number of nonzeros in the matrix on this MPI rank

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • nz - the number of nonzeros

Level: advanced

See also: Mat, MATMPIAIJ

External Links

source
PETSc.LibPETSc.MatMPIAIJGetSeqAIJ — Method
Ad::PetscMat,Ao::PetscMat,colmap::Vector{PetscInt} = MatMPIAIJGetSeqAIJ(petsclib::PetscLibType, A::AbstractPetscMat)

Returns the local pieces of this distributed matrix

Not Collective

Input Parameter:

  • A - The MATMPIAIJ matrix

Output Parameters:

  • Ad - The local diagonal block as a MATSEQAIJ matrix
  • Ao - The local off-diagonal block as a MATSEQAIJ matrix
  • colmap - An array mapping local column numbers of Ao to global column numbers of the parallel matrix

Level: intermediate

See also: Mat, MATMPIAIJ, MatMPIAIJGetLocalMat(), MatMPIAIJGetLocalMatCondensed(), MatCreateAIJ(), MATSEQAIJ

External Links

source
PETSc.LibPETSc.MatMPIAIJSetPreallocation — Method
MatMPIAIJSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Preallocates memory for a sparse parallel matrix in MATMPIAIJ format (the default parallel PETSc format). For good matrix assembly performance the user should preallocate the matrix storage by setting the parameters d_nz (or d_nnz) and o_nz (or o_nnz).

Collective

Input Parameters:

  • B - the matrix
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL (PETSC_NULL_INTEGER in Fortran), if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'. For matrices that will be factored, you must leave room for (and set) the diagonal entry even if it is zero.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL (PETSC_NULL_INTEGER in Fortran), if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'.

See also: Mat, Sparse Matrices, MATMPIAIJ, MATAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateAIJ(), MatMPIAIJSetPreallocationCSR(), MatGetInfo(), PetscSplitOwnership(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatMPIAIJSetPreallocationCSR — Method
MatMPIAIJSetPreallocationCSR(petsclib::PetscLibType, B::AbstractPetscMat, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar})

Allocates memory for a sparse parallel matrix in MATAIJ format (the default parallel PETSc format).

Collective

Input Parameters:

  • B - the matrix
  • i - the indices into j for the start of each local row (indices start with zero)
  • j - the column indices for each local row (indices start with zero)
  • v - optional values in the matrix

Level: developer

See also: Mat, MATMPIAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatCreateAIJ(), MatCreateSeqAIJWithArrays(), MatCreateMPIAIJWithSplitArrays(), MatCreateMPIAIJWithArrays(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatMPIAdjCreateNonemptySubcommMat — Method
B::PetscMat = MatMPIAdjCreateNonemptySubcommMat(petsclib::PetscLibType, A::AbstractPetscMat)

create the same MATMPIADJ matrix on a subcommunicator containing only processes owning a positive number of rows

Collective

Input Parameter:

  • A - original MATMPIADJ matrix

Output Parameter:

  • B - matrix on subcommunicator, NULL on MPI processes that own zero rows of A

Level: developer

See also: Mat, MATMPIADJ, MatCreateMPIAdj()

External Links

source
PETSc.LibPETSc.MatMPIAdjSetPreallocation — Method
i::PetscInt,j::PetscInt,values::PetscInt = MatMPIAdjSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat)

Sets the array used for storing the matrix elements

Logically Collective

Input Parameters:

  • B - the matrix
  • i - the indices into j for the start of each row
  • j - the column indices for each row (sorted for each row).

The indices in i and j start with zero (NOT with one).

  • values - [use NULL if not provided] edge weights

Level: intermediate

See also: Mat, MatCreate(), MatCreateMPIAdj(), MatSetValues(), MATMPIADJ

External Links

source
PETSc.LibPETSc.MatMPIAdjToSeq — Method
B::PetscMat = MatMPIAdjToSeq(petsclib::PetscLibType, A::AbstractPetscMat)

Converts an parallel MATMPIADJ matrix to complete MATMPIADJ on each process (needed by sequential partitioners)

Logically Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • B - the same matrix on all processes

Level: intermediate

See also: Mat, MATMPIADJ, MatCreate(), MatCreateMPIAdj(), MatSetValues(), MatMPIAdjToSeqRankZero()

External Links

source
PETSc.LibPETSc.MatMPIAdjToSeqRankZero — Method
B::PetscMat = MatMPIAdjToSeqRankZero(petsclib::PetscLibType, A::AbstractPetscMat)

Converts an parallel MATMPIADJ matrix to complete MATMPIADJ on rank zero (needed by sequential partitioners)

Logically Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • B - the same matrix on rank zero, not set on other ranks

Level: intermediate

See also: Mat, MATMPIADJ, MatCreate(), MatCreateMPIAdj(), MatSetValues(), MatMPIAdjToSeq()

External Links

source
PETSc.LibPETSc.MatMPIBAIJGetSeqBAIJ — Method
Ad::PetscMat,Ao::PetscMat,colmap::Ptr{PetscInt} = MatMPIBAIJGetSeqBAIJ(petsclib::PetscLibType, A::AbstractPetscMat)

Get the on-process (diagonal block) and off-process (off-diagonal block) MATSEQBAIJ matrices that make up an MATMPIBAIJ matrix, together with the local-to-global column map for the off-diagonal block.

Not Collective

Input Parameter:

  • A - the MATMPIBAIJ matrix

Output Parameters:

  • Ad - the diagonal block MATSEQBAIJ, or NULL if not needed
  • Ao - the off-diagonal block MATSEQBAIJ, or NULL if not needed
  • colmap - the local-to-global column index map for Ao, or NULL if not needed

Level: advanced

See also: Mat, MATMPIBAIJ, MATSEQBAIJ, MatMPIAIJGetSeqAIJ()

External Links

source
PETSc.LibPETSc.MatMPIBAIJSetHashTableFactor — Method
MatMPIBAIJSetHashTableFactor(petsclib::PetscLibType, mat::AbstractPetscMat, fact::PetscReal)

Sets the factor required to compute the size of the matrices hash table

Input Parameters:

  • mat - the matrix
  • fact - factor

Options Database Key:

  • -mat_use_hash_table fact - provide the factor

Level: advanced

See also: Mat, MATMPIBAIJ, MatSetOption()

External Links

source
PETSc.LibPETSc.MatMPIBAIJSetPreallocation — Method
MatMPIBAIJSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Union{Ptr, Vector{PetscInt}}, o_nz::PetscInt, o_nnz::Union{Ptr, Vector{PetscInt}})

Allocates memory for a sparse parallel matrix in MATMPIBAIJ format (block compressed row).

Collective

Input Parameters:

  • B - the matrix
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • d_nz - number of block nonzeros per block row in diagonal portion of local

submatrix (same for all local rows)

  • d_nnz - array containing the number of block nonzeros in the various block rows

of the in diagonal portion of the local (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room for the diagonal entry and set it even if it is zero.

  • o_nz - number of block nonzeros per block row in the off-diagonal portion of local

submatrix (same for all local rows).

  • o_nnz - array containing the number of nonzeros in the various block rows of the

off-diagonal portion of the local submatrix (possibly different for each block row) or NULL.

If the *nnz parameter is given then the *nz parameter is ignored

Options Database Keys:

  • -mat_block_size - size of the blocks to use
  • -mat_use_hash_table fact - set hash table factor

Level: intermediate

See also: Mat, MATMPIBAIJ, MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatCreateBAIJ(), MatMPIBAIJSetPreallocationCSR(), PetscSplitOwnership()

External Links

source
PETSc.LibPETSc.MatMPIBAIJSetPreallocationCSR — Method
MatMPIBAIJSetPreallocationCSR(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Union{Ptr, Vector{PetscScalar}})

Creates a sparse parallel matrix in MATBAIJ format using the given nonzero structure and (optional) numerical values

Collective

Input Parameters:

  • B - the matrix
  • bs - the block size
  • i - the indices into j for the start of each local row (starts with zero)
  • j - the column indices for each local row (starts with zero) these must be sorted for each row
  • v - optional values in the matrix, use NULL if not provided

Level: advanced

See also: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MATMPIAIJ, MatCreateMPIBAIJWithArrays(), MATMPIBAIJ

External Links

source
PETSc.LibPETSc.MatMPIDenseSetPreallocation — Method
data::PetscScalar = MatMPIDenseSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat)

Sets the array used to store the matrix entries

Collective

Input Parameters:

  • B - the matrix
  • data - optional location of matrix data. Set to NULL for PETSc

to control all matrix memory allocation.

Level: intermediate

See also: Mat, MATMPIDENSE, MatCreate(), MatCreateSeqDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatMPISBAIJSetPreallocation — Method
MatMPISBAIJSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

For good matrix assembly performance the user should preallocate the matrix storage by setting the parameters dnz (or dnnz) and onz (or onnz). By setting these parameters accurately, performance can be increased by more than a factor of 50.

Collective

Input Parameters:

  • B - the matrix
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • d_nz - number of block nonzeros per block row in diagonal portion of local

submatrix (same for all local rows)

  • d_nnz - array containing the number of block nonzeros in the various block rows

in the upper triangular and diagonal part of the in diagonal portion of the local (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room for the diagonal entry and set a value even if it is zero.

  • o_nz - number of block nonzeros per block row in the off-diagonal portion of local

submatrix (same for all local rows).

  • o_nnz - array containing the number of nonzeros in the various block rows of the

off-diagonal portion of the local submatrix that is right of the diagonal (possibly different for each block row) or NULL.

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the

block calculations (much slower)

  • -mat_block_size - size of the blocks to use

Level: intermediate

See also: Mat, MATMPISBAIJ, MATSBAIJ, MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), PetscSplitOwnership()

External Links

source
PETSc.LibPETSc.MatMPISBAIJSetPreallocationCSR — Method
MatMPISBAIJSetPreallocationCSR(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar})

Creates a sparse parallel matrix in MATMPISBAIJ format using the given nonzero structure and (optional) numerical values

Collective

Input Parameters:

  • B - the matrix
  • bs - the block size
  • i - the indices into j for the start of each local row (indices start with zero)
  • j - the column indices for each local row (indices start with zero) these must be sorted for each row
  • v - optional values in the matrix, pass NULL if not provided

Level: advanced

See also: Mat, MATMPISBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MATMPIAIJ, MatCreateMPISBAIJWithArrays()

External Links

source
PETSc.LibPETSc.MatMPISELLGetLocalMatCondensed — Method
A_loc::PetscMat = MatMPISELLGetLocalMatCondensed(petsclib::PetscLibType, A::AbstractPetscMat, scall::MatReuse, row::Union{Ptr, AbstractIS}, col::Union{Ptr, AbstractIS})

Creates a MATSEQSELL matrix from an MATMPISELL matrix by taking all its local rows and NON-ZERO columns

Not Collective

Input Parameters:

  • A - the matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • row - index sets of rows to extract (or NULL)
  • col - index sets of columns to extract (or NULL)

Output Parameter:

  • A_loc - the local sequential matrix generated

Level: advanced

See also: Mat, MATSEQSELL, MATMPISELL, MatGetOwnershipRange(), MatMPISELLGetLocalMat()

External Links

source
PETSc.LibPETSc.MatMPISELLGetSeqSELL — Method
Ad::PetscMat,Ao::PetscMat,colmap::Ptr{PetscInt} = MatMPISELLGetSeqSELL(petsclib::PetscLibType, A::AbstractPetscMat)

Returns the local pieces of this distributed matrix

Not Collective

Input Parameter:

  • A - the MATMPISELL matrix

Output Parameters:

  • Ad - The diagonal portion of A
  • Ao - The off-diagonal portion of A
  • colmap - An array mapping local column numbers of Ao to global column numbers of the parallel matrix

Level: advanced

See also: Mat, MATSEQSELL, MATMPISELL

External Links

source
PETSc.LibPETSc.MatMPISELLSetPreallocation — Method
MatMPISELLSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

Preallocates memory for a MATMPISELL sparse parallel matrix in sell format. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameters d_nz (or d_nnz) and o_nz (or o_nnz).

Collective

Input Parameters:

  • B - the matrix
  • d_nz - number of nonzeros per row in DIAGONAL portion of local submatrix

(same value is used for all local rows)

  • d_nnz - array containing the number of nonzeros in the various rows of the

DIAGONAL portion of the local submatrix (possibly different for each row) or NULL (PETSC_NULL_INTEGER in Fortran), if d_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'. For matrices that will be factored, you must leave room for (and set) the diagonal entry even if it is zero.

  • o_nz - number of nonzeros per row in the OFF-DIAGONAL portion of local

submatrix (same value is used for all local rows).

  • o_nnz - array containing the number of nonzeros in the various rows of the

OFF-DIAGONAL portion of the local submatrix (possibly different for each row) or NULL (PETSC_NULL_INTEGER in Fortran), if o_nz is used to specify the nonzero structure. The size of this array is equal to the number of local rows, i.e 'm'.

Example usage: Consider the following 8x8 matrix with 34 non-zero values, that is assembled across 3 processors. Lets assume that proc0 owns 3 rows, proc1 owns 3 rows, proc2 owns 2 rows. This division can be shown as follows

$1 2 0 | 0 3 0 | 0 4 Proc0 0 5 6 | 7 0 0 | 8 0 9 0 10 | 11 0 0 | 12 0 ------------------------------------- 13 0 14 | 15 16 17 | 0 0 Proc1 0 18 0 | 19 20 21 | 0 0 0 0 0 | 22 23 0 | 24 0 ------------------------------------- Proc2 25 26 27 | 0 0 28 | 29 0 30 0 0 | 31 32 33 | 0 34$

This can be represented as a collection of submatrices as

$A B C D E F G H I$

Where the submatrices A,B,C are owned by proc0, D,E,F are owned by proc1, G,H,I are owned by proc2.

The 'm' parameters for proc0,proc1,proc2 are 3,3,2 respectively. The 'n' parameters for proc0,proc1,proc2 are 3,3,2 respectively. The 'M','N' parameters are 8,8, and have the same values on all procs.

The DIAGONAL submatrices corresponding to proc0,proc1,proc2 are submatrices [A], [E], [I] respectively. The OFF-DIAGONAL submatrices corresponding to proc0,proc1,proc2 are [BC], [DF], [GH] respectively. Internally, each processor stores the DIAGONAL part, and the OFF-DIAGONAL part as MATSEQSELL matrices. For example, proc1 will store [E] as a MATSEQSELL matrix, and [DF] as another SeqSELL matrix.

When d_nz, o_nz parameters are specified, d_nz storage elements are allocated for every row of the local DIAGONAL submatrix, and onz storage locations are allocated for every row of the OFF-DIAGONAL submatrix. One way to choose `dnzandonz` is to use the maximum number of nonzeros over the local rows for each of the local DIAGONAL, and the OFF-DIAGONAL submatrices. In this case, the values of dnz,onz are `` proc0 dnz = 2, onz = 2 proc1 dnz = 3, onz = 2 proc2 dnz = 1, onz = 4 `` We are allocating m(dnz+onz) storage locations for every proc. This translates to 3(2+2)=12 for proc0, 3(3+2)=15 for proc1, 2(1+4)=10 for proc3. i.e we are using 12+15+10=37 storage locations to store 34 values.

When d_nnz, o_nnz parameters are specified, the storage is specified for every row, corresponding to both DIAGONAL and OFF-DIAGONAL submatrices. In the above case the values for dnnz,onnz are $proc0 d_nnz = [2,2,2] and o_nnz = [2,2,2] proc1 d_nnz = [3,3,2] and o_nnz = [2,1,1] proc2 d_nnz = [1,1] and o_nnz = [4,4]$ Here the space allocated is according to nz (or maximum values in the nnz if nnz is provided) for DIAGONAL and OFF-DIAGONAL submatrices, i.e (2+2+3+2)3+(1+4)2=37

Level: intermediate

See also: Mat, MatCreate(), MatCreateSeqSELL(), MatSetValues(), MatCreateSELL(), MATMPISELL, MatGetInfo(), PetscSplitOwnership(), MATSELL

External Links

source
PETSc.LibPETSc.MatMatInterpolate — Method
y::PetscMat = MatMatInterpolate(petsclib::PetscLibType, A::AbstractPetscMat, x::AbstractPetscMat)

Y = AX or A^TX depending on the shape of A

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • x - the input dense matrix

Output Parameter:

  • y - the output dense matrix

Level: intermediate

See also: Mat, MatInterpolate(), MatRestrict(), MatMatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatMatInterpolateAdd — Method
y::PetscMat = MatMatInterpolateAdd(petsclib::PetscLibType, A::AbstractPetscMat, x::AbstractPetscMat, w::AbstractPetscMat)

Y = W + AX or W + A^TX depending on the shape of A

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • x - the input dense matrix to be multiplied
  • w - the input dense matrix to be added to the result

Output Parameter:

  • y - the output dense matrix

Level: intermediate

See also: Mat, MatInterpolateAdd(), MatMatInterpolate(), MatMatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatMatMatMult — Method
D::PetscMat = MatMatMatMult(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::AbstractPetscMat, scall::MatReuse, fill::PetscReal)

Performs matrix-matrix-matrix multiplication D=ABC.

Neighbor-wise Collective

Input Parameters:

  • A - the left matrix
  • B - the middle matrix
  • C - the right matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill as ratio of nnz(D)/(nnz(A) + nnz(B)+nnz(C)), use PETSC_DETERMINE or PETSC_CURRENT if you do not have a good estimate

if the result is a dense matrix this is irrelevant

Output Parameter:

  • D - the product matrix

Level: intermediate

See also: Mat, MatProductCreate(), MATPRODUCT_ABC, MatMatMult, MatPtAP(), MatMatTransposeMult(), MatTransposeMatMult()

External Links

source
PETSc.LibPETSc.MatMatMult — Method
C::PetscMat = MatMatMult(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, scall::MatReuse, fill::PetscReal)

Performs matrix-matrix multiplication C=A*B .

Neighbor-wise Collective

Input Parameters:

  • A - the left matrix
  • B - the right matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use PETSC_DETERMINE or PETSC_CURRENT if you do not have a good estimate

if the result is a dense matrix this is irrelevant

Output Parameter:

  • C - the product matrix

See also: Mat, MatProductType, MATPRODUCT_AB, MatTransposeMatMult(), MatMatTransposeMult(), MatPtAP(), MatProductCreate(), MatProductSymbolic(), MatProductReplaceMats(), MatProductNumeric()

External Links

source
PETSc.LibPETSc.MatMatMultEqual — Method
flg::PetscBool = MatMatMultEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::AbstractPetscMat, n::PetscInt)

Test ABx = C*x for n random vector x

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMatRestrict — Method
y::PetscMat = MatMatRestrict(petsclib::PetscLibType, A::AbstractPetscMat, x::AbstractPetscMat)

Y = AX or A^TX depending on the shape of A

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • x - the input dense matrix

Output Parameter:

  • y - the output dense matrix

Level: intermediate

See also: Mat, MatRestrict(), MatInterpolate(), MatMatInterpolate(), PCMG

External Links

source
PETSc.LibPETSc.MatMatSolve — Method
MatMatSolve(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, X::AbstractPetscMat)

Solves A X = B, given a factored matrix.

Neighbor-wise Collective

Input Parameters:

  • A - the factored matrix
  • B - the right-hand-side matrix MATDENSE (or sparse MATAIJ– when using MUMPS)

Output Parameter:

  • X - the result matrix (dense matrix)

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatSolve(), MatMatSolveTranspose(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatMatSolveTranspose — Method
MatMatSolveTranspose(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, X::AbstractPetscMat)

Solves A^T X = B , given a factored matrix.

Neighbor-wise Collective

Input Parameters:

  • A - the factored matrix
  • B - the right-hand-side matrix (MATDENSE matrix)

Output Parameter:

  • X - the result matrix (dense matrix)

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatSolveTranspose(), MatMatSolve(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatMatTransposeMult — Method
C::PetscMat = MatMatTransposeMult(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, scall::MatReuse, fill::PetscReal)

Performs matrix-matrix multiplication C = A*B^T.

Neighbor-wise Collective

Input Parameters:

  • A - the left matrix
  • B - the right matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use PETSC_DETERMINE or PETSC_CURRENT if not known

Output Parameter:

  • C - the product matrix

Options Database Key:

  • -matmattransmult_mpidense_mpidense_via {allgatherv,cyclic} - Choose between algorithms for MATMPIDENSE matrices: the

first redundantly copies the transposed B matrix on each process and requires O(log P) communication complexity; the second never stores more than one portion of the B matrix at a time but requires O(P) communication complexity.

Level: intermediate

See also: Mat, MatProductCreate(), MATPRODUCT_ABt, MatMatMult(), MatTransposeMatMult(), MatPtAP(), MatProductAlgorithm, MatProductType

External Links

source
PETSc.LibPETSc.MatMatTransposeMultEqual — Method
flg::PetscBool = MatMatTransposeMultEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::AbstractPetscMat, n::PetscInt)

Test AB^Tx = C*x for n random vector x

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMatTransposeSolve — Method
MatMatTransposeSolve(petsclib::PetscLibType, A::AbstractPetscMat, Bt::AbstractPetscMat, X::AbstractPetscMat)

Solves A X = B^T, given a factored matrix.

Neighbor-wise Collective

Input Parameters:

  • A - the factored matrix
  • Bt - the transpose of right-hand-side matrix as a MATDENSE

Output Parameter:

  • X - the result matrix (dense matrix)

Level: developer

See also: Mat, Matrix Factorization, MatMatSolve(), MatMatSolveTranspose(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatMeshToCellGraph — Method
dual::PetscMat = MatMeshToCellGraph(petsclib::PetscLibType, mesh::AbstractPetscMat, ncommonnodes::PetscInt)

Convert a mesh to a cell graph.

Collective

Input Parameters:

  • mesh - the graph that represents the coupling of the vertices of the mesh
  • ncommonnodes - mesh elements that share this number of common nodes are considered neighbors, use 2 for triangles and

quadrilaterials, 3 for tetrahedrals and 4 for hexahedrals

Output Parameter:

  • dual - the dual graph

Level: advanced

See also: MatCreateMPIAdj(), MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatMult — Method
MatMult(petsclib::PetscLibType, mat::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

Computes the matrix-vector product, y = Ax.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: beginner

See also: Mat, MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatMultAdd — Method
MatMultAdd(petsclib::PetscLibType, mat::AbstractPetscMat, v1::AbstractPetscVec, v2::AbstractPetscVec, v3::AbstractPetscVec)

Computes v3 = v2 + A * v1.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • v1 - the vector to be multiplied by mat
  • v2 - the vector to be added to the result

Output Parameter:

  • v3 - the result

Level: beginner

See also: Mat, MatMultTranspose(), MatMult(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatMultAddEqual — Method
flg::PetscBool = MatMultAddEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, n::PetscInt)

Compares matrix-vector product plus vector add of two matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMultEqual(), MatMultTransposeEqual(), MatMultTransposeAddEqual()

External Links

source
PETSc.LibPETSc.MatMultDiagonalBlock — Method
MatMultDiagonalBlock(petsclib::PetscLibType, mat::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

Computes the matrix-vector product, y = Dx. Where D is defined by the inode or block structure of the diagonal

Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: developer

See also: Mat, MatMult(), MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatMultEqual — Method
flg::PetscBool = MatMultEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of two matrices using n random vectors

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMultAddEqual(), MatMultTransposeEqual(), MatMultTransposeAddEqual(), MatIsLinear(), MatEqual()

External Links

source
PETSc.LibPETSc.MatMultHermitianTranspose — Method
MatMultHermitianTranspose(petsclib::PetscLibType, mat::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

Computes matrix Hermitian-transpose times a vector y = A^H * x.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: beginner

See also: Mat, MatMult(), MatMultAdd(), MatMultHermitianTransposeAdd(), MatMultTranspose()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeAdd — Method
MatMultHermitianTransposeAdd(petsclib::PetscLibType, mat::AbstractPetscMat, v1::AbstractPetscVec, v2::AbstractPetscVec, v3::AbstractPetscVec)

Computes v3 = v2 + A^H * v1.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • v1 - the vector to be multiplied by the Hermitian transpose
  • v2 - the vector to be added to the result

Output Parameter:

  • v3 - the result

Level: beginner

See also: Mat, MatMultHermitianTranspose(), MatMultTranspose(), MatMultAdd(), MatMult()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeAddEqual — Method
flg::PetscBool = MatMultHermitianTransposeAddEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of two matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeEqual — Method
flg::PetscBool = MatMultHermitianTransposeEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of two matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMultTranspose — Method
MatMultTranspose(petsclib::PetscLibType, mat::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

Computes matrix transpose times a vector y = A^T * x.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: beginner

See also: Mat, MatMult(), MatMultAdd(), MatMultTransposeAdd(), MatMultHermitianTranspose(), MatTranspose()

External Links

source
PETSc.LibPETSc.MatMultTransposeAdd — Method
MatMultTransposeAdd(petsclib::PetscLibType, mat::AbstractPetscMat, v1::AbstractPetscVec, v2::AbstractPetscVec, v3::AbstractPetscVec)

Computes v3 = v2 + A^T * v1.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • v1 - the vector to be multiplied by the transpose of the matrix
  • v2 - the vector to be added to the result

Output Parameter:

  • v3 - the result

Level: beginner

See also: Mat, MatMultTranspose(), MatMultAdd(), MatMult()

External Links

source
PETSc.LibPETSc.MatMultTransposeAddEqual — Method
flg::PetscBool = MatMultTransposeAddEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of two matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMultTransposeEqual — Method
flg::PetscBool = MatMultTransposeEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of two matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMultEqual(), MatMultAddEqual(), MatMultTransposeAddEqual()

External Links

source
PETSc.LibPETSc.MatMumpsGetCntl — Method
val::PetscReal = MatMumpsGetCntl(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt)

Get MUMPS parameter CNTL() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array CNTL()

Output Parameter:

  • val - value of MUMPS CNTL(icntl)

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetIcntl — Method
ival::PetscInt = MatMumpsGetIcntl(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt)

Get MUMPS parameter ICNTL() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array ICNTL()

Output Parameter:

  • ival - value of MUMPS ICNTL(icntl)

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetInfo — Method
ival::PetscInt = MatMumpsGetInfo(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt)

Get MUMPS parameter INFO() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array INFO()

Output Parameter:

  • ival - value of MUMPS INFO(icntl)

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetInfog — Method
ival::PetscInt = MatMumpsGetInfog(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt)

Get MUMPS parameter INFOG() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array INFOG()

Output Parameter:

  • ival - value of MUMPS INFOG(icntl)

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetInverse — Method
MatMumpsGetInverse(petsclib::PetscLibType, F::AbstractPetscMat, spRHS::AbstractPetscMat)

Get user-specified set of entries in inverse of A https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameter:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY

Output Parameter:

  • spRHS - sequential sparse matrix in MATTRANSPOSEVIRTUAL format with requested entries of inverse of A

Level: beginner

See also: Mat, MatGetFactor(), MatCreateTranspose()

External Links

source
PETSc.LibPETSc.MatMumpsGetInverseTranspose — Method
MatMumpsGetInverseTranspose(petsclib::PetscLibType, F::AbstractPetscMat, spRHST::AbstractPetscMat)

Get user-specified set of entries in inverse of matrix A^T https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameter:

  • F - the factored matrix of A obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY

Output Parameter:

  • spRHST - sequential sparse matrix in MATAIJ format containing the requested entries of inverse of A^T

Level: beginner

See also: Mat, MatGetFactor(), MatCreateTranspose(), MatMumpsGetInverse()

External Links

source
PETSc.LibPETSc.MatMumpsGetNullPivots — Method
size::PetscInt,array::Ptr{PetscInt} = MatMumpsGetNullPivots(petsclib::PetscLibType, F::AbstractPetscMat)

Get MUMPS parameter PIVNUL_LIST() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameter:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY

Output Parameters:

  • size - local size of the array. The size of the array is non-zero only on MPI rank 0
  • array - array of rows with null pivot, these rows follow 0-based indexing. The array gets allocated within the function and the user is responsible

for freeing this array.

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo()

External Links

source
PETSc.LibPETSc.MatMumpsGetOocTmpDir — Method
tmpdir::String = MatMumpsGetOocTmpDir(petsclib::PetscLibType, F::AbstractPetscMat)

Get MUMPS out-of-core OOC_TMPDIR https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameter:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY.

Output Parameter:

  • tmpdir - temporary directory for out-of-core facility.

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetOocTmpDir, MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetRinfo — Method
val::PetscReal = MatMumpsGetRinfo(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt)

Get MUMPS parameter RINFO() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array RINFO()

Output Parameter:

  • val - value of MUMPS RINFO(icntl)

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetRinfog — Method
val::PetscReal = MatMumpsGetRinfog(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt)

Get MUMPS parameter RINFOG() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array RINFOG()

Output Parameter:

  • val - value of MUMPS RINFOG(icntl)

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo()

External Links

source
PETSc.LibPETSc.MatMumpsSetBlk — Method
MatMumpsSetBlk(petsclib::PetscLibType, F::AbstractPetscMat, nblk::PetscInt, blkvar::Vector{PetscInt}, blkptr::Vector{PetscInt})

Set user-specified variable block sizes to be used with -mat_mumps_icntl_15 1

Not collective, only relevant on the first process of the MPI communicator

Input Parameters:

  • F - the factored matrix of A obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • nblk - the number of blocks
  • blkvar - see MUMPS documentation, blkvar(blkptr(iblk):blkptr(iblk+1)-1), (iblk=1, nblk) holds the variables associated to block iblk
  • blkptr - array starting at 1 and of size nblk + 1 storing the prefix sum of all blocks

Level: advanced

See also: MATSOLVERMUMPS, Mat, MatGetFactor(), MatMumpsSetIcntl(), MatSetVariableBlockSizes()

External Links

source
PETSc.LibPETSc.MatMumpsSetCntl — Method
MatMumpsSetCntl(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt, val::PetscReal)

Set MUMPS parameter CNTL() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array CNTL()
  • val - value of MUMPS CNTL(icntl)

Options Database Key:

  • -mat_mumps_cntl_icntl val - change the option numbered icntl to ival

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsSetIcntl — Method
MatMumpsSetIcntl(petsclib::PetscLibType, F::AbstractPetscMat, icntl::PetscInt, ival::PetscInt)

Set MUMPS parameter ICNTL() https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY
  • icntl - index of MUMPS parameter array ICNTL()
  • ival - value of MUMPS ICNTL(icntl)

Options Database Key:

  • -mat_mumps_icntl_ICNTL ival - change the option numbered icntl to ival, here ICNTL denotes an integer value

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsSetOocTmpDir — Method
MatMumpsSetOocTmpDir(petsclib::PetscLibType, F::AbstractPetscMat, tmpdir::String)

Set MUMPS out-of-core OOC_TMPDIR https://mumps-solver.org/index.php?page=doc

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() with a MatSolverType of MATSOLVERMUMPS and a MatFactorType of MAT_FACTOR_LU or MAT_FACTOR_CHOLESKY.
  • tmpdir - temporary directory for out-of-core facility.

Level: beginner

See also: Mat, MatGetFactor(), MatMumpsGetOocTmpDir, MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatNestGetISs — Method
MatNestGetISs(petsclib::PetscLibType, A::AbstractPetscMat, rows::Vector{<:AbstractIS}, cols::Vector{<:AbstractIS})

Returns the index sets partitioning the row and column spaces of a MATNEST

Not Collective

Input Parameter:

  • A - MATNEST matrix

Output Parameters:

  • rows - array of row index sets (pass NULL to ignore)
  • cols - array of column index sets (pass NULL to ignore)

Level: advanced

See also: Mat, MATNEST, MatNestGetSubMat(), MatNestGetSubMats(), MatNestGetSize(), MatNestGetLocalISs(), MatCreateNest(), MatNestSetSubMats()

External Links

source
PETSc.LibPETSc.MatNestGetLocalISs — Method
MatNestGetLocalISs(petsclib::PetscLibType, A::AbstractPetscMat, rows::Vector{<:AbstractIS}, cols::Vector{<:AbstractIS})

Returns the index sets partitioning the row and column spaces of a MATNEST

Not Collective

Input Parameter:

  • A - MATNEST matrix

Output Parameters:

  • rows - array of row index sets (pass NULL to ignore)
  • cols - array of column index sets (pass NULL to ignore)

Level: advanced

See also: Mat, MATNEST, MatNestGetSubMat(), MatNestGetSubMats(), MatNestGetSize(), MatNestGetISs(), MatCreateNest(), MatNestSetSubMats(), MatNestSetSubMat()

External Links

source
PETSc.LibPETSc.MatNestGetSize — Method
M::PetscInt,N::PetscInt = MatNestGetSize(petsclib::PetscLibType, A::AbstractPetscMat)

Returns the size of the MATNEST matrix.

Not Collective

Input Parameter:

  • A - MATNEST matrix

Output Parameters:

  • M - number of rows in the nested mat
  • N - number of cols in the nested mat

Level: developer

See also: Mat, MATNEST, MatNestGetSubMat(), MatNestGetSubMats(), MatCreateNest(), MatNestGetLocalISs(), MatNestGetISs()

External Links

source
PETSc.LibPETSc.MatNestGetSubMat — Method
sub::PetscMat = MatNestGetSubMat(petsclib::PetscLibType, A::AbstractPetscMat, idxm::PetscInt, jdxm::PetscInt)

Returns a single, sub-matrix from a MATNEST

Not Collective

Input Parameters:

  • A - MATNEST matrix
  • idxm - index of the matrix within the nest matrix
  • jdxm - index of the matrix within the nest matrix

Output Parameter:

  • sub - matrix at index idxm, jdxm within the nest matrix

Level: developer

See also: Mat, MATNEST, MatNestGetSize(), MatNestGetSubMats(), MatCreateNest(), MatNestSetSubMat(), MatNestGetLocalISs(), MatNestGetISs()

External Links

source
PETSc.LibPETSc.MatNestGetSubMats — Method
M::PetscInt,N::PetscInt,mat::PetscMat = MatNestGetSubMats(petsclib::PetscLibType, A::AbstractPetscMat)

Returns the entire two dimensional array of matrices defining a MATNEST matrix.

Not Collective

Input Parameter:

  • A - nest matrix

Output Parameters:

  • M - number of submatrix rows in the nest matrix
  • N - number of submatrix columns in the nest matrix
  • mat - array of matrices

Level: developer

See also: Mat, MATNEST, MatNestGetSize(), MatNestGetSubMat(), MatNestGetLocalISs(), MatCreateNest(), MatNestSetSubMats(), MatNestGetISs(), MatNestSetSubMat()

External Links

source
PETSc.LibPETSc.MatNestSetSubMat — Method
MatNestSetSubMat(petsclib::PetscLibType, A::AbstractPetscMat, idxm::PetscInt, jdxm::PetscInt, sub::AbstractPetscMat)

Set a single submatrix in the MATNEST

Logically Collective

Input Parameters:

  • A - MATNEST matrix
  • idxm - index of the matrix within the nest matrix
  • jdxm - index of the matrix within the nest matrix
  • sub - matrix at index idxm, jdxm within the nest matrix

Level: developer

See also: Mat, MATNEST, MatNestSetSubMats(), MatNestGetSubMats(), MatNestGetLocalISs(), MatCreateNest(), MatNestGetSubMat(), MatNestGetISs(), MatNestGetSize()

External Links

source
PETSc.LibPETSc.MatNestSetSubMats — Method
MatNestSetSubMats(petsclib::PetscLibType, A::AbstractPetscMat, nr::PetscInt, is_row::Vector{<:AbstractIS}, nc::PetscInt, is_col::Vector{<:AbstractIS}, M_a::Vector{<:AbstractPetscMat})

Sets the nested submatrices in a MATNEST

Collective

Input Parameters:

  • A - MATNEST matrix
  • nr - number of nested row blocks
  • is_row - index sets for each nested row block, or NULL to make contiguous
  • nc - number of nested column blocks
  • is_col - index sets for each nested column block, or NULL to make contiguous
  • a - array of nr \times nc submatrices, or NULL

Level: advanced

See also: Mat, MATNEST, MatCreateNest(), MatNestSetSubMat(), MatNestGetSubMat(), MatNestGetSubMats()

External Links

source
PETSc.LibPETSc.MatNestSetVecType — Method
MatNestSetVecType(petsclib::PetscLibType, A::AbstractPetscMat, vtype::String)

Sets the type of Vec returned by MatCreateVecs()

Not Collective

Input Parameters:

  • A - MATNEST matrix
  • vtype - VecType to use for creating vectors

Level: developer

See also: Mat, MATNEST, MatCreateVecs(), MatCreateNest(), VecType

External Links

source
PETSc.LibPETSc.MatNorm — Method
nrm::PetscReal = MatNorm(petsclib::PetscLibType, mat::AbstractPetscMat, type::NormType)

Calculates various norms of a matrix.

Collective

Input Parameters:

  • mat - the matrix
  • type - the type of norm, NORM_1, NORM_FROBENIUS, NORM_INFINITY

Output Parameter:

  • nrm - the resulting norm

Level: intermediate

See also: Mat

External Links

source
PETSc.LibPETSc.MatNormalGetMat — Method
M::PetscMat = MatNormalGetMat(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the Mat object stored inside a MATNORMAL

Logically Collective

Input Parameter:

  • A - the MATNORMAL matrix

Output Parameter:

  • M - the matrix object stored inside A

Level: intermediate

See also: Mat, MATNORMAL, MATNORMALHERMITIAN, MatCreateNormal()

External Links

source
PETSc.LibPETSc.MatNormalHermitianGetMat — Method
M::PetscMat = MatNormalHermitianGetMat(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the Mat object stored inside a MATNORMALHERMITIAN

Logically Collective

Input Parameter:

  • A - the MATNORMALHERMITIAN matrix

Output Parameter:

  • M - the matrix object stored inside A

Level: intermediate

See also: Mat, MATNORMALHERMITIAN, MatCreateNormalHermitian()

External Links

source
PETSc.LibPETSc.MatOrderingRegister — Method
MatOrderingRegister(petsclib::PetscLibType, sname::String, fnc::external)

Adds a new sparse matrix ordering to the matrix package.

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of ordering (for example MATORDERINGND)
  • function - function pointer that creates the ordering

Level: developer

See also: Mat, MatOrderingType, MatOrderingRegisterAll(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatPermute — Method
B::PetscMat = MatPermute(petsclib::PetscLibType, mat::AbstractPetscMat, row::AbstractIS, col::AbstractIS)

Creates a new matrix with rows and columns permuted from the original.

Collective

Input Parameters:

  • mat - the matrix to permute
  • row - row permutation, each processor supplies only the permutation for its rows
  • col - column permutation, each processor supplies only the permutation for its columns

Output Parameter:

  • B - the permuted matrix

Level: advanced

See also: Mat, MatGetOrdering(), ISAllGather(), MatCreateSubMatrix()

External Links

source
PETSc.LibPETSc.MatPreallocatorPreallocate — Method
MatPreallocatorPreallocate(petsclib::PetscLibType, mat::AbstractPetscMat, fill::PetscBool, A::AbstractPetscMat)

Preallocates the A matrix, using information from a MATPREALLOCATOR mat, optionally filling A with zeros

Input Parameters:

  • mat - the MATPREALLOCATOR preallocator matrix
  • fill - fill the matrix with zeros
  • A - the matrix to be preallocated

See also: MATPREALLOCATOR, MatXAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatProductClear — Method
MatProductClear(petsclib::PetscLibType, mat::AbstractPetscMat)

Clears from the matrix any internal data structures related to the computation of the values of the matrix from matrix-matrix product operations

Collective

Input Parameter:

  • mat - the matrix whose values are to be computed via a matrix-matrix product operation

Options Database Key:

  • -mat_product_clear - Clear intermediate data structures after MatProductNumeric() has been called

Level: intermediate

See also: MatProduct, Mat, MatProductCreate()

External Links

source
PETSc.LibPETSc.MatProductCreate — Method
D::PetscMat = MatProductCreate(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::Union{Ptr, AbstractPetscMat})

create a matrix to hold the result of a matrix-matrix (or matrix-matrix-matrix) product operation

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix (or NULL)

Output Parameter:

  • D - the matrix whose values are to be computed via a matrix-matrix product operation

Level: intermediate

Example: $MatProductCreate(A,B,C,&D); or MatProductCreateWithMat(A,B,C,D) MatProductSetType(D, MATPRODUCT_AB or MATPRODUCT_AtB or MATPRODUCT_ABt or MATPRODUCT_PtAP or MATPRODUCT_RARt or MATPRODUCT_ABC) MatProductSetAlgorithm(D, alg) MatProductSetFill(D,fill) MatProductSetFromOptions(D) MatProductSymbolic(D) MatProductNumeric(D) Change numerical values in some of the matrices MatProductNumeric(D)$

See also: MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductSetAlgorithm(), MatProductClear(), MatProductSymbolic(), MatProductNumeric(), MatProductAlgorithm, MatProductType

External Links

source
PETSc.LibPETSc.MatProductCreateWithMat — Method
MatProductCreateWithMat(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::Union{Ptr, AbstractPetscMat}, D::AbstractPetscMat)

Set a given matrix to have its values computed via matrix-matrix operations on other matrices.

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix (optional, use NULL if not needed)
  • D - the matrix whose values are to be computed via a matrix-matrix product operation

Level: intermediate

See also: MatProduct, Mat, MatProductType, MatProductSetType(), MatProductAlgorithm, MatProductSetAlgorithm, MatProductCreate(), MatProductClear()

External Links

source
PETSc.LibPETSc.MatProductGetAlgorithm — Method
alg::String = MatProductGetAlgorithm(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the selected algorithm for a matrix-matrix product operation

Not Collective

Input Parameter:

  • mat - the matrix whose values are computed via a matrix-matrix product operation

Output Parameter:

  • alg - the selected algorithm of the matrix product, e.g., MATPRODUCTALGORITHMDEFAULT.

Level: intermediate

See also: MatProduct, Mat, MatProductSetAlgorithm()

External Links

source
PETSc.LibPETSc.MatProductGetMats — Method
A::PetscMat,B::PetscMat,C::PetscMat = MatProductGetMats(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the matrices associated with the matrix-matrix product associated with computing values for the given matrix

Not Collective

Input Parameter:

  • mat - the matrix whose values are to be computed via a matrix-matrix product operation

Output Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix (may be NULL for some MatProductType)

Level: intermediate

See also: MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductSetAlgorithm(), MatProductCreate()

External Links

source
PETSc.LibPETSc.MatProductGetType — Method
mtype::MatProductType = MatProductGetType(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the type of matrix-matrix product associated with computing values for the given matrix

Not Collective

Input Parameter:

  • mat - the matrix whose values are to be computed via a matrix-matrix product operation

Output Parameter:

  • mtype - the MatProductType

Level: intermediate

See also: MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductCreate(), MatProductType, MatProductAlgorithm

External Links

source
PETSc.LibPETSc.MatProductNumeric — Method
MatProductNumeric(petsclib::PetscLibType, mat::AbstractPetscMat)

Compute a matrix-matrix product operation with the numerical values

Collective

Input/Output Parameter:

  • mat - the matrix whose values are computed via a matrix-matrix product operation

Level: intermediate

See also: MatProduct, Mat, MatProductSetAlgorithm(), MatProductSetType(), MatProductCreate(), MatSetType(), MatProductSymbolic()

External Links

source
PETSc.LibPETSc.MatProductReplaceMats — Method
MatProductReplaceMats(petsclib::PetscLibType, A::Union{Ptr, AbstractPetscMat}, B::Union{Ptr, AbstractPetscMat}, C::Union{Ptr, AbstractPetscMat}, D::Union{Ptr, AbstractPetscMat})

Replace the input matrices for the matrix-matrix product operation inside the computed matrix

Collective

Input Parameters:

  • A - the matrix or NULL if not being replaced
  • B - the matrix or NULL if not being replaced
  • C - the matrix or NULL if not being replaced
  • D - the matrix whose values are computed via a matrix-matrix product operation

Level: intermediate

See also: MatProduct, Mat, MatProductCreate(), MatProductSetFromOptions(), MatProductSymbolic(), MatProductClear()

External Links

source
PETSc.LibPETSc.MatProductSetAlgorithm — Method
MatProductSetAlgorithm(petsclib::PetscLibType, mat::AbstractPetscMat, alg::String)

Requests a particular algorithm for a matrix-matrix product operation that will perform to compute the given matrix

Collective

Input Parameters:

  • mat - the matrix whose values are computed via a matrix-matrix product operation
  • alg - particular implementation algorithm of the matrix product, e.g., MATPRODUCTALGORITHMDEFAULT.

Options Database Key:

  • -mat_product_algorithm algorithm - Sets the algorithm, see MatProductAlgorithm

Level: intermediate

See also: MatProduct, Mat, MatProductClear(), MatProductSetType(), MatProductSetFill(), MatProductCreate(), MatProductAlgorithm, MatProductType, MatProductGetAlgorithm()

External Links

source
PETSc.LibPETSc.MatProductSetFill — Method
MatProductSetFill(petsclib::PetscLibType, mat::AbstractPetscMat, fill::PetscReal)

Set an expected fill of the matrix whose values are computed via a matrix-matrix product operation

Collective

Input Parameters:

  • mat - the matrix whose values are to be computed via a matrix-matrix product operation
  • fill - expected fill as ratio of nnz(mat)/(nnz(A) + nnz(B) + nnz(C)); use PETSC_DETERMINE or PETSC_CURRENT if you do not have a good estimate.

If the product is a dense matrix, this value is not used.

Level: intermediate

See also: MatProduct, PETSC_DETERMINE, Mat, MatProductSetFromOptions(), MatProductSetType(), MatProductSetAlgorithm(), MatProductCreate()

External Links

source
PETSc.LibPETSc.MatProductSetFromOptions — Method
MatProductSetFromOptions(petsclib::PetscLibType, mat::AbstractPetscMat)

Sets the options for the computation of a matrix-matrix product operation where the type, the algorithm etc are determined from the options database.

Logically Collective

Input Parameter:

  • mat - the matrix whose values are computed via a matrix-matrix product operation

Options Database Keys:

  • -mat_product_clear - Clear intermediate data structures after MatProductNumeric() has been called
  • -mat_product_algorithm algorithm - Sets the algorithm, see MatProductAlgorithm for possible values
  • -mat_product_algorithm_backend_cpu - Use the CPU to perform the computation even if the matrix is a GPU matrix

Level: intermediate

See also: MatProduct, Mat, MatSetFromOptions(), MatProductCreate(), MatProductCreateWithMat(), MatProductNumeric(), MatProductSetType(), MatProductSetAlgorithm(), MatProductAlgorithm

External Links

source
PETSc.LibPETSc.MatProductSetType — Method
MatProductSetType(petsclib::PetscLibType, mat::AbstractPetscMat, productype::MatProductType)

Sets a particular matrix-matrix product operation to be used to compute the values of the given matrix

Collective

Input Parameters:

  • mat - the matrix whose values are computed via a matrix-matrix product operation
  • productype - matrix product type, e.g., MATPRODUCT_AB,MATPRODUCT_AtB,MATPRODUCT_ABt,MATPRODUCT_PtAP,MATPRODUCT_RARt,MATPRODUCT_ABC,

see MatProductType

Level: intermediate

See also: MatProduct, Mat, MatProductCreate(), MatProductType, MATPRODUCT_AB, MATPRODUCT_AtB, MATPRODUCT_ABt, MATPRODUCT_PtAP, MATPRODUCT_RARt, MATPRODUCT_ABC

External Links

source
PETSc.LibPETSc.MatProductSymbolic — Method
MatProductSymbolic(petsclib::PetscLibType, mat::AbstractPetscMat)

Perform the symbolic portion of a matrix-matrix product operation, this creates a data structure for use with the numerical product to be done with MatProductNumeric()

Collective

Input/Output Parameter:

  • mat - the matrix whose values are to be computed via a matrix-matrix product operation

Level: intermediate

See also: MatProduct, Mat, MatProductCreate(), MatProductCreateWithMat(), MatProductSetFromOptions(), MatProductNumeric(), MatProductSetType(), MatProductSetAlgorithm()

External Links

source
PETSc.LibPETSc.MatProductView — Method
MatProductView(petsclib::PetscLibType, mat::AbstractPetscMat, viewer::PetscViewer)

View the private matrix-matrix algorithm object within a matrix

Logically Collective

Input Parameters:

  • mat - the matrix obtained with MatProductCreate() or MatProductCreateWithMat()
  • viewer - where the information on the matrix-matrix algorithm of mat should be reviewed

Level: intermediate

See also: MatProductType, Mat, MatProductSetFromOptions(), MatView(), MatProductCreate(), MatProductCreateWithMat()

External Links

source
PETSc.LibPETSc.MatPropagateSymmetryOptions — Method
MatPropagateSymmetryOptions(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat)

Propagates symmetry options set on a matrix to another matrix

Not Collective

Input Parameters:

  • A - the matrix we wish to propagate options from
  • B - the matrix we wish to propagate options to

Level: beginner

See also: Mat, MatSetOption(), MatIsSymmetricKnown(), MatIsSPDKnown(), MatIsHermitianKnown(), MatIsStructurallySymmetricKnown()

External Links

source
PETSc.LibPETSc.MatPtAP — Method
C::PetscMat = MatPtAP(petsclib::PetscLibType, A::AbstractPetscMat, P::AbstractPetscMat, scall::MatReuse, fill::PetscReal)

Creates the matrix product C = P^T * A * P

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • P - the projection matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill as ratio of nnz(C)/(nnz(A) + nnz(P)), use PETSC_DETERMINE or PETSC_CURRENT if you do not have a good estimate

if the result is a dense matrix this is irrelevant

Output Parameter:

  • C - the product matrix

Level: intermediate

See also: Mat, MatProductCreate(), MatMatMult(), MatRARt()

External Links

source
PETSc.LibPETSc.MatPtAPMultEqual — Method
flg::PetscBool = MatPtAPMultEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of C = BtAB

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatPythonCreate — Method
A::PetscMat = MatPythonCreate(petsclib::PetscLibType, comm::MPI_Comm, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, pyname::String)

Create a Mat object implemented in Python.

Collective

Input Parameters:

  • comm - MPI communicator
  • m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
  • n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
  • M - number of global rows (or PETSC_DECIDE to have calculated if m is given)
  • N - number of global columns (or PETSC_DECIDE to have calculated if n is given)
  • pyname - full dotted Python name [package].module[.{class|function}]

Output Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MatType, MATPYTHON, MatPythonSetType(), PetscPythonInitialize()

External Links

source
PETSc.LibPETSc.MatPythonGetType — Method
pyname::String = MatPythonGetType(petsclib::PetscLibType, mat::AbstractPetscMat)

Get the Python name of a Mat object implemented in Python.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • pyname - full dotted Python name [package].module[.{class|function}]

Level: intermediate

See also: Mat, MatType, MatCreate(), MatSetType(), MATPYTHON, PetscPythonInitialize(), MatPythonSetType()

External Links

source
PETSc.LibPETSc.MatPythonSetType — Method
MatPythonSetType(petsclib::PetscLibType, mat::AbstractPetscMat, pyname::String)

Initialize a Mat object implemented in Python.

Collective

Input Parameters:

  • mat - the matrix object.
  • pyname - full dotted Python name [package].module[.{class|function}]

Options Database Key:

  • -mat_python_type pyname - python class

Level: intermediate

See also: Mat, MatType, MatCreate(), MatSetType(), MATPYTHON, PetscPythonInitialize()

External Links

source
PETSc.LibPETSc.MatQRFactor — Method
MatQRFactor(petsclib::PetscLibType, mat::AbstractPetscMat, col::AbstractIS, info::Vector{MatFactorInfo})

Performs in-place QR factorization of matrix.

Collective

Input Parameters:

  • mat - the matrix
  • col - column permutation
  • info - options for factorization, includes

$fill - expected fill as ratio of original fill. dtcol - pivot tolerance (0 no pivot, 1 full column pivoting) Run with the option -info to determine an optimal value to use$

Level: developer

See also: Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatQRFactorSymbolic(), MatQRFactorNumeric(), MatLUFactor(), MatSetUnfactored()

External Links

source
PETSc.LibPETSc.MatQRFactorNumeric — Method
MatQRFactorNumeric(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, info::Vector{MatFactorInfo})

Performs numeric QR factorization of a matrix. Call this routine after first calling MatGetFactor(), and MatQRFactorSymbolic().

Collective

Input Parameters:

  • fact - the factor matrix obtained with MatGetFactor()
  • mat - the matrix
  • info - options for factorization

Level: developer

See also: Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatQRFactor(), MatQRFactorSymbolic(), MatLUFactor()

External Links

source
PETSc.LibPETSc.MatQRFactorSymbolic — Method
MatQRFactorSymbolic(petsclib::PetscLibType, fact::AbstractPetscMat, mat::AbstractPetscMat, col::AbstractIS, info::Vector{MatFactorInfo})

Performs symbolic QR factorization of matrix. Call this routine after MatGetFactor() but before calling MatQRFactorNumeric().

Collective

Input Parameters:

  • fact - the factor matrix obtained with MatGetFactor()
  • mat - the matrix
  • col - column permutation
  • info - options for factorization, includes

$fill - expected fill as ratio of original fill. dtcol - pivot tolerance (0 no pivot, 1 full column pivoting) Run with the option -info to determine an optimal value to use$

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatFactorInfo, MatQRFactor(), MatQRFactorNumeric(), MatLUFactor(), MatFactorInfoInitialize()

External Links

source
PETSc.LibPETSc.MatRARt — Method
C::PetscMat = MatRARt(petsclib::PetscLibType, A::AbstractPetscMat, R::AbstractPetscMat, scall::MatReuse, fill::PetscReal)

Creates the matrix product C = R * A * R^T

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • R - the projection matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill as ratio of nnz(C)/nnz(A), use PETSC_DETERMINE or PETSC_CURRENT if you do not have a good estimate

if the result is a dense matrix this is irrelevant

Output Parameter:

  • C - the product matrix

Level: intermediate

See also: Mat, MatProductCreate(), MatMatMult(), MatPtAP()

External Links

source
PETSc.LibPETSc.MatRARtMultEqual — Method
flg::PetscBool = MatRARtMultEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::AbstractPetscMat, n::PetscInt)

Compares matrix-vector products of C = BAB^t

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatRealPart — Method
MatRealPart(petsclib::PetscLibType, mat::AbstractPetscMat)

Zeros out the imaginary part of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Level: advanced

See also: Mat, MatImaginaryPart()

External Links

source
PETSc.LibPETSc.MatRegister — Method
MatRegister(petsclib::PetscLibType, sname::String, fnc::external)

Adds a new matrix type implementation that is usable as a Mat in PETSc

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of a new user-defined matrix type
  • function - routine to create method context

Level: advanced

See also: Mat, MatType, MatSetType(), MatRegisterAll()

External Links

source
PETSc.LibPETSc.MatRegisterRootName — Method
MatRegisterRootName(petsclib::PetscLibType, rname::String, sname::String, mname::String)

Registers a name that can be used for either a sequential or its corresponding parallel matrix type.

Input Parameters:

  • rname - the rootname, for example, MATAIJ
  • sname - the name of the sequential matrix type, for example, MATSEQAIJ
  • mname - the name of the parallel matrix type, for example, MATMPIAIJ

Level: developer

See also: Mat, MatType, PetscObjectBaseTypeCompare()

External Links

source
PETSc.LibPETSc.MatReorderForNonzeroDiagonal — Method
MatReorderForNonzeroDiagonal(petsclib::PetscLibType, mat::AbstractPetscMat, abstol::PetscReal, ris::AbstractIS, cis::AbstractIS)

Changes matrix ordering to remove zeros from diagonal. This may help in the PCLU factorization to prevent a zero pivot.

Collective

Input Parameters:

  • mat - matrix to reorder
  • abstol - absolute tolerance, it attempts to move all values smaller off the diagonal
  • ris - the row reordering
  • cis - the column reordering; this may be changed

Level: intermediate

Options Database Key:

  • -pc_factor_nonzeros_along_diagonal - Reorder to remove zeros from diagonal

See also: Mat, MatGetFactor(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatReorderingSeqSBAIJ — Method
MatReorderingSeqSBAIJ(petsclib::PetscLibType, A::AbstractPetscMat, perm::AbstractIS)

Prepare an updated index structure for a symmetric reordering of a MATSEQSBAIJ matrix.

Not Collective

Input Parameters:

  • A - the MATSEQSBAIJ matrix
  • perm - the (assumed symmetric) permutation to be applied

Level: developer

See also: Mat, MATSEQSBAIJ, MatGetOrdering(), MatPermute()

External Links

source
PETSc.LibPETSc.MatResetHash — Method
MatResetHash(petsclib::PetscLibType, A::AbstractPetscMat)

Reset the matrix so that it will use a hash table for the next round of MatSetValues() and MatAssemblyBegin()/MatAssemblyEnd().

Collective

Input Parameter:

  • A - the matrix

Level: intermediate

See also: Mat, MatResetPreallocation()

External Links

source
PETSc.LibPETSc.MatResetPreallocation — Method
MatResetPreallocation(petsclib::PetscLibType, A::AbstractPetscMat)

Reset matrix to use the original preallocation values provided by the user, for example with MatXAIJSetPreallocation()

Collective

Input Parameter:

  • A - the matrix

Level: beginner

See also: Mat, MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatXAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatResidual — Method
MatResidual(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, x::AbstractPetscVec, r::AbstractPetscVec)

Default routine to calculate the residual r = b - Ax

Collective

Input Parameters:

  • mat - the matrix
  • b - the right-hand-side
  • x - the approximate solution

Output Parameter:

  • r - location to store the residual

Level: developer

See also: Mat, MatMult(), MatMultAdd(), PCMGSetResidual()

External Links

source
PETSc.LibPETSc.MatRestoreColumnIJ — Method
done::PetscBool = MatRestoreColumnIJ(petsclib::PetscLibType, mat::AbstractPetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool, ia::Vector{PetscInt}, ja::Vector{PetscInt})

Call after you are completed with the ia,ja indices obtained with MatGetColumnIJ().

Collective

Input Parameters:

  • mat - the matrix
  • shift - 1 or zero indicating we want the indices starting at 0 or 1
  • symmetric - PETSC_TRUE or PETSC_FALSE indicating the matrix data structure should be symmetrized
  • inodecompressed - PETSC_TRUE or PETSC_FALSE indicating if the nonzero structure of the

inodes or the nonzero elements is wanted. For MATBAIJ matrices the compressed version is always used.

Output Parameters:

  • n - size of (possibly compressed) matrix
  • ia - the column pointers
  • ja - the row indices
  • done - PETSC_TRUE or PETSC_FALSE indicated that the values have been returned

Level: developer

See also: Mat, MatGetColumnIJ(), MatRestoreRowIJ()

External Links

source
PETSc.LibPETSc.MatRestoreLocalSubMatrix — Method
MatRestoreLocalSubMatrix(petsclib::PetscLibType, mat::AbstractPetscMat, isrow::AbstractIS, iscol::AbstractIS, submat::AbstractPetscMat)

Restores a reference to a submatrix specified in local numbering obtained with MatGetLocalSubMatrix()

Not Collective

Input Parameters:

  • mat - matrix to extract local submatrix from
  • isrow - local row indices for submatrix
  • iscol - local column indices for submatrix
  • submat - the submatrix

Level: intermediate

See also: Mat, MatGetLocalSubMatrix()

External Links

source
PETSc.LibPETSc.MatRestoreNullSpaces — Method
MatRestoreNullSpaces(petsclib::PetscLibType, n::PetscInt, mat::Vector{<:AbstractPetscMat}, nullsp::Union{Ptr, AbstractArray{MatNullSpace}})

sets the null spaces, transpose null spaces, and near null spaces obtained with MatGetNullSpaces() for an array of matrices

Logically Collective

Input Parameters:

  • n - the number of matrices
  • mat - the array of matrices
  • nullsp - an array of null spaces

Level: developer

See also: Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), MatGetNullSpaces()

External Links

source
PETSc.LibPETSc.MatRestoreRow — Method
MatRestoreRow(petsclib::PetscLibType, mat::AbstractPetscMat, row::PetscInt, ncols::PetscInt, cols::Union{Ptr, AbstractArray{PetscInt}}, vals::Union{Ptr, AbstractArray{PetscScalar}})

Frees any temporary space allocated by MatGetRow().

Not Collective

Input Parameters:

  • mat - the matrix
  • row - the row to get
  • ncols - the number of nonzeros
  • cols - the columns of the nonzeros
  • vals - if nonzero the column values

Level: advanced

See also: Mat, MatGetRow()

External Links

source
PETSc.LibPETSc.MatRestoreRowIJ — Method
done::PetscBool = MatRestoreRowIJ(petsclib::PetscLibType, mat::AbstractPetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool, ia::Vector{PetscInt}, ja::Vector{PetscInt})

Call after you are completed with the ia,ja indices obtained with MatGetRowIJ().

Collective

Input Parameters:

  • mat - the matrix
  • shift - 1 or zero indicating we want the indices starting at 0 or 1
  • symmetric - PETSC_TRUE or PETSC_FALSE indicating the matrix data structure should be symmetrized
  • inodecompressed - PETSC_TRUE or PETSC_FALSE indicating if the nonzero structure of the

inodes or the nonzero elements is wanted. For MATBAIJ matrices the compressed version is always used.

  • n - size of (possibly compressed) matrix
  • ia - the row pointers
  • ja - the column indices

Output Parameter:

  • done - PETSC_TRUE or PETSC_FALSE indicated that the values have been returned

Level: developer

See also: Mat, MatGetRowIJ(), MatRestoreColumnIJ()

External Links

source
PETSc.LibPETSc.MatRestrict — Method
MatRestrict(petsclib::PetscLibType, A::AbstractPetscMat, x::AbstractPetscVec, y::AbstractPetscVec)

y = Ax or A^Tx

Neighbor-wise Collective

Input Parameters:

  • A - the matrix
  • x - the vector to be restricted

Output Parameter:

  • y - the resulting vector

Level: intermediate

See also: Mat, MatMultAdd(), MatMultTransposeAdd(), MatInterpolate(), PCMG

External Links

source
PETSc.LibPETSc.MatRetrieveValues — Method
MatRetrieveValues(petsclib::PetscLibType, mat::AbstractPetscMat)

Retrieves the copy of the matrix values that was stored with MatStoreValues()

Logically Collect

Input Parameter:

  • mat - the matrix (currently only MATAIJ matrices support this option)

Level: advanced

See also: Mat, MatStoreValues()

External Links

source
PETSc.LibPETSc.MatSNESMFGetReuseBase — Method
use::PetscBool = MatSNESMFGetReuseBase(petsclib::PetscLibType, J::AbstractPetscMat)

Determines if the base vector is to be used for differencing even if the function provided to SNESSetFunction() is not the same as that provided to MatMFFDSetFunction().

Logically Collective

Input Parameter:

  • J - the MATMFFD matrix

Output Parameter:

  • use - if true always reuse the base vector instead of recomputing f(u) even if the function in the MATMFFD is

not SNESComputeFunction()

Level: advanced

See also: Mat, SNES, MatSNESMFSetReuseBase(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatSNESMFGetSNES — Method
snes::SNES = MatSNESMFGetSNES(petsclib::PetscLibType, J::AbstractPetscMat)

returns the SNES associated with a matrix created with MatCreateSNESMF()

Not Collective

Input Parameter:

  • J - the matrix

Output Parameter:

  • snes - the SNES object

Level: advanced

See also: Mat, SNES, MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatSNESMFMoreSetParameters — Method
MatSNESMFMoreSetParameters(petsclib::PetscLibType, mat::AbstractPetscMat, error::PetscReal, umin::PetscReal, h::PetscReal)

Sets the parameters for the approximation of matrix-vector products using finite differences, see MatCreateSNESMFMore()

Input Parameters:

  • mat - the matrix
  • error - relative error (should be set to the square root of the relative error in the function evaluations)
  • umin - minimum allowable u-value
  • h - differencing parameter

Options Database Keys:

  • -snes_mf_err error_rel - see MatCreateSNESMF()
  • -snes_mf_umin umin - see MatCreateSNESMF()
  • -snes_mf_compute_err - compute the square root or relative error in function
  • -snes_mf_freq_err freq - set the frequency to recompute the parameters
  • -snes_mf_jorge - use the method of Jorge More

Level: advanced

See also: SNES, MatCreateSNESMF(), MatCreateSNESMFMore()

External Links

source
PETSc.LibPETSc.MatSNESMFSetReuseBase — Method
MatSNESMFSetReuseBase(petsclib::PetscLibType, J::AbstractPetscMat, use::PetscBool)

Causes the base vector to be used for differencing even if the function provided to SNESSetFunction() is not the same as that provided to MatMFFDSetFunction().

Logically Collective

Input Parameters:

  • J - the MATMFFD matrix
  • use - if true always reuse the base vector instead of recomputing f(u) even if the function in the MATMFFD is

not SNESComputeFunction()

Level: advanced

See also: SNES, MATMFFD, MatMFFDSetFunction(), SNESSetFunction(), MatCreateSNESMF(), MatSNESMFGetReuseBase()

External Links

source
PETSc.LibPETSc.MatSOR — Method
MatSOR(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, omega::PetscReal, flag::MatSORType, shift::PetscReal, its::PetscInt, lits::PetscInt, x::AbstractPetscVec)

Computes relaxation (SOR, Gauss-Seidel) sweeps.

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • b - the right-hand side
  • omega - the relaxation factor
  • flag - flag indicating the type of SOR (see below)
  • shift - diagonal shift
  • its - the number of iterations
  • lits - the number of local iterations

Output Parameter:

  • x - the solution (can contain an initial guess, use option SOR_ZERO_INITIAL_GUESS to indicate no guess)

SOR Flags:

  • SOR_FORWARD_SWEEP - forward SOR
  • SOR_BACKWARD_SWEEP - backward SOR
  • SOR_SYMMETRIC_SWEEP - SSOR (symmetric SOR)
  • SOR_LOCAL_FORWARD_SWEEP - local forward SOR
  • SOR_LOCAL_BACKWARD_SWEEP - local forward SOR
  • SOR_LOCAL_SYMMETRIC_SWEEP - local SSOR
  • SOR_EISENSTAT - SOR with Eisenstat trick
  • SOR_APPLY_UPPER, SOR_APPLY_LOWER - applies upper/lower triangular part of matrix to vector (with omega)
  • SOR_ZERO_INITIAL_GUESS - zero initial guess

Level: developer

See also: Mat, MatMult(), KSP, PC, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetColPerm — Method
cperm::PetscBool = MatSTRUMPACKGetColPerm(petsclib::PetscLibType, F::AbstractPetscMat)

Get whether STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master will try to permute the columns of the matrix in order to get a nonzero diagonal

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()

Output Parameter:

  • cperm - Indicates whether STRUMPACK will permute columns

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatSTRUMPACKSetReordering(), Mat, MatGetFactor(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompAbsTol — Method
atol::PetscReal = MatSTRUMPACKGetCompAbsTol(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master absolute tolerance for compression

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()

Output Parameter:

  • atol - absolute compression tolerance

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatGetFactor(), MatSTRUMPACKSetCompAbsTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompButterflyLevels — Method
bfly_lvls::PetscInt = MatSTRUMPACKGetCompButterflyLevels(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master number of butterfly levels in HODLR compression (requires ButterflyPACK support)

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • bfly_lvls - Number of levels of butterfly compression in HODLR compression

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetCompButterflyLevels()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompLeafSize — Method
leaf_size::PetscInt = MatSTRUMPACKGetCompLeafSize(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master leaf size for HSS, BLR, HODLR...

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • leaf_size - Size of diagonal blocks in rank-structured approximation

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatGetFactor(), MatSTRUMPACKSetCompLeafSize(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompLossyPrecision — Method
lossy_prec::PetscInt = MatSTRUMPACKGetCompLossyPrecision(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master precision for lossy compression (requires ZFP support)

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • lossy_prec - Number of bitplanes to use in lossy compression

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetCompLossyPrecision()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompMinSepSize — Method
min_sep_size::PetscInt = MatSTRUMPACKGetCompMinSepSize(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master minimum separator size for low-rank approximation

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • min_sep_size - minimum dense matrix size for low-rank approximation

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetCompMinSepSize()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompRelTol — Method
rtol::PetscReal = MatSTRUMPACKGetCompRelTol(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master relative tolerance for compression

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()

Output Parameter:

  • rtol - relative compression tolerance

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatGetFactor(), MatSTRUMPACKSetCompRelTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompression — Method
comp::MatSTRUMPACKCompressionType = MatSTRUMPACKGetCompression(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master compression type

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • comp - Type of compression to be used in the approximate sparse factorization

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKCompressionType, MatSTRUMPACKSetCompression()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetGPU — Method
gpu::PetscBool = MatSTRUMPACKGetGPU(petsclib::PetscLibType, F::AbstractPetscMat)

Get whether STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master will try to use GPU acceleration (not supported for all compression types)

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • gpu - whether or not STRUMPACK will try to use GPU acceleration

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetGPU()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetReordering — Method
reordering::MatSTRUMPACKReordering = MatSTRUMPACKGetReordering(petsclib::PetscLibType, F::AbstractPetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master fill-reducing reordering

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface

Output Parameter:

  • reordering - the code to be used to find the fill-reducing reordering

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatSTRUMPACKReordering, MatGetFactor(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetColPerm — Method
MatSTRUMPACKSetColPerm(petsclib::PetscLibType, F::AbstractPetscMat, cperm::PetscBool)

Set whether STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master should try to permute the columns of the matrix in order to get a nonzero diagonal

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • cperm - PETSC_TRUE to permute (internally) the columns of the matrix

Options Database Key:

  • -mat_strumpack_colperm <cperm> - true to use the permutation

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatSTRUMPACKSetReordering(), Mat, MatGetFactor(), MatSTRUMPACKGetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompAbsTol — Method
MatSTRUMPACKSetCompAbsTol(petsclib::PetscLibType, F::AbstractPetscMat, atol::PetscReal)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master absolute tolerance for compression

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • atol - absolute compression tolerance

Options Database Key:

  • -mat_strumpack_compression_abs_tol <1e-10> - Absolute compression tolerance, when using -pctype ilu

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatGetFactor(), MatSTRUMPACKGetCompAbsTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompButterflyLevels — Method
MatSTRUMPACKSetCompButterflyLevels(petsclib::PetscLibType, F::AbstractPetscMat, bfly_lvls::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master number of butterfly levels in HODLR compression (requires ButterflyPACK support)

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • bfly_lvls - Number of levels of butterfly compression in HODLR compression

Options Database Key:

  • -mat_strumpack_compression_butterfly_levels <bfly_lvls> - Number of levels in the hierarchically off-diagonal matrix for which to use butterfly,

when using -pctype ilu, (BLR_)HODLR compression

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetCompButterflyLevels()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompLeafSize — Method
MatSTRUMPACKSetCompLeafSize(petsclib::PetscLibType, F::AbstractPetscMat, leaf_size::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master leaf size for HSS, BLR, HODLR...

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • leaf_size - Size of diagonal blocks in rank-structured approximation

Options Database Key:

  • -mat_strumpack_compression_leaf_size - Size of diagonal blocks in rank-structured approximation, when using -pctype ilu

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatGetFactor(), MatSTRUMPACKGetCompLeafSize(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompLossyPrecision — Method
MatSTRUMPACKSetCompLossyPrecision(petsclib::PetscLibType, F::AbstractPetscMat, lossy_prec::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master precision for lossy compression (requires ZFP support)

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • lossy_prec - Number of bitplanes to use in lossy compression

Options Database Key:

  • -mat_strumpack_compression_lossy_precision <lossy_prec> - Precision when using lossy compression [1-64], when using -pctype ilu -mat_strumpack_compression MAT_STRUMPACK_COMPRESSION_TYPE_LOSSY

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetCompLossyPrecision()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompMinSepSize — Method
MatSTRUMPACKSetCompMinSepSize(petsclib::PetscLibType, F::AbstractPetscMat, min_sep_size::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master minimum separator size for low-rank approximation

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • min_sep_size - minimum dense matrix size for low-rank approximation

Options Database Key:

  • -mat_strumpack_compression_min_sep_size <min_sep_size> - Minimum size of dense sub-block for low-rank compression

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetCompMinSepSize()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompRelTol — Method
MatSTRUMPACKSetCompRelTol(petsclib::PetscLibType, F::AbstractPetscMat, rtol::PetscReal)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master relative tolerance for compression

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • rtol - relative compression tolerance

Options Database Key:

  • -mat_strumpack_compression_rel_tol <1e-4> - Relative compression tolerance, when using -pctype ilu

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatGetFactor(), MatSTRUMPACKGetCompRelTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompression — Method
MatSTRUMPACKSetCompression(petsclib::PetscLibType, F::AbstractPetscMat, comp::MatSTRUMPACKCompressionType)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master compression type

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • comp - Type of compression to be used in the approximate sparse factorization

Options Database Key:

  • -mat_strumpack_compression <NONE> - Type of rank-structured compression in sparse LU factors (choose one of) NONE HSS BLR HODLR BLRHODLR ZFPBLR_HODLR LOSSLESS LOSSY

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKCompressionType, MatSTRUMPACKGetCompression()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGPU — Method
MatSTRUMPACKSetGPU(petsclib::PetscLibType, F::AbstractPetscMat, gpu::PetscBool)

Set whether STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master should enable GPU acceleration (not supported for all compression types)

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • gpu - whether or not to use GPU acceleration

Options Database Key:

  • -mat_strumpack_gpu <gpu> - true to use gpu offload

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetGPU()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGeometricComponents — Method
MatSTRUMPACKSetGeometricComponents(petsclib::PetscLibType, F::AbstractPetscMat, nc::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master number of degrees of freedom per mesh point, for use with GEOMETRIC ordering.

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • nc - Number of components/dof's per grid point

Options Database Key:

  • -mat_strumpack_geometric_components <1> - Number of components per mesh point, for geometric nested dissection ordering

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGeometricNxyz — Method
MatSTRUMPACKSetGeometricNxyz(petsclib::PetscLibType, F::AbstractPetscMat, nx::PetscInt, ny::PetscInt, nz::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master mesh x, y and z dimensions, for use with GEOMETRIC ordering.

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • nx - x dimension of the mesh
  • ny - y dimension of the mesh
  • nz - z dimension of the mesh

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGeometricWidth — Method
MatSTRUMPACKSetGeometricWidth(petsclib::PetscLibType, F::AbstractPetscMat, w::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master width of the separator, for use with GEOMETRIC ordering.

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • w - width of the separator

Options Database Key:

  • -mat_strumpack_geometric_width <1> - Width of the separator of the mesh, for geometric nested dissection ordering

Level: intermediate

See also: MATSOLVERSTRUMPACK, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetReordering — Method
MatSTRUMPACKSetReordering(petsclib::PetscLibType, F::AbstractPetscMat, reordering::MatSTRUMPACKReordering)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master fill-reducing reordering

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor() from PETSc-STRUMPACK interface
  • reordering - the code to be used to find the fill-reducing reordering

Options Database Key:

  • -mat_strumpack_reordering <METIS> - Sparsity reducing matrix reordering, see MatSTRUMPACKReordering

Level: intermediate

See also: MATSOLVERSTRUMPACK, Mat, MatSTRUMPACKReordering, MatGetFactor(), MatSTRUMPACKSetColPerm(), MatSTRUMPACKGetReordering()

External Links

source
PETSc.LibPETSc.MatScaLAPACKGetBlockSizes — Method
mb::PetscInt,nb::PetscInt = MatScaLAPACKGetBlockSizes(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the block sizes used in the distribution of the MATSCALAPACK matrix

Not Collective

Input Parameter:

  • A - a MATSCALAPACK matrix

Output Parameters:

  • mb - the row block size
  • nb - the column block size

Level: intermediate

See also: Mat, MATSCALAPACK, MatCreateScaLAPACK(), MatScaLAPACKSetBlockSizes()

External Links

source
PETSc.LibPETSc.MatScaLAPACKSetBlockSizes — Method
MatScaLAPACKSetBlockSizes(petsclib::PetscLibType, A::AbstractPetscMat, mb::PetscInt, nb::PetscInt)

Sets the block sizes to be used for the distribution of the MATSCALAPACK matrix

Logically Collective

Input Parameters:

  • A - a MATSCALAPACK matrix
  • mb - the row block size
  • nb - the column block size

Level: intermediate

See also: Mat, MATSCALAPACK, MatCreateScaLAPACK(), MatScaLAPACKGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatScale — Method
MatScale(petsclib::PetscLibType, mat::AbstractPetscMat, a::PetscScalar)

Scales all elements of a matrix by a given number.

Logically Collective

Input Parameters:

  • mat - the matrix to be scaled
  • a - the scaling value

Level: intermediate

See also: Mat, MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatScatterGetVecScatter — Method
scatter::VecScatter = MatScatterGetVecScatter(petsclib::PetscLibType, mat::AbstractPetscMat)

Returns the user-provided scatter set with MatScatterSetVecScatter() in a MATSCATTER matrix

Logically Collective

Input Parameter:

  • mat - the matrix, should have been created with MatCreateScatter() or have type MATSCATTER

Output Parameter:

  • scatter - the scatter context

Level: intermediate

See also: Mat, MATSCATTER, MatCreateScatter(), MatScatterSetVecScatter()

External Links

source
PETSc.LibPETSc.MatScatterSetVecScatter — Method
MatScatterSetVecScatter(petsclib::PetscLibType, mat::AbstractPetscMat, scatter::VecScatter)

sets the scatter that the matrix is to apply as its linear operator in a MATSCATTER

Logically Collective

Input Parameters:

  • mat - the MATSCATTER matrix
  • scatter - the scatter context create with VecScatterCreate()

Level: advanced

See also: Mat, MATSCATTER, MatCreateScatter()

External Links

source
PETSc.LibPETSc.MatSchurComplementComputeExplicitOperator — Method
S::PetscMat = MatSchurComplementComputeExplicitOperator(petsclib::PetscLibType, A::AbstractPetscMat)

Compute the Schur complement matrix explicitly

Collective

Input Parameter:

  • A - the matrix obtained with MatCreateSchurComplement()

Output Parameter:

  • S - the Schur complement matrix

Level: advanced

See also: MatCreateSchurComplement(), MatSchurComplementUpdateSubMatrices(), MatSchurComplementGetPmat()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetAinvType — Method
ainvtype::MatSchurComplementAinvType = MatSchurComplementGetAinvType(petsclib::PetscLibType, S::AbstractPetscMat)

get the type of approximation for the inverse of the (0,0) block used in forming Sp in MatSchurComplementGetPmat()

Not Collective

Input Parameter:

  • S - matrix obtained with MatCreateSchurComplement() (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01

Output Parameter:

  • ainvtype - type of approximation used to form approximate Schur complement Sp = A11 - A10 inv(DIAGFORM(A00)) A01:

MAT_SCHUR_COMPLEMENT_AINV_DIAG, MAT_SCHUR_COMPLEMENT_AINV_LUMP, MAT_SCHUR_COMPLEMENT_AINV_BLOCK_DIAG, or MAT_SCHUR_COMPLEMENT_AINV_FULL

Level: advanced

See also: MatSchurComplementAinvType, MatCreateSchurComplement(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementSetAinvType()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetKSP — Method
ksp::KSP = MatSchurComplementGetKSP(petsclib::PetscLibType, S::AbstractPetscMat)

Gets the KSP object that is used to solve with A00 in the Schur complement matrix S = A11 - A10 ksp(A00,Ap00) A01

Not Collective

Input Parameter:

  • S - matrix obtained with MatCreateSchurComplement() (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01

Output Parameter:

  • ksp - the linear solver object

Level: intermediate

See also: Mat, MatSchurComplementSetKSP(), MatCreateSchurComplement(), MatCreateNormal(), MatMult(), MatCreate()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetPmat — Method
Sp::PetscMat = MatSchurComplementGetPmat(petsclib::PetscLibType, S::AbstractPetscMat, preuse::MatReuse)

Obtain a matrix for preconditioning the Schur complement by assembling Sp = A11 - A10 inv(DIAGFORM(A00)) A01

Collective

Input Parameters:

  • S - matrix obtained with MatCreateSchurComplement() (or equivalent) that implements the action of A11 - A10 ksp(A00,Ap00) A01
  • preuse - MAT_INITIAL_MATRIX for a new Sp, or MAT_REUSE_MATRIX to reuse an existing Sp, or MAT_IGNORE_MATRIX to put nothing in Sp

Output Parameter:

  • Sp - approximate Schur complement suitable for preconditioning the exact Schur complement S = A11 - A10 inv(A00) A01

Level: advanced

See also: MatCreateSubMatrix(), PCFIELDSPLIT, MatGetSchurComplement(), MatCreateSchurComplement(), MatSchurComplementSetAinvType()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetSubMatrices — Method
A00::PetscMat,Ap00::PetscMat,A01::PetscMat,A10::PetscMat,A11::PetscMat = MatSchurComplementGetSubMatrices(petsclib::PetscLibType, S::AbstractPetscMat)

Get the individual submatrices in the Schur complement

Collective

Input Parameter:

  • S - matrix obtained with MatCreateSchurComplement() (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01

Output Parameters:

  • A00 - the upper-left block of the original matrix A = [A00 A01; A10 A11]
  • Ap00 - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A^{-1}
  • A01 - the upper-right block of the original matrix A = [A00 A01; A10 A11]
  • A10 - the lower-left block of the original matrix A = [A00 A01; A10 A11]
  • A11 - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11]

Level: intermediate

See also: MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatCreateSchurComplement(), MatSchurComplementUpdateSubMatrices()

External Links

source
PETSc.LibPETSc.MatSchurComplementSetAinvType — Method
MatSchurComplementSetAinvType(petsclib::PetscLibType, S::AbstractPetscMat, ainvtype::MatSchurComplementAinvType)

set the type of approximation used for the inverse of the (0,0) block used in forming Sp in MatSchurComplementGetPmat()

Not Collective

Input Parameters:

  • S - matrix obtained with MatCreateSchurComplement() (or equivalent) and implementing the action of A11 - A10 ksp(A00,Ap00) A01
  • ainvtype - type of approximation to be used to form approximate Schur complement Sp = A11 - A10 inv(DIAGFORM(A00)) A01:

MAT_SCHUR_COMPLEMENT_AINV_DIAG, MAT_SCHUR_COMPLEMENT_AINV_LUMP, MAT_SCHUR_COMPLEMENT_AINV_BLOCK_DIAG, or MAT_SCHUR_COMPLEMENT_AINV_FULL

Options Database Key:

  • -mat_schur_complement_ainv_type (diag|lump|blockdiag|full) - set Schur complement type

Level: advanced

See also: MatSchurComplementAinvType, MatCreateSchurComplement(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementGetAinvType()

External Links

source
PETSc.LibPETSc.MatSchurComplementSetKSP — Method
MatSchurComplementSetKSP(petsclib::PetscLibType, S::AbstractPetscMat, ksp::AbstractKSP)

Sets the KSP object that is used to solve with A00 in the Schur complement matrix S = A11 - A10 ksp(A00,Ap00) A01

Not Collective

Input Parameters:

  • S - matrix created with MatCreateSchurComplement()
  • ksp - the linear solver object

Level: developer

See also: Mat, MatSchurComplementGetKSP(), MatCreateSchurComplement(), MatCreateNormal(), MatMult(), MatCreate(), MATSCHURCOMPLEMENT

External Links

source
PETSc.LibPETSc.MatSchurComplementSetSubMatrices — Method
MatSchurComplementSetSubMatrices(petsclib::PetscLibType, S::AbstractPetscMat, A00::AbstractPetscMat, Ap00::AbstractPetscMat, A01::AbstractPetscMat, A10::AbstractPetscMat, A11::AbstractPetscMat)

Sets the matrices that define the Schur complement

Collective

Input Parameters:

  • S - matrix obtained with MatSetType(S,MATSCHURCOMPLEMENT)
  • A00 - the upper-left block of the original matrix A = [A00 A01; A10 A11]
  • Ap00 - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A00^{-1}
  • A01 - the upper-right block of the original matrix A = [A00 A01; A10 A11]
  • A10 - the lower-left block of the original matrix A = [A00 A01; A10 A11]
  • A11 - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11]

Level: intermediate

See also: Mat, MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatSchurComplementUpdateSubMatrices(), MatCreateTranspose(), MatCreateSchurComplement(), MatGetSchurComplement()

External Links

source
PETSc.LibPETSc.MatSchurComplementUpdateSubMatrices — Method
MatSchurComplementUpdateSubMatrices(petsclib::PetscLibType, S::AbstractPetscMat, A00::AbstractPetscMat, Ap00::AbstractPetscMat, A01::AbstractPetscMat, A10::AbstractPetscMat, A11::AbstractPetscMat)

Updates the Schur complement matrix object with new submatrices

Collective

Input Parameters:

  • S - matrix obtained with MatCreateSchurComplement() (or MatSchurSetSubMatrices()) and implementing the action of A11 - A10 ksp(A00,Ap00) A01
  • A00 - the upper-left block of the original matrix A = [A00 A01; A10 A11]
  • Ap00 - matrix from which the preconditioner is constructed for use in ksp(A00,Ap00) to approximate the action of A00^{-1}
  • A01 - the upper-right block of the original matrix A = [A00 A01; A10 A11]
  • A10 - the lower-left block of the original matrix A = [A00 A01; A10 A11]
  • A11 - (optional) the lower-right block of the original matrix A = [A00 A01; A10 A11]

Level: intermediate

See also: Mat, MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatCreateSchurComplement()

External Links

source
PETSc.LibPETSc.MatSelectVariableBlockSizes — Method
MatSelectVariableBlockSizes(petsclib::PetscLibType, subA::AbstractPetscMat, A::AbstractPetscMat, isrow::AbstractIS)

When creating a submatrix, pass on the variable block sizes

Not Collective

Input Parameter:

  • subA - the submatrix
  • A - the original matrix
  • isrow - The IS of selected rows for the submatrix, must be sorted

Level: developer

See also: Mat, MatSetVariableBlockSizes(), MatComputeVariableBlockEnvelope()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetArray — Method
array::Vector{PetscScalar} = MatSeqAIJGetArray(petsclib::PetscLibType, A::AbstractPetscMat)

Returns a 1D Julia Array (Vector) providing direct read/write access to the internal numerical values of a MATSEQAIJ (Sparse) matrix.

Note: This only provides access to the values array. It does not allow changing the sparsity pattern (row pointers or column indices).

Not Collective

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - A Vector view of the non-zero values.

Level: intermediate

See also: MatSeqAIJRestoreArray(), MatDenseGetArray()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetArrayRead — Method
array::Ptr{PetscScalar} = MatSeqAIJGetArrayRead(petsclib::PetscLibType, A::AbstractPetscMat)

gives read-only access to the array where the data for a MATSEQAIJ matrix is stored

Not Collective

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MatSeqAIJGetArray(), MatSeqAIJRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetArrayWrite — Method
array::Ptr{PetscScalar} = MatSeqAIJGetArrayWrite(petsclib::PetscLibType, A::AbstractPetscMat)

gives write-only access to the array where the data for a MATSEQAIJ matrix is stored

Not Collective

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MatSeqAIJGetArray(), MatSeqAIJRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetCSRAndMemType — Method
i::Vector{PetscInt},j::Vector{PetscInt},a::Vector{PetscScalar},mtype::PetscMemType = MatSeqAIJGetCSRAndMemType(petsclib::PetscLibType, mat::AbstractPetscMat)

Get the CSR arrays and the memory type of the MATSEQAIJ matrix

Not Collective; No Fortran Support

Input Parameter:

  • mat - a matrix of type MATSEQAIJ or its subclasses

Output Parameters:

  • i - row map array of the matrix
  • j - column index array of the matrix
  • a - data array of the matrix
  • mtype - memory type of the arrays

Level: developer

See also: Mat, MatSeqAIJGetArray(), MatSeqAIJGetArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetMaxRowNonzeros — Method
nz::PetscInt = MatSeqAIJGetMaxRowNonzeros(petsclib::PetscLibType, A::AbstractPetscMat)

returns the maximum number of nonzeros in any row

Not Collective

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • nz - the maximum number of nonzeros in any row

Level: intermediate

See also: Mat, MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqAIJKron — Method
C::PetscMat = MatSeqAIJKron(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, reuse::MatReuse)

Computes C, the Kronecker product of A and B.

Input Parameters:

  • A - left-hand side matrix
  • B - right-hand side matrix
  • reuse - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX

Output Parameter:

  • C - Kronecker product of A and B

Level: intermediate

See also: Mat, MatCreateSeqAIJ(), MATSEQAIJ, MATKAIJ, MatReuse

External Links

source
PETSc.LibPETSc.MatSeqAIJRegister — Method
MatSeqAIJRegister(petsclib::PetscLibType, sname::String, fnc::external)
  • Adds a new sub-matrix type for sequential MATSEQAIJ matrices

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of a new user-defined matrix type, for example MATSEQAIJCRL
  • function - routine to convert to subtype

Level: advanced

See also: Mat, MatSeqAIJRegisterAll()

External Links

source
PETSc.LibPETSc.MatSeqAIJRestoreArray — Method
MatSeqAIJRestoreArray(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array where the data for a MATSEQAIJ matrix is stored obtained by MatSeqAIJGetArray()

Not Collective

Input Parameters:

  • A - a MATSEQAIJ matrix
  • array - pointer to the data

Level: intermediate

See also: Mat, MatSeqAIJGetArray()

External Links

source
PETSc.LibPETSc.MatSeqAIJRestoreArrayRead — Method
MatSeqAIJRestoreArrayRead(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

restore the read-only access array obtained from MatSeqAIJGetArrayRead()

Not Collective

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MatSeqAIJGetArray(), MatSeqAIJGetArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJRestoreArrayWrite — Method
MatSeqAIJRestoreArrayWrite(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

restore the write-only access array obtained from MatSeqAIJGetArrayWrite()

Not Collective

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MatSeqAIJGetArray(), MatSeqAIJGetArrayWrite()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetPreallocation — Method
MatSeqAIJSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz). By setting these parameters accurately, performance during matrix assembly can be increased by more than a factor of 50.

Collective

Input Parameters:

  • B - The matrix
  • nz - number of nonzeros per row (same for all rows)
  • nnz - array containing the number of nonzeros in the various rows

(possibly different for each row) or NULL

Options Database Keys:

  • -mat_no_inode - Do not use inodes
  • -mat_inode_limit limit - Sets inode limit (max limit=5)

Level: intermediate

See also: Mat, MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatGetInfo(), MatSeqAIJSetTotalPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetPreallocationCSR — Method
MatSeqAIJSetPreallocationCSR(petsclib::PetscLibType, B::AbstractPetscMat, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar})

Allocates memory for a sparse sequential matrix in MATSEQAIJ format.

Input Parameters:

  • B - the matrix
  • i - the indices into j for the start of each row (indices start with zero)
  • j - the column indices for each row (indices start with zero) these must be sorted for each row
  • v - optional values in the matrix, use NULL if not provided

Level: developer

See also: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MATSEQAIJ, MatResetPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetTotalPreallocation — Method
MatSeqAIJSetTotalPreallocation(petsclib::PetscLibType, A::AbstractPetscMat, nztotal::PetscInt)

Sets an upper bound on the total number of expected nonzeros in the matrix.

Input Parameters:

  • A - the MATSEQAIJ matrix
  • nztotal - bound on the number of nonzeros

Level: advanced

See also: Mat, MatSetOption(), MAT_SORTED_FULL, MatSetValues(), MatSeqAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetType — Method
MatSeqAIJSetType(petsclib::PetscLibType, mat::AbstractPetscMat, matype::String)

Converts a MATSEQAIJ matrix to a subtype

Collective

Input Parameters:

  • mat - the matrix object
  • matype - matrix type

Options Database Key:

  • -mat_seqaij_type method - for example seqaijcrl

Level: intermediate

See also: Mat, PCSetType(), VecSetType(), MatCreate(), MatType

External Links

source
PETSc.LibPETSc.MatSeqAIJSetValuesLocalFast — Method
MatSeqAIJSetValuesLocalFast(petsclib::PetscLibType, A::AbstractPetscMat, m::PetscInt, im::Vector{PetscInt}, n::PetscInt, in::Vector{PetscInt}, v::Vector{PetscScalar}, is::InsertMode)

An optimized version of MatSetValuesLocal() for MATSEQAIJ matrices, valid under several restrictive assumptions.

Not Collective

Input Parameters:

  • A - the MATSEQAIJ matrix
  • m - the number of rows being set (must be 1)
  • im - array of length m giving the local row index
  • n - the number of columns being set
  • in - array of length n giving the local column indices
  • v - array of length n of values to add
  • is - the insert mode (must be ADD_VALUES)

Level: developer

See also: Mat, MATSEQAIJ, MatSetValuesLocal(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatSeqBAIJGetArray — Method
array::Ptr{PetscScalar} = MatSeqBAIJGetArray(petsclib::PetscLibType, A::AbstractPetscMat)

gives read/write access to the array where the data for a MATSEQBAIJ matrix is stored

Not Collective

Input Parameter:

  • A - a MATSEQBAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MATSEQBAIJ, MatSeqBAIJRestoreArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqBAIJRestoreArray — Method
MatSeqBAIJRestoreArray(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array where the data for a MATSEQBAIJ matrix is stored obtained by MatSeqBAIJGetArray()

Not Collective

Input Parameters:

  • A - a MATSEQBAIJ matrix
  • array - pointer to the data

Level: intermediate

See also: Mat, MatSeqBAIJGetArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqBAIJSetColumnIndices — Method
indices::PetscInt = MatSeqBAIJSetColumnIndices(petsclib::PetscLibType, mat::AbstractPetscMat)

Set the column indices for all the block rows in the matrix.

Input Parameters:

  • mat - the MATSEQBAIJ matrix
  • indices - the block column indices

Level: advanced

See also: Mat, MATSEQBAIJ, MatSetValues()

External Links

source
PETSc.LibPETSc.MatSeqBAIJSetPreallocation — Method
MatSeqBAIJSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, nz::PetscInt, nnz::Union{Ptr, Vector{PetscInt}})

Sets the block size and expected nonzeros per row in the matrix. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz).

Collective

Input Parameters:

  • B - the matrix
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • nz - number of block nonzeros per block row (same for all rows)
  • nnz - array containing the number of block nonzeros in the various block rows

(possibly different for each block row) or NULL

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the block calculations (much slower)
  • -mat_block_size - size of the blocks to use

Level: intermediate

See also: Mat, Sparse Matrices, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ(), MatGetInfo()

External Links

source
PETSc.LibPETSc.MatSeqBAIJSetPreallocationCSR — Method
MatSeqBAIJSetPreallocationCSR(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Union{Ptr, Vector{PetscScalar}})

Creates a sparse sequential matrix in MATSEQBAIJ format using the given nonzero structure and (optional) numerical values

Collective

Input Parameters:

  • B - the matrix
  • bs - the blocksize
  • i - the indices into j for the start of each local row (indices start with zero)
  • j - the column indices for each local row (indices start with zero) these must be sorted for each row
  • v - optional values in the matrix, use NULL if not provided

Level: advanced

See also: Mat, MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatSeqBAIJSetPreallocation(), MATSEQBAIJ

External Links

source
PETSc.LibPETSc.MatSeqDenseInvert — Method
MatSeqDenseInvert(petsclib::PetscLibType, A::AbstractPetscMat)

Invert a small MATSEQDENSE matrix in place using a hard-coded kernel.

Not Collective

Input Parameter:

  • A - the MATSEQDENSE matrix

Level: developer

See also: Mat, MATSEQDENSE, MatInvertBlockDiagonal(), MatLUFactor(), MatSetErrorIfFailure(), MatFactorGetError()

External Links

source
PETSc.LibPETSc.MatSeqDenseSetPreallocation — Method
MatSeqDenseSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, data::Vector{PetscScalar})

Sets the array used for storing the matrix elements of a MATSEQDENSE matrix

Collective

Input Parameters:

  • B - the matrix
  • data - the array (or NULL)

Level: intermediate

See also: Mat, MATSEQDENSE, MatCreate(), MatCreateDense(), MatSetValues(), MatDenseSetLDA()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJGetArray — Method
array::Ptr{PetscScalar} = MatSeqSBAIJGetArray(petsclib::PetscLibType, A::AbstractPetscMat)

gives access to the array where the numerical data for a MATSEQSBAIJ matrix is stored

Not Collective

Input Parameter:

  • A - a MATSEQSBAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

See also: Mat, MATSEQSBAIJ, MatSeqSBAIJRestoreArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJRestoreArray — Method
MatSeqSBAIJRestoreArray(petsclib::PetscLibType, A::AbstractPetscMat, array::Union{Ptr, AbstractArray{PetscScalar}})

returns access to the array where the numerical data for a MATSEQSBAIJ matrix is stored obtained by MatSeqSBAIJGetArray()

Not Collective

Input Parameters:

  • A - a MATSEQSBAIJ matrix
  • array - pointer to the data

Level: intermediate

See also: Mat, MATSEQSBAIJ, MatSeqSBAIJGetArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJSetColumnIndices — Method
indices::PetscInt = MatSeqSBAIJSetColumnIndices(petsclib::PetscLibType, mat::AbstractPetscMat)

Set the column indices for all the rows in a MATSEQSBAIJ matrix.

Input Parameters:

  • mat - the MATSEQSBAIJ matrix
  • indices - the column indices

Level: advanced

See also: Mat, MATSEQSBAIJ, MatCreateSeqSBAIJ

External Links

source
PETSc.LibPETSc.MatSeqSBAIJSetPreallocation — Method
MatSeqSBAIJSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, nz::PetscInt, nnz::Vector{PetscInt})

Creates a sparse symmetric matrix in block AIJ (block compressed row) MATSEQSBAIJ format. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz).

Collective

Input Parameters:

  • B - the symmetric matrix
  • bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row

blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()

  • nz - number of block nonzeros per block row (same for all rows)
  • nnz - array containing the number of block nonzeros in the upper triangular plus

diagonal portion of each block (possibly different for each block row) or NULL

Options Database Keys:

  • -mat_no_unroll - uses code that does not unroll the loops in the block calculations (much slower)
  • -mat_block_size - size of the blocks to use (only works if a negative bs is passed in

Level: intermediate

See also: Mat, Sparse Matrices, MATSEQSBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateSBAIJ()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJSetPreallocationCSR — Method
MatSeqSBAIJSetPreallocationCSR(petsclib::PetscLibType, B::AbstractPetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::Vector{PetscScalar})

Creates a sparse parallel matrix in MATSEQSBAIJ format using the given nonzero structure and (optional) numerical values

Input Parameters:

  • B - the matrix
  • bs - size of block, the blocks are ALWAYS square.
  • i - the indices into j for the start of each local row (indices start with zero)
  • j - the column indices for each local row (indices start with zero) these must be sorted for each row
  • v - optional values in the matrix, use NULL if not provided

Level: advanced

See also: Mat, MATSEQSBAIJ, MatCreate(), MatCreateSeqSBAIJ(), MatSetValuesBlocked(), MatSeqSBAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetAvgSliceWidth — Method
slicewidth::PetscReal = MatSeqSELLGetAvgSliceWidth(petsclib::PetscLibType, A::AbstractPetscMat)

returns the average slice width.

Not Collective

Input Parameter:

  • A - a MATSEQSELL matrix

Output Parameter:

  • slicewidth - average slice width

Level: intermediate

See also: MATSEQSELL, MatSeqSELLGetMaxSliceWidth()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetFillRatio — Method
ratio::PetscReal = MatSeqSELLGetFillRatio(petsclib::PetscLibType, A::AbstractPetscMat)

returns a ratio that indicates the irregularity of the matrix.

Not Collective

Input Parameter:

  • A - a MATSEQSELL matrix

Output Parameter:

  • ratio - ratio of number of padded zeros to number of allocated elements

Level: intermediate

See also: MATSEQSELL, MatSeqSELLGetAvgSliceWidth()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetMaxSliceWidth — Method
slicewidth::PetscInt = MatSeqSELLGetMaxSliceWidth(petsclib::PetscLibType, A::AbstractPetscMat)

returns the maximum slice width.

Not Collective

Input Parameter:

  • A - a MATSEQSELL matrix

Output Parameter:

  • slicewidth - maximum slice width

Level: intermediate

See also: MATSEQSELL, MatSeqSELLGetAvgSliceWidth()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetVarSliceSize — Method
variance::PetscReal = MatSeqSELLGetVarSliceSize(petsclib::PetscLibType, A::AbstractPetscMat)

returns the variance of the slice size.

Not Collective

Input Parameter:

  • A - a MATSEQSELL matrix

Output Parameter:

  • variance - variance of the slice size

Level: intermediate

See also: MATSEQSELL, MatSeqSELLSetSliceHeight()

External Links

source
PETSc.LibPETSc.MatSeqSELLSetPreallocation — Method
MatSeqSELLSetPreallocation(petsclib::PetscLibType, B::AbstractPetscMat, rlenmax::PetscInt, rlen::Vector{PetscInt})

For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz).

Collective

Input Parameters:

  • B - The MATSEQSELL matrix
  • rlenmax - number of nonzeros per row (same for all rows), ignored if rlen is provided
  • rlen - array containing the number of nonzeros in the various rows (possibly different for each row) or NULL

Level: intermediate

See also: Mat, MATSEQSELL, MATSELL, MatCreate(), MatCreateSELL(), MatSetValues(), MatGetInfo()

External Links

source
PETSc.LibPETSc.MatSetBindingPropagates — Method
MatSetBindingPropagates(petsclib::PetscLibType, A::AbstractPetscMat, flg::PetscBool)

Sets whether the state of being bound to the CPU for a GPU matrix type propagates to child and some other associated objects

Input Parameters:

  • A - the matrix
  • flg - flag indicating whether the boundtocpu flag should be propagated

Level: developer

See also: Mat, VecSetBindingPropagates(), MatGetBindingPropagates()

External Links

source
PETSc.LibPETSc.MatSetBlockSize — Method
MatSetBlockSize(petsclib::PetscLibType, mat::AbstractPetscMat, bs::PetscInt)

Sets the matrix block size.

Logically Collective

Input Parameters:

  • mat - the matrix
  • bs - block size

Level: intermediate

See also: Mat, MATBAIJ, MATSBAIJ, MATAIJ, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatSetBlockSizes — Method
MatSetBlockSizes(petsclib::PetscLibType, mat::AbstractPetscMat, rbs::PetscInt, cbs::PetscInt)

Sets the matrix block row and column sizes.

Logically Collective

Input Parameters:

  • mat - the matrix
  • rbs - row block size
  • cbs - column block size

Level: intermediate

See also: Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSize(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatSetBlockSizesFromMats — Method
MatSetBlockSizesFromMats(petsclib::PetscLibType, mat::AbstractPetscMat, fromRow::AbstractPetscMat, fromCol::AbstractPetscMat)

Sets the matrix block row and column sizes to match a pair of matrices

Logically Collective

Input Parameters:

  • mat - the matrix
  • fromRow - matrix from which to copy row block size
  • fromCol - matrix from which to copy column block size (can be same as fromRow)

Level: developer

See also: Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes()

External Links

source
PETSc.LibPETSc.MatSetDM — Method
MatSetDM(petsclib::PetscLibType, A::AbstractPetscMat, dm::AbstractPetscDM)

Sets the DM defining the data layout of the matrix

Not Collective

Input Parameters:

  • A - The Mat
  • dm - The DM

Level: developer

See also: DM, MatGetDM(), DMCreateMatrix(), DMSetMatType()

External Links

source
PETSc.LibPETSc.MatSetErrorIfFailure — Method
MatSetErrorIfFailure(petsclib::PetscLibType, mat::AbstractPetscMat, flg::PetscBool)

Causes Mat to generate an immediate error, for example a zero pivot, is detected.

Logically Collective

Input Parameters:

  • mat - matrix obtained from MatCreate()
  • flg - PETSC_TRUE indicates you want the error generated

Level: advanced

See also: Mat, PCSetErrorIfFailure(), KSPConvergedReason, SNESConvergedReason

External Links

source
PETSc.LibPETSc.MatSetFactorType — Method
MatSetFactorType(petsclib::PetscLibType, mat::AbstractPetscMat, t::MatFactorType)

sets the type of factorization a matrix is

Logically Collective

Input Parameters:

  • mat - the matrix
  • t - the type, one of MAT_FACTOR_NONE, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ILU, MAT_FACTOR_ICC,MAT_FACTOR_ILUDT, MAT_FACTOR_QR

Level: intermediate

See also: Mat, Matrix Factorization, MatFactorType, MatGetFactor(), MatGetFactorType(), MAT_FACTOR_NONE, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ILU, MAT_FACTOR_ICC, MAT_FACTOR_ILUDT, MAT_FACTOR_QR

External Links

source
PETSc.LibPETSc.MatSetFromOptions — Method
MatSetFromOptions(petsclib::PetscLibType, B::AbstractPetscMat)

Creates a matrix where the type is determined from the options database.

Collective

Input Parameter:

  • B - the matrix

Options Database Keys:

  • -mat_type seqaij - MATSEQAIJ type, uses MatCreateSeqAIJ()
  • -mat_type mpiaij - MATMPIAIJ type, uses MatCreateAIJ()
  • -mat_type seqdense - MATSEQDENSE type, uses MatCreateSeqDense()
  • -mat_type mpidense - MATMPIDENSE, uses MatCreateDense()
  • -mat_type seqbaij - MATSEQBAIJ, uses MatCreateSeqBAIJ()
  • -mat_type mpibaij - MATMPIBAIJ, uses MatCreateBAIJ()
  • -mat_vec_type - the VecType used by MatCreateVecs(), see MatSetVecType()

See the manpages for particular formats (e.g., MATSEQAIJ) for additional format-specific options.

Level: beginner

See also: Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert()

External Links

source
PETSc.LibPETSc.MatSetHPL — Method
MatSetHPL(petsclib::PetscLibType, A::AbstractPetscMat, iseed::Cint)

fills a MATSEQDENSE matrix using the HPL 2.3 random matrix generation routine

Collective

Input Parameters:

  • A - the matrix
  • iseed - the random number seed

Level: intermediate

See also: Mat, MatCreate()

External Links

source
PETSc.LibPETSc.MatSetInf — Method
MatSetInf(petsclib::PetscLibType, A::AbstractPetscMat)

Set every entry (of a given nonzero pattern) of a matrix to positive infinity.

Logically Collective

Input Parameter:

  • A - the matrix

Level: developer

See also: Mat, MatZeroEntries(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatSetLayouts — Method
MatSetLayouts(petsclib::PetscLibType, A::AbstractPetscMat, rmap::PetscLayout, cmap::PetscLayout)

Sets the PetscLayout objects for rows and columns of a matrix

Logically Collective

Input Parameters:

  • A - the matrix
  • rmap - row layout
  • cmap - column layout

Level: advanced

See also: Mat, PetscLayout, MatCreateVecs(), MatGetLocalToGlobalMapping(), MatGetLayouts()

External Links

source
PETSc.LibPETSc.MatSetLocalToGlobalMapping — Method
MatSetLocalToGlobalMapping(petsclib::PetscLibType, x::AbstractPetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping)

Sets a local-to-global numbering for use by the routine MatSetValuesLocal() to allow users to insert matrix entries using a local (per-processor) numbering.

Not Collective

Input Parameters:

  • x - the matrix
  • rmapping - row mapping created with ISLocalToGlobalMappingCreate() or ISLocalToGlobalMappingCreateIS()
  • cmapping - column mapping

Level: intermediate

See also: Mat, DM, DMCreateMatrix(), MatGetLocalToGlobalMapping(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetValuesLocal(), MatGetValuesLocal()

External Links

source
PETSc.LibPETSc.MatSetNearNullSpace — Method
MatSetNearNullSpace(petsclib::PetscLibType, mat::AbstractPetscMat, nullsp::MatNullSpace)

attaches a null space to a matrix, which is often the null space (rigid body modes) of the operator without boundary conditions This null space will be used to provide near null space vectors to a multigrid preconditioner built from this matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: advanced

See also: Mat, MatNullSpace, MatCreate(), MatNullSpaceCreate(), MatSetNullSpace(), MatNullSpaceCreateRigidBody(), MatGetNearNullSpace()

External Links

source
PETSc.LibPETSc.MatSetNullSpace — Method
MatSetNullSpace(petsclib::PetscLibType, mat::AbstractPetscMat, nullsp::MatNullSpace)

attaches a null space to a matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: advanced

See also: Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), KSPSetPCSide()

External Links

source
PETSc.LibPETSc.MatSetOperation — Method
MatSetOperation(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOperation, f::Ptr{Cvoid})

Allows user to set a matrix operation for any matrix type

Logically Collective

Input Parameters:

  • mat - the matrix
  • op - the name of the operation
  • f - the function that provides the operation

Level: developer

See also: Mat, MatGetOperation(), MatCreateShell(), MatShellSetContext(), MatShellSetOperation()

External Links

source
PETSc.LibPETSc.MatSetOption — Method
MatSetOption(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOption, flg::PetscBool)

Sets a parameter option for a matrix. Some options may be specific to certain storage formats. Some options determine how values will be inserted (or added). Sorted, row-oriented input will generally assemble the fastest. The default is row-oriented.

Logically Collective for certain operations, such as MAT_SPD, not collective for MAT_ROW_ORIENTED, see MatOption

Input Parameters:

  • mat - the matrix
  • op - the option, one of those listed below (and possibly others),
  • flg - turn the option on (PETSC_TRUE) or off (PETSC_FALSE)

Options Describing Matrix Structure:

  • MAT_SPD - symmetric positive definite
  • MAT_SYMMETRIC - symmetric in terms of both structure and value
  • MAT_HERMITIAN - transpose is the complex conjugation
  • MAT_STRUCTURALLY_SYMMETRIC - symmetric nonzero structure
  • MAT_SYMMETRY_ETERNAL - indicates the symmetry (or Hermitian structure) or its absence will persist through any changes to the matrix
  • MAT_STRUCTURAL_SYMMETRY_ETERNAL - indicates the structural symmetry or its absence will persist through any changes to the matrix
  • MAT_SPD_ETERNAL - indicates the value of MAT_SPD (true or false) will persist through any changes to the matrix

These are not really options of the matrix, they are knowledge about the structure of the matrix that users may provide so that they do not need to be computed (usually at a high cost)

Options For Use with MatSetValues(): Insert a logically dense subblock, which can be

  • MAT_ROW_ORIENTED - row-oriented (default)

These options reflect the data you pass in with MatSetValues(); it has nothing to do with how the data is stored internally in the matrix data structure.

When (re)assembling a matrix, we can restrict the input for efficiency/debugging purposes. These options include

  • MAT_NEW_NONZERO_LOCATIONS - additional insertions will be allowed if they generate a new nonzero (slow)
  • MAT_FORCE_DIAGONAL_ENTRIES - forces diagonal entries to be allocated
  • MAT_IGNORE_OFF_PROC_ENTRIES - drops off-processor entries
  • MAT_NEW_NONZERO_LOCATION_ERR - generates an error for new matrix entry
  • MAT_USE_HASH_TABLE - uses a hash table to speed up matrix assembly
  • MAT_NO_OFF_PROC_ENTRIES - you know each process will only set values for its own rows, will generate an error if

any process sets values for another process. This avoids all reductions in the MatAssembly routines and thus improves performance for very large process counts.

  • MAT_SUBSET_OFF_PROC_ENTRIES - you know that the first assembly after setting this flag will set a superset

of the off-process entries required for all subsequent assemblies. This avoids a rendezvous step in the MatAssembly functions, instead sending only neighbor messages.

Level: intermediate

See also: MatOption, Mat, MatGetOption()

External Links

source
PETSc.LibPETSc.MatSetOptionsPrefix — Method
MatSetOptionsPrefix(petsclib::PetscLibType, A::AbstractPetscMat, prefix::String)

Sets the prefix used for searching for all Mat options in the database.

Logically Collective

Input Parameters:

  • A - the matrix
  • prefix - the prefix to prepend to all option names

Level: advanced

See also: Mat, MatSetFromOptions(), MatSetOptionsPrefixFactor()

External Links

source
PETSc.LibPETSc.MatSetOptionsPrefixFactor — Method
MatSetOptionsPrefixFactor(petsclib::PetscLibType, A::AbstractPetscMat, prefix::String)

Sets the prefix used for searching for all matrix factor options in the database for for matrices created with MatGetFactor()

Logically Collective

Input Parameters:

  • A - the matrix
  • prefix - the prefix to prepend to all option names for the factored matrix

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatSetFromOptions(), MatSetOptionsPrefix(), MatAppendOptionsPrefixFactor()

External Links

source
PETSc.LibPETSc.MatSetPreallocationCOO — Method
MatSetPreallocationCOO(petsclib::PetscLibType, A::AbstractPetscMat, ncoo::PetscCount, coo_i::Vector{PetscInt}, coo_j::Vector{PetscInt})

set preallocation for matrices using a coordinate format of the entries with global indices

Collective

Input Parameters:

  • A - matrix being preallocated
  • ncoo - number of entries
  • coo_i - row indices
  • coo_j - column indices

Level: beginner

See also: Mat, MatSetValuesCOO(), MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatSeqBAIJSetPreallocation(), MatMPIBAIJSetPreallocation(), MatSeqSBAIJSetPreallocation(), MatMPISBAIJSetPreallocation(), MatSetPreallocationCOOLocal(), DMSetMatrixPreallocateSkip(), MatCreateSeqAIJFromTriple()

External Links

source
PETSc.LibPETSc.MatSetPreallocationCOOLocal — Method
MatSetPreallocationCOOLocal(petsclib::PetscLibType, A::AbstractPetscMat, ncoo::PetscCount, coo_i::Vector{PetscInt}, coo_j::Vector{PetscInt})

set preallocation for matrices using a coordinate format of the entries with local indices

Collective

Input Parameters:

  • A - matrix being preallocated
  • ncoo - number of entries
  • coo_i - row indices (local numbering; may be modified)
  • coo_j - column indices (local numbering; may be modified)

Level: beginner

See also: Mat, MatSetValuesCOO(), MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatSeqBAIJSetPreallocation(), MatMPIBAIJSetPreallocation(), MatSeqSBAIJSetPreallocation(), MatMPISBAIJSetPreallocation(), MatSetPreallocationCOO(), DMSetMatrixPreallocateSkip()

External Links

source
PETSc.LibPETSc.MatSetRandom — Method
MatSetRandom(petsclib::PetscLibType, x::AbstractPetscMat, rctx::Union{Ptr, PetscRandom})

Sets all components of a matrix to random numbers.

Logically Collective

Input Parameters:

  • x - the matrix
  • rctx - the PetscRandom object, formed by PetscRandomCreate(), or NULL and

it will create one internally.

Example: $PetscRandomCreate(PETSC_COMM_WORLD,&rctx); MatSetRandom(x,rctx); PetscRandomDestroy(rctx);$

Level: intermediate

See also: Mat, PetscRandom, PetscRandomCreate(), MatZeroEntries(), MatSetValues(), PetscRandomDestroy()

External Links

source
PETSc.LibPETSc.MatSetSizes — Method
MatSetSizes(petsclib::PetscLibType, A::AbstractPetscMat, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt)

Sets the local and global sizes, and checks to determine compatibility

Collective

Input Parameters:

  • A - the matrix
  • m - number of local rows (or PETSC_DECIDE)
  • n - number of local columns (or PETSC_DECIDE)
  • M - number of global rows (or PETSC_DETERMINE)
  • N - number of global columns (or PETSC_DETERMINE)

Level: beginner

See also: Mat, MatGetSize(), PetscSplitOwnership(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout, VecSetSizes()

External Links

source
PETSc.LibPETSc.MatSetStencil — Method
MatSetStencil(petsclib::PetscLibType, mat::AbstractPetscMat, dim::PetscInt, dims::Vector{PetscInt}, starts::Vector{PetscInt}, dof::PetscInt)

Sets the grid information for setting values into a matrix via MatSetValuesStencil()

Not Collective

Input Parameters:

  • mat - the matrix
  • dim - dimension of the grid 1, 2, or 3
  • dims - number of grid points in x, y, and z direction, including ghost points on your processor
  • starts - starting point of ghost nodes on your processor in x, y, and z direction
  • dof - number of degrees of freedom per node

Level: beginner

See also: Mat, MatStencil, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), MatSetValues(), MatSetValuesBlockedStencil(), MatSetValuesStencil()

External Links

source
PETSc.LibPETSc.MatSetTransposeNullSpace — Method
MatSetTransposeNullSpace(petsclib::PetscLibType, mat::AbstractPetscMat, nullsp::MatNullSpace)

attaches the null space of a transpose of a matrix to the matrix

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: advanced

See also: Mat, MatNullSpace, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), KSPSetPCSide()

External Links

source
PETSc.LibPETSc.MatSetType — Method
MatSetType(petsclib::PetscLibType, mat::AbstractPetscMat, matype::String)

Builds matrix object for a particular matrix type

Collective

Input Parameters:

  • mat - the matrix object
  • matype - matrix type

Options Database Key:

  • -mat_type type - Sets the type; see MatType

Level: intermediate

See also: Mat, PCSetType(), VecSetType(), MatCreate(), MatType

External Links

source
PETSc.LibPETSc.MatSetUnfactored — Method
MatSetUnfactored(petsclib::PetscLibType, mat::AbstractPetscMat)

Resets a factored matrix to be treated as unfactored.

Logically Collective

Input Parameter:

  • mat - the factored matrix to be reset

Level: developer

See also: Mat, PCFactorSetUseInPlace(), PCFactorGetUseInPlace()

External Links

source
PETSc.LibPETSc.MatSetUp — Method
MatSetUp(petsclib::PetscLibType, A::AbstractPetscMat)

Sets up the internal matrix data structures for later use by the matrix

Collective

Input Parameter:

  • A - the matrix

Level: advanced

See also: Mat, MatMult(), MatCreate(), MatDestroy(), MatXAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatSetValues — Method
MatSetValues(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds a block of values into a matrix. These values may be cached, so MatAssemblyBegin() and MatAssemblyEnd() MUST be called after all calls to MatSetValues() have been completed.

Not Collective

Input Parameters:

  • mat - the matrix
  • m - the number of rows
  • idxm - the global indices of the rows
  • n - the number of columns
  • idxn - the global indices of the columns
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES to replace existing entries with new values

Level: beginner

See also: Mat, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesBatch — Method
MatSetValuesBatch(petsclib::PetscLibType, mat::AbstractPetscMat, nb::PetscInt, bs::PetscInt, rows::Vector{PetscInt}, v::Vector{PetscScalar})

Adds (ADD_VALUES) many blocks of values into a matrix at once. The blocks must all be square and the same size. Currently, this can only be called once and creates the given matrix.

Not Collective

Input Parameters:

  • mat - the matrix
  • nb - the number of blocks
  • bs - the number of rows (and columns) in each block
  • rows - a concatenation of the rows for each block
  • v - a concatenation of logically two-dimensional arrays of values

Level: advanced

See also: Mat, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES, MatSetValues(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatSetValuesBlocked — Method
MatSetValuesBlocked(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, idxm::Vector{PetscInt}, n::PetscInt, idxn::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds a block of values into a matrix.

Not Collective

Input Parameters:

  • mat - the matrix
  • m - the number of block rows
  • idxm - the global block indices
  • n - the number of block columns
  • idxn - the global block indices
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES replaces existing entries with new values

Level: intermediate

See also: Mat, MatSetBlockSize(), MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetValuesBlockedLocal()

External Links

source
PETSc.LibPETSc.MatSetValuesBlockedLocal — Method
MatSetValuesBlockedLocal(petsclib::PetscLibType, mat::AbstractPetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds values into certain locations of a matrix, using a local ordering of the nodes a block at a time.

Not Collective

Input Parameters:

  • mat - the matrix
  • nrow - number of rows
  • irow - the row local indices
  • ncol - number of columns
  • icol - the column local indices
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES to replace existing entries with new values

Level: intermediate

See also: Mat, MatSetBlockSize(), MatSetLocalToGlobalMapping(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesLocal(), MatSetValuesBlocked()

External Links

source
PETSc.LibPETSc.MatSetValuesBlockedStencil — Method
MatSetValuesBlockedStencil(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, idxm::Vector{MatStencil}, n::PetscInt, idxn::Vector{MatStencil}, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds a block of values into a matrix. Using structured grid indexing

Not Collective

Input Parameters:

  • mat - the matrix
  • m - number of rows being entered
  • idxm - grid coordinates for matrix rows being entered
  • n - number of columns being entered
  • idxn - grid coordinates for matrix columns being entered
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add to existing entries or INSERT_VALUES to replace existing entries with new values

Level: beginner

See also: Mat, DMDA, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), MatSetValues(), MatSetValuesStencil(), MatSetStencil(), DMCreateMatrix(), DMDAVecGetArray(), MatStencil, MatSetBlockSize(), MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatSetValuesCOO — Method
MatSetValuesCOO(petsclib::PetscLibType, A::AbstractPetscMat, coo_v::Vector{PetscScalar}, imode::InsertMode)

set values at once in a matrix preallocated using MatSetPreallocationCOO()

Collective

Input Parameters:

  • A - matrix being preallocated
  • coo_v - the matrix values (can be NULL)
  • imode - the insert mode

Level: beginner

See also: Mat, MatSetPreallocationCOO(), MatSetPreallocationCOOLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesIS — Method
MatSetValuesIS(petsclib::PetscLibType, mat::AbstractPetscMat, ism::AbstractIS, isn::AbstractIS, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds a block of values into a matrix using an IS to indicate the rows and columns These values may be cached, so MatAssemblyBegin() and MatAssemblyEnd() MUST be called after all calls to MatSetValues() have been completed.

Not Collective

Input Parameters:

  • mat - the matrix
  • ism - the rows to provide
  • isn - the columns to provide
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES to replace existing entries with new values

Level: beginner

See also: Mat, MatSetOption(), MatSetValues(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesLocal — Method
MatSetValuesLocal(petsclib::PetscLibType, mat::AbstractPetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds values into certain locations of a matrix, using a local numbering of the rows and columns.

Not Collective

Input Parameters:

  • mat - the matrix
  • nrow - number of rows
  • irow - the row local indices
  • ncol - number of columns
  • icol - the column local indices
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES to replace existing entries with new values

Level: intermediate

See also: Mat, MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetLocalToGlobalMapping(), MatGetValuesLocal()

External Links

source
PETSc.LibPETSc.MatSetValuesRow — Method
MatSetValuesRow(petsclib::PetscLibType, mat::AbstractPetscMat, row::PetscInt, v::Vector{PetscScalar})

Inserts a row of nonzero values into a matrix

Not Collective

Input Parameters:

  • mat - the matrix
  • row - the row to set
  • v - a one dimensional array of values

Level: advanced

See also: Mat, MatSetValues(), MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES, MATAIJ

External Links

source
PETSc.LibPETSc.MatSetValuesRowLocal — Method
MatSetValuesRowLocal(petsclib::PetscLibType, mat::AbstractPetscMat, row::PetscInt, v::Vector{PetscScalar})

Inserts a row of nonzero values into a matrix

Not Collective

Input Parameters:

  • mat - the matrix
  • row - the row to set
  • v - a one-dimensional array that contains the values

Level: intermediate

See also: Mat, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES, MatSetValues(), MatSetValuesRow(), MatSetLocalToGlobalMapping(), MATAIJ

External Links

source
PETSc.LibPETSc.MatSetValuesStencil — Method
MatSetValuesStencil(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, idxm::Vector{MatStencil}, n::PetscInt, idxn::Vector{MatStencil}, v::Vector{PetscScalar}, addv::InsertMode)

Inserts or adds a block of values into a matrix. Using structured grid indexing

Not Collective

Input Parameters:

  • mat - the matrix
  • m - number of rows being entered
  • idxm - grid coordinates (and component number when dof > 1) for matrix rows being entered
  • n - number of columns being entered
  • idxn - grid coordinates (and component number when dof > 1) for matrix columns being entered
  • v - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order.

See MAT_ROW_ORIENTED in MatSetOption() for how to use column-major order.

  • addv - either ADD_VALUES to add to existing entries at that location or INSERT_VALUES to replace existing entries with new values

Level: beginner

See also: Mat, DMDA, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), MatSetValues(), MatSetValuesBlockedStencil(), MatSetStencil(), DMCreateMatrix(), DMDAVecGetArray(), MatStencil

External Links

source
PETSc.LibPETSc.MatSetVariableBlockSizes — Method
MatSetVariableBlockSizes(petsclib::PetscLibType, mat::AbstractPetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt})

Sets diagonal point-blocks of the matrix that need not be of the same size

Not Collective

Input Parameters:

  • mat - the matrix
  • nblocks - the number of blocks on this process, each block can only exist on a single process
  • bsizes - the block sizes

Level: intermediate

See also: Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes(), MatGetBlockSizes(), MatGetVariableBlockSizes(), MatComputeVariableBlockEnvelope(), PCVPBJACOBI

External Links

source
PETSc.LibPETSc.MatSetVecType — Method
MatSetVecType(petsclib::PetscLibType, mat::AbstractPetscMat, vtype::String)

Set the vector type the matrix will return with MatCreateVecs()

Collective

Input Parameters:

  • mat - the matrix object
  • vtype - vector type

Options Database Key:

  • -mat_vec_type vtype - set the VecType of the created vectors during MatSetFromOptions()

Level: advanced

See also: Mat, VecType, VecSetType(), MatGetVecType(), MatCreateVecs()

External Links

source
PETSc.LibPETSc.MatShellGetContext — Method
ctx::Ptr{Cvoid} = MatShellGetContext(petsclib::PetscLibType, mat::Union{Ptr, AbstractPetscMat})

Returns the user-provided context associated with a MATSHELL shell matrix.

Not Collective

Input Parameter:

  • mat - the matrix, should have been created with MatCreateShell()

Output Parameter:

  • ctx - the user provided context

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellSetOperation(), MatShellSetContext()

External Links

source
PETSc.LibPETSc.MatShellGetOperation — Method
g::Ptr{Cvoid} = MatShellGetOperation(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOperation)

Gets a matrix function for a MATSHELL shell matrix.

Not Collective

Input Parameters:

  • mat - the MATSHELL shell matrix
  • op - the name of the operation

Output Parameter:

  • g - the function that provides the operation.

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellSetOperation(), MatShellSetContext()

External Links

source
PETSc.LibPETSc.MatShellSetContext — Method
MatShellSetContext(petsclib::PetscLibType, mat::AbstractPetscMat, ctx::Ptr{Cvoid})

sets the context for a MATSHELL shell matrix

Logically Collective

Input Parameters:

  • mat - the MATSHELL shell matrix
  • ctx - the context

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation()

External Links

source
PETSc.LibPETSc.MatShellSetContextDestroy — Method
MatShellSetContextDestroy(petsclib::PetscLibType, mat::AbstractPetscMat, f::Ptr{Cvoid})

sets the destroy function for a MATSHELL shell matrix context

Logically Collective

Input Parameters:

  • mat - the shell matrix
  • f - the context destroy function, see PetscCtxDestroyFn for calling sequence

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellSetContext(), PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.MatShellSetManageScalingShifts — Method
MatShellSetManageScalingShifts(petsclib::PetscLibType, A::AbstractPetscMat)

Allows the user to control the scaling and shift operations of the MATSHELL. Must be called immediately after MatCreateShell()

Logically Collective

Input Parameter:

  • A - the MATSHELL shell matrix

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellSetContext(), MatShellSetOperation()

External Links

source
PETSc.LibPETSc.MatShellSetMatProductOperation — Method
MatShellSetMatProductOperation(petsclib::PetscLibType, A::AbstractPetscMat, ptype::MatProductType, symbolic::Union{Ptr, external}, numeric::Union{Ptr, external}, destroy::Ptr{Cvoid}, Btype::String, Ctype::Union{Ptr, String})

Allows user to set a matrix matrix operation for a MATSHELL shell matrix.

Logically Collective; No Fortran Support

Input Parameters:

  • A - the MATSHELL shell matrix
  • ptype - the product type
  • symbolic - the function for the symbolic phase (can be NULL)
  • numeric - the function for the numerical phase
  • destroy - the function for the destruction of the needed data generated during the symbolic phase (can be NULL)
  • Btype - the matrix type for the matrix to be multiplied against
  • Ctype - the matrix type for the result (can be NULL)

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellSetContext(), MatSetOperation(), MatProductType, MatType, MatSetUp()

External Links

source
PETSc.LibPETSc.MatShellSetOperation — Method
MatShellSetOperation(petsclib::PetscLibType, mat::AbstractPetscMat, op::MatOperation, g::Ptr)

Allows user to set a matrix operation for a MATSHELL shell matrix.

Logically Collective

Input Parameters: mat - the MATSHELL shell matrix op - the name of the operation g - a pointer to the function that provides the operation created with @cfunction

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellSetContext(), MatSetOperation(), MatShellSetManageScalingShifts(), MatShellSetMatProductOperation()

External Links

source
PETSc.LibPETSc.MatShellSetVecType — Method
MatShellSetVecType(petsclib::PetscLibType, mat::AbstractPetscMat, vtype::String)

Sets the VecType of Vec returned by MatCreateVecs()

Logically Collective

Input Parameters:

  • mat - the MATSHELL shell matrix
  • vtype - type to use for creating vectors

Level: advanced

See also: Mat, MATSHELL, MatCreateVecs()

External Links

source
PETSc.LibPETSc.MatShellTestMult — Method
flg::PetscBool = MatShellTestMult(petsclib::PetscLibType, mat::AbstractPetscMat, f::external, base::AbstractPetscVec, ctx::Ptr{Cvoid})

Compares the multiply routine provided to the MATSHELL with differencing on a given function.

Logically Collective; No Fortran Support

Input Parameters:

  • mat - the MATSHELL shell matrix
  • f - the function
  • base - differences are computed around this vector, see MatMFFDSetBase(), for Jacobians this is the point at which the Jacobian is being evaluated
  • ctx - an optional context for the function

Output Parameter:

  • flg - PETSC_TRUE if the multiply is likely correct

Options Database Key:

  • -mat_shell_test_mult_view - print if any differences are detected between the products and print the difference

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellTestMultTranspose()

External Links

source
PETSc.LibPETSc.MatShellTestMultTranspose — Method
flg::PetscBool = MatShellTestMultTranspose(petsclib::PetscLibType, mat::AbstractPetscMat, f::external, base::AbstractPetscVec, ctx::Ptr{Cvoid})

Compares the multiply transpose routine provided to the MATSHELL with differencing on a given function.

Logically Collective; No Fortran Support

Input Parameters:

  • mat - the MATSHELL shell matrix
  • f - the function
  • base - differences are computed around this vector, see MatMFFDSetBase(), for Jacobians this is the point at which the Jacobian is being evaluated
  • ctx - an optional context for the function

Output Parameter:

  • flg - PETSC_TRUE if the multiply is likely correct

Options Database Key:

  • -mat_shell_test_mult_view - print if any differences are detected between the products and print the difference

Level: advanced

See also: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellTestMult()

External Links

source
PETSc.LibPETSc.MatShift — Method
MatShift(petsclib::PetscLibType, Y::AbstractPetscMat, a::PetscScalar)

Computes Y = Y + a I, where a is a PetscScalar

Neighbor-wise Collective

Input Parameters:

  • Y - the matrix
  • a - the PetscScalar

Level: intermediate

See also: Mat, MatDiagonalSet(), MatScale(), MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatSolve — Method
MatSolve(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, x::AbstractPetscVec)

Solves A x = b, given a factored matrix.

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix
  • b - the right-hand-side vector

Output Parameter:

  • x - the result vector

Level: developer

See also: Mat, Matrix Factorization, MatGetFactor(), MatLUFactor(), MatSolveAdd(), MatSolveTranspose(), MatSolveTransposeAdd()

External Links

source
PETSc.LibPETSc.MatSolveAdd — Method
MatSolveAdd(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, y::AbstractPetscVec, x::AbstractPetscVec)

Computes x = y + A^{-1}*b, given a factored matrix.

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix
  • b - the right-hand-side vector
  • y - the vector to be added to

Output Parameter:

  • x - the result vector

Level: developer

See also: Mat, Matrix Factorization, MatSolve(), MatGetFactor(), MatSolveTranspose(), MatSolveTransposeAdd()

External Links

source
PETSc.LibPETSc.MatSolveTranspose — Method
MatSolveTranspose(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, x::AbstractPetscVec)

Solves A^T x = b, given a factored matrix.

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix
  • b - the right-hand-side vector

Output Parameter:

  • x - the result vector

Level: developer

See also: Mat, MatGetFactor(), KSP, MatSolve(), MatSolveAdd(), MatSolveTransposeAdd()

External Links

source
PETSc.LibPETSc.MatSolveTransposeAdd — Method
MatSolveTransposeAdd(petsclib::PetscLibType, mat::AbstractPetscMat, b::AbstractPetscVec, y::AbstractPetscVec, x::AbstractPetscVec)

Computes x = y + A^{-T} b factored matrix.

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix
  • b - the right-hand-side vector
  • y - the vector to be added to

Output Parameter:

  • x - the result vector

Level: developer

See also: Mat, MatGetFactor(), MatSolve(), MatSolveAdd(), MatSolveTranspose()

External Links

source
PETSc.LibPETSc.MatSolverTypeGet — Method
foundtype::PetscBool,foundmtype::PetscBool = MatSolverTypeGet(petsclib::PetscLibType, type::String, mtype::String, ftype::MatFactorType, noname::Ptr{Cvoid})

Gets the function that creates the factor matrix if it exist

Input Parameters:

  • type - name of the package, for example petsc or superlu, if this is NULL, then the first result that satisfies the other criteria is returned
  • ftype - the type of factorization supported by the type
  • mtype - the matrix type that works with this type

Output Parameters:

  • foundtype - PETSC_TRUE if the type was registered
  • foundmtype - PETSC_TRUE if the type supports the requested mtype
  • createfactor - routine that will create the factored matrix ready to be used or NULL if not found

Calling sequence of createfactor:

  • A - the matrix providing the factor matrix
  • ftype - the MatFactorType of the factor requested
  • B - the new factor matrix that responds to MatXXFactorSymbolic,Numeric() functions, such as MatLUFactorSymbolic()

Level: developer

See also: Mat, MatFactorType, MatType, MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatSolverTypeRegister(), MatGetFactor(), MatInitializePackage()

External Links

source
PETSc.LibPETSc.MatSolverTypeRegister — Method
MatSolverTypeRegister(petsclib::PetscLibType, package::String, mtype::String, ftype::MatFactorType, createfactor::external)

Registers a MatSolverType that works for a particular matrix type

Logically Collective, No Fortran Support

Input Parameters:

  • package - name of the package, for example petsc or superlu
  • mtype - the matrix type that works with this package
  • ftype - the type of factorization supported by the package
  • createfactor - routine that will create the factored matrix ready to be used

Level: developer

See also: Mat, Matrix Factorization, MatFactorGetSolverType(), MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSolves — Method
MatSolves(petsclib::PetscLibType, mat::AbstractPetscMat, b::Vecs, x::Vecs)

Solves A x = b, given a factored matrix, for a collection of vectors

Neighbor-wise Collective

Input Parameters:

  • mat - the factored matrix obtained with MatGetFactor()
  • b - the right-hand-side vectors

Output Parameter:

  • x - the result vectors

Level: developer

See also: Mat, Vecs, MatSolveAdd(), MatSolveTranspose(), MatSolveTransposeAdd(), MatSolve()

External Links

source
PETSc.LibPETSc.MatStashGetInfo — Method
nstash::PetscInt,reallocs::PetscInt,bnstash::PetscInt,breallocs::PetscInt = MatStashGetInfo(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets how many values are currently in the matrix stash, i.e. need to be communicated to other processors during the MatAssemblyBegin()/MatAssemblyEnd() process

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • nstash - the size of the stash
  • reallocs - the number of additional mallocs incurred.
  • bnstash - the size of the block stash
  • breallocs - the number of additional mallocs incurred.in the block stash

Level: advanced

See also: MatAssemblyBegin(), MatAssemblyEnd(), Mat, MatStashSetInitialSize()

External Links

source
PETSc.LibPETSc.MatStashSetInitialSize — Method
MatStashSetInitialSize(petsclib::PetscLibType, mat::AbstractPetscMat, size::PetscInt, bsize::PetscInt)

sets the sizes of the matrix stash, that is used during the assembly process to store values that belong to other processors.

Not Collective

Input Parameters:

  • mat - the matrix
  • size - the initial size of the stash.
  • bsize - the initial size of the block-stash(if used).

Options Database Keys:

  • -matstash_initial_size size or size0,size1,...,sizep-1 - set initial size
  • -matstash_block_initial_size bsize or bsize0,bsize1,...,bsizep-1 - set initial block size

Level: intermediate

See also: MatAssemblyBegin(), MatAssemblyEnd(), Mat, MatStashGetInfo()

External Links

source
PETSc.LibPETSc.MatStoreValues — Method
MatStoreValues(petsclib::PetscLibType, mat::AbstractPetscMat)

Stashes a copy of the matrix values; this allows reusing of the linear part of a Jacobian, while recomputing only the nonlinear portion.

Logically Collect

Input Parameter:

  • mat - the matrix (currently only MATAIJ matrices support this option)

Level: advanced

See also: Mat, MatRetrieveValues()

External Links

source
PETSc.LibPETSc.MatSubMatrixVirtualUpdate — Method
MatSubMatrixVirtualUpdate(petsclib::PetscLibType, N::AbstractPetscMat, A::AbstractPetscMat, isrow::AbstractIS, iscol::AbstractIS)

Updates a MATSUBMATRIX virtual submatrix

Collective

Input Parameters:

  • N - submatrix to update
  • A - full matrix in the submatrix
  • isrow - rows in the update (same as the first time the submatrix was created)
  • iscol - columns in the update (same as the first time the submatrix was created)

Level: developer

See also: Mat, MATSUBMATRIX, MatCreateSubMatrixVirtual()

External Links

source
PETSc.LibPETSc.MatSubdomainsCreateCoalesce — Method
M_n::PetscInt,iss::Vector{IS} = MatSubdomainsCreateCoalesce(petsclib::PetscLibType, A::AbstractPetscMat, N::PetscInt)

Creates index subdomains by coalescing adjacent MPI processes' ownership ranges.

Collective

Input Parameters:

  • A - the matrix to create subdomains from
  • N - requested number of subdomains

Output Parameters:

  • n - number of subdomains resulting on this MPI process
  • iss - IS list with indices of subdomains on this MPI process

Level: advanced

See also: Mat, IS

External Links

source
PETSc.LibPETSc.MatSuperluDistGetDiagU — Method
diagU::PetscScalar = MatSuperluDistGetDiagU(petsclib::PetscLibType, F::AbstractPetscMat)

Get the diagonal of the U factor of a MATSOLVERSUPERLU_DIST factored matrix.

Collective

Input Parameter:

  • F - the factored matrix returned by MatGetFactor() with MATSOLVERSUPERLU_DIST

Output Parameter:

  • diagU - array of the U factor diagonal; must be preallocated by the caller

Level: advanced

See also: Mat, MATSOLVERSUPERLU_DIST, MatGetFactor(), MatLUFactorSymbolic(), MatLUFactorNumeric()

External Links

source
PETSc.LibPETSc.MatSuperluSetILUDropTol — Method
MatSuperluSetILUDropTol(petsclib::PetscLibType, F::AbstractPetscMat, dtol::PetscReal)

Set SuperLU https://portal.nersc.gov/project/sparse/superlu/superlu_ug.pdf ILU drop tolerance

Logically Collective

Input Parameters:

  • F - the factored matrix obtained by calling MatGetFactor()
  • dtol - drop tolerance

Options Database Key:

  • -mat_superlu_ilu_droptol dtol - the drop tolerance

Level: beginner

See also: Mat, MatGetFactor(), MATSOLVERSUPERLU

External Links

source
PETSc.LibPETSc.MatTransColoringApplyDenToSp — Method
MatTransColoringApplyDenToSp(petsclib::PetscLibType, matcoloring::MatTransposeColoring, Cden::AbstractPetscMat, Csp::AbstractPetscMat)

Given a symbolic matrix product C{sp} = A*B^T for which a MatTransposeColoring context has been created and a dense matrix C{den} = A*B^T{dense} in which `B^T{dens}is obtained fromMatTransColoringApplySpToDen()`, recover sparse matrix C{sp} from C{den}.

Collective

Input Parameters:

  • matcoloring - coloring context created with MatTransposeColoringCreate()
  • Cden - matrix product of a sparse matrix and a dense matrix Btdense

Output Parameter:

  • Csp - sparse matrix

Level: developer

See also: Mat, MatTransposeColoringCreate(), MatTransposeColoringDestroy(), MatTransColoringApplySpToDen()

External Links

source
PETSc.LibPETSc.MatTransColoringApplySpToDen — Method
MatTransColoringApplySpToDen(petsclib::PetscLibType, coloring::MatTransposeColoring, B::AbstractPetscMat, Btdense::AbstractPetscMat)

Given a symbolic matrix product C = A*B^T for which a MatTransposeColoring context has been created, computes a dense B^T by applying MatTransposeColoring to sparse B.

Collective

Input Parameters:

  • coloring - coloring context created with MatTransposeColoringCreate()
  • B - sparse matrix

Output Parameter:

  • Btdense - dense matrix B^T

Level: developer

See also: Mat, MatTransposeColoringCreate(), MatTransposeColoringDestroy(), MatTransColoringApplyDenToSp()

External Links

source
PETSc.LibPETSc.MatTranspose — Method
B::PetscMat = MatTranspose(petsclib::PetscLibType, mat::AbstractPetscMat, reuse::MatReuse)

Computes the transpose of a matrix, either in-place or out-of-place.

Collective

Input Parameters:

  • mat - the matrix to transpose
  • reuse - either MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, or MAT_INPLACE_MATRIX

Output Parameter:

  • B - the transpose of the matrix

Level: intermediate

See also: Mat, MatTransposeSetPrecursor(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX, MatTransposeSymbolic(), MatCreateTranspose()

External Links

source
PETSc.LibPETSc.MatTransposeGetMat — Method
M::PetscMat = MatTransposeGetMat(petsclib::PetscLibType, A::AbstractPetscMat)

Gets the Mat object stored inside a MATTRANSPOSEVIRTUAL

Logically Collective

Input Parameter:

  • A - the MATTRANSPOSEVIRTUAL matrix

Output Parameter:

  • M - the matrix object stored inside A

Level: intermediate

See also: Mat, MATTRANSPOSEVIRTUAL, MatCreateTranspose()

External Links

source
PETSc.LibPETSc.MatTransposeMatMult — Method
C::PetscMat = MatTransposeMatMult(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, scall::MatReuse, fill::PetscReal)

Performs matrix-matrix multiplication C = A^T*B.

Neighbor-wise Collective

Input Parameters:

  • A - the left matrix
  • B - the right matrix
  • scall - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX
  • fill - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use PETSC_DETERMINE or PETSC_CURRENT if not known

Output Parameter:

  • C - the product matrix

Level: intermediate

See also: Mat, MatProductCreate(), MATPRODUCT_AtB, MatMatMult(), MatMatTransposeMult(), MatPtAP()

External Links

source
PETSc.LibPETSc.MatTransposeMatMultEqual — Method
flg::PetscBool = MatTransposeMatMultEqual(petsclib::PetscLibType, A::AbstractPetscMat, B::AbstractPetscMat, C::AbstractPetscMat, n::PetscInt)

Test A^TBx = C*x for n random vector x

Collective

Input Parameters:

  • A - the first matrix
  • B - the second matrix
  • C - the third matrix
  • n - number of random vectors to be tested

Output Parameter:

  • flg - PETSC_TRUE if the products are equal; PETSC_FALSE otherwise.

Level: intermediate

See also: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatTransposeSetPrecursor — Method
MatTransposeSetPrecursor(petsclib::PetscLibType, mat::AbstractPetscMat, B::AbstractPetscMat)

Set the matrix from which the second matrix will receive numerical transpose data with a call to MatTranspose(A,MAT_REUSE_MATRIX,&B) when B was not obtained with MatTranspose(A,MAT_INITIAL_MATRIX,&B)

Collective

Input Parameter:

  • mat - the matrix to provide the transpose

Output Parameter:

  • B - the matrix to contain the transpose; it MUST have the nonzero structure of the transpose of A or the code will crash or generate incorrect results

Level: advanced

See also: Mat, MatTransposeSymbolic(), MatTranspose(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX

External Links

source
PETSc.LibPETSc.MatTransposeSymbolic — Method
B::PetscMat = MatTransposeSymbolic(petsclib::PetscLibType, A::AbstractPetscMat)

Computes the symbolic part of the transpose of a matrix.

Collective

Input Parameter:

  • A - the matrix to transpose

Output Parameter:

  • B - the transpose. This is a complete matrix but the numerical portion is invalid. One can call MatTranspose(A,MAT_REUSE_MATRIX,&B) to compute the

numerical portion.

Level: intermediate

See also: Mat, MatTransposeSetPrecursor(), MatTranspose(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX

External Links

source
PETSc.LibPETSc.MatUpdateMPIAIJWithArray — Method
MatUpdateMPIAIJWithArray(petsclib::PetscLibType, mat::AbstractPetscMat, v::Vector{PetscScalar})

updates an MATMPIAIJ matrix using an array that contains the nonzero values

Collective

Input Parameters:

  • mat - the matrix
  • v - matrix values, stored by row

Level: intermediate

See also: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays(), MatUpdateMPIAIJWithArrays(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatUpdateMPIAIJWithArrays — Method
MatUpdateMPIAIJWithArrays(petsclib::PetscLibType, mat::AbstractPetscMat, m::PetscInt, n::PetscInt, M_M::PetscInt, M_N::PetscInt, Ii::Vector{PetscInt}, J::Vector{PetscInt}, v::Vector{PetscScalar})

updates a MATMPIAIJ matrix using arrays that contain in standard CSR format for the local rows. Only the numerical values are updated the other arrays must be identical to what was passed from MatCreateMPIAIJWithArrays()

Deprecated: Use MatUpdateMPIAIJWithArray()

Collective

Input Parameters:

  • mat - the matrix
  • m - number of local rows (Cannot be PETSC_DECIDE)
  • n - This value should be the same as the local size used in creating the

x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have calculated if N is given) For square matrices n is almost always m.

  • M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
  • N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
  • Ii - row indices; that is Ii[0] = 0, Ii[row] = Ii[row-1] + number of elements in that row of the matrix
  • J - column indices
  • v - matrix values

Level: deprecated

See also: Mat, MATMPIAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays(), MatUpdateMPIAIJWithArray(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatView — Method
MatView(petsclib::PetscLibType, mat::AbstractPetscMat, viewer::PetscViewer)

display information about a matrix in a variety ways

Collective on viewer

Input Parameters:

  • mat - the matrix
  • viewer - visualization context

Options Database Keys:

  • -mat_view ::ascii_info - Prints info on matrix at conclusion of MatAssemblyEnd()
  • -mat_view ::ascii_info_detail - Prints more detailed info
  • -mat_view - Prints matrix in ASCII format
  • -mat_view ::ascii_matlab - Prints matrix in MATLAB format
  • -mat_view draw - PetscDraws nonzero structure of matrix, using MatView() and PetscDrawOpenX().
  • -display name - Sets display name (default is host)
  • -draw_pause sec - Sets number of seconds to pause after display
  • -mat_view socket - Sends matrix to socket, can be accessed from MATLAB (see Users-Manual: ch_matlab for details)
  • -viewer_socket_machine machine - -
  • -viewer_socket_port port - -
  • -mat_view binary - save matrix to file in binary format
  • -viewer_binary_filename name - -

Level: beginner

See also: Mat, PetscViewerPushFormat(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewer, PetscViewerSocketOpen(), PetscViewerBinaryOpen(), MatLoad(), MatViewFromOptions()

External Links

source
PETSc.LibPETSc.MatViewFromOptions — Method
MatViewFromOptions(petsclib::PetscLibType, A::AbstractPetscMat, obj, name::String)

View properties of the matrix based on options set in the options database

Collective

Input Parameters:

  • A - the matrix
  • obj - optional additional object that provides the options prefix to use
  • name - command line option

Options Database Key:

  • -name [viewertype][:...] - option name and values. See PetscObjectViewFromOptions() for the possible arguments

Level: intermediate

See also: Mat, MatView(), PetscObjectViewFromOptions(), MatCreate()

External Links

source
PETSc.LibPETSc.MatXAIJSetPreallocation — Method
MatXAIJSetPreallocation(petsclib::PetscLibType, A::AbstractPetscMat, bs::PetscInt, dnnz::Union{Ptr, Vector{PetscInt}}, onnz::Union{Ptr, Vector{PetscInt}}, dnnzu::Union{Ptr, Vector{PetscInt}}, onnzu::Union{Ptr, Vector{PetscInt}})

set preallocation for serial and parallel MATAIJ, MATBAIJ, and MATSBAIJ matrices and their unassembled versions.

Collective

Input Parameters:

  • A - matrix being preallocated
  • bs - block size
  • dnnz - number of nonzero column blocks per block row of diagonal part of parallel matrix
  • onnz - number of nonzero column blocks per block row of off-diagonal part of parallel matrix
  • dnnzu - number of nonzero column blocks per block row of upper-triangular part of diagonal part of parallel matrix
  • onnzu - number of nonzero column blocks per block row of upper-triangular part of off-diagonal part of parallel matrix

Level: beginner

See also: Mat, MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatSeqBAIJSetPreallocation(), MatMPIBAIJSetPreallocation(), MatSeqSBAIJSetPreallocation(), MatMPISBAIJSetPreallocation(), PetscSplitOwnership()

External Links

source
PETSc.LibPETSc.MatZeroEntries — Method
MatZeroEntries(petsclib::PetscLibType, mat::AbstractPetscMat)

Zeros all entries of a matrix. For sparse matrices this routine retains the old nonzero structure.

Logically Collective

Input Parameter:

  • mat - the matrix

Level: intermediate

See also: Mat, MatZeroRows(), MatZeroRowsColumns()

External Links

source
PETSc.LibPETSc.MatZeroRows — Method
MatZeroRows(petsclib::PetscLibType, mat::AbstractPetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix.

Collective

Input Parameters:

  • mat - the matrix
  • numRows - the number of rows to zero
  • rows - the global row indices
  • diag - value put in the diagonal of the zeroed rows
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used), these must be set before this call
  • b - optional vector of right-hand side, that will be adjusted by provided solution entries

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil(), PCREDISTRIBUTE, MAT_KEEP_NONZERO_PATTERN

External Links

source
PETSc.LibPETSc.MatZeroRowsColumns — Method
MatZeroRowsColumns(petsclib::PetscLibType, mat::AbstractPetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows and columns of a matrix.

Collective

Input Parameters:

  • mat - the matrix
  • numRows - the number of rows/columns to zero
  • rows - the global row indices
  • diag - value put in the diagonal of the eliminated rows
  • x - optional vector of the solution for zeroed rows (other entries in vector are not used), these must be set before this call
  • b - optional vector of the right-hand side, that will be adjusted by provided solution entries

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRows(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsIS — Method
MatZeroRowsColumnsIS(petsclib::PetscLibType, mat::AbstractPetscMat, is::AbstractIS, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows and columns of a matrix.

Collective

Input Parameters:

  • mat - the matrix
  • is - the rows to zero
  • diag - value put in all diagonals of eliminated rows (0.0 will even eliminate diagonal entry)
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRows(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsLocal — Method
MatZeroRowsColumnsLocal(petsclib::PetscLibType, mat::AbstractPetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows and columns of a matrix; using local numbering of rows.

Collective

Input Parameters:

  • mat - the matrix
  • numRows - the number of rows to remove
  • rows - the global row indices
  • diag - value put in all diagonals of eliminated rows
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRows(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsLocalIS — Method
MatZeroRowsColumnsLocalIS(petsclib::PetscLibType, mat::AbstractPetscMat, is::AbstractIS, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows and columns of a matrix; using local numbering of rows.

Collective

Input Parameters:

  • mat - the matrix
  • is - index set of rows to remove
  • diag - value put in all diagonals of eliminated rows
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRows(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsStencil — Method
MatZeroRowsColumnsStencil(petsclib::PetscLibType, mat::AbstractPetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all row and column entries (except possibly the main diagonal) of a set of rows and columns of a matrix.

Collective

Input Parameters:

  • mat - the matrix
  • numRows - the number of rows/columns to remove
  • rows - the grid coordinates (and component number when dof > 1) for matrix rows
  • diag - value put in all diagonals of eliminated rows (0.0 will even eliminate diagonal entry)
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRows()

External Links

source
PETSc.LibPETSc.MatZeroRowsIS — Method
MatZeroRowsIS(petsclib::PetscLibType, mat::AbstractPetscMat, is::Union{Ptr, AbstractIS}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix indicated by an IS

Collective

Input Parameters:

  • mat - the matrix
  • is - index set, IS, of rows to remove (if NULL then no row is removed)
  • diag - value put in all diagonals of eliminated rows
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRows(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil(), IS

External Links

source
PETSc.LibPETSc.MatZeroRowsLocal — Method
MatZeroRowsLocal(petsclib::PetscLibType, mat::AbstractPetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix; using local numbering of rows.

Collective

Input Parameters:

  • mat - the matrix
  • numRows - the number of rows to remove
  • rows - the local row indices
  • diag - value put in all diagonals of eliminated rows
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRows(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsLocalIS — Method
MatZeroRowsLocalIS(petsclib::PetscLibType, mat::AbstractPetscMat, is::AbstractIS, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix; using local numbering of rows.

Collective

Input Parameters:

  • mat - the matrix
  • is - index set of rows to remove
  • diag - value put in all diagonals of eliminated rows
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRows(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsStencil — Method
MatZeroRowsStencil(petsclib::PetscLibType, mat::AbstractPetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::AbstractPetscVec, b::AbstractPetscVec)

Zeros all entries (except possibly the main diagonal) of a set of rows of a matrix indicated by a MatStencil. These rows must be local to the process.

Collective

Input Parameters:

  • mat - the matrix
  • numRows - the number of rows to remove
  • rows - the grid coordinates (and component number when dof > 1) for matrix rows indicated by an array of MatStencil
  • diag - value put in all diagonals of eliminated rows (0.0 will even eliminate diagonal entry)
  • x - optional vector of solutions for zeroed rows (other entries in vector are not used)
  • b - optional vector of right-hand side, that will be adjusted by provided solution

Level: intermediate

See also: Mat, MatStencil, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRows(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatCoarsenApply — Method
MatCoarsenApply(petsclib::PetscLibType, coarser::MatCoarsen)

Gets a coarsen for a matrix.

Collective

Input Parameter:

  • coarser - the coarsen

Options Database Keys:

  • -mat_coarsen_type (mis|hem|misk) - mis: maximal independent set based; misk: distance k MIS; hem: heavy edge matching
  • -mat_coarsen_view - view the coarsening object

Level: advanced

See also: MatCoarsen, MatCoarsenSetFromOptions(), MatCoarsenSetType(), MatCoarsenRegister(), MatCoarsenCreate(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenCreate — Method
newcrs::MatCoarsen = MatCoarsenCreate(petsclib::PetscLibType, comm::MPI_Comm)

Creates a coarsen context.

Collective

Input Parameter:

  • comm - MPI communicator

Output Parameter:

  • newcrs - location to put the context

Level: advanced

See also: MatCoarsen, MatCoarsenSetType(), MatCoarsenApply(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenGetData — Method
llist::Ptr{PetscCoarsenData} = MatCoarsenGetData(petsclib::PetscLibType, coarser::MatCoarsen)

Gets the weights for vertices for a coarsener.

Logically Collective, No Fortran Support

Input Parameter:

  • coarser - the coarsen context

Output Parameter:

  • llist - linked list of aggregates

Level: advanced

See also: MatCoarsen, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType(), PetscCoarsenData

External Links

source
PETSc.LibPETSc.MatCoarsenGetType — Method
type::String = MatCoarsenGetType(petsclib::PetscLibType, coarsen::MatCoarsen)

Gets the Coarsen method type and name (as a string) from the coarsen context.

Not Collective

Input Parameter:

  • coarsen - the coarsen context

Output Parameter:

  • type - coarsener type

Level: advanced

See also: MatCoarsen, MatCoarsenCreate(), MatCoarsenType, MatCoarsenSetType(), MatCoarsenRegister()

External Links

source
PETSc.LibPETSc.MatCoarsenMISKGetDistance — Method
k::PetscInt = MatCoarsenMISKGetDistance(petsclib::PetscLibType, crs::MatCoarsen)

gets the distance to be used by MISK

Collective

Input Parameter:

  • crs - the coarsen

Output Parameter:

  • k - the distance

Level: advanced

See also: MATCOARSENMISK, MatCoarsen, MatCoarsenSetFromOptions(), MatCoarsenSetType(), MatCoarsenRegister(), MatCoarsenCreate(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenMISKSetDistance — Method
MatCoarsenMISKSetDistance(petsclib::PetscLibType, crs::MatCoarsen, k::PetscInt)

the distance to be used by MISK

Collective

Input Parameters:

  • crs - the coarsen
  • k - the distance

Options Database Key:

  • -mat_coarsen_misk_distance k - distance for MIS

Level: advanced

See also: MATCOARSENMISK, MatCoarsen, MatCoarsenSetFromOptions(), MatCoarsenSetType(), MatCoarsenRegister(), MatCoarsenCreate(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenMISKGetDistance(), MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenRegister — Method
MatCoarsenRegister(petsclib::PetscLibType, sname::String, fnc::external)

Adds a new sparse matrix coarsening algorithm to the matrix package.

Logically Collective, No Fortran Support

Input Parameters:

  • sname - name of coarsen (for example MATCOARSENMIS)
  • function - function pointer that creates the coarsen type

Level: developer

See also: MatCoarsen, MatCoarsenType, MatCoarsenSetType(), MatCoarsenCreate(), MatCoarsenRegisterDestroy(), MatCoarsenRegisterAll()

External Links

source
PETSc.LibPETSc.MatCoarsenSetAdjacency — Method
MatCoarsenSetAdjacency(petsclib::PetscLibType, agg::MatCoarsen, adj::AbstractPetscMat)

Sets the adjacency graph (matrix) of the thing to be coarsened.

Collective

Input Parameters:

  • agg - the coarsen context
  • adj - the adjacency matrix

Level: advanced

See also: MatCoarsen, MatCoarsenSetFromOptions(), Mat, MatCoarsenCreate(), MatCoarsenApply()

External Links

source
PETSc.LibPETSc.MatCoarsenSetFromOptions — Method
MatCoarsenSetFromOptions(petsclib::PetscLibType, coarser::MatCoarsen)

Sets various coarsen options from the options database.

Collective

Input Parameter:

  • coarser - the coarsen context.

Options Database Key:

  • -mat_coarsen_type (mis|hem|misk) - see MatCoarsenType
  • -mat_coarsen_max_it its - number of iterations to use in the coarsening process, see MatCoarsenSetMaximumIterations()
  • -mat_coarsen_threshold threshold - see MatCoarsenSetThreshold(), for MATCOARSENHEM only

Level: advanced

See also: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType(), MatCoarsenSetMaximumIterations(), MATCOARSENHEM, MATCOARSENMIS, MATCOARSENMISK

External Links

source
PETSc.LibPETSc.MatCoarsenSetGreedyOrdering — Method
MatCoarsenSetGreedyOrdering(petsclib::PetscLibType, coarser::MatCoarsen, perm::AbstractIS)

Sets the ordering of the vertices to use with a greedy coarsening method

Logically Collective

Input Parameters:

  • coarser - the coarsen context
  • perm - vertex ordering of (greedy) algorithm

Level: advanced

See also: MatCoarsen, MatCoarsenType, MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetMaximumIterations — Method
MatCoarsenSetMaximumIterations(petsclib::PetscLibType, coarse::MatCoarsen, n::PetscInt)

Maximum MATCOARSENHEM iterations to use

Logically Collective

Input Parameters:

  • coarse - the coarsen context
  • n - number of HEM iterations

Options Database Key:

  • -mat_coarsen_max_it n - Maximum MATCOARSENHEM iterations to use

Level: intermediate

See also: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetStrengthIndex — Method
MatCoarsenSetStrengthIndex(petsclib::PetscLibType, coarse::MatCoarsen, n::PetscInt, idx::Vector{PetscInt})

Index array to use for index to use for strength of connection

Logically Collective

Input Parameters:

  • coarse - the coarsen context
  • n - number of indices
  • idx - array of indices

Options Database Key:

  • -mat_coarsen_strength_index - array of subset of variables per vertex to use for strength norm, -1 for using all (default)

Level: intermediate

See also: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetStrictAggs — Method
MatCoarsenSetStrictAggs(petsclib::PetscLibType, agg::MatCoarsen, str::PetscBool)

Set whether to keep strict (non overlapping) aggregates in the linked list of aggregates for a coarsen context

Logically Collective

Input Parameters:

  • agg - the coarsen context
  • str - PETSC_TRUE keep strict aggregates, PETSC_FALSE allow overlap

Level: advanced

See also: MatCoarsen, MatCoarsenCreate(), MatCoarsenSetFromOptions()

External Links

source
PETSc.LibPETSc.MatCoarsenSetThreshold — Method
MatCoarsenSetThreshold(petsclib::PetscLibType, coarse::MatCoarsen, b::PetscReal)

Set the threshold for HEM

Logically Collective

Input Parameters:

  • coarse - the coarsen context
  • b - threshold value, default is 0

Options Database Key:

  • -mat_coarsen_threshold b - threshold

Level: intermediate

See also: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetType — Method
MatCoarsenSetType(petsclib::PetscLibType, coarser::MatCoarsen, type::String)

Sets the type of aggregator to use

Collective

Input Parameters:

  • coarser - the coarsen context.
  • type - a known coarsening method

Options Database Key:

  • -mat_coarsen_type type - maximal independent set based; distance k MIS; heavy edge matching

Level: advanced

See also: MatCoarsen, MatCoarsenCreate(), MatCoarsenApply(), MatCoarsenType, MatCoarsenGetType()

External Links

source
PETSc.LibPETSc.MatCoarsenView — Method
MatCoarsenView(petsclib::PetscLibType, agg::MatCoarsen, viewer::PetscViewer)

Prints the coarsen data structure.

Collective

Input Parameters:

  • agg - the coarsen context
  • viewer - optional visualization context

For viewing the options database see MatCoarsenViewFromOptions()

Level: advanced

See also: MatCoarsen, PetscViewer, PetscViewerASCIIOpen(), MatCoarsenViewFromOptions

External Links

source
PETSc.LibPETSc.MatCoarsenViewFromOptions — Method
MatCoarsenViewFromOptions(petsclib::PetscLibType, A::MatCoarsen, obj, name::String)

View the coarsener from the options database

Collective

Input Parameters:

  • A - the coarsen context
  • obj - Optional object that provides the prefix for the option name
  • name - command line option (usually -mat_coarsen_view)

Options Database Key:

  • -name [viewertype][:...] - option name and values. See PetscObjectViewFromOptions() for the possible arguments

Level: intermediate

See also: MatCoarsen, MatCoarsenView(), PetscObjectViewFromOptions(), MatCoarsenCreate()

External Links

source
PETSc.LibPETSc.MatColoringApply — Method
coloring::ISColoring = MatColoringApply(petsclib::PetscLibType, mc::MatColoring)

Apply the coloring to the matrix, producing index sets corresponding to a number of independent sets in the induced graph.

Collective

Input Parameter:

  • mc - the MatColoring context

Output Parameter:

  • coloring - the ISColoring instance containing the coloring

Level: beginner

See also: ISColoring, MatColoring, MatColoringCreate()

External Links

source
PETSc.LibPETSc.MatColoringCreate — Method
mcptr::MatColoring = MatColoringCreate(petsclib::PetscLibType, m::AbstractPetscMat)

Creates a matrix coloring context.

Collective

Input Parameter:

  • m - a Mat from which a coloring is derived

Output Parameter:

  • mcptr - the new MatColoring context

Options Database Keys:

  • -mat_coloring_type - the type of coloring algorithm used. See MatColoringType.
  • -mat_coloring_maxcolors - the maximum number of relevant colors, all nodes not in a color are in maxcolors+1
  • -mat_coloring_distance - compute a distance 1,2,... coloring.
  • -mat_coloring_view - print information about the coloring and the produced index sets
  • -mat_coloring_test - debugging option that prints all coloring incompatibilities
  • -mat_is_coloring_test - debugging option that throws an error if MatColoringApply() generates an incorrect iscoloring

Level: beginner

See also: MatColoringSetFromOptions(), MatColoring, MatColoringApply(), MatFDColoringCreate(), DMCreateColoring(), MatColoringType

External Links

source
PETSc.LibPETSc.MatColoringCreateWeights — Method
weights::Ptr{PetscReal},lperm::Ptr{PetscInt} = MatColoringCreateWeights(petsclib::PetscLibType, mc::MatColoring)

Create per-row weights and, optionally, a decreasing-order permutation of them for a MatColoring, using the weight scheme set on the MatColoring.

Collective

Input Parameter:

  • mc - the MatColoring

Output Parameters:

  • weights - the array of per-row weights, or NULL if not needed
  • lperm - the permutation that sorts weights in decreasing order, or NULL if not needed

Level: developer

See also: MatColoring, MatColoringWeightType, MatColoringSetWeights(), MatColoringGetDegrees()

External Links

source
PETSc.LibPETSc.MatColoringGetDegrees — Method
degrees::PetscInt = MatColoringGetDegrees(petsclib::PetscLibType, G::AbstractPetscMat, distance::PetscInt)

Compute the number of vertices reachable in the graph within a given distance for each locally owned row.

Collective

Input Parameters:

  • G - the graph matrix
  • distance - the distance (in graph edges) used to define the neighborhood

Output Parameter:

  • degrees - array (of local size) of neighborhood sizes for each row

Level: developer

See also: MatColoring, MatColoringCreateWeights(), MatColoringSetWeights()

External Links

source
PETSc.LibPETSc.MatColoringGetDistance — Method
dist::PetscInt = MatColoringGetDistance(petsclib::PetscLibType, mc::MatColoring)

Gets the distance of the coloring

Logically Collective

Input Parameter:

  • mc - the MatColoring context

Output Parameter:

  • dist - the current distance being used for the coloring.

Level: beginner

See also: MatColoring, MatColoringSetDistance(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringGetMaxColors — Method
maxcolors::PetscInt = MatColoringGetMaxColors(petsclib::PetscLibType, mc::MatColoring)

Gets the maximum number of colors

Logically Collective

Input Parameter:

  • mc - the MatColoring context

Output Parameter:

  • maxcolors - the current maximum number of colors to produce

Level: beginner

See also: MatColoring, MatColoringSetMaxColors(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringPatch — Method
iscoloring::ISColoring = MatColoringPatch(petsclib::PetscLibType, mat::AbstractPetscMat, ncolors::PetscInt, n::PetscInt, colorarray::Vector{ISColoringValue})

Used inside matrix coloring routines that use MatGetRowIJ() and/or MatGetColumnIJ().

Collective

Input Parameters:

  • mat - the matrix
  • ncolors - maximum color value
  • n - number of entries in colorarray
  • colorarray - array indicating color for each column

Output Parameter:

  • iscoloring - coloring generated using colorarray information

Level: developer

See also: Mat, MatGetRowIJ(), MatGetColumnIJ()

External Links

source
PETSc.LibPETSc.MatColoringRegister — Method
MatColoringRegister(petsclib::PetscLibType, sname::String, fnc::external)

Adds a new sparse matrix coloring to the matrix package.

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of Coloring (for example MATCOLORINGSL)
  • function - function pointer that creates the coloring

Level: developer

See also: MatColoringType, MatColoringRegisterDestroy(), MatColoringRegisterAll()

External Links

source
PETSc.LibPETSc.MatColoringSetDistance — Method
MatColoringSetDistance(petsclib::PetscLibType, mc::MatColoring, dist::PetscInt)

Sets the distance of the coloring

Logically Collective

Input Parameters:

  • mc - the MatColoring context
  • dist - the distance the coloring should compute

Options Database Key:

  • -mat_coloring_type - the type of coloring algorithm used. See MatColoringType.

Level: beginner

See also: MatColoring, MatColoringSetFromOptions(), MatColoringGetDistance(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetFromOptions — Method
MatColoringSetFromOptions(petsclib::PetscLibType, mc::MatColoring)

Sets MatColoring options from options database

Collective

Input Parameter:

  • mc - MatColoring context

Options Database Keys:

  • -mat_coloring_type - the type of coloring algorithm used. See MatColoringType.
  • -mat_coloring_maxcolors - the maximum number of relevant colors, all nodes not in a color are in maxcolors+1
  • -mat_coloring_distance - compute a distance 1,2,... coloring.
  • -mat_coloring_view - print information about the coloring and the produced index sets
  • -snes_fd_color - instruct SNES to using coloring and then MatFDColoring to compute the Jacobians
  • -snes_fd_color_use_mat - instruct SNES to color the matrix directly instead of the DM from which the matrix comes (the default)

Level: beginner

See also: MatColoring, MatColoringApply(), MatColoringSetDistance(), MatColoringSetType(), SNESComputeJacobianDefaultColor(), MatColoringType

External Links

source
PETSc.LibPETSc.MatColoringSetMaxColors — Method
MatColoringSetMaxColors(petsclib::PetscLibType, mc::MatColoring, maxcolors::PetscInt)

Sets the maximum number of colors to produce

Logically Collective

Input Parameters:

  • mc - the MatColoring context
  • maxcolors - the maximum number of colors to produce

Level: beginner

See also: MatColoring, MatColoringGetMaxColors(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetType — Method
MatColoringSetType(petsclib::PetscLibType, mc::MatColoring, type::String)

Sets the type of coloring algorithm used

Collective

Input Parameters:

  • mc - the MatColoring context
  • type - the type of coloring

Options Database Key:

  • -mat_coloring_type type - the name of the type

Level: beginner

See also: MatColoring, MatColoringSetFromOptions(), MatColoringType, MatColoringCreate(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetWeightType — Method
MatColoringSetWeightType(petsclib::PetscLibType, mc::MatColoring, wt::MatColoringWeightType)

Set the type of weight computation used while computing the coloring

Logically Collective

Input Parameters:

  • mc - the MatColoring context
  • wt - the weight type

Level: beginner

See also: MatColoring, MatColoringWeightType, MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetWeights — Method
weights::PetscReal,lperm::PetscInt = MatColoringSetWeights(petsclib::PetscLibType, mc::MatColoring)

Provide user weights (and optionally a permutation ordering) for a MatColoring.

Collective

Input Parameters:

  • mc - the MatColoring
  • weights - array of per-row weights, or NULL to clear any previously set weights
  • lperm - the permutation sorting weights in decreasing order, or NULL to have it computed

Level: developer

See also: MatColoring, MatColoringCreateWeights(), MatColoringGetDegrees()

External Links

source
PETSc.LibPETSc.MatColoringView — Method
MatColoringView(petsclib::PetscLibType, mc::MatColoring, viewer::PetscViewer)

Output details about the MatColoring.

Collective

Input Parameters:

  • mc - the MatColoring context
  • viewer - the Viewer context

Level: beginner

See also: PetscViewer, MatColoring, MatColoringApply()

External Links

source
PETSc.LibPETSc.MatFDColoringApply — Method
MatFDColoringApply(petsclib::PetscLibType, J::AbstractPetscMat, coloring::MatFDColoring, x1::AbstractPetscVec, sctx::Ptr{Cvoid})

Given a matrix for which a MatFDColoring context has been created, computes the Jacobian for a function via finite differences.

Collective

Input Parameters:

  • J - matrix to store Jacobian entries into
  • coloring - coloring context created with MatFDColoringCreate()
  • x1 - location at which Jacobian is to be computed
  • sctx - context required by function, if this is being used with the SNES solver then it is SNES object, otherwise it is NULL

Options Database Keys:

  • -mat_fd_type - "wp" or "ds" (see MATMFFD_WP or MATMFFD_DS)
  • -mat_fd_coloring_view - Activates basic viewing or coloring
  • -mat_fd_coloring_view draw - Activates drawing of coloring
  • -mat_fd_coloring_view ::ascii_info - Activates viewing of coloring info

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringDestroy(), MatFDColoringView(), MatFDColoringSetFunction(), MatFDColoringSetValues()

External Links

source
PETSc.LibPETSc.MatFDColoringCreate — Method
color::MatFDColoring = MatFDColoringCreate(petsclib::PetscLibType, mat::AbstractPetscMat, iscoloring::ISColoring)

Creates a matrix coloring context for finite difference computation of Jacobians.

Collective

Input Parameters:

  • mat - the matrix containing the nonzero structure of the Jacobian
  • iscoloring - the coloring of the matrix; usually obtained with MatColoringCreate() or DMCreateColoring()

Output Parameter:

  • color - the new coloring context

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringDestroy(), SNESComputeJacobianDefaultColor(), ISColoringCreate(), MatFDColoringSetFunction(), MatFDColoringSetFromOptions(), MatFDColoringApply(), MatFDColoringView(), MatFDColoringSetParameters(), MatColoringCreate(), DMCreateColoring(), MatFDColoringSetValues()

External Links

source
PETSc.LibPETSc.MatFDColoringDestroy — Method
MatFDColoringDestroy(petsclib::PetscLibType, c::Union{MatFDColoring, Ref{MatFDColoring}})

Destroys a matrix coloring context that was created via MatFDColoringCreate().

Collective

Input Parameter:

  • c - coloring context

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate()

External Links

source
PETSc.LibPETSc.MatFDColoringGetFunction — Method
f::Ptr{Cvoid},fctx::Ptr{Cvoid} = MatFDColoringGetFunction(petsclib::PetscLibType, matfd::MatFDColoring)

Gets the function to use for computing the Jacobian.

Not Collective

Input Parameter:

  • matfd - the coloring context

Output Parameters:

  • f - the function, see MatFDColoringFn for the calling sequence
  • fctx - the optional user-defined function context

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringSetFunction(), MatFDColoringSetFromOptions(), MatFDColoringFn

External Links

source
PETSc.LibPETSc.MatFDColoringGetPerturbedColumns — Method
n::PetscInt,cols::Vector{PetscInt} = MatFDColoringGetPerturbedColumns(petsclib::PetscLibType, coloring::MatFDColoring)

Returns the indices of the columns that that are currently being perturbed.

Not Collective

Input Parameter:

  • coloring - coloring context created with MatFDColoringCreate()

Output Parameters:

  • n - the number of local columns being perturbed
  • cols - the column indices, in global numbering

Level: advanced

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringDestroy(), MatFDColoringView(), MatFDColoringApply()

External Links

source
PETSc.LibPETSc.MatFDColoringSetBlockSize — Method
MatFDColoringSetBlockSize(petsclib::PetscLibType, matfd::MatFDColoring, brows::PetscInt, bcols::PetscInt)

Sets block size for efficient inserting entries of Jacobian matrix.

Logically Collective

Input Parameters:

  • matfd - the coloring context
  • brows - number of rows in the block
  • bcols - number of columns in the block

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringSetFromOptions()

External Links

source
PETSc.LibPETSc.MatFDColoringSetF — Method
MatFDColoringSetF(petsclib::PetscLibType, fd::MatFDColoring, F::AbstractPetscVec)

Cache the current function value used by the finite-difference coloring context to avoid recomputing F(x) during a Jacobian evaluation.

Logically Collective

Input Parameters:

  • fd - the MatFDColoring context
  • F - the current function value F(x), or NULL to invalidate any cached value

Level: advanced

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringApply()

External Links

source
PETSc.LibPETSc.MatFDColoringSetFromOptions — Method
MatFDColoringSetFromOptions(petsclib::PetscLibType, matfd::MatFDColoring)

Sets coloring finite difference parameters from the options database.

Collective

The Jacobian, F'(u), is estimated with the differencing approximation $F'(u)_{:,i} = [F(u+h*dx_{i}) - F(u)]/h where h = error_rel*u[i] if abs(u[i]) > umin = +/- error_rel*umin otherwise, with +/- determined by the sign of u[i] dx_{i} = (0, ... 1, .... 0)$

Input Parameter:

  • matfd - the coloring context

Options Database Keys:

  • -mat_fd_coloring_err err - Sets err (square root of relative error in the function)
  • -mat_fd_coloring_umin umin - Sets umin, the minimum allowable u-value magnitude
  • -mat_fd_type (wp|ds) - See MATMFFD_WP and MATMFFD_DS
  • -mat_fd_coloring_view - Activates basic viewing
  • -mat_fd_coloring_view ::ascii_info - Activates viewing info
  • -mat_fd_coloring_view draw - Activates drawing

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringView(), MatFDColoringSetParameters()

External Links

source
PETSc.LibPETSc.MatFDColoringSetFunction — Method
MatFDColoringSetFunction(petsclib::PetscLibType, matfd::MatFDColoring, f::Ptr{Cvoid}, fctx::Ptr{Cvoid})

Sets the function to use for computing the Jacobian.

Logically Collective

Input Parameters:

  • matfd - the coloring context
  • f - the function, see MatFDColoringFn for the calling sequence
  • fctx - the optional user-defined function context

Level: advanced

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringGetFunction(), MatFDColoringSetFromOptions(), MatFDColoringFn

External Links

source
PETSc.LibPETSc.MatFDColoringSetParameters — Method
MatFDColoringSetParameters(petsclib::PetscLibType, matfd::MatFDColoring, error::PetscReal, umin::PetscReal)

Sets the parameters for the approximation of a sparse Jacobian matrix using finite differences and matrix coloring

Logically Collective

Input Parameters:

  • matfd - the coloring context
  • error - relative error
  • umin - minimum allowable u-value magnitude

Level: advanced

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringSetFromOptions()

External Links

source
PETSc.LibPETSc.MatFDColoringSetType — Method
MatFDColoringSetType(petsclib::PetscLibType, matfd::MatFDColoring, type::String)

Sets the approach for computing the finite difference parameter

Collective

Input Parameters:

  • matfd - the coloring context
  • type - either MATMFFD_WP or MATMFFD_DS

Options Database Key:

  • -mat_fd_type - "wp" or "ds"

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringView(), MatFDColoringSetParameters()

External Links

source
PETSc.LibPETSc.MatFDColoringSetUp — Method
MatFDColoringSetUp(petsclib::PetscLibType, mat::AbstractPetscMat, iscoloring::ISColoring, color::MatFDColoring)

Sets up the internal data structures of matrix coloring context for the later use.

Collective

Input Parameters:

  • mat - the matrix containing the nonzero structure of the Jacobian
  • iscoloring - the coloring of the matrix; usually obtained with MatGetColoring() or DMCreateColoring()
  • color - the matrix coloring context

Level: beginner

See also: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringDestroy()

External Links

source
PETSc.LibPETSc.MatFDColoringSetValues — Method
MatFDColoringSetValues(petsclib::PetscLibType, J::AbstractPetscMat, coloring::MatFDColoring, y::Vector{PetscScalar})

takes a matrix in compressed color format and enters the matrix into a PETSc Mat

Collective

Input Parameters:

  • J - the sparse matrix
  • coloring - created with MatFDColoringCreate() and a local coloring
  • y - column major storage of matrix values with one color of values per column, the number of rows of y should match

the number of local rows of J and the number of columns is the number of colors.

Level: intermediate

See also: Mat, MatFDColoringCreate(), ISColoring, ISColoringCreate(), ISColoringSetType(), IS_COLORING_LOCAL, MatFDColoringSetBlockSize()

External Links

source
PETSc.LibPETSc.MatFDColoringUseDM — Method
MatFDColoringUseDM(petsclib::PetscLibType, coloring::AbstractPetscMat, fdcoloring::MatFDColoring)

allows a MatFDColoring object to use the DM associated with the matrix to compute a IS_COLORING_LOCAL coloring

Input Parameters:

  • coloring - The matrix to get the DM from
  • fdcoloring - the MatFDColoring object

Level: advanced

See also: DM, MatFDColoring, MatFDColoringCreate(), ISColoringType

External Links

source
PETSc.LibPETSc.MatFDColoringView — Method
MatFDColoringView(petsclib::PetscLibType, c::MatFDColoring, viewer::PetscViewer)

Views a finite difference coloring context.

Collective

Input Parameters:

  • c - the coloring context
  • viewer - visualization context

Level: intermediate

See also: Mat, MatFDColoring, MatFDColoringCreate()

External Links

source
PETSc.LibPETSc.MatMFFDCheckPositivity — Method
h::PetscScalar = MatMFFDCheckPositivity(petsclib::PetscLibType, dummy::Ptr{Cvoid}, U::AbstractPetscVec, a::AbstractPetscVec)

Checks that all entries in U + h*a are positive or zero, decreases h until this is satisfied for a MATMFFD matrix

Logically Collective

Input Parameters:

  • dummy - context variable (unused)
  • U - base vector that is added to
  • a - vector that is added
  • h - scaling factor on a, may be changed on output

Options Database Keys:

  • -mat_mffd_check_positivity (true|false) - Ensure that U + h*a is nonnegative

Level: advanced

See also: Mat, MATMFFD, MatMFFDSetCheckh()

External Links

source
PETSc.LibPETSc.MatMFFDComputeJacobian — Method
MatMFFDComputeJacobian(petsclib::PetscLibType, snes::AbstractSNES, x::AbstractPetscVec, jac::AbstractPetscMat, B::AbstractPetscMat, dummy::Ptr{Cvoid})

Tells the matrix-free Jacobian object the new location at which Jacobian matrix-vector products will be computed at, i.e. J(x) * a. The x is obtained from the SNES object (using SNESGetSolution()).

Collective

Input Parameters:

  • snes - the nonlinear solver context
  • x - the point at which the Jacobian-vector products will be performed
  • jac - the matrix-free Jacobian object of MatType MATMFFD, likely obtained with MatCreateSNESMF()
  • B - either the same as jac or another matrix type (ignored)
  • dummy - the application context (ignored)

Options Database Key:

  • -snes_mf - use the matrix created with MatSNESMFCreate() to setup the Jacobian for each new solution in the Newton process

Level: developer

See also: MatMFFDGetH(), MatCreateSNESMF(), MatMFFDSetBase(), MatCreateMFFD(), MATMFFD, MatMFFDSetHHistory(), MatMFFDSetFunctionError(), SNESSetJacobian()

External Links

source
PETSc.LibPETSc.MatMFFDDSSetUmin — Method
MatMFFDDSSetUmin(petsclib::PetscLibType, A::AbstractPetscMat, umin::PetscReal)

Sets the "umin" parameter used by the PETSc routine for computing the differencing parameter, h, which is used for matrix-free Jacobian-vector products for a MATMFFD matrix.

Input Parameters:

  • A - the MATMFFD matrix
  • umin - the parameter

Level: advanced

See also: MATMFFD, MatMFFDSetFunctionError(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatMFFDGetH — Method
h::PetscScalar = MatMFFDGetH(petsclib::PetscLibType, mat::AbstractPetscMat)

Gets the last value that was used as the differencing for a MATMFFD matrix parameter.

Not Collective

Input Parameters:

  • mat - the MATMFFD matrix

Output Parameter:

  • h - the differencing step size

Level: advanced

See also: Mat, MATMFFD, MatCreateSNESMF(), MatMFFDSetHHistory(), MatCreateMFFD(), MatMFFDResetHHistory()

External Links

source
PETSc.LibPETSc.MatMFFDRegister — Method
MatMFFDRegister(petsclib::PetscLibType, sname::String, fnc::external)

Adds a method to the MATMFFD registry.

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of a new user-defined compute-h module
  • function - routine to create method context

Level: developer

See also: Mat, MATMFFD, MatMFFDRegisterAll(), MatMFFDRegisterDestroy()

External Links

source
PETSc.LibPETSc.MatMFFDResetHHistory — Method
MatMFFDResetHHistory(petsclib::PetscLibType, J::AbstractPetscMat)

Resets the counter to zero to begin collecting a new set of differencing histories for the MATMFFD matrix

Logically Collective

Input Parameter:

  • J - the matrix-free matrix context

Level: advanced

See also: Mat, MATMFFD, MatMFFDGetH(), MatCreateSNESMF(), MatMFFDSetHHistory(), MatMFFDSetFunctionError()

External Links

source
PETSc.LibPETSc.MatMFFDSetBase — Method
MatMFFDSetBase(petsclib::PetscLibType, J::AbstractPetscMat, U::AbstractPetscVec, F::AbstractPetscVec)

Sets the vector U at which matrix vector products of the Jacobian are computed for the MATMFFD matrix

Logically Collective

Input Parameters:

  • J - the MATMFFD matrix
  • U - the vector
  • F - (optional) vector that contains F(u) if it has been already computed

Level: advanced

See also: Mat, MATMFFD, MatMult()

External Links

source
PETSc.LibPETSc.MatMFFDSetCheckh — Method
MatMFFDSetCheckh(petsclib::PetscLibType, J::AbstractPetscMat, fun::Ptr{Cvoid}, ctx::Ptr{Cvoid})

Sets a function that checks the computed h and adjusts it to satisfy some criteria for the MATMFFD matrix

Logically Collective

Input Parameters:

  • J - the MATMFFD matrix
  • fun - the function that checks h, see MatMFFDCheckhFn
  • ctx - any context needed by the function

Options Database Keys:

  • -mat_mffd_check_positivity (true|false) - Ensure that U + h*a is non-negative

Level: advanced

See also: Mat, MATMFFD, MatMFFDCheckhFn, MatMFFDCheckPositivity()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunction — Method
MatMFFDSetFunction(petsclib::PetscLibType, mat::AbstractPetscMat, func::Ptr{Cvoid}, funcctx::Ptr{Cvoid})

Sets the function used in applying the matrix-free MATMFFD matrix.

Logically Collective

Input Parameters:

  • mat - the matrix-free matrix MATMFFD created via MatCreateSNESMF() or MatCreateMFFD()
  • func - the function to use
  • funcctx - optional function context passed to function

Level: advanced

See also: Mat, MATMFFD, MatMFFDFn, MatCreateSNESMF(), MatMFFDGetH(), MatCreateMFFD(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESSetFunction()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctionError — Method
MatMFFDSetFunctionError(petsclib::PetscLibType, mat::AbstractPetscMat, error::PetscReal)

Sets the error_rel for the approximation of matrix-vector products using finite differences with the MATMFFD matrix

Logically Collective

Input Parameters:

  • mat - the MATMFFD matrix-free matrix
  • error - relative error (should be set to the square root of the relative error in the function evaluations)

Options Database Key:

  • -mat_mffd_err error_rel - Sets error_rel

Level: advanced

See also: Mat, MATMFFD, MatCreateSNESMF(), MatMFFDGetH(), MatCreateMFFD(), MatMFFDSetHHistory(), MatMFFDResetHHistory()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctioni — Method
MatMFFDSetFunctioni(petsclib::PetscLibType, mat::AbstractPetscMat, funci::Ptr{Cvoid})

Sets the function for computing a single component for a MATMFFD matrix

Logically Collective

Input Parameters:

  • mat - the matrix-free matrix MATMFFD
  • funci - the function to use

Level: advanced

See also: Mat, MATMFFD, MatMFFDiFn, MatCreateSNESMF(), MatMFFDGetH(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESSetFunction(), MatGetDiagonal()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctioniBase — Method
MatMFFDSetFunctioniBase(petsclib::PetscLibType, mat::AbstractPetscMat, func::Ptr{Cvoid})

Sets the function to compute the base vector for a single component function evaluation for a MATMFFD matrix

Logically Collective

Input Parameters:

  • mat - the MATMFFD matrix-free matrix
  • func - the function to use

Level: advanced

See also: Mat, MATMFFD, MatCreateSNESMF(), MatMFFDGetH(), MatCreateMFFD(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESSetFunction(), MatGetDiagonal()

External Links

source
PETSc.LibPETSc.MatMFFDSetHHistory — Method
MatMFFDSetHHistory(petsclib::PetscLibType, J::AbstractPetscMat, history::Vector{PetscScalar}, nhistory::PetscInt)

Sets an array to collect a history of the differencing values (h) computed for the matrix-free product MATMFFD matrix

Logically Collective

Input Parameters:

  • J - the MATMFFD matrix-free matrix
  • history - space to hold the history
  • nhistory - number of entries in history, if more entries are generated than

nhistory, then the later ones are discarded

Level: advanced

See also: Mat, MATMFFD, MatMFFDGetH(), MatCreateSNESMF(), MatMFFDResetHHistory(), MatMFFDSetFunctionError()

External Links

source
PETSc.LibPETSc.MatMFFDSetOptionsPrefix — Method
MatMFFDSetOptionsPrefix(petsclib::PetscLibType, mat::AbstractPetscMat, prefix::String)

Sets the prefix used for searching for all MATMFFD` options in the database.

Collective

Input Parameters:

  • mat - the MATMFFD context
  • prefix - the prefix to prepend to all option names

See also: Mat, MATMFFD, MatSetFromOptions(), MatCreateSNESMF(), MatCreateMFFD()

External Links

source
PETSc.LibPETSc.MatMFFDSetPeriod — Method
MatMFFDSetPeriod(petsclib::PetscLibType, mat::AbstractPetscMat, period::PetscInt)

Sets how often the step-size h is recomputed for a MATMFFD matrix, by default it is every time

Logically Collective

Input Parameters:

  • mat - the MATMFFD matrix-free matrix
  • period - 1 for every time, 2 for every second etc

Options Database Key:

  • -mat_mffd_period period - Sets how often h is recomputed

Level: advanced

See also: Mat, MATMFFD, MatCreateSNESMF(), MatMFFDGetH(), MatMFFDSetHHistory(), MatMFFDResetHHistory()

External Links

source
PETSc.LibPETSc.MatMFFDSetType — Method
MatMFFDSetType(petsclib::PetscLibType, mat::AbstractPetscMat, ftype::String)

Sets the method that is used to compute the differencing parameter for finite difference matrix-free formulations.

Input Parameters:

  • mat - the "matrix-free" matrix created via MatCreateSNESMF(), or MatCreateMFFD()

or MatSetType(mat,MATMFFD);

  • ftype - the type requested, either MATMFFD_WP or MATMFFD_DS

Level: advanced

See also: Mat, MATMFFD, MATMFFD_WP, MATMFFD_DS, MatCreateSNESMF(), MatMFFDRegister(), MatMFFDSetFunction(), MatCreateMFFD()

External Links

source
PETSc.LibPETSc.MatMFFDWPSetComputeNormU — Method
MatMFFDWPSetComputeNormU(petsclib::PetscLibType, A::AbstractPetscMat, flag::PetscBool)

Sets whether it computes the ||U|| used by the Walker-Pernice {cite}pw98 PETSc routine for computing h. With any Krylov solver this need only be computed during the first iteration and kept for later.

Input Parameters:

  • A - the MATMFFD matrix
  • flag - PETSC_TRUE causes it to compute ||U||, PETSC_FALSE uses the previous value

Options Database Key:

  • -mat_mffd_compute_normu (true|false) - true by default, false can save calculations but you

must be sure that ||U|| has not changed in the mean time.

Level: advanced

See also: MATMFFD_WP, MATMFFD, MatMFFDSetFunctionError(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatNullSpaceCreate — Method
SP::MatNullSpace = MatNullSpaceCreate(petsclib::PetscLibType, comm::MPI_Comm, has_cnst::PetscBool, n::PetscInt, vecs::Vector{<:AbstractPetscVec})

Creates a MatNullSpace data structure used to project vectors out of null spaces.

Collective

Input Parameters:

  • comm - the MPI communicator associated with the object
  • has_cnst - PETSC_TRUE if the null space contains the constant vector; otherwise PETSC_FALSE
  • n - number of vectors (excluding constant vector) in null space
  • vecs - the vectors that span the null space (excluding the constant vector);

these vectors must be orthonormal. These vectors are NOT copied, so do not change them after this call. You should free the array that you pass in and destroy the vectors (this will reduce the reference count for them by one).

Output Parameter:

  • SP - the null space context

Level: advanced

See also: Mat, MatNullSpace, MatNullSpaceDestroy(), MatNullSpaceRemove(), MatSetNullSpace(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceCreateRigidBody — Method
sp::MatNullSpace = MatNullSpaceCreateRigidBody(petsclib::PetscLibType, coords::AbstractPetscVec)

create rigid body modes from coordinates

Collective

Input Parameter:

  • coords - block of coordinates of each node, must have block size set

Output Parameter:

  • sp - the null space

Level: advanced

See also: Mat, MatNullSpace, MatNullSpaceCreate(), MatSetNearNullSpace(), MatSetNullSpace(), PCGAMG

External Links

source
PETSc.LibPETSc.MatNullSpaceDestroy — Method
MatNullSpaceDestroy(petsclib::PetscLibType, sp::Union{MatNullSpace, Ref{MatNullSpace}})

Destroys a data structure used to project vectors out of null spaces.

Collective

Input Parameter:

  • sp - the null space context to be destroyed

Level: advanced

See also: Mat, MatNullSpace, MatNullSpaceCreate(), MatNullSpaceRemove(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceGetVecs — Method
has_const::PetscBool,n::PetscInt,vecs::Vector{PetscVec} = MatNullSpaceGetVecs(petsclib::PetscLibType, sp::MatNullSpace)

get the vectors defining the null space

Not Collective

Input Parameter:

  • sp - null space object

Output Parameters:

  • has_const - PETSC_TRUE if the null space contains the constant vector, otherwise PETSC_FALSE
  • n - number of vectors (excluding constant vector) in the null space
  • vecs - returns array of length n containing the orthonormal vectors that span the null space (excluding the constant vector), NULL if n is 0

Level: developer

See also: Mat, MatNullSpace, MatNullSpaceCreate(), MatGetNullSpace(), MatGetNearNullSpace()

External Links

source
PETSc.LibPETSc.MatNullSpaceRemove — Method
MatNullSpaceRemove(petsclib::PetscLibType, sp::MatNullSpace, vec::AbstractPetscVec)

Removes all the components of a null space from a vector.

Collective

Input Parameters:

  • sp - the null space context (if this is NULL then no null space is removed)
  • vec - the vector from which the null space is to be removed

Level: advanced

See also: Mat, MatNullSpace, MatNullSpaceCreate(), MatNullSpaceDestroy(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceSetFunction — Method
MatNullSpaceSetFunction(petsclib::PetscLibType, sp::MatNullSpace, rem::Ptr{Cvoid}, ctx::Ptr{Cvoid})

set a function that removes a null space from a vector out of null spaces.

Logically Collective

Input Parameters:

  • sp - the MatNullSpace null space object
  • rem - the function that removes the null space
  • ctx - context for the remove function

Level: advanced

See also: Mat, MatNullSpace, MatNullSpaceDestroy(), MatNullSpaceRemove(), MatSetNullSpace(), MatNullSpaceCreate(), MatNullSpaceRemoveFn

External Links

source
PETSc.LibPETSc.MatNullSpaceTest — Method
isNull::PetscBool = MatNullSpaceTest(petsclib::PetscLibType, sp::MatNullSpace, mat::AbstractPetscMat)

Tests if the claimed null space is really a null space of a matrix

Collective

Input Parameters:

  • sp - the null space context
  • mat - the matrix

Output Parameter:

  • isNull - PETSC_TRUE if the nullspace is valid for this matrix

Level: advanced

See also: Mat, MatNullSpace, MatNullSpaceCreate(), MatNullSpaceDestroy(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceView — Method
MatNullSpaceView(petsclib::PetscLibType, sp::MatNullSpace, viewer::PetscViewer)

Visualizes a null space object.

Collective

Input Parameters:

  • sp - the null space
  • viewer - visualization context

Level: advanced

See also: Mat, MatNullSpace, PetscViewer, MatNullSpaceCreate(), PetscViewerASCIIOpen()

External Links

source
PETSc.LibPETSc.MatPartitioningApply — Method
partitioning::IS = MatPartitioningApply(petsclib::PetscLibType, matp::MatPartitioning)

Gets a partitioning for the graph represented by a sparse matrix.

Collective

Input Parameter:

  • matp - the matrix partitioning object

Output Parameter:

  • partitioning - the partitioning. For each local node this tells the MPI rank that that node is assigned to.

Options Database Keys:

  • -mat_partitioning_type type - set the partitioning package or algorithm to use
  • -mat_partitioning_view - display information about the partitioning object

Level: beginner

The user can define additional partitionings; see MatPartitioningRegister().

See also: Mat, MatPartitioning, MatPartitioningType, MatPartitioningRegister(), MatPartitioningCreate(), MatPartitioningDestroy(), MatPartitioningSetAdjacency(), ISPartitioningToNumbering(), ISPartitioningCount()

External Links

source
PETSc.LibPETSc.MatPartitioningApplyND — Method
partitioning::IS = MatPartitioningApplyND(petsclib::PetscLibType, matp::MatPartitioning)

Gets a nested dissection partitioning for a matrix.

Collective

Input Parameter:

  • matp - the matrix partitioning object

Output Parameter:

  • partitioning - the partitioning. For each local node, a positive value indicates the processor

number the node has been assigned to. Negative x values indicate the separator level -(x+1).

Level: intermediate

See also: Mat, MatPartitioningRegister(), MatPartitioningCreate(), MatPartitioningDestroy(), MatPartitioningSetAdjacency(), ISPartitioningToNumbering(), ISPartitioningCount()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetEigenNumber — Method
num::PetscInt = MatPartitioningChacoGetEigenNumber(petsclib::PetscLibType, part::MatPartitioning)

Gets the number of eigenvectors used by Chaco.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • num - number of eigenvectors

Level: advanced

See also: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenNumber()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetEigenSolver — Method
method::MPChacoEigenType = MatPartitioningChacoGetEigenSolver(petsclib::PetscLibType, part::MatPartitioning)

Get the eigensolver used by the Chaco partitioner.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • method - the method

Level: advanced

See also: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenSolver()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetCoarseLevel — Method
MatPartitioningChacoSetCoarseLevel(petsclib::PetscLibType, part::MatPartitioning, level::PetscReal)

Set the coarse level parameter for the Chaco partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • level - the coarse level in range [0.0,1.0]

Options Database Key:

  • -mat_partitioning_chaco_coarse l - Coarse level

Level: advanced

See also: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetEigenNumber — Method
MatPartitioningChacoSetEigenNumber(petsclib::PetscLibType, part::MatPartitioning, num::PetscInt)

Sets the number of eigenvectors to compute by Chaco during partitioning during partitioning.

Collective

Input Parameters:

  • part - the partitioning context
  • num - the number of eigenvectors

Options Database Key:

  • -mat_partitioning_chaco_eigen_number n - Number of eigenvectors

See also: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenSolver(), MatPartitioningChacoGetEigenTol()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetEigenSolver — Method
MatPartitioningChacoSetEigenSolver(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoEigenType)

Set the eigensolver method for Chaco partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • method - one of MP_CHACO_LANCZOS or MP_CHACO_RQI

Options Database Key:

  • -mat_partitioning_chaco_eigen_solver method - the eigensolver

Level: advanced

See also: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenTol(), MatPartitioningChacoSetEigenNumber(), MatPartitioningChacoGetEigenSolver()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetEigenTol — Method
MatPartitioningChacoSetEigenTol(petsclib::PetscLibType, part::MatPartitioning, tol::PetscReal)

Sets the tolerance for the eigensolver used by Chaco

Collective

Input Parameters:

  • part - the partitioning context
  • tol - the tolerance

Options Database Key:

  • -mat_partitioning_chaco_eigen_tol tol - Tolerance for eigensolver

See also: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenSolver(), MatPartitioningChacoGetEigenTol()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetGlobal — Method
MatPartitioningChacoSetGlobal(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoGlobalType)

Set the global method for Chaco partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • method - one of MP_CHACO_MULTILEVEL, MP_CHACO_SPECTRAL, MP_CHACO_LINEAR,

MP_CHACO_RANDOM or MP_CHACO_SCATTERED

Options Database Key:

  • -mat_partitioning_chaco_global method - the global method

Level: advanced

See also: MatPartitioning, MatPartioningSetType(), MatPartitioningType, MATPARTITIONINGCHACO, MatPartitioningChacoSetLocal(), MatPartitioningChacoGetGlobal()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetLocal — Method
MatPartitioningChacoSetLocal(petsclib::PetscLibType, part::MatPartitioning, method::MPChacoLocalType)

Set the local method for the Chaco partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • method - one of MP_CHACO_KERNIGHAN or MP_CHACO_NONE

Options Database Key:

  • -mat_partitioning_chaco_local method - the local method

Level: advanced

See also: MatPartitioningType, MATPARTITIONINGCHACO, MatPartitioningChacoSetGlobal(), MatPartitioningChacoGetLocal()

External Links

source
PETSc.LibPETSc.MatPartitioningCreate — Method
newp::MatPartitioning = MatPartitioningCreate(petsclib::PetscLibType, comm::MPI_Comm)

Creates a partitioning context.

Collective

Input Parameter:

  • comm - MPI communicator

Output Parameter:

  • newp - location to put the context

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningSetType(), MatPartitioningApply(), MatPartitioningDestroy(), MatPartitioningSetAdjacency()

External Links

source
PETSc.LibPETSc.MatPartitioningGetType — Method
type::String = MatPartitioningGetType(petsclib::PetscLibType, partitioning::MatPartitioning)

Gets the Partitioning method type and name (as a string) from the partitioning context.

Not Collective

Input Parameter:

  • partitioning - the partitioning context

Output Parameter:

  • type - partitioner type

Level: intermediate

See also: Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate(), MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()

External Links

source
PETSc.LibPETSc.MatPartitioningGetUseEdgeWeights — Method
use_edge_weights::PetscBool = MatPartitioningGetUseEdgeWeights(petsclib::PetscLibType, part::MatPartitioning)

Get a flag that indicates whether or not to edge weights are used.

Logically Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • use_edge_weights - the flag indicateing whether or not to edge weights are used.

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningSetType(), MatPartitioningSetVertexWeights(), MatPartitioningSetPartitionWeights(), MatPartitioningSetUseEdgeWeights

External Links

source
PETSc.LibPETSc.MatPartitioningHierarchicalGetCoarseparts — Method
coarseparts::IS = MatPartitioningHierarchicalGetCoarseparts(petsclib::PetscLibType, part::MatPartitioning)

Get the coarse-level partitioning of a hierarchical MatPartitioning.

Not Collective

Input Parameter:

  • part - the MatPartitioning of type MATPARTITIONINGHIERARCH

Output Parameter:

  • coarseparts - the IS mapping each local row to its coarse partition; the caller must destroy it with ISDestroy()

Level: advanced

See also: MatPartitioning, MATPARTITIONINGHIERARCH, MatPartitioningHierarchicalGetFineparts(), MatPartitioningHierarchicalSetNcoarseparts()

External Links

source
PETSc.LibPETSc.MatPartitioningHierarchicalGetFineparts — Method
fineparts::IS = MatPartitioningHierarchicalGetFineparts(petsclib::PetscLibType, part::MatPartitioning)

Get the fine-level partitioning of a hierarchical MatPartitioning.

Not Collective

Input Parameter:

  • part - the MatPartitioning of type MATPARTITIONINGHIERARCH

Output Parameter:

  • fineparts - the IS mapping each local row to its fine partition; the caller must destroy it with ISDestroy()

Level: advanced

See also: MatPartitioning, MATPARTITIONINGHIERARCH, MatPartitioningHierarchicalGetCoarseparts(), MatPartitioningHierarchicalSetNfineparts()

External Links

source
PETSc.LibPETSc.MatPartitioningHierarchicalSetNcoarseparts — Method
MatPartitioningHierarchicalSetNcoarseparts(petsclib::PetscLibType, part::MatPartitioning, ncoarseparts::PetscInt)

Set the number of coarse partitions produced by a hierarchical MatPartitioning.

Logically Collective

Input Parameters:

  • part - the MatPartitioning of type MATPARTITIONINGHIERARCH
  • ncoarseparts - the number of coarse partitions

Level: advanced

See also: MatPartitioning, MATPARTITIONINGHIERARCH, MatPartitioningHierarchicalSetNfineparts(), MatPartitioningHierarchicalGetCoarseparts()

External Links

source
PETSc.LibPETSc.MatPartitioningHierarchicalSetNfineparts — Method
MatPartitioningHierarchicalSetNfineparts(petsclib::PetscLibType, part::MatPartitioning, nfineparts::PetscInt)

Set the number of fine partitions per coarse partition produced by a hierarchical MatPartitioning.

Logically Collective

Input Parameters:

  • part - the MatPartitioning of type MATPARTITIONINGHIERARCH
  • nfineparts - the number of fine partitions per coarse partition

Level: advanced

See also: MatPartitioning, MATPARTITIONINGHIERARCH, MatPartitioningHierarchicalSetNcoarseparts(), MatPartitioningHierarchicalGetFineparts()

External Links

source
PETSc.LibPETSc.MatPartitioningImprove — Method
MatPartitioningImprove(petsclib::PetscLibType, matp::MatPartitioning, partitioning::AbstractIS)

Improves the quality of a given partition.

Collective

Input Parameters:

  • matp - the matrix partitioning object
  • partitioning - the original partitioning. For each local node this tells the processor

number that that node is assigned to.

Options Database Key:

  • -mat_partitioning_improve - improve the quality of the given partition

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningType, MatPartitioningApply(), MatPartitioningCreate(), MatPartitioningDestroy(), MatPartitioningSetAdjacency(), ISPartitioningToNumbering(), ISPartitioningCount()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchGetImbalance — Method
imb::PetscReal = MatPartitioningPTScotchGetImbalance(petsclib::PetscLibType, part::MatPartitioning)

Gets the value of the load imbalance ratio used during strategy selection.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • imb - the load imbalance ratio

Level: advanced

See also: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetImbalance()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchSetImbalance — Method
MatPartitioningPTScotchSetImbalance(petsclib::PetscLibType, part::MatPartitioning, imb::PetscReal)

Sets the value of the load imbalance ratio to be used during strategy selection.

Collective

Input Parameters:

  • part - the partitioning context
  • imb - the load imbalance ratio

Options Database Key:

  • -mat_partitioning_ptscotch_imbalance imb - set load imbalance ratio

See also: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetStrategy(), MatPartitioningPTScotchGetImbalance()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchSetStrategy — Method
MatPartitioningPTScotchSetStrategy(petsclib::PetscLibType, part::MatPartitioning, strategy::MPPTScotchStrategyType)

Sets the strategy to be used in PTScotch.

Collective

Input Parameters:

  • part - the partitioning context
  • strategy - the strategy, one of

$MP_PTSCOTCH_DEFAULT - Default behavior MP_PTSCOTCH_QUALITY - Prioritize quality over speed MP_PTSCOTCH_SPEED - Prioritize speed over quality MP_PTSCOTCH_BALANCE - Enforce load balance MP_PTSCOTCH_SAFETY - Avoid methods that may fail MP_PTSCOTCH_SCALABILITY - Favor scalability as much as possible$

Options Database Key:

  • -mat_partitioning_ptscotch_strategy [quality,speed,balance,safety,scalability] - strategy

Level: advanced

See also: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetImbalance(), MatPartitioningPTScotchGetStrategy()

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetBipart — Method
MatPartitioningPartySetBipart(petsclib::PetscLibType, part::MatPartitioning, bp::PetscBool)

Activate or deactivate recursive bisection in the Party partitioner

Collective

Input Parameters:

  • part - the partitioning context
  • bp - boolean flag

Options Database Key:

  • -mat_partitioning_party_bipart - Bipartitioning option on/off

Level: advanced

See also: MATPARTITIONINGPARTY

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetCoarseLevel — Method
MatPartitioningPartySetCoarseLevel(petsclib::PetscLibType, part::MatPartitioning, level::PetscReal)

Set the coarse level parameter for the Party partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • level - the coarse level in range [0.0,1.0]

Options Database Key:

  • -mat_partitioning_party_coarse l - Coarse level

Level: advanced

See also: MATPARTITIONINGPARTY

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetGlobal — Method
MatPartitioningPartySetGlobal(petsclib::PetscLibType, part::MatPartitioning, glob::String)

Set global method for Party partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • global - a string representing the method

Options Database Key:

  • -mat_partitioning_party_global method - the global method

Level: advanced

See also: MATPARTITIONINGPARTY, MatPartitioningPartySetLocal()

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetLocal — Method
MatPartitioningPartySetLocal(petsclib::PetscLibType, part::MatPartitioning, loc::String)

Set local method used by the Party partitioner.

Collective

Input Parameters:

  • part - the partitioning context
  • local - a string representing the method

Options Database Key:

  • -mat_partitioning_party_local method - the local method

Level: advanced

See also: MATPARTITIONINGPARTY, MatPartitioningPartySetGlobal()

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetMatchOptimization — Method
MatPartitioningPartySetMatchOptimization(petsclib::PetscLibType, part::MatPartitioning, opt::PetscBool)

Activate matching optimization for graph reduction.

Collective

Input Parameters:

  • part - the partitioning context
  • opt - boolean flag

Options Database Key:

  • -mat_partitioning_party_match_optimization - Matching optimization on/off

Level: advanced

See also: MATPARTITIONINGPARTY

External Links

source
PETSc.LibPETSc.MatPartitioningRegister — Method
MatPartitioningRegister(petsclib::PetscLibType, sname::String, fnc::external)

Adds a new sparse matrix partitioning to the matrix package.

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of partitioning (for example MATPARTITIONINGCURRENT) or MATPARTITIONINGPARMETIS
  • function - function pointer that creates the partitioning type

Level: developer

See also: Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate(), MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()

External Links

source
PETSc.LibPETSc.MatPartitioningSetAdjacency — Method
MatPartitioningSetAdjacency(petsclib::PetscLibType, part::MatPartitioning, adj::AbstractPetscMat)

Sets the adjacency graph (matrix) of the thing to be partitioned.

Collective

Input Parameters:

  • part - the partitioning context
  • adj - the adjacency matrix, this can be any MatType but the natural representation is MATMPIADJ

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatPartitioningSetFromOptions — Method
MatPartitioningSetFromOptions(petsclib::PetscLibType, part::MatPartitioning)

Sets various partitioning options from the options database for the partitioning object

Collective

Input Parameter:

  • part - the partitioning context.

Options Database Keys:

  • -mat_partitioning_type type - (for instance, parmetis), use -help for a list of available methods
  • -mat_partitioning_nparts - number of subgraphs

Level: beginner

See also: Mat, MatPartitioning

External Links

source
PETSc.LibPETSc.MatPartitioningSetNParts — Method
MatPartitioningSetNParts(petsclib::PetscLibType, part::MatPartitioning, n::PetscInt)

Set how many partitions need to be created; by default this is one per processor. Certain partitioning schemes may in fact only support that option.

Collective

Input Parameters:

  • part - the partitioning context
  • n - the number of partitions

Level: intermediate

See also: Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningApply()

External Links

source
PETSc.LibPETSc.MatPartitioningSetPartitionWeights — Method
MatPartitioningSetPartitionWeights(petsclib::PetscLibType, part::MatPartitioning, weights::Vector{PetscReal})

Sets the weights for each partition.

Logically Collective

Input Parameters:

  • part - the partitioning context
  • weights - An array of size nparts that is used to specify the fraction of

vertex weight that should be distributed to each sub-domain for the balance constraint. If all of the sub-domains are to be of the same size, then each of the nparts elements should be set to a value of 1/nparts. Note that the sum of all of the weights should be one.

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningSetVertexWeights(), MatPartitioningCreate(), MatPartitioningSetType()

External Links

source
PETSc.LibPETSc.MatPartitioningSetType — Method
MatPartitioningSetType(petsclib::PetscLibType, part::MatPartitioning, type::String)

Sets the type of partitioner to use

Collective

Input Parameters:

  • part - the partitioning context.
  • type - a known method

Options Database Key:

  • -mat_partitioning_type type - (for instance, parmetis), see MatPartitioningType

Level: intermediate

See also: Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningApply(), MatPartitioningType

External Links

source
PETSc.LibPETSc.MatPartitioningSetUseEdgeWeights — Method
MatPartitioningSetUseEdgeWeights(petsclib::PetscLibType, part::MatPartitioning, use_edge_weights::PetscBool)

Set a flag to indicate whether or not to use edge weights.

Logically Collective

Input Parameters:

  • part - the partitioning context
  • use_edge_weights - the flag indicateing whether or not to use edge weights. By default no edge weights will be used,

that is, useedgeweights is set to FALSE. If set useedgeweights to TRUE, users need to make sure legal edge weights are stored in an ADJ matrix.

Options Database Key:

  • -mat_partitioning_use_edge_weights - (true or false)

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningSetType(), MatPartitioningSetVertexWeights(), MatPartitioningSetPartitionWeights()

External Links

source
PETSc.LibPETSc.MatPartitioningSetVertexWeights — Method
MatPartitioningSetVertexWeights(petsclib::PetscLibType, part::MatPartitioning, weights::Vector{PetscInt})

Sets the weights for vertices for a partitioning.

Logically Collective

Input Parameters:

  • part - the partitioning context
  • weights - the weights, on each process this array must have the same size as the number of local rows times the value passed with MatPartitioningSetNumberVertexWeights() or

1 if that is not provided

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningSetType(), MatPartitioningSetPartitionWeights(), MatPartitioningSetNumberVertexWeights()

External Links

source
PETSc.LibPETSc.MatPartitioningView — Method
MatPartitioningView(petsclib::PetscLibType, part::MatPartitioning, viewer::PetscViewer)

Prints the partitioning data structure.

Collective

Input Parameters:

  • part - the partitioning context
  • viewer - optional visualization context

Level: intermediate

See also: Mat, MatPartitioning, PetscViewer, PetscViewerASCIIOpen()

External Links

source
PETSc.LibPETSc.MatPartitioningViewFromOptions — Method
MatPartitioningViewFromOptions(petsclib::PetscLibType, A::MatPartitioning, obj, name::String)

View a partitioning context from the options database

Collective

Input Parameters:

  • A - the partitioning context
  • obj - Optional object that provides the prefix used in the options database check
  • name - command line option

Options Database Key:

  • -name [viewertype][:...] - option name and values. See PetscObjectViewFromOptions() for the possible arguments

Level: intermediate

See also: Mat, MatPartitioning, MatPartitioningView(), PetscObjectViewFromOptions(), MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatPartitioningViewImbalance — Method
MatPartitioningViewImbalance(petsclib::PetscLibType, matp::MatPartitioning, partitioning::AbstractIS)

Display partitioning imbalance information.

Collective

Input Parameters:

  • matp - the matrix partitioning object
  • partitioning - the partitioning. For each local node this tells the MPI rank that that node is assigned to.

Options Database Key:

  • -mat_partitioning_view_balance - view the balance information from the last partitioning

Level: beginner

See also: Mat, MatPartitioning, MatPartitioningType, MatPartitioningApply(), MatPartitioningView()

External Links

source
PETSc.LibPETSc.MatTransposeColoringCreate — Method
color::MatTransposeColoring = MatTransposeColoringCreate(petsclib::PetscLibType, mat::AbstractPetscMat, iscoloring::ISColoring)

Creates a matrix coloring context for the matrix product C = A*B^T.

Collective

Input Parameters:

  • mat - the matrix product C
  • iscoloring - the coloring of the matrix; usually obtained with MatColoringCreate() or DMCreateColoring()

Output Parameter:

  • color - the new coloring context

Level: intermediate

See also: Mat, MatTransposeColoringDestroy(), MatTransColoringApplySpToDen(), MatTransColoringApplyDenToSp()

External Links

source
PETSc.LibPETSc.MatTransposeColoringDestroy — Method
MatTransposeColoringDestroy(petsclib::PetscLibType, c::Union{MatTransposeColoring, Ref{MatTransposeColoring}})

Destroys a coloring context for matrix product C = A*B^T that was created via MatTransposeColoringCreate().

Collective

Input Parameter:

  • c - coloring context

Level: intermediate

See also: Mat, MatTransposeColoringCreate()

External Links

source