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.MatAIJGetLocalMatMethod
MatAIJGetLocalMat(petsclib::PetscLibType,A::PetscMat, A_loc::PetscMat)

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

-seealso: , Mat, MatMPIAIJGetLocalMat()

External Links

source
PETSc.LibPETSc.MatAXPYMethod
MatAXPY(petsclib::PetscLibType,Y::PetscMat, a::PetscScalar, X::PetscMat, 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

-seealso: , Mat, MatAYPX()

External Links

source
PETSc.LibPETSc.MatAYPXMethod
MatAYPX(petsclib::PetscLibType,Y::PetscMat, a::PetscScalar, X::PetscMat, 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

-seealso: , Mat, MatAXPY()

External Links

source
PETSc.LibPETSc.MatAppendOptionsPrefixMethod
MatAppendOptionsPrefix(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar})

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

-seealso: , Mat, MatGetOptionsPrefix(), MatAppendOptionsPrefixFactor(), MatSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.MatAppendOptionsPrefixFactorMethod
MatAppendOptionsPrefixFactor(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar})

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

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

External Links

source
PETSc.LibPETSc.MatAssembledMethod
assembled::PetscBool = MatAssembled(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatAssemblyEnd(), MatSetValues(), MatAssemblyBegin()

External Links

source
PETSc.LibPETSc.MatAssemblyBeginMethod
MatAssemblyBegin(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatAssemblyEnd(), MatSetValues(), MatAssembled()

External Links

source
PETSc.LibPETSc.MatAssemblyEndMethod
MatAssemblyEnd(petsclib::PetscLibType,mat::PetscMat, 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 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 - draws 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 Using MATLAB with PETSc)
  • -viewer_socket_machine <machine> - Machine to use for socket
  • -viewer_socket_port <port> - Port number to use for socket
  • -mat_view binary:filename[:append] - Save matrix to file in binary format

Level: beginner

-seealso: , Mat, MatAssemblyBegin(), MatSetValues(), PetscDrawOpenX(), PetscDrawCreate(), MatView(), MatAssembled(), PetscViewerSocketOpen()

External Links

source
PETSc.LibPETSc.MatBackwardSolveMethod
MatBackwardSolve(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec)

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

-seealso: , Mat, MatForwardSolve(), MatGetFactor(), MatSolve()

External Links

source
PETSc.LibPETSc.MatBindToCPUMethod
MatBindToCPU(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatBoundToCPU()

External Links

source
PETSc.LibPETSc.MatBlockMatSetPreallocationMethod
MatBlockMatSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MatCreate(), MatCreateBlockMat(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatBoundToCPUMethod
flg::PetscBool = MatBoundToCPU(petsclib::PetscLibType,A::PetscMat)

query if a matrix is bound to the CPU

Input Parameter:

  • A - the matrix

Output Parameter:

  • flg - the logical flag

Level: intermediate

-seealso: , Mat, MatBindToCPU()

External Links

source
PETSc.LibPETSc.MatCholeskyFactorMethod
MatCholeskyFactor(petsclib::PetscLibType,mat::PetscMat, perm::IS, info::MatFactorInfo)

Performs in symmetric matrix.

Collective

Input Parameters:

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

Level: developer

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatFactorInfo, MatLUFactor(), MatCholeskyFactorSymbolic(), MatCholeskyFactorNumeric() MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatCholeskyFactorNumericMethod
MatCholeskyFactorNumeric(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, info::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

-seealso: , Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatCholeskyFactorSymbolic(), MatCholeskyFactor(), MatLUFactorNumeric()

External Links

source
PETSc.LibPETSc.MatCholeskyFactorSymbolicMethod
MatCholeskyFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, perm::IS, info::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

-seealso: , Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactor(), MatCholeskyFactorNumeric() MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatCompositeAddMatMethod
MatCompositeAddMat(petsclib::PetscLibType,mat::PetscMat, smat::PetscMat)

Add another matrix to a composite matrix.

Collective

Input Parameters:

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

Level: advanced

-seealso: , Mat, MatCreateComposite(), MatCompositeGetMat(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetMatMethod
MatCompositeGetMat(petsclib::PetscLibType,mat::PetscMat, i::PetscInt, Ai::PetscMat)

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

-seealso: , Mat, MatCreateComposite(), MatCompositeGetNumberMat(), MatCompositeAddMat(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetMatStructureMethod
MatCompositeGetMatStructure(petsclib::PetscLibType,mat::PetscMat, str::MatStructure)

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

-seealso: , Mat, MatCreateComposite(), MatCompositeSetMatStructure(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetNumberMatMethod
nmat::PetscInt = MatCompositeGetNumberMat(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatCreateComposite(), MatCompositeGetMat(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeGetTypeMethod
type::MatCompositeType = MatCompositeGetType(petsclib::PetscLibType,mat::PetscMat)

Returns type of composite.

Not Collective

Input Parameter:

  • mat - the composite matrix

Output Parameter:

  • type - type of composite

Level: advanced

-seealso: , Mat, MatCreateComposite(), MatCompositeSetType(), MATCOMPOSITE, MatCompositeType

External Links

source
PETSc.LibPETSc.MatCompositeMergeMethod
MatCompositeMerge(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatDestroy(), MatMult(), MatCompositeAddMat(), MatCreateComposite(), MatCompositeSetMatStructure(), MatCompositeSetMergeType(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetMatStructureMethod
MatCompositeSetMatStructure(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatAXPY(), MatCreateComposite(), MatCompositeMerge() MatCompositeGetMatStructure(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetMergeTypeMethod
MatCompositeSetMergeType(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatCreateComposite(), MatCompositeMerge(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetScalingsMethod
scalings::PetscScalar = MatCompositeSetScalings(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatScale(), MatDiagonalScale(), MATCOMPOSITE

External Links

source
PETSc.LibPETSc.MatCompositeSetTypeMethod
MatCompositeSetType(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatDestroy(), MatMult(), MatCompositeAddMat(), MatCreateComposite(), MatCompositeGetType(), MATCOMPOSITE, MatCompositeType

External Links

source
PETSc.LibPETSc.MatComputeBandwidthMethod
bw::PetscInt = MatComputeBandwidth(petsclib::PetscLibType,A::PetscMat, 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

-seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart()

External Links

source
PETSc.LibPETSc.MatComputeOperatorMethod
MatComputeOperator(petsclib::PetscLibType,inmat::PetscMat, mattype::MatType, mat::PetscMat)

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

-seealso: , Mat, MatConvert(), MatMult(), MatComputeOperatorTranspose()

External Links

source
PETSc.LibPETSc.MatComputeOperatorTransposeMethod
MatComputeOperatorTranspose(petsclib::PetscLibType,inmat::PetscMat, mattype::MatType, mat::PetscMat)

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

-seealso: , Mat, MatConvert(), MatMult(), MatComputeOperator()

External Links

source
PETSc.LibPETSc.MatComputeVariableBlockEnvelopeMethod
MatComputeVariableBlockEnvelope(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatInvertVariableBlockEnvelope(), MatSetVariableBlockSizes()

External Links

source
PETSc.LibPETSc.MatConjugateMethod
MatConjugate(petsclib::PetscLibType,mat::PetscMat)

replaces the matrix values with their complex conjugates

Logically Collective

Input Parameter:

  • mat - the matrix

Level: advanced

-seealso: , Mat, MatRealPart(), MatImaginaryPart(), VecConjugate(), MatTranspose()

External Links

source
PETSc.LibPETSc.MatConstantDiagonalGetConstantMethod
value::PetscScalar = MatConstantDiagonalGetConstant(petsclib::PetscLibType,mat::PetscMat)

Get the scalar constant of a constant diagonal matrix

Not collective

Input Parameter:

  • mat - a MATCONSTANTDIAGONAL

Output Parameter:

  • value - the scalar value

Level: developer

-seealso: , Mat, MatDestroy(), MATCONSTANTDIAGONAL

External Links

source
PETSc.LibPETSc.MatConvertMethod
MatConvert(petsclib::PetscLibType,mat::PetscMat, newtype::MatType, reuse::MatReuse, M::PetscMat)

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

-seealso: , Mat, MatCopy(), MatDuplicate(), MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX

External Links

source
PETSc.LibPETSc.MatCopyMethod
MatCopy(petsclib::PetscLibType,A::PetscMat, B::PetscMat, 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

-seealso: , Mat, MatConvert(), MatDuplicate()

External Links

source
PETSc.LibPETSc.MatCopyHashToXAIJMethod
MatCopyHashToXAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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: -seealso: , Mat, MAT_USE_HASH_TABLE

External Links

source
PETSc.LibPETSc.MatCreateMethod
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

-seealso: , Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert()

External Links

source
PETSc.LibPETSc.MatCreateAIJMethod
A::PetscMat = MatCreateAIJ(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::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

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

External Links

source
PETSc.LibPETSc.MatCreateAIJKokkosMethod
A::PetscMat = MatCreateAIJKokkos(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::Vector{PetscInt})

External Links

source
PETSc.LibPETSc.MatCreateBAIJMethod
A::PetscMat = MatCreateBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: Mat, MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatMPIBAIJSetPreallocationCSR(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout

External Links

source
PETSc.LibPETSc.MatCreateBAIJMKLMethod
A::PetscMat = MatCreateBAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::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

-seealso: , Mat, MATBAIJMKL, MATBAIJ, MatCreate(), MatCreateSeqBAIJMKL(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatMPIBAIJSetPreallocationCSR()

External Links

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

Creates a new matrix in which each block contains a uniform

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

-seealso: , Mat, MATBLOCKMAT, MatCreateNest()

External Links

source
PETSc.LibPETSc.MatCreateCenteringMethod
C::PetscMat = MatCreateCentering(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a new matrix object that implements the (symmetric and idempotent) centering matrix, I

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

-seealso: , Mat, MatCreateLRC(), MatCreateComposite()

External Links

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

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

-seealso: , Mat, MatDestroy(), MatMult(), MatCompositeAddMat(), MatCompositeGetMat(), MatCompositeMerge(), MatCompositeSetType(), MATCOMPOSITE, MatCompositeType

External Links

source
PETSc.LibPETSc.MatCreateConstantDiagonalMethod
J::PetscMat = MatCreateConstantDiagonal(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MatDestroy(), MATCONSTANTDIAGONAL, MatScale(), MatShift(), MatMult(), MatGetDiagonal(), MatGetFactor(), MatSolve()

External Links

source
PETSc.LibPETSc.MatCreateDenseMethod
A::PetscMat = MatCreateDense(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MATDENSE, MatCreate(), MatCreateSeqDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateDenseFromVecTypeMethod
data::PetscScalar,A::PetscMat = MatCreateDenseFromVecType(petsclib::PetscLibType,comm::MPI_Comm, vtype::VecType, m::PetscInt, n::PetscInt, M::PetscInt, 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 - optional leading dimension. Pass any non-positive number 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

-seealso: , Mat, MatCreateDense(), MatCreateDenseCUDA(), MatCreateDenseHIP(), PetscMemType

External Links

source
PETSc.LibPETSc.MatCreateDiagonalMethod
J::PetscMat = MatCreateDiagonal(petsclib::PetscLibType,diag::PetscVec)

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

-seealso: , Mat, MatDestroy(), MATCONSTANTDIAGONAL, MatScale(), MatShift(), MatMult(), MatGetDiagonal(), MatSolve() MatDiagonalRestoreInverseDiagonal(), MatDiagonalGetDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal()

External Links

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

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

-seealso: , Mat, MATFFTW, MATSEQCUFFT, MatCreateVecsFFTW()

External Links

source
PETSc.LibPETSc.MatCreateFromOptionsMethod
A::PetscMat = MatCreateFromOptions(petsclib::PetscLibType,comm::MPI_Comm, prefix::Vector{Cchar}, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert(), MatCreate()

External Links

source
PETSc.LibPETSc.MatCreateGraphMethod
graph::PetscMat = MatCreateGraph(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatCreate(), PCGAMG

External Links

source
PETSc.LibPETSc.MatCreateHermitianTransposeMethod
N::PetscMat = MatCreateHermitianTranspose(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatCreateNormal(), MatMult(), MatMultHermitianTranspose(), MatCreate(), MATTRANSPOSEVIRTUAL, MatCreateTranspose(), MatHermitianTransposeGetMat(), MATNORMAL, MATNORMALHERMITIAN

External Links

source
PETSc.LibPETSc.MatCreateHtoolFromKernelMethod
kernel::MatHtoolKernelFn,kernelctx::Cvoid,B::PetscMat = MatCreateHtoolFromKernel(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, spacedim::PetscInt, coords_target::Vector{PetscReal}, coords_source::Vector{PetscReal})

External Links

source
PETSc.LibPETSc.MatCreateISMethod
A::PetscMat = MatCreateIS(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MATIS, MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatCreateKAIJMethod
kaij::PetscMat = MatCreateKAIJ(petsclib::PetscLibType,A::PetscMat, p::PetscInt, q::PetscInt, S::Vector{PetscScalar}, T::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

-seealso: , Mat, MatKAIJSetAIJ(), MatKAIJSetS(), MatKAIJSetT(), MatKAIJGetAIJ(), MatKAIJGetS(), MatKAIJGetT(), MATKAIJ

External Links

source
PETSc.LibPETSc.MatCreateLMVMBFGSMethod
B::PetscMat = MatCreateLMVMBFGS(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , MatCreate(), MATLMVM, MATLMVMBFGS, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMBadBroydenMethod
B::PetscMat = MatCreateLMVMBadBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , MatCreate(), MATLMVM, MATLMVMBADBRDN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMBroydenMethod
B::PetscMat = MatCreateLMVMBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , MatCreate(), MATLMVM, MATLMVMBRDN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDBFGSMethod
B::PetscMat = MatCreateLMVMDBFGS(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a dense representation of the limited 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

-seealso: MatCreate(), MATLMVM, MATLMVMDBFGS, MatCreateLMVMBFGS()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDDFPMethod
B::PetscMat = MatCreateLMVMDDFP(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a dense representation of the limited 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

-seealso: MatCreate(), MATLMVM, MATLMVMDDFP, MatCreateLMVMDFP()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDFPMethod
B::PetscMat = MatCreateLMVMDFP(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , MatCreate(), MATLMVM, MATLMVMDFP, MatCreateLMVMBFGS(), MatCreateLMVMSR1(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDQNMethod
B::PetscMat = MatCreateLMVMDQN(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a dense representation of the limited 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

-seealso: MatCreate(), MATLMVM, MATLMVMDBFGS, MATLMVMDDFP, MatCreateLMVMDDFP(), MatCreateLMVMDBFGS()

External Links

source
PETSc.LibPETSc.MatCreateLMVMDiagBroydenMethod
B::PetscMat = MatCreateLMVMDiagBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

DiagBrdn creates a symmetric Broyden 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

-seealso: , MatCreate(), MATLMVM, MATLMVMDIAGBRDN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMSR1Method
B::PetscMat = MatCreateLMVMSR1(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , MatCreate(), MATLMVM, MATLMVMSR1, MatCreateLMVMBFGS(), MatCreateLMVMDFP(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden(), MatCreateLMVMSymBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMSymBadBroydenMethod
B::PetscMat = MatCreateLMVMSymBadBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , LMVM Matrices, MatCreate(), MATLMVM, MATLMVMSYMBROYDEN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLMVMSymBroydenMethod
B::PetscMat = MatCreateLMVMSymBroyden(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a limited 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

-seealso: , MatCreate(), MATLMVM, MATLMVMSYMBROYDEN, MatCreateLMVMDFP(), MatCreateLMVMSR1(), MatCreateLMVMBFGS(), MatCreateLMVMBroyden(), MatCreateLMVMBadBroyden()

External Links

source
PETSc.LibPETSc.MatCreateLRCMethod
N::PetscMat = MatCreateLRC(petsclib::PetscLibType,A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat)

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

-seealso: , Mat, MATLRC, MatLRCGetMats()

External Links

source
PETSc.LibPETSc.MatCreateLaplacianMethod
L::PetscMat = MatCreateLaplacian(petsclib::PetscLibType,A::PetscMat, 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

-seealso: MatFilter(), MatGetGraph()

External Links

source
PETSc.LibPETSc.MatCreateLocalRefMethod
newmat::PetscMat = MatCreateLocalRef(petsclib::PetscLibType,A::PetscMat, isrow::IS, iscol::IS)

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

-seealso: , Mat, MATSUBMATRIX, MatCreateSubMatrixVirtual(), MatSetValuesLocal(), MatSetValuesBlockedLocal(), MatGetLocalSubMatrix(), MatCreateSubMatrix()

External Links

source
PETSc.LibPETSc.MatCreateMAIJMethod
maij::PetscMat = MatCreateMAIJ(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MATAIJ, MATMAIJ, MatMAIJGetAIJ(), MatMAIJRedimension()

External Links

source
PETSc.LibPETSc.MatCreateMFFDMethod
J::PetscMat = MatCreateMFFD(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt)

Creates a matrix 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

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

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJCRLMethod
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

-seealso: , Mat, Sparse Matrix Creation, MATAIJ, MATAIJSELL, MATAIJPERM, MATAIJMKL, MatCreate(), MatCreateMPIAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJMKLMethod
A::PetscMat = MatCreateMPIAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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

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

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJPERMMethod
A::PetscMat = MatCreateMPIAIJPERM(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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 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

-seealso: , Mat, Sparse Matrix Creation, MATMPIAIJPERM, MatCreate(), MatCreateSeqAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJSELLMethod
A::PetscMat = MatCreateMPIAIJSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, Sparse Matrix Creation, MATSEQAIJSELL, MATMPIAIJSELL, MATAIJSELL, MatCreate(), MatCreateSeqAIJSELL(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJSumSeqAIJMethod
mpimat::PetscMat = MatCreateMPIAIJSumSeqAIJ(petsclib::PetscLibType,comm::MPI_Comm, seqmat::PetscMat, 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

-seealso: , Mat, MatCreateAIJ()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJWithArraysMethod
mat::PetscMat = MatCreateMPIAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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

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

External Links

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

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

-seealso: , Mat, MATMPIAIJ, MATSEQAIJ, MatCreateMPIAIJWithSplitArrays()

External Links

source
PETSc.LibPETSc.MatCreateMPIAIJWithSplitArraysMethod
mat::PetscMat = MatCreateMPIAIJWithSplitArrays(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithArrays()

External Links

source
PETSc.LibPETSc.MatCreateMPIAdjMethod
A::PetscMat = MatCreateMPIAdj(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, N::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, values::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

-seealso: , Mat, MatCreate(), MatConvert(), MatGetOrdering(), MATMPIADJ, MatMPIAdjSetPreallocation()

External Links

source
PETSc.LibPETSc.MatCreateMPIBAIJWithArraysMethod
mat::PetscMat = MatCreateMPIBAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays()

External Links

source
PETSc.LibPETSc.MatCreateMPIMatConcatenateSeqMatMethod
mpimat::PetscMat = MatCreateMPIMatConcatenateSeqMat(petsclib::PetscLibType,comm::MPI_Comm, seqmat::PetscMat, 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

-seealso: , Mat

External Links

source
PETSc.LibPETSc.MatCreateMPISBAIJWithArraysMethod
mat::PetscMat = MatCreateMPISBAIJWithArrays(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MATMPISBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays(), MatMPISBAIJSetPreallocationCSR()

External Links

source
PETSc.LibPETSc.MatCreateNestMethod
B::PetscMat = MatCreateNest(petsclib::PetscLibType,comm::MPI_Comm, nr::PetscInt, is_row::Vector{IS}, nc::PetscInt, is_col::Vector{IS}, a::Vector{PetscMat})

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 imes nc submatrices, empty submatrices can be passed using NULL

Output Parameter:

  • B - new matrix

Level: advanced

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

External Links

source
PETSc.LibPETSc.MatCreateNormalMethod
N::PetscMat = MatCreateNormal(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATNORMAL, MatMult(), MatNormalGetMat(), MATNORMALHERMITIAN, MatCreateNormalHermitian()

External Links

source
PETSc.LibPETSc.MatCreateNormalHermitianMethod
N::PetscMat = MatCreateNormalHermitian(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATNORMAL, MATNORMALHERMITIAN, MatNormalHermitianGetMat()

External Links

source
PETSc.LibPETSc.MatCreateRedundantMatrixMethod
matredundant::PetscMat = MatCreateRedundantMatrix(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatDestroy(), PetscSubcommCreate(), PetscSubcomm

External Links

source
PETSc.LibPETSc.MatCreateSBAIJMethod
A::PetscMat = MatCreateSBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::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

-seealso: , Mat, MATSBAIJ, MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout

External Links

source
PETSc.LibPETSc.MatCreateSELLMethod
A::PetscMat = MatCreateSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, d_rlenmax::PetscInt, d_rlen::Vector{PetscInt}, o_rlenmax::PetscInt, o_rlen::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

-seealso: Mat, MATSELL, MatCreate(), MatCreateSeqSELL(), MatSetValues(), MatMPISELLSetPreallocation(), MATMPISELL

External Links

source
PETSc.LibPETSc.MatCreateSNESMFMethod
J::PetscMat = MatCreateSNESMF(petsclib::PetscLibType,snes::PetscSNES)

Creates a finite differencing based matrix 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

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

External Links

source
PETSc.LibPETSc.MatCreateSNESMFMoreMethod
J::PetscMat = MatCreateSNESMFMore(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec)

Creates a 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

-seealso: , SNESCreateMF(), MatCreateMFFD(), MatDestroy(), MatMFFDSetFunctionError()

External Links

source
PETSc.LibPETSc.MatCreateScaLAPACKMethod
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

-seealso: , Mat, MATSCALAPACK, MATDENSE, MATELEMENTAL, MatCreate(), MatCreateDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateScatterMethod
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

-seealso: , Mat, MatScatterSetVecScatter(), MatScatterGetVecScatter(), MATSCATTER

External Links

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

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

-seealso: , MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatSchurComplementUpdateSubMatrices(), MatCreateTranspose(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementSetSubMatrices()

External Links

source
PETSc.LibPETSc.MatCreateSchurComplementPmatMethod
Sp::PetscMat = MatCreateSchurComplementPmat(petsclib::PetscLibType,A00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat, 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

-seealso: , MatCreateSchurComplement(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementAinvType

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJMethod
A::PetscMat = MatCreateSeqAIJ(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::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

-seealso: , Mat, Sparse Matrix Creation, MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJCRLMethod
A::PetscMat = MatCreateSeqAIJCRL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::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

-seealso: , Mat, MatCreate(), MatCreateMPIAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJFromTripleMethod
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) -seealso: , Mat, MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR(), MatSetValuesCOO(), MatSetPreallocationCOO()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJMKLMethod
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

-seealso: , Mat, MatCreate(), MatCreateMPIAIJMKL(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJPERMMethod
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

-seealso: , Mat, MatCreate(), MatCreateMPIAIJPERM(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJSELLMethod
A::PetscMat = MatCreateSeqAIJSELL(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::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

-seealso: , Mat, MatCreate(), MatCreateMPIAIJSELL(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqAIJWithArraysMethod
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

-seealso: , Mat, MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateMPIAIJWithArrays(), MatMPIAIJSetPreallocationCSR()

External Links

source
PETSc.LibPETSc.MatCreateSeqBAIJMethod
A::PetscMat = MatCreateSeqBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::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

-seealso: , Mat, Sparse Matrices, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqBAIJMKLMethod
A::PetscMat = MatCreateSeqBAIJMKL(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::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

-seealso: Sparse Matrices, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqBAIJWithArraysMethod
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

-seealso: , Mat, MatCreate(), MatCreateBAIJ(), MatCreateSeqBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqDenseMethod
A::PetscMat = MatCreateSeqDense(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, data::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

-seealso: , Mat, MATSEQDENSE, MatCreate(), MatCreateDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatCreateSeqSBAIJMethod
A::PetscMat = MatCreateSeqSBAIJ(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, m::PetscInt, n::PetscInt, nz::PetscInt, nnz::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

-seealso: , Mat, Sparse Matrices, MATSEQSBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateSBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqSBAIJWithArraysMethod
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

-seealso: , Mat, MATSEQSBAIJ, MatCreate(), MatCreateSBAIJ(), MatCreateSeqSBAIJ()

External Links

source
PETSc.LibPETSc.MatCreateSeqSELLMethod
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

-seealso: Mat, MATSEQSELL, MatCreate(), MatCreateSELL(), MatSetValues(), MatSeqSELLSetPreallocation(), MATSELL, MATMPISELL

External Links

source
PETSc.LibPETSc.MatCreateShellMethod
A::PetscMat = MatCreateShell(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, ctx::Ptr)

Creates a new matrix of MatType MATSHELL for use with a user 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

-seealso: , Mat, MATSHELL, MatShellSetOperation(), MatHasOperation(), MatShellGetContext(), MatShellSetContext(), MatShellSetManageScalingShifts(), MatShellSetMatProductOperation()

External Links

source
PETSc.LibPETSc.MatCreateSubMatricesMethod
submat::Vector{PetscMat} = MatCreateSubMatrices(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse)

Extracts several submatrices from a matrix. If submat points to an array of valid matrices, they may be reused to store the new submatrices.

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

Output Parameter:

  • submat - the array of submatrices

Level: advanced

-seealso: , Mat, MatDestroySubMatrices(), MatCreateSubMatrix(), MatGetRow(), MatGetDiagonal(), MatReuse

External Links

source
PETSc.LibPETSc.MatCreateSubMatricesMPIMethod
submat::Vector{PetscMat} = MatCreateSubMatricesMPI(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, irow::Vector{IS}, icol::Vector{IS}, scall::MatReuse)

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

Output Parameter:

  • submat - the array of submatrices

Level: advanced

-seealso: , Mat, PCGASM, MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRow(), MatGetDiagonal(), MatReuse

External Links

source
PETSc.LibPETSc.MatCreateSubMatrixMethod
newmat::PetscMat = MatCreateSubMatrix(petsclib::PetscLibType,mat::PetscMat, isrow::IS, iscol::IS, 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

-seealso: , Mat, MatCreateSubMatrices(), MatCreateSubMatricesMPI(), MatCreateSubMatrixVirtual(), MatSubMatrixVirtualUpdate()

External Links

source
PETSc.LibPETSc.MatCreateSubMatrixFreeMethod
J::PetscMat = MatCreateSubMatrixFree(petsclib::PetscLibType,mat::PetscMat, Rows::IS, Cols::IS)

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

-seealso: MatCreate()

External Links

source
PETSc.LibPETSc.MatCreateSubMatrixVirtualMethod
newmat::PetscMat = MatCreateSubMatrixVirtual(petsclib::PetscLibType,A::PetscMat, isrow::IS, iscol::IS)

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

-seealso: , Mat, MATSUBMATRIX, MATLOCALREF, MatCreateLocalRef(), MatCreateSubMatrix(), MatSubMatrixVirtualUpdate()

External Links

source
PETSc.LibPETSc.MatCreateTransposeMethod
N::PetscMat = MatCreateTranspose(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATTRANSPOSEVIRTUAL, MatCreateNormal(), MatMult(), MatMultTranspose(), MatCreate(), MATNORMALHERMITIAN

External Links

source
PETSc.LibPETSc.MatCreateVecsMethod
right::PetscVec,left::PetscVec = MatCreateVecs(petsclib::PetscLibType,mat::PetscMat)

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

Level: advanced

-seealso: , Mat, Vec, VecCreate(), VecDestroy(), DMCreateGlobalVector()

External Links

source
PETSc.LibPETSc.MatCreateVecsFFTWMethod
x::PetscVec,y::PetscVec,z::PetscVec = MatCreateVecsFFTW(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATFFTW, MatCreateFFT(), MatCreateVecs()

External Links

source
PETSc.LibPETSc.MatDFischerMethod
MatDFischer(petsclib::PetscLibType,jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec)

Calculates an element of the B 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

-seealso: Mat, VecFischer(), VecSFischer(), MatDSFischer()

External Links

source
PETSc.LibPETSc.MatDSFischerMethod
MatDSFischer(petsclib::PetscLibType,jac::PetscMat, X::PetscVec, Con::PetscVec, XL::PetscVec, XU::PetscVec, mu::PetscReal, T1::PetscVec, T2::PetscVec, Da::PetscVec, Db::PetscVec, Dm::PetscVec)

Calculates an element of the B 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

-seealso: Mat, VecFischer(), VecDFischer(), MatDFischer()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayMethod
array::Vector{PetscScalar} = MatDenseGetArray(petsclib::PetscLibType,A::PetscMat)

gives read

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MATDENSE, MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayAndMemTypeMethod
array::Vector{PetscScalar},mtype::PetscMemType = MatDenseGetArrayAndMemType(petsclib::PetscLibType,A::PetscMat)

gives read

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameters:

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

Level: intermediate

-seealso: , Mat, MATDENSE, MatDenseRestoreArrayAndMemType(), MatDenseGetArrayReadAndMemType(), MatDenseGetArrayWriteAndMemType(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite(), MatSeqAIJGetCSRAndMemType()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayReadMethod
array::Vector{PetscScalar} = MatDenseGetArrayRead(petsclib::PetscLibType,A::PetscMat)

gives read

Not Collective

Input Parameter:

  • A - a dense matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MATDENSE, MatDenseRestoreArrayRead(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayReadAndMemTypeMethod
array::Vector{PetscScalar},mtype::PetscMemType = MatDenseGetArrayReadAndMemType(petsclib::PetscLibType,A::PetscMat)

gives read

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameters:

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

Level: intermediate

-seealso: , Mat, MATDENSE, MatDenseRestoreArrayReadAndMemType(), MatDenseGetArrayWriteAndMemType(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite(), MatSeqAIJGetCSRAndMemType()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayWriteMethod
array::Vector{PetscScalar} = MatDenseGetArrayWrite(petsclib::PetscLibType,A::PetscMat)

gives write

Not Collective

Input Parameter:

  • A - a dense matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MATDENSE, MatDenseRestoreArrayWrite(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatDenseGetArrayWriteAndMemTypeMethod
array::Vector{PetscScalar},mtype::PetscMemType = MatDenseGetArrayWriteAndMemType(petsclib::PetscLibType,A::PetscMat)

gives write

Logically Collective

Input Parameter:

  • A - a dense matrix

Output Parameters:

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

Level: intermediate

-seealso: , Mat, MATDENSE, MatDenseRestoreArrayWriteAndMemType(), MatDenseGetArrayReadAndMemType(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite(), MatSeqAIJGetCSRAndMemType()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnMethod
vals::Vector{PetscScalar} = MatDenseGetColumn(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MATDENSE, MatDenseRestoreColumn(), MatDenseGetColumnVec()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnVecMethod
MatDenseGetColumnVec(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec)

Gives read

Collective

Input Parameters:

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

Output Parameter:

  • v - the vector

Level: intermediate

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite(), MatDenseGetColumn()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnVecReadMethod
MatDenseGetColumnVecRead(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec)

Gives read

Collective

Input Parameters:

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

Output Parameter:

  • v - the vector

Level: intermediate

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetColumnVecWriteMethod
MatDenseGetColumnVecWrite(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec)

Gives write

Collective

Input Parameters:

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

Output Parameter:

  • v - the vector

Level: intermediate

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseGetLDAMethod
lda::PetscInt = MatDenseGetLDA(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MATDENSECUDA, MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseSetLDA()

External Links

source
PETSc.LibPETSc.MatDenseGetLocalMatrixMethod
MatDenseGetLocalMatrix(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MATDENSE, MATMPIDENSE, MATSEQDENSE

External Links

source
PETSc.LibPETSc.MatDenseGetSubMatrixMethod
MatDenseGetSubMatrix(petsclib::PetscLibType,A::PetscMat, rbegin::PetscInt, rend::PetscInt, cbegin::PetscInt, cend::PetscInt, v::PetscMat)

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

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseRestoreColumnVec(), MatDenseRestoreSubMatrix()

External Links

source
PETSc.LibPETSc.MatDensePlaceArrayMethod
array::PetscScalar = MatDensePlaceArray(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArray(), MatDenseResetArray(), VecPlaceArray(), VecGetArray(), VecRestoreArray(), VecReplaceArray(), VecResetArray(), MatDenseReplaceArray()

External Links

source
PETSc.LibPETSc.MatDenseReplaceArrayMethod
array::PetscScalar = MatDenseReplaceArray(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatDensePlaceArray(), MatDenseGetArray(), VecReplaceArray()

External Links

source
PETSc.LibPETSc.MatDenseResetArrayMethod
MatDenseResetArray(petsclib::PetscLibType,mat::PetscMat)

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

Not Collective

Input Parameter:

  • mat - the matrix

Level: developer

-seealso: , Mat, MATDENSE, MatDenseGetArray(), MatDensePlaceArray(), VecPlaceArray(), VecGetArray(), VecRestoreArray(), VecReplaceArray(), VecResetArray()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayMethod
array::Vector{PetscScalar} = MatDenseRestoreArray(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayAndMemTypeMethod
array::Vector{PetscScalar} = MatDenseRestoreArrayAndMemType(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArrayAndMemType(), MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayReadMethod
array::Vector{PetscScalar} = MatDenseRestoreArrayRead(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArrayRead(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayReadAndMemTypeMethod
array::Vector{PetscScalar} = MatDenseRestoreArrayReadAndMemType(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArrayReadAndMemType(), MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayWriteMethod
array::Vector{PetscScalar} = MatDenseRestoreArrayWrite(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArrayWrite(), MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatDenseRestoreArrayWriteAndMemTypeMethod
array::Vector{PetscScalar} = MatDenseRestoreArrayWriteAndMemType(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetArrayWriteAndMemType(), MatDenseGetArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetArrayWrite(), MatDenseRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnMethod
vals::Vector{PetscScalar} = MatDenseRestoreColumn(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATDENSE, MatDenseGetColumn()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnVecMethod
MatDenseRestoreColumnVec(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec)

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

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVecRead(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnVecReadMethod
MatDenseRestoreColumnVecRead(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec)

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

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecWrite()

External Links

source
PETSc.LibPETSc.MatDenseRestoreColumnVecWriteMethod
MatDenseRestoreColumnVecWrite(petsclib::PetscLibType,A::PetscMat, col::PetscInt, v::PetscVec)

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

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseGetColumnVecRead(), MatDenseGetColumnVecWrite(), MatDenseRestoreColumnVec(), MatDenseRestoreColumnVecRead()

External Links

source
PETSc.LibPETSc.MatDenseRestoreSubMatrixMethod
MatDenseRestoreSubMatrix(petsclib::PetscLibType,A::PetscMat, v::PetscMat)

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 (may be NULL)

Level: intermediate

-seealso: , Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseRestoreColumnVec(), MatDenseGetSubMatrix()

External Links

source
PETSc.LibPETSc.MatDenseSetLDAMethod
MatDenseSetLDA(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MATDENSE, MATDENSECUDA, MatDenseGetArray(), MatDenseRestoreArray(), MatDenseGetArrayRead(), MatDenseRestoreArrayRead(), MatDenseGetLDA()

External Links

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

Frees space taken by a matrix.

Collective

Input Parameter:

  • A - the matrix

Level: beginner

-seealso: , Mat, MatCreate()

External Links

source
PETSc.LibPETSc.MatDestroyMatricesMethod
MatDestroyMatrices(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat})

Destroys an array of matrices

Collective

Input Parameters:

  • n - the number of local matrices
  • mat - the matrices (this is a pointer to the array of matrices)

Level: advanced

-seealso: , Mat, MatCreateSubMatrices(), MatDestroySubMatrices()

External Links

source
PETSc.LibPETSc.MatDestroySubMatricesMethod
MatDestroySubMatrices(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat})

Destroys a set of matrices obtained with MatCreateSubMatrices().

Collective

Input Parameters:

  • n - the number of local matrices
  • mat - the matrices (this is a pointer to the array of matrices, to match the calling sequence of MatCreateSubMatrices())

Level: advanced

-seealso: , Mat, MatCreateSubMatrices(), MatDestroyMatrices()

External Links

source
PETSc.LibPETSc.MatDiagonalGetDiagonalMethod
MatDiagonalGetDiagonal(petsclib::PetscLibType,A::PetscMat, diag::PetscVec)

Get the diagonal of a MATDIAGONAL

Input Parameter:

  • A - the MATDIAGONAL

Output Parameter:

  • diag - the Vec that defines the diagonal

Level: developer

-seealso: , MATDIAGONAL, MatCreateDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal(), MatGetDiagonal()

External Links

source
PETSc.LibPETSc.MatDiagonalGetInverseDiagonalMethod
MatDiagonalGetInverseDiagonal(petsclib::PetscLibType,A::PetscMat, inv_diag::PetscVec)

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

-seealso: , MATDIAGONAL, MatCreateDiagonal(), MatDiagonalRestoreInverseDiagonal(), MatDiagonalGetDiagonal(), MATLMVMBROYDEN, MatSolve()

External Links

source
PETSc.LibPETSc.MatDiagonalRestoreDiagonalMethod
MatDiagonalRestoreDiagonal(petsclib::PetscLibType,A::PetscMat, diag::PetscVec)

Restore the diagonal of a MATDIAGONAL

Input Parameters:

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

Level: developer

-seealso: , MATDIAGONAL, MatCreateDiagonal(), MatDiagonalGetDiagonal()

External Links

source
PETSc.LibPETSc.MatDiagonalRestoreInverseDiagonalMethod
MatDiagonalRestoreInverseDiagonal(petsclib::PetscLibType,A::PetscMat, inv_diag::PetscVec)

Restore the inverse diagonal of a MATDIAGONAL

Input Parameters:

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

Level: developer

-seealso: , MATDIAGONAL, MatCreateDiagonal(), MatDiagonalGetInverseDiagonal()

External Links

source
PETSc.LibPETSc.MatDiagonalScaleMethod
MatDiagonalScale(petsclib::PetscLibType,mat::PetscMat, l::PetscVec, r::PetscVec)

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

-seealso: , Mat, MatScale(), MatShift(), MatDiagonalSet()

External Links

source
PETSc.LibPETSc.MatDiagonalScaleLocalMethod
MatDiagonalScaleLocal(petsclib::PetscLibType,mat::PetscMat, diag::PetscVec)

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

-seealso: , Mat, MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatDiagonalSetMethod
MatDiagonalSet(petsclib::PetscLibType,Y::PetscMat, D::PetscVec, 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

-seealso: , Mat, MatShift(), MatScale(), MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatDuplicateMethod
MatDuplicate(petsclib::PetscLibType,mat::PetscMat, op::MatDuplicateOption, M::PetscMat)

Duplicates a matrix including the non

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

-seealso: , Mat, MatCopy(), MatConvert(), MatDuplicateOption

External Links

source
PETSc.LibPETSc.MatEliminateZerosMethod
MatEliminateZeros(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatCreate(), MatCreateGraph(), MatFilter()

External Links

source
PETSc.LibPETSc.MatEqualMethod
flg::PetscBool = MatEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MatMultEqual()

External Links

source
PETSc.LibPETSc.MatFactorClearErrorMethod
MatFactorClearError(petsclib::PetscLibType,mat::PetscMat)

clears the error code in a factorization

Logically Collective

Input Parameter:

  • mat - the factored matrix

Level: developer

-seealso: , Mat, MatZeroEntries(), MatFactor(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatFactorGetError(), MatFactorGetErrorZeroPivot(), MatGetErrorCode(), MatFactorError

External Links

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

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

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorGetSchurComplement(), MatFactorSchurStatus, MATSOLVERMUMPS, MATSOLVERMKL_PARDISO

External Links

source
PETSc.LibPETSc.MatFactorFactorizeSchurComplementMethod
MatFactorFactorizeSchurComplement(petsclib::PetscLibType,F::PetscMat)

Factorize the Schur complement matrix computed during the factorization step

Logically Collective

Input Parameter:

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

Level: advanced

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorInvertSchurComplement()

External Links

source
PETSc.LibPETSc.MatFactorGetCanUseOrderingMethod
flg::PetscBool = MatFactorGetCanUseOrdering(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, Matrix Factorization, MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic()

External Links

source
PETSc.LibPETSc.MatFactorGetErrorMethod
MatFactorGetError(petsclib::PetscLibType,mat::PetscMat, err::MatFactorError)

gets the error code from a factorization

Logically Collective

Input Parameter:

  • mat - the factored matrix

Output Parameter:

  • err - the error code

Level: advanced

-seealso: , Mat, MatZeroEntries(), MatFactor(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatFactorClearError(), MatFactorGetErrorZeroPivot(), MatFactorError

External Links

source
PETSc.LibPETSc.MatFactorGetErrorZeroPivotMethod
pivot::PetscReal,row::PetscInt = MatFactorGetErrorZeroPivot(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatZeroEntries(), MatFactor(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatFactorClearError(), MAT_FACTOR_NUMERIC_ZEROPIVOT

External Links

source
PETSc.LibPETSc.MatFactorGetPreferredOrderingMethod
MatFactorGetPreferredOrdering(petsclib::PetscLibType,mat::PetscMat, ftype::MatFactorType, otype::MatOrderingType)

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

-seealso: , Mat, Matrix Factorization, MatFactorType, MatOrderingType, MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatGetFactor(), MatLUFactorSymbolic(), MatCholeskyFactorSymbolic()

External Links

source
PETSc.LibPETSc.MatFactorGetSchurComplementMethod
MatFactorGetSchurComplement(petsclib::PetscLibType,F::PetscMat, S::PetscMat, status::MatFactorSchurStatus)

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

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorRestoreSchurComplement(), MatFactorCreateSchurComplement(), MatFactorSchurStatus

External Links

source
PETSc.LibPETSc.MatFactorGetSolverTypeMethod
type::MatSolverType = MatFactorGetSolverType(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatSolverType, MatCopy(), MatDuplicate(), MatGetFactorAvailable()

External Links

source
PETSc.LibPETSc.MatFactorInfoInitializeMethod
MatFactorInfoInitialize(petsclib::PetscLibType,info::MatFactorInfo)

Initializes a MatFactorInfo data structure with default values.

Not Collective

Input Parameter:

  • info - the MatFactorInfo data structure

Level: developer

-seealso: , Mat, MatGetFactor(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatFactorInvertSchurComplementMethod
MatFactorInvertSchurComplement(petsclib::PetscLibType,F::PetscMat)

Invert the Schur complement matrix computed during the factorization step

Logically Collective

Input Parameter:

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

Level: advanced

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorGetSchurComplement(), MatFactorCreateSchurComplement()

External Links

source
PETSc.LibPETSc.MatFactorRestoreSchurComplementMethod
MatFactorRestoreSchurComplement(petsclib::PetscLibType,F::PetscMat, S::PetscMat, 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

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorCreateSchurComplement(), MatFactorSchurStatus

External Links

source
PETSc.LibPETSc.MatFactorSetSchurISMethod
MatFactorSetSchurIS(petsclib::PetscLibType,mat::PetscMat, is::IS)

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

-seealso: , Mat, MatGetFactor(), MatFactorGetSchurComplement(), MatFactorRestoreSchurComplement(), MatFactorCreateSchurComplement(), MatFactorSolveSchurComplement(), MatFactorSolveSchurComplementTranspose(), MATSOLVERMUMPS, MATSOLVERMKL_PARDISO

External Links

source
PETSc.LibPETSc.MatFactorSolveSchurComplementMethod
MatFactorSolveSchurComplement(petsclib::PetscLibType,F::PetscMat, rhs::PetscVec, sol::PetscVec)

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

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorSolveSchurComplementTranspose()

External Links

source
PETSc.LibPETSc.MatFactorSolveSchurComplementTransposeMethod
MatFactorSolveSchurComplementTranspose(petsclib::PetscLibType,F::PetscMat, rhs::PetscVec, sol::PetscVec)

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

-seealso: , Mat, MatGetFactor(), MatFactorSetSchurIS(), MatFactorSolveSchurComplement()

External Links

source
PETSc.LibPETSc.MatFilterMethod
MatFilter(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatCreate(), MatZeroEntries(), MatEliminateZeros(), VecFilter()

External Links

source
PETSc.LibPETSc.MatFinalizePackageMethod
MatFinalizePackage(petsclib::PetscLibType)

This function destroys everything in the PETSc interface to the Mat package. It is called from PetscFinalize().

Level: developer

-seealso: Mat, PetscFinalize(), MatInitializePackage()

External Links

source
PETSc.LibPETSc.MatFindNonzeroRowsMethod
MatFindNonzeroRows(petsclib::PetscLibType,mat::PetscMat, keptrows::IS)

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

-seealso: , Mat, MatFindZeroRows()

External Links

source
PETSc.LibPETSc.MatFindOffBlockDiagonalEntriesMethod
MatFindOffBlockDiagonalEntries(petsclib::PetscLibType,mat::PetscMat, is::IS)

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

-seealso: , Mat, MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatFindZeroDiagonalsMethod
MatFindZeroDiagonals(petsclib::PetscLibType,mat::PetscMat, is::IS)

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

-seealso: , Mat, MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatFindZeroRowsMethod
MatFindZeroRows(petsclib::PetscLibType,mat::PetscMat, zerorows::IS)

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

-seealso: , Mat, MatFindNonzeroRows()

External Links

source
PETSc.LibPETSc.MatForwardSolveMethod
MatForwardSolve(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec)

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

-seealso: , Mat, MatBackwardSolve(), MatGetFactor(), MatSolve()

External Links

source
PETSc.LibPETSc.MatGalerkinMethod
MatGalerkin(petsclib::PetscLibType,restrct::PetscMat, dA::PetscMat, interpolate::PetscMat, reuse::MatReuse, fill::PetscReal, A::PetscMat)

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

-seealso: , Mat, MatPtAP(), MatMatMatMult()

External Links

source
PETSc.LibPETSc.MatGetBindingPropagatesMethod
flg::PetscBool = MatGetBindingPropagates(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatSetBindingPropagates()

External Links

source
PETSc.LibPETSc.MatGetBlockSizeMethod
bs::PetscInt = MatGetBlockSize(petsclib::PetscLibType,mat::PetscMat)

Returns the matrix block size.

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameter:

  • bs - block size

Level: intermediate

-seealso: , Mat, MATBAIJ, MATSBAIJ, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatGetBlockSizesMethod
rbs::PetscInt,cbs::PetscInt = MatGetBlockSizes(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MATBAIJ, MATSBAIJ, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSize(), MatSetBlockSizes()

External Links

source
PETSc.LibPETSc.MatGetBrowsOfAcolsMethod
MatGetBrowsOfAcols(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, rowb::IS, colb::IS, B_seq::PetscMat)

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

-seealso: Mat, MATMPIAIJ, IS, MatReuse

External Links

source
PETSc.LibPETSc.MatGetColumnIJMethod
n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatGetColumnIJ(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatGetRowIJ(), MatRestoreColumnIJ()

External Links

source
PETSc.LibPETSc.MatGetColumnMeansMethod
MatGetColumnMeans(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, VecSum(), MatGetColumnSums(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnMeansImaginaryPartMethod
MatGetColumnMeansImaginaryPart(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatGetColumnMeansRealPart(), VecSum(), MatGetColumnSums(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnMeansRealPartMethod
MatGetColumnMeansRealPart(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatGetColumnMeansImaginaryPart(), VecSum(), MatGetColumnSums(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnNormsMethod
MatGetColumnNorms(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, NormType, MatNorm()

External Links

source
PETSc.LibPETSc.MatGetColumnReductionsMethod
MatGetColumnReductions(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, ReductionType, NormType, MatGetColumnNorms(), MatGetColumnSums(), MatGetColumnMeans()

External Links

source
PETSc.LibPETSc.MatGetColumnSumsMethod
MatGetColumnSums(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, VecSum(), MatGetColumnMeans(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnSumsImaginaryPartMethod
MatGetColumnSumsImaginaryPart(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatGetColumnSumsRealPart(), VecSum(), MatGetColumnMeans(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnSumsRealPartMethod
MatGetColumnSumsRealPart(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatGetColumnSumsImaginaryPart(), VecSum(), MatGetColumnMeans(), MatGetColumnNorms(), MatGetColumnReductions()

External Links

source
PETSc.LibPETSc.MatGetColumnVectorMethod
MatGetColumnVector(petsclib::PetscLibType,A::PetscMat, yy::PetscVec, 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

-seealso: , Mat, MatGetRow(), MatGetDiagonal(), MatMult()

External Links

source
PETSc.LibPETSc.MatGetCurrentMemTypeMethod
m::PetscMemType = MatGetCurrentMemType(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatBoundToCPU(), PetscMemType

External Links

source
PETSc.LibPETSc.MatGetDMMethod
dm::PetscDM = MatGetDM(petsclib::PetscLibType,A::PetscMat)

Gets the DM defining the data layout of the matrix

Not Collective

Input Parameter:

  • A - The Mat

Output Parameter:

  • dm - The DM

Level: intermediate

Note: A matrix may not have a DM associated with it

Developer Note: Since the Mat class doesn't know about the DM class the DM object is associated with the Mat through a PetscObjectCompose() operation

See also:

DM, MatSetDM(), DMCreateMatrix(), DMSetMatType()

External Links

source
PETSc.LibPETSc.MatGetDiagonalMethod
MatGetDiagonal(petsclib::PetscLibType,mat::PetscMat, v::PetscVec)

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

-seealso: , Mat, Vec, MatGetRow(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMaxAbs()

External Links

source
PETSc.LibPETSc.MatGetDiagonalBlockMethod
MatGetDiagonalBlock(petsclib::PetscLibType,A::PetscMat, a::PetscMat)

Returns the part of the matrix associated with the on

Not Collective

Input Parameter:

  • A - the matrix

Output Parameter:

  • a - the diagonal part (which is a SEQUENTIAL matrix)

Level: advanced

-seealso: , Mat, MatCreateAIJ(), MATAIJ, MATBAIJ, MATSBAIJ

External Links

source
PETSc.LibPETSc.MatGetFactorMethod
MatGetFactor(petsclib::PetscLibType,mat::PetscMat, type::MatSolverType, ftype::MatFactorType, f::PetscMat)

Returns a matrix suitable to calls to MatXXFactorSymbolic,Numeric()

Collective

Input Parameters:

  • mat - the matrix
  • type - name of solver type, for example, superlu, 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 <bool> - do mat factorization on host (with device matrices). Default is doing it on device
  • -pc_factor_mat_solve_on_host <bool> - do mat solve on host (with device matrices). Default is doing it on device

Level: intermediate

-seealso: , 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()

External Links

source
PETSc.LibPETSc.MatGetFactorAvailableMethod
flg::PetscBool = MatGetFactorAvailable(petsclib::PetscLibType,mat::PetscMat, type::MatSolverType, 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

-seealso: , 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.MatGetFactorTypeMethod
t::MatFactorType = MatGetFactorType(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , 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.MatGetGhostsMethod
nghosts::PetscInt,ghosts::Vector{PetscInt} = MatGetGhosts(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, VecCreateGhost(), VecCreateGhostBlock()

External Links

source
PETSc.LibPETSc.MatGetInertiaMethod
nneg::PetscInt,nzero::PetscInt,npos::PetscInt = MatGetInertia(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatGetFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatGetInfoMethod
MatGetInfo(petsclib::PetscLibType,mat::PetscMat, flag::MatInfoType, info::MatInfo)

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

-seealso: , Mat, MatInfo, MatStashGetInfo()

External Links

source
PETSc.LibPETSc.MatGetLayoutsMethod
MatGetLayouts(petsclib::PetscLibType,A::PetscMat, rmap::PetscLayout, cmap::PetscLayout)

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

-seealso: , Mat, Matrix Layouts, PetscLayout, MatCreateVecs(), MatGetLocalToGlobalMapping(), MatSetLayouts()

External Links

source
PETSc.LibPETSc.MatGetLocalSizeMethod
m::PetscInt,n::PetscInt = MatGetLocalSize(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatSetSizes(), MatGetSize()

External Links

source
PETSc.LibPETSc.MatGetLocalSubMatrixMethod
MatGetLocalSubMatrix(petsclib::PetscLibType,mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat)

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

-seealso: , Mat, MatRestoreLocalSubMatrix(), MatCreateLocalRef(), MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatGetLocalToGlobalMappingMethod
MatGetLocalToGlobalMapping(petsclib::PetscLibType,A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping)

Gets the local

Not Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • rmapping - row mapping
  • cmapping - column mapping

Level: advanced

-seealso: , Mat, MatSetLocalToGlobalMapping(), MatSetValuesLocal()

External Links

source
PETSc.LibPETSc.MatGetMultiProcBlockMethod
MatGetMultiProcBlock(petsclib::PetscLibType,mat::PetscMat, subComm::MPI_Comm, scall::MatReuse, subMat::PetscMat)

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

-seealso: , Mat, MatCreateRedundantMatrix(), MatCreateSubMatrices(), PCBJACOBI

External Links

source
PETSc.LibPETSc.MatGetNearNullSpaceMethod
MatGetNearNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace)

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

-seealso: , Mat, MatNullSpace, MatSetNearNullSpace(), MatGetNullSpace(), MatNullSpaceCreate()

External Links

source
PETSc.LibPETSc.MatGetNonzeroStateMethod
MatGetNonzeroState(petsclib::PetscLibType,mat::PetscMat, state::PetscObjectState)

Returns a 64 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

-seealso: , Mat, PetscObjectStateGet(), PetscObjectGetId()

External Links

source
PETSc.LibPETSc.MatGetNullSpaceMethod
MatGetNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace)

retrieves the null space of a matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: developer

-seealso: , Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatSetNullSpace(), MatNullSpace

External Links

source
PETSc.LibPETSc.MatGetNullSpacesMethod
MatGetNullSpaces(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat}, nullsp::Vector{MatNullSpace})

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

-seealso: , Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), MatRestoreNullSpaces()

External Links

source
PETSc.LibPETSc.MatGetOptionMethod
flg::PetscBool = MatGetOption(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatOption, MatSetOption(), MatIsSymmetric(), MatIsHermitian(), MatIsStructurallySymmetric(), MatIsSymmetricKnown(), MatIsHermitianKnown(), MatIsStructurallySymmetricKnown()

External Links

source
PETSc.LibPETSc.MatGetOptionsPrefixMethod
MatGetOptionsPrefix(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar})

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

-seealso: , Mat, MatAppendOptionsPrefix(), MatSetOptionsPrefix(), MatAppendOptionsPrefixFactor(), MatSetOptionsPrefixFactor()

External Links

source
PETSc.LibPETSc.MatGetOrderingMethod
MatGetOrdering(petsclib::PetscLibType,mat::PetscMat, type::MatOrderingType, rperm::IS, cperm::IS)

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

-seealso: MatOrderingRegister(), PCFactorSetMatOrderingType(), MatColoring, MatColoringCreate(), MatOrderingType, Mat

External Links

source
PETSc.LibPETSc.MatGetOwnershipISMethod
MatGetOwnershipIS(petsclib::PetscLibType,A::PetscMat, rows::IS, cols::IS)

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

-seealso: , IS, Mat, MatGetOwnershipRanges(), MatSetValues(), MATELEMENTAL, MATSCALAPACK

External Links

source
PETSc.LibPETSc.MatGetOwnershipRangeMethod
m::PetscInt,n::PetscInt = MatGetOwnershipRange(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscSplitOwnership(), PetscSplitOwnershipBlock(), PetscLayout, MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetOwnershipRangeColumnMethod
m::PetscInt,n::PetscInt = MatGetOwnershipRangeColumn(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangesColumn(), PetscLayout, MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetOwnershipRangesMethod
ranges::Vector{PetscInt} = MatGetOwnershipRanges(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatGetOwnershipRange(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout, PetscSplitOwnership(), PetscSplitOwnershipBlock(), MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetOwnershipRangesColumnMethod
ranges::Vector{PetscInt} = MatGetOwnershipRangesColumn(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatGetOwnershipRange(), MatGetOwnershipRangeColumn(), MatGetOwnershipRanges(), PetscSplitOwnership(), PetscSplitOwnershipBlock(), PetscLayout, MatSetSizes(), MatCreateAIJ(), DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.MatGetRowMethod
ncols::PetscInt,cols::Vector{PetscInt},vals::Vector{PetscScalar} = MatGetRow(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatRestoreRow(), MatSetValues(), MatGetValues(), MatCreateSubMatrices(), MatGetDiagonal(), MatGetRowIJ(), MatRestoreRowIJ()

External Links

source
PETSc.LibPETSc.MatGetRowIJMethod
n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatGetRowIJ(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MATAIJ, MatGetColumnIJ(), MatRestoreRowIJ(), MatSeqAIJGetArray()

External Links

source
PETSc.LibPETSc.MatGetRowMaxMethod
MatGetRowMax(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, 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

-seealso: , Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMaxAbs(), MatGetRowMin(), MatGetRowMinAbs()

External Links

source
PETSc.LibPETSc.MatGetRowMaxAbsMethod
MatGetRowMaxAbs(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, 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

-seealso: , Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowSum(), MatGetRowMin(), MatGetRowMinAbs()

External Links

source
PETSc.LibPETSc.MatGetRowMinMethod
MatGetRowMin(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, 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

-seealso: , Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMaxAbs(), MatGetRowMinAbs(), MatGetRowMax()

External Links

source
PETSc.LibPETSc.MatGetRowMinAbsMethod
MatGetRowMinAbs(petsclib::PetscLibType,mat::PetscMat, v::PetscVec, 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

-seealso: , Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMax(), MatGetRowMaxAbs(), MatGetRowMin()

External Links

source
PETSc.LibPETSc.MatGetRowSumMethod
MatGetRowSum(petsclib::PetscLibType,mat::PetscMat, v::PetscVec)

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

-seealso: , Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMax(), MatGetRowMin(), MatGetRowMaxAbs(), MatGetRowMinAbs(), MatGetRowSumAbs()

External Links

source
PETSc.LibPETSc.MatGetRowSumAbsMethod
MatGetRowSumAbs(petsclib::PetscLibType,mat::PetscMat, v::PetscVec)

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.

-seealso: , Mat, MatGetDiagonal(), MatCreateSubMatrices(), MatCreateSubMatrix(), MatGetRowMax(), MatGetRowMin(), MatGetRowMinAbs()

External Links

source
PETSc.LibPETSc.MatGetRowUpperTriangularMethod
MatGetRowUpperTriangular(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MATSBAIJ, MatRestoreRowUpperTriangular()

External Links

source
PETSc.LibPETSc.MatGetSchurComplementMethod
MatGetSchurComplement(petsclib::PetscLibType,A::PetscMat, isrow0::IS, iscol0::IS, isrow1::IS, iscol1::IS, mreuse::MatReuse, S::PetscMat, ainvtype::MatSchurComplementAinvType, preuse::MatReuse, Sp::PetscMat)

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

-seealso: , MatCreateSubMatrix(), PCFIELDSPLIT, MatCreateSchurComplement(), MatSchurComplementAinvType

External Links

source
PETSc.LibPETSc.MatGetSeqNonzeroStructureMethod
MatGetSeqNonzeroStructure(petsclib::PetscLibType,mat::PetscMat, matstruct::PetscMat)

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

-seealso: , Mat, MatDestroySeqNonzeroStructure(), MatCreateSubMatrices(), MatDestroyMatrices()

External Links

source
PETSc.LibPETSc.MatGetSizeMethod
m::PetscInt,n::PetscInt = MatGetSize(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatSetSizes(), MatGetLocalSize()

External Links

source
PETSc.LibPETSc.MatGetStateMethod
MatGetState(petsclib::PetscLibType,A::PetscMat, state::PetscObjectState)

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

-seealso: , Mat, MatCreate(), PetscObjectStateGet(), MatGetNonzeroState()

External Links

source
PETSc.LibPETSc.MatGetTraceMethod
trace::PetscScalar = MatGetTrace(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat

External Links

source
PETSc.LibPETSc.MatGetTransposeNullSpaceMethod
MatGetTransposeNullSpace(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatNullSpace, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatSetTransposeNullSpace(), MatSetNullSpace(), MatGetNullSpace()

External Links

source
PETSc.LibPETSc.MatGetTypeMethod
type::MatType = MatGetType(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatType, MatSetType()

External Links

source
PETSc.LibPETSc.MatGetValuesMethod
MatGetValues(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatGetRow(), MatCreateSubMatrices(), MatSetValues(), MatGetOwnershipRange(), MatGetValuesLocal(), MatGetValue()

External Links

source
PETSc.LibPETSc.MatGetValuesLocalMethod
MatGetValuesLocal(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetLocalToGlobalMapping(), MatSetValuesLocal(), MatGetValues()

External Links

source
PETSc.LibPETSc.MatGetVariableBlockSizesMethod
nblocks::PetscInt,bsizes::Vector{PetscInt} = MatGetVariableBlockSizes(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes(), MatGetBlockSizes(), MatSetVariableBlockSizes(), MatComputeVariableBlockEnvelope()

External Links

source
PETSc.LibPETSc.MatGetVecTypeMethod
vtype::VecType = MatGetVecType(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatType, MatSetVecType(), VecType

External Links

source
PETSc.LibPETSc.MatHYPREGetParCSRMethod
MatHYPREGetParCSR(petsclib::PetscLibType,A::PetscMat, parcsr::hypre_ParCSRMatrix)

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

-seealso: , Mat, MATHYPRE, PetscCopyMode

External Links

source
PETSc.LibPETSc.MatHYPRESetPreallocationMethod
MatHYPRESetPreallocation(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatCreate(), MatMPIAIJSetPreallocation(), MATHYPRE, MATAIJ

External Links

source
PETSc.LibPETSc.MatHasCongruentLayoutsMethod
cong::PetscBool = MatHasCongruentLayouts(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatCreate(), MatSetSizes(), PetscLayout

External Links

source
PETSc.LibPETSc.MatHasOperationMethod
has::PetscBool = MatHasOperation(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatCreateShell(), MatGetOperation(), MatSetOperation()

External Links

source
PETSc.LibPETSc.MatHeaderMergeMethod
MatHeaderMerge(petsclib::PetscLibType,A::PetscMat, C::PetscMat)

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

-seealso: Mat, MatHeaderReplace()

External Links

source
PETSc.LibPETSc.MatHeaderReplaceMethod
MatHeaderReplace(petsclib::PetscLibType,A::PetscMat, C::PetscMat)

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

-seealso: Mat, MatHeaderMerge()

External Links

source
PETSc.LibPETSc.MatHermitianTransposeMethod
MatHermitianTranspose(petsclib::PetscLibType,mat::PetscMat, reuse::MatReuse, B::PetscMat)

Computes an in

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

-seealso: , Mat, MatTranspose(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse

External Links

source
PETSc.LibPETSc.MatHermitianTransposeGetMatMethod
MatHermitianTransposeGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat)

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

-seealso: , Mat, MATHERMITIANTRANSPOSEVIRTUAL, MatCreateHermitianTranspose()

External Links

source
PETSc.LibPETSc.MatICCFactorMethod
MatICCFactor(petsclib::PetscLibType,mat::PetscMat, row::IS, info::MatFactorInfo)

Performs in

Collective

Input Parameters:

  • mat - the matrix
  • row - row/column permutation
  • info - information on desired factorization process

Level: developer

-seealso: , Mat, MatFactorInfo, MatGetFactor(), MatICCFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatICCFactorSymbolicMethod
MatICCFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, perm::IS, info::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

-seealso: , Mat, MatGetFactor(), MatCholeskyFactorNumeric(), MatCholeskyFactor(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatILUFactorMethod
MatILUFactor(petsclib::PetscLibType,mat::PetscMat, row::IS, col::IS, info::MatFactorInfo)

Performs in

Collective

Input Parameters:

  • mat - the matrix
  • row - row permutation
  • col - column permutation
  • info - structure containing

-seealso: , Mat, Matrix Factorization, MatILUFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatILUFactorSymbolicMethod
MatILUFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatLUFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor() MatGetOrdering(), MatFactorInfo

External Links

source
PETSc.LibPETSc.MatISFixLocalEmptyMethod
MatISFixLocalEmpty(petsclib::PetscLibType,A::PetscMat, fix::PetscBool)

Compress out zero local rows from the local matrices

Logically Collective

Input Parameters:

  • A - the matrix
  • fix - the boolean flag

Level: advanced

-seealso: , Mat, MATIS, MatCreate(), MatCreateIS(), MatISSetPreallocation(), MatAssemblyEnd(), MAT_FINAL_ASSEMBLY

External Links

source
PETSc.LibPETSc.MatISGetAllowRepeatedMethod
flg::PetscBool = MatISGetAllowRepeated(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatCreate(), MatCreateIS(), MatSetLocalToGlobalMapping(), MatISSetAllowRepeated()

External Links

source
PETSc.LibPETSc.MatISGetLocalMatMethod
MatISGetLocalMat(petsclib::PetscLibType,mat::PetscMat, loc::PetscMat)

Gets the local matrix stored inside a MATIS matrix.

Not Collective.

Input Parameter:

  • mat - the matrix

Output Parameter:

  • local - the local matrix

Level: intermediate

-seealso: , Mat, MATIS, MatISRestoreLocalMat()

External Links

source
PETSc.LibPETSc.MatISGetLocalToGlobalMappingMethod
MatISGetLocalToGlobalMapping(petsclib::PetscLibType,A::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping)

Gets the local

Not Collective

Input Parameter:

  • A - the matrix

Output Parameters:

  • rmapping - row mapping
  • cmapping - column mapping

Level: advanced

-seealso: , Mat, MATIS, MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatISRestoreLocalMatMethod
MatISRestoreLocalMat(petsclib::PetscLibType,mat::PetscMat, loc::PetscMat)

Restores the local matrix obtained with MatISGetLocalMat()

Not Collective.

Input Parameters:

  • mat - the matrix
  • local - the local matrix

Level: intermediate

-seealso: , Mat, MATIS, MatISGetLocalMat()

External Links

source
PETSc.LibPETSc.MatISSetAllowRepeatedMethod
MatISSetAllowRepeated(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatCreate(), MatCreateIS(), MatSetLocalToGlobalMapping(), MatISGetAllowRepeated()

External Links

source
PETSc.LibPETSc.MatISSetLocalMatMethod
MatISSetLocalMat(petsclib::PetscLibType,mat::PetscMat, loc::PetscMat)

Replace the local matrix stored inside a MATIS object.

Not Collective

Input Parameters:

  • mat - the matrix
  • local - the local matrix

Level: intermediate

-seealso: , Mat, MATIS, MatISSetLocalMatType, MatISGetLocalMat()

External Links

source
PETSc.LibPETSc.MatISSetLocalMatTypeMethod
MatISSetLocalMatType(petsclib::PetscLibType,mat::PetscMat, mtype::MatType)

Specifies the type of local matrix inside the MATIS

Logically Collective.

Input Parameters:

  • mat - the matrix
  • mtype - the local matrix type

Level: intermediate

-seealso: , Mat, MATIS, MatSetType(), MatType

External Links

source
PETSc.LibPETSc.MatISSetPreallocationMethod
MatISSetPreallocation(petsclib::PetscLibType,B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::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

-seealso: , Mat, MatCreate(), MatCreateIS(), MatMPIAIJSetPreallocation(), MatISGetLocalMat(), MATIS

External Links

source
PETSc.LibPETSc.MatISStoreL2LMethod
MatISStoreL2L(petsclib::PetscLibType,A::PetscMat, store::PetscBool)

Store local

Logically Collective

Input Parameters:

  • A - the matrix
  • store - the boolean flag

Level: advanced

-seealso: , Mat, MatCreate(), MatCreateIS(), MatISSetPreallocation(), MatPtAP()

External Links

source
PETSc.LibPETSc.MatImaginaryPartMethod
MatImaginaryPart(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatRealPart()

External Links

source
PETSc.LibPETSc.MatIncreaseOverlapMethod
MatIncreaseOverlap(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, is::Vector{IS}, 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

-seealso: , Mat, PCASM, MatSetBlockSize(), MatIncreaseOverlapSplit(), MatCreateSubMatrices()

External Links

source
PETSc.LibPETSc.MatIncreaseOverlapSplitMethod
MatIncreaseOverlapSplit(petsclib::PetscLibType,mat::PetscMat, n::PetscInt, is::Vector{IS}, 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

-seealso: , Mat, MatCreateSubMatrices(), MatIncreaseOverlap()

External Links

source
PETSc.LibPETSc.MatInitializePackageMethod
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

-seealso: , Mat, PetscInitialize(), MatFinalizePackage()

External Links

source
PETSc.LibPETSc.MatInodeGetInodeSizesMethod
node_count::PetscInt,sizes::Vector{PetscInt},limit::PetscInt = MatInodeGetInodeSizes(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatGetInfo()

External Links

source
PETSc.LibPETSc.MatInterpolateMethod
MatInterpolate(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec)

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

-seealso: , Mat, MatMultAdd(), MatMultTransposeAdd(), MatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatInterpolateAddMethod
MatInterpolateAdd(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec, w::PetscVec)

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

-seealso: , Mat, MatMultAdd(), MatMultTransposeAdd(), MatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatInvertBlockDiagonalMethod
values::Vector{PetscScalar} = MatInvertBlockDiagonal(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatInvertVariableBlockEnvelope(), MatInvertBlockDiagonalMat()

External Links

source
PETSc.LibPETSc.MatInvertBlockDiagonalMatMethod
MatInvertBlockDiagonalMat(petsclib::PetscLibType,A::PetscMat, C::PetscMat)

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

-seealso: , Mat, MatInvertBlockDiagonal()

External Links

source
PETSc.LibPETSc.MatInvertVariableBlockDiagonalMethod
MatInvertVariableBlockDiagonal(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatInvertBlockDiagonal(), MatSetVariableBlockSizes(), MatInvertVariableBlockEnvelope()

External Links

source
PETSc.LibPETSc.MatInvertVariableBlockEnvelopeMethod
MatInvertVariableBlockEnvelope(petsclib::PetscLibType,A::PetscMat, reuse::MatReuse, C::PetscMat)

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

-seealso: , Mat, MatInvertBlockDiagonal(), MatComputeBlockDiagonal()

External Links

source
PETSc.LibPETSc.MatIsHermitianMethod
flg::PetscBool = MatIsHermitian(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatTranspose(), MatIsTranspose(), MatIsHermitianKnown(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetricKnown(), MatIsSymmetric(), MAT_HERMITIAN, MAT_SYMMETRY_ETERNAL

External Links

source
PETSc.LibPETSc.MatIsHermitianKnownMethod
set::PetscBool,flg::PetscBool = MatIsHermitianKnown(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MAT_SYMMETRY_ETERNAL, MAT_HERMITIAN, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric()

External Links

source
PETSc.LibPETSc.MatIsHermitianTransposeMethod
flg::PetscBool = MatIsHermitianTranspose(petsclib::PetscLibType,A::PetscMat, B::PetscMat, 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

-seealso: , Mat, MatTranspose(), MatIsSymmetric(), MatIsHermitian(), MatIsTranspose()

External Links

source
PETSc.LibPETSc.MatIsLinearMethod
flg::PetscBool = MatIsLinear(petsclib::PetscLibType,A::PetscMat, 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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatIsSPDKnownMethod
set::PetscBool,flg::PetscBool = MatIsSPDKnown(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MAT_SPD_ETERNAL, MAT_SPD, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric(), MatIsHermitianKnown()

External Links

source
PETSc.LibPETSc.MatIsShellMethod
flg::PetscBool = MatIsShell(petsclib::PetscLibType,mat::PetscMat)

Inquires if a matrix is derived from MATSHELL

Input Parameter:

  • mat - the matrix

Output Parameter:

  • flg - the Boolean value

Level: developer

-seealso: , Mat, MATSHELL, MATMFFD, MatCreateShell(), MATTRANSPOSEVIRTUAL, MATSCHURCOMPLEMENT

External Links

source
PETSc.LibPETSc.MatIsStructurallySymmetricMethod
flg::PetscBool = MatIsStructurallySymmetric(petsclib::PetscLibType,A::PetscMat)

Test whether a matrix is structurally symmetric

Collective

Input Parameter:

  • A - the matrix to test

Output Parameter:

  • flg - the result

Level: intermediate

-seealso: , Mat, MAT_STRUCTURALLY_SYMMETRIC, MAT_STRUCTURAL_SYMMETRY_ETERNAL, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsSymmetric(), MatSetOption(), MatIsStructurallySymmetricKnown()

External Links

source
PETSc.LibPETSc.MatIsStructurallySymmetricKnownMethod
set::PetscBool,flg::PetscBool = MatIsStructurallySymmetricKnown(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MAT_STRUCTURALLY_SYMMETRIC, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric(), MatIsHermitianKnown()

External Links

source
PETSc.LibPETSc.MatIsSymmetricMethod
flg::PetscBool = MatIsSymmetric(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetricKnown(), MAT_SYMMETRIC, MAT_SYMMETRY_ETERNAL

External Links

source
PETSc.LibPETSc.MatIsSymmetricKnownMethod
set::PetscBool,flg::PetscBool = MatIsSymmetricKnown(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MAT_SYMMETRY_ETERNAL, MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetric(), MatIsHermitianKnown()

External Links

source
PETSc.LibPETSc.MatIsTransposeMethod
flg::PetscBool = MatIsTranspose(petsclib::PetscLibType,A::PetscMat, B::PetscMat, 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

-seealso: , Mat, MatTranspose(), MatIsSymmetric(), MatIsHermitian()

External Links

source
PETSc.LibPETSc.MatKAIJGetAIJMethod
MatKAIJGetAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MatCreateKAIJ(), MATKAIJ, MATAIJ

External Links

source
PETSc.LibPETSc.MatKAIJGetSMethod
m::PetscInt,n::PetscInt,S::Vector{PetscScalar} = MatKAIJGetS(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJGetSReadMethod
m::PetscInt,n::PetscInt,S::Vector{PetscScalar} = MatKAIJGetSRead(petsclib::PetscLibType,A::PetscMat)

Get a read

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

-seealso: , Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJGetScaledIdentityMethod
identity::PetscBool = MatKAIJGetScaledIdentity(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATKAIJ, MatKAIJGetS(), MatKAIJGetT()

External Links

source
PETSc.LibPETSc.MatKAIJGetTMethod
m::PetscInt,n::PetscInt,T::Vector{PetscScalar} = MatKAIJGetT(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJGetTReadMethod
m::PetscInt,n::PetscInt,T::Vector{PetscScalar} = MatKAIJGetTRead(petsclib::PetscLibType,A::PetscMat)

Get a read

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

-seealso: , Mat, MATKAIJ, MatCreateKAIJ(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreSMethod
S::Vector{PetscScalar} = MatKAIJRestoreS(petsclib::PetscLibType,A::PetscMat)

Restore array obtained with MatKAIJGetS()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • S - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

-seealso: , Mat, MATKAIJ, MatKAIJGetS(), MatKAIJGetSRead(), MatKAIJRestoreSRead()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreSReadMethod
S::Vector{PetscScalar} = MatKAIJRestoreSRead(petsclib::PetscLibType,A::PetscMat)

Restore array obtained with MatKAIJGetSRead()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • S - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

-seealso: , Mat, MATKAIJ, MatKAIJGetS(), MatKAIJGetSRead()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreTMethod
T::Vector{PetscScalar} = MatKAIJRestoreT(petsclib::PetscLibType,A::PetscMat)

Restore array obtained with MatKAIJGetT()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • T - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

-seealso: , Mat, MATKAIJ, MatKAIJGetT(), MatKAIJGetTRead(), MatKAIJRestoreTRead()

External Links

source
PETSc.LibPETSc.MatKAIJRestoreTReadMethod
T::Vector{PetscScalar} = MatKAIJRestoreTRead(petsclib::PetscLibType,A::PetscMat)

Restore array obtained with MatKAIJGetTRead()

Not Collective

Input Parameters:

  • A - the MATKAIJ matrix
  • T - location of pointer to array obtained with MatKAIJGetS()

Level: advanced

-seealso: , Mat, MATKAIJ, MatKAIJGetT(), MatKAIJGetTRead()

External Links

source
PETSc.LibPETSc.MatKAIJSetAIJMethod
MatKAIJSetAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MATKAIJ, MatKAIJGetAIJ(), MatKAIJSetS(), MatKAIJSetT()

External Links

source
PETSc.LibPETSc.MatKAIJSetSMethod
MatKAIJSetS(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MATKAIJ, MatKAIJGetS(), MatKAIJSetT(), MatKAIJSetAIJ()

External Links

source
PETSc.LibPETSc.MatKAIJSetTMethod
MatKAIJSetT(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MATKAIJ, MatKAIJGetT(), MatKAIJSetS(), MatKAIJSetAIJ()

External Links

source
PETSc.LibPETSc.MatLMVMAllocateMethod
MatLMVMAllocate(petsclib::PetscLibType,B::PetscMat, X::PetscVec, F::PetscVec)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMReset(), MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMApplyJ0FwdMethod
MatLMVMApplyJ0Fwd(petsclib::PetscLibType,B::PetscMat, X::PetscVec, Y::PetscVec)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetJ0(), MatLMVMSetJ0Scale(), MatLMVMSetJ0ScaleDiag(), MatLMVMSetJ0PC(), MatLMVMSetJ0KSP(), MatLMVMApplyJ0Inv()

External Links

source
PETSc.LibPETSc.MatLMVMApplyJ0InvMethod
MatLMVMApplyJ0Inv(petsclib::PetscLibType,B::PetscMat, X::PetscVec, Y::PetscVec)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetJ0(), MatLMVMSetJ0Scale(), MatLMVMSetJ0ScaleDiag(), MatLMVMSetJ0PC(), MatLMVMSetJ0KSP(), MatLMVMApplyJ0Fwd()

External Links

source
PETSc.LibPETSc.MatLMVMDenseSetTypeMethod
MatLMVMDenseSetType(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , MATLMVMDQN, MATLMVMDBFGS, MATLMVMDDFP, MatLMVMDenseType

External Links

source
PETSc.LibPETSc.MatLMVMGetJ0Method
MatLMVMGetJ0(petsclib::PetscLibType,B::PetscMat, J0::PetscMat)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMGetJ0KSPMethod
MatLMVMGetJ0KSP(petsclib::PetscLibType,B::PetscMat, J0ksp::PetscKSP)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetJ0KSP()

External Links

source
PETSc.LibPETSc.MatLMVMGetJ0PCMethod
MatLMVMGetJ0PC(petsclib::PetscLibType,B::PetscMat, J0pc::PC)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetJ0PC()

External Links

source
PETSc.LibPETSc.MatLMVMGetLastUpdateMethod
MatLMVMGetLastUpdate(petsclib::PetscLibType,B::PetscMat, x_prev::PetscVec, f_prev::PetscVec)

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

-seealso: , MatLMVM, MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMGetMultAlgorithmMethod
MatLMVMGetMultAlgorithm(petsclib::PetscLibType,B::PetscMat, alg::MatLMVMMultAlgorithm)

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

-seealso: , MatLMVM, MatLMVMMultAlgorithm, MatLMVMSetMultAlgorithm()

External Links

source
PETSc.LibPETSc.MatLMVMGetRejectCountMethod
nrejects::PetscInt = MatLMVMGetRejectCount(petsclib::PetscLibType,B::PetscMat)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMReset()

External Links

source
PETSc.LibPETSc.MatLMVMGetUpdateCountMethod
nupdates::PetscInt = MatLMVMGetUpdateCount(petsclib::PetscLibType,B::PetscMat)

Returns the number of accepted updates.

Input Parameter:

  • B - A MATLMVM matrix

Output Parameter:

  • nupdates - number of accepted updates

Level: intermediate

-seealso: , LMVM Matrices, MATLMVM, MatLMVMGetRejectCount(), MatLMVMReset()

External Links

source
PETSc.LibPETSc.MatLMVMIsAllocatedMethod
flg::PetscBool = MatLMVMIsAllocated(petsclib::PetscLibType,B::PetscMat)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMAllocate(), MatLMVMReset()

External Links

source
PETSc.LibPETSc.MatLMVMResetMethod
MatLMVMReset(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMAllocate(), MatLMVMUpdate()

External Links

source
PETSc.LibPETSc.MatLMVMSetHistorySizeMethod
MatLMVMSetHistorySize(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMGetUpdateCount()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0Method
MatLMVMSetJ0(petsclib::PetscLibType,B::PetscMat, J0::PetscMat)

Allows the user to define the initial Jacobian matrix from which the LMVM up.

Input Parameters:

  • B - An LMVM-type matrix
  • J0 - The initial Jacobian matrix, will be referenced by B.

Level: advanced

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetJ0PC(), MatLMVMSetJ0KSP()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0DiagMethod
MatLMVMSetJ0Diag(petsclib::PetscLibType,B::PetscMat, V::PetscVec)

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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetScale(), MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0KSPMethod
MatLMVMSetJ0KSP(petsclib::PetscLibType,B::PetscMat, J0ksp::PetscKSP)

Allows the user to provide a pre approximation.

Input Parameters:

  • B - A MATLMVM matrix
  • J0ksp - KSP solver for the initial inverse-Jacobian application

Level: advanced

-seealso: , LMVM Matrices, MATLMVM, MatLMVMGetJ0KSP()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0PCMethod
MatLMVMSetJ0PC(petsclib::PetscLibType,B::PetscMat, J0pc::PC)

Allows the user to define a PC object that acts as the initial inverse

Input Parameters:

  • B - A MATLMVM matrix
  • J0pc - PC object where PCApply() defines an inverse application for J0

Level: advanced

-seealso: , LMVM Matrices, MATLMVM, MatLMVMGetJ0PC()

External Links

source
PETSc.LibPETSc.MatLMVMSetJ0ScaleMethod
MatLMVMSetJ0Scale(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , LMVM Matrices, MATLMVM, MatLMVMSetDiagScale(), MatLMVMSetJ0()

External Links

source
PETSc.LibPETSc.MatLMVMSetMultAlgorithmMethod
MatLMVMSetMultAlgorithm(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , MatLMVM, MatLMVMMultAlgorithm, MatLMVMGetMultAlgorithm()

External Links

source
PETSc.LibPETSc.MatLMVMSymBadBroydenGetPsiMethod
psi::PetscReal = MatLMVMSymBadBroydenGetPsi(petsclib::PetscLibType,B::PetscMat)

Get the psi parameter for a Broyden class quasi

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

-seealso: , MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBadBroydenSetPsi(), MatLMVMSymBroydenGetPhi(), MatLMVMSymBroydenSetPhi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBadBroydenSetPsiMethod
MatLMVMSymBadBroydenSetPsi(petsclib::PetscLibType,B::PetscMat, psi::PetscReal)

Get the psi parameter for a Broyden class quasi

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

-seealso: , MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBadBroydenGetPsi(), MatLMVMSymBroydenGetPhi(), MatLMVMSymBroydenSetPhi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenGetPhiMethod
phi::PetscReal = MatLMVMSymBroydenGetPhi(petsclib::PetscLibType,B::PetscMat)

Get the phi parameter for a Broyden class quasi

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

-seealso: , MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBroydenSetPhi(), MatLMVMSymBadBroydenGetPsi(), MatLMVMSymBadBroydenSetPsi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenSetDeltaMethod
MatLMVMSymBroydenSetDelta(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , MATLMVMSYMBROYDEN

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenSetPhiMethod
MatLMVMSymBroydenSetPhi(petsclib::PetscLibType,B::PetscMat, phi::PetscReal)

Get the phi parameter for a Broyden class quasi

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

-seealso: , MATLMVMSYMBROYDEN, MATLMVMSYMBADBROYDEN, MATLMVMDFP, MATLMVMBFGS, MatLMVMSymBroydenGetPhi(), MatLMVMSymBadBroydenGetPsi(), MatLMVMSymBadBroydenSetPsi()

External Links

source
PETSc.LibPETSc.MatLMVMSymBroydenSetScaleTypeMethod
MatLMVMSymBroydenSetScaleType(petsclib::PetscLibType,B::PetscMat, stype::MatLMVMSymBroydenScaleType)

Sets the scale type for symmetric Broyden

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

-seealso: , MATLMVMSYMBROYDEN, MatCreateLMVMSymBroyden(), MatLMVMSymBroydenScaleType

External Links

source
PETSc.LibPETSc.MatLMVMUpdateMethod
MatLMVMUpdate(petsclib::PetscLibType,B::PetscMat, X::PetscVec, F::PetscVec)

Adds (X

Input Parameters:

  • B - A MATLMVM matrix
  • X - Solution vector
  • F - Function vector

Level: intermediate

-seealso: , LMVM Matrices, MATLMVM, MatLMVMReset(), MatLMVMAllocate()

External Links

source
PETSc.LibPETSc.MatLRCGetMatsMethod
MatLRCGetMats(petsclib::PetscLibType,N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat)

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

-seealso: , MatLRCSetMats(), Mat, MATLRC, MatCreateLRC()

External Links

source
PETSc.LibPETSc.MatLRCSetMatsMethod
MatLRCSetMats(petsclib::PetscLibType,N::PetscMat, A::PetscMat, U::PetscMat, c::PetscVec, V::PetscMat)

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

-seealso: , MatLRCGetMats(), Mat, MATLRC, MatCreateLRC()

External Links

source
PETSc.LibPETSc.MatLUFactorMethod
MatLUFactor(petsclib::PetscLibType,mat::PetscMat, row::IS, col::IS, info::MatFactorInfo)

Performs in

Collective

Input Parameters:

  • mat - the matrix
  • row - row permutation
  • col - column permutation
  • info - options for factorization, includes

-seealso: , Matrix Factorization, Mat, MatFactorType, MatLUFactorSymbolic(), MatLUFactorNumeric(), MatCholeskyFactor(), MatGetOrdering(), MatSetUnfactored(), MatFactorInfo, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatLUFactorNumericMethod
MatLUFactorNumeric(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, info::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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatFactorInfo, MatLUFactorSymbolic(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatLUFactorSymbolicMethod
MatLUFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, row::IS, col::IS, info::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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatLUFactor(), MatLUFactorNumeric(), MatCholeskyFactor(), MatFactorInfo, MatFactorInfoInitialize()

External Links

source
PETSc.LibPETSc.MatLoadMethod
MatLoad(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, PetscViewerBinaryOpen(), PetscViewerSetType(), MatView(), VecLoad()

External Links

source
PETSc.LibPETSc.MatMAIJGetAIJMethod
MatMAIJGetAIJ(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MATMAIJ, MATAIJ, MatCreateMAIJ()

External Links

source
PETSc.LibPETSc.MatMAIJRedimensionMethod
MatMAIJRedimension(petsclib::PetscLibType,A::PetscMat, dof::PetscInt, B::PetscMat)

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

-seealso: , Mat, MATMAIJ, MatCreateMAIJ()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetLocalMatMethod
MatMPIAIJGetLocalMat(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, A_loc::PetscMat)

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

-seealso: , Mat, MATMPIAIJ, MatGetOwnershipRange(), MatMPIAIJGetLocalMatCondensed(), MatMPIAIJGetLocalMatMerge()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetLocalMatCondensedMethod
MatMPIAIJGetLocalMatCondensed(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, row::IS, col::IS, A_loc::PetscMat)

Creates a MATSEQAIJ matrix from an MATMPIAIJ matrix by taking all its local rows and NON

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

-seealso: , Mat, MATMPIAIJ, MatGetOwnershipRange(), MatMPIAIJGetLocalMat()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetLocalMatMergeMethod
MatMPIAIJGetLocalMatMerge(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, glob::IS, A_loc::PetscMat)

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

-seealso: , Mat, MATMPIAIJ, MatGetOwnershipRange(), MatMPIAIJGetLocalMat(), MatMPIAIJGetLocalMatCondensed()

External Links

source
PETSc.LibPETSc.MatMPIAIJGetSeqAIJMethod
colmap::Vector{PetscInt} = MatMPIAIJGetSeqAIJ(petsclib::PetscLibType,A::PetscMat, Ad::PetscMat, Ao::PetscMat)

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

-seealso: , Mat, MATMPIAIJ, MatMPIAIJGetLocalMat(), MatMPIAIJGetLocalMatCondensed(), MatCreateAIJ(), MATSEQAIJ

External Links

source
PETSc.LibPETSc.MatMPIAIJSetPreallocationMethod
MatMPIAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::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'.

-seealso: , Mat, Sparse Matrices, MATMPIAIJ, MATAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateAIJ(), MatMPIAIJSetPreallocationCSR(), MatGetInfo(), PetscSplitOwnership(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatMPIAIJSetPreallocationCSRMethod
MatMPIAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MATMPIAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatCreateAIJ(), MatCreateSeqAIJWithArrays(), MatCreateMPIAIJWithSplitArrays(), MatCreateMPIAIJWithArrays(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatMPIAdjCreateNonemptySubcommMatMethod
B::PetscMat = MatMPIAdjCreateNonemptySubcommMat(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATMPIADJ, MatCreateMPIAdj()

External Links

source
PETSc.LibPETSc.MatMPIAdjSetPreallocationMethod
i::PetscInt,j::PetscInt,values::PetscInt = MatMPIAdjSetPreallocation(petsclib::PetscLibType,B::PetscMat)

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

-seealso: , Mat, MatCreate(), MatCreateMPIAdj(), MatSetValues(), MATMPIADJ

External Links

source
PETSc.LibPETSc.MatMPIAdjToSeqMethod
MatMPIAdjToSeq(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MATMPIADJ, MatCreate(), MatCreateMPIAdj(), MatSetValues(), MatMPIAdjToSeqRankZero()

External Links

source
PETSc.LibPETSc.MatMPIAdjToSeqRankZeroMethod
MatMPIAdjToSeqRankZero(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MATMPIADJ, MatCreate(), MatCreateMPIAdj(), MatSetValues(), MatMPIAdjToSeq()

External Links

source
PETSc.LibPETSc.MatMPIBAIJSetHashTableFactorMethod
MatMPIBAIJSetHashTableFactor(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: Mat, MATMPIBAIJ, MatSetOption()

External Links

source
PETSc.LibPETSc.MatMPIBAIJSetPreallocationMethod
MatMPIBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, d_nz::PetscInt, d_nnz::Vector{PetscInt}, o_nz::PetscInt, o_nnz::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

-seealso: Mat, MATMPIBAIJ, MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatCreateBAIJ(), MatMPIBAIJSetPreallocationCSR(), PetscSplitOwnership()

External Links

source
PETSc.LibPETSc.MatMPIBAIJSetPreallocationCSRMethod
MatMPIBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::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

-seealso: Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MATMPIAIJ, MatCreateMPIBAIJWithArrays(), MATMPIBAIJ

External Links

source
PETSc.LibPETSc.MatMPIDenseSetPreallocationMethod
MatMPIDenseSetPreallocation(petsclib::PetscLibType,B::PetscMat, data::PetscScalar)

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

-seealso: , Mat, MATMPIDENSE, MatCreate(), MatCreateSeqDense(), MatSetValues()

External Links

source
PETSc.LibPETSc.MatMPISBAIJSetPreallocationMethod
MatMPISBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MATMPISBAIJ, MATSBAIJ, MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), PetscSplitOwnership()

External Links

source
PETSc.LibPETSc.MatMPISBAIJSetPreallocationCSRMethod
MatMPISBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MATMPISBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MATMPIAIJ, MatCreateMPISBAIJWithArrays()

External Links

source
PETSc.LibPETSc.MatMPISELLGetLocalMatCondensedMethod
MatMPISELLGetLocalMatCondensed(petsclib::PetscLibType,A::PetscMat, scall::MatReuse, row::IS, col::IS, A_loc::PetscMat)

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

-seealso: Mat, MATSEQSELL, MATMPISELL, MatGetOwnershipRange(), MatMPISELLGetLocalMat()

External Links

source
PETSc.LibPETSc.MatMPISELLGetSeqSELLMethod
colmap::Vector{PetscInt} = MatMPISELLGetSeqSELL(petsclib::PetscLibType,A::PetscMat, Ad::PetscMat, Ao::PetscMat)

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

-seealso: Mat, MATSEQSELL, MATMPISELL

External Links

source
PETSc.LibPETSc.MatMPISELLSetPreallocationMethod
MatMPISELLSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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

-seealso: Mat, MatCreate(), MatCreateSeqSELL(), MatSetValues(), MatCreateSELL(), MATMPISELL, MatGetInfo(), PetscSplitOwnership(), MATSELL

External Links

source
PETSc.LibPETSc.MatMatInterpolateMethod
MatMatInterpolate(petsclib::PetscLibType,A::PetscMat, x::PetscMat, y::PetscMat)

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

-seealso: , Mat, MatInterpolate(), MatRestrict(), MatMatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatMatInterpolateAddMethod
MatMatInterpolateAdd(petsclib::PetscLibType,A::PetscMat, x::PetscMat, w::PetscMat, y::PetscMat)

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

-seealso: , Mat, MatInterpolateAdd(), MatMatInterpolate(), MatMatRestrict(), PCMG

External Links

source
PETSc.LibPETSc.MatMatMatMultMethod
MatMatMatMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, scall::MatReuse, fill::PetscReal, D::PetscMat)

Performs matrix

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

-seealso: , Mat, MatProductCreate(), MATPRODUCT_ABC, MatMatMult, MatPtAP(), MatMatTransposeMult(), MatTransposeMatMult()

External Links

source
PETSc.LibPETSc.MatMatMultMethod
MatMatMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat)

Performs matrix

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

-seealso: , Mat, MatProductType, MATPRODUCT_AB, MatTransposeMatMult(), MatMatTransposeMult(), MatPtAP(), MatProductCreate(), MatProductSymbolic(), MatProductReplaceMats(), MatProductNumeric()

External Links

source
PETSc.LibPETSc.MatMatMultEqualMethod
flg::PetscBool = MatMatMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, 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

-seealso: Mat, MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMatRestrictMethod
MatMatRestrict(petsclib::PetscLibType,A::PetscMat, x::PetscMat, y::PetscMat)

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

-seealso: , Mat, MatRestrict(), MatInterpolate(), MatMatInterpolate(), PCMG

External Links

source
PETSc.LibPETSc.MatMatSolveMethod
MatMatSolve(petsclib::PetscLibType,A::PetscMat, B::PetscMat, X::PetscMat)

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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatSolve(), MatMatSolveTranspose(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatMatSolveTransposeMethod
MatMatSolveTranspose(petsclib::PetscLibType,A::PetscMat, B::PetscMat, X::PetscMat)

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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatSolveTranspose(), MatMatSolve(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatMatTransposeMultMethod
MatMatTransposeMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat)

Performs matrix

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

-seealso: , Mat, MatProductCreate(), MATPRODUCT_ABt, MatMatMult(), MatTransposeMatMult() MatPtAP(), MatProductAlgorithm, MatProductType

External Links

source
PETSc.LibPETSc.MatMatTransposeMultEqualMethod
flg::PetscBool = MatMatTransposeMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, 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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMatTransposeSolveMethod
MatMatTransposeSolve(petsclib::PetscLibType,A::PetscMat, Bt::PetscMat, X::PetscMat)

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

-seealso: , Mat, Matrix Factorization, MatMatSolve(), MatMatSolveTranspose(), MatLUFactor(), MatCholeskyFactor()

External Links

source
PETSc.LibPETSc.MatMeshToCellGraphMethod
MatMeshToCellGraph(petsclib::PetscLibType,mesh::PetscMat, ncommonnodes::PetscInt, dual::PetscMat)

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

-seealso: MatCreateMPIAdj(), MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatMissingDiagonalMethod
missing::PetscBool,dd::PetscInt = MatMissingDiagonal(petsclib::PetscLibType,mat::PetscMat)

Determine if sparse matrix is missing a diagonal entry (or block entry for MATBAIJ and MATSBAIJ matrices) in the nonzero structure

Not Collective

Input Parameter:

  • mat - the matrix

Output Parameters:

  • missing - is any diagonal entry missing
  • dd - first diagonal entry that is missing (optional) on this process

Level: advanced

-seealso: , Mat

External Links

source
PETSc.LibPETSc.MatMultMethod
MatMult(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec)

Computes the matrix

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: beginner

-seealso: , Mat, MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatMultAddMethod
MatMultAdd(petsclib::PetscLibType,mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec)

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

-seealso: , Mat, MatMultTranspose(), MatMult(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatMultAddEqualMethod
flg::PetscBool = MatMultAddEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMultEqual(), MatMultTransposeEqual(), MatMultTransposeAddEqual()

External Links

source
PETSc.LibPETSc.MatMultDiagonalBlockMethod
MatMultDiagonalBlock(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec)

Computes the matrix

Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: developer

-seealso: , Mat, MatMult(), MatMultTranspose(), MatMultAdd(), MatMultTransposeAdd()

External Links

source
PETSc.LibPETSc.MatMultEqualMethod
flg::PetscBool = MatMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMultAddEqual(), MatMultTransposeEqual(), MatMultTransposeAddEqual(), MatIsLinear(), MatEqual()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeMethod
MatMultHermitianTranspose(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec)

Computes matrix Hermitian

Neighbor-wise Collective

Input Parameters:

  • mat - the matrix
  • x - the vector to be multiplied

Output Parameter:

  • y - the result

Level: beginner

-seealso: , Mat, MatMult(), MatMultAdd(), MatMultHermitianTransposeAdd(), MatMultTranspose()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeAddMethod
MatMultHermitianTransposeAdd(petsclib::PetscLibType,mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec)

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

-seealso: , Mat, MatMultHermitianTranspose(), MatMultTranspose(), MatMultAdd(), MatMult()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeAddEqualMethod
flg::PetscBool = MatMultHermitianTransposeAddEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMultHermitianTransposeEqualMethod
flg::PetscBool = MatMultHermitianTransposeEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMultTransposeMethod
MatMultTranspose(petsclib::PetscLibType,mat::PetscMat, x::PetscVec, y::PetscVec)

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

-seealso: , Mat, MatMult(), MatMultAdd(), MatMultTransposeAdd(), MatMultHermitianTranspose(), MatTranspose()

External Links

source
PETSc.LibPETSc.MatMultTransposeAddMethod
MatMultTransposeAdd(petsclib::PetscLibType,mat::PetscMat, v1::PetscVec, v2::PetscVec, v3::PetscVec)

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

-seealso: , Mat, MatMultTranspose(), MatMultAdd(), MatMult()

External Links

source
PETSc.LibPETSc.MatMultTransposeAddEqualMethod
flg::PetscBool = MatMultTransposeAddEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatMultTransposeEqualMethod
flg::PetscBool = MatMultTransposeEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMultEqual(), MatMultAddEqual(), MatMultTransposeAddEqual()

External Links

source
PETSc.LibPETSc.MatMumpsGetCntlMethod
val::PetscReal = MatMumpsGetCntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt)

Get MUMPS parameter CNTL() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetIcntlMethod
ival::PetscInt = MatMumpsGetIcntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt)

Get MUMPS parameter ICNTL() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetInfoMethod
ival::PetscInt = MatMumpsGetInfo(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt)

Get MUMPS parameter INFO() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetInfogMethod
ival::PetscInt = MatMumpsGetInfog(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt)

Get MUMPS parameter INFOG() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetInverseMethod
MatMumpsGetInverse(petsclib::PetscLibType,F::PetscMat, spRHS::PetscMat)

Get user

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

-seealso: , Mat, MatGetFactor(), MatCreateTranspose()

External Links

source
PETSc.LibPETSc.MatMumpsGetInverseTransposeMethod
MatMumpsGetInverseTranspose(petsclib::PetscLibType,F::PetscMat, spRHST::PetscMat)

Get user

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

-seealso: , Mat, MatGetFactor(), MatCreateTranspose(), MatMumpsGetInverse()

External Links

source
PETSc.LibPETSc.MatMumpsGetNullPivotsMethod
size::PetscInt = MatMumpsGetNullPivots(petsclib::PetscLibType,F::PetscMat, array::PetscInt)

Get MUMPS parameter PIVNUL_LIST() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo()

External Links

source
PETSc.LibPETSc.MatMumpsGetRinfoMethod
val::PetscReal = MatMumpsGetRinfo(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt)

Get MUMPS parameter RINFO() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsGetRinfogMethod
val::PetscReal = MatMumpsGetRinfog(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt)

Get MUMPS parameter RINFOG() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo()

External Links

source
PETSc.LibPETSc.MatMumpsSetBlkMethod
MatMumpsSetBlk(petsclib::PetscLibType,F::PetscMat, nblk::PetscInt, blkvar::Vector{PetscInt}, blkptr::Vector{PetscInt})

Set user

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

-seealso: , MATSOLVERMUMPS, Mat, MatGetFactor(), MatMumpsSetIcntl(), MatSetVariableBlockSizes()

External Links

source
PETSc.LibPETSc.MatMumpsSetCntlMethod
MatMumpsSetCntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt, val::PetscReal)

Set MUMPS parameter CNTL() <https://mumps

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

-seealso: , Mat, MatGetFactor(), MatMumpsSetIcntl(), MatMumpsGetIcntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatMumpsSetIcntlMethod
MatMumpsSetIcntl(petsclib::PetscLibType,F::PetscMat, icntl::PetscInt, ival::PetscInt)

Set MUMPS parameter ICNTL() <https://mumps

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

Level: beginner

-seealso: , Mat, MatGetFactor(), MatMumpsGetIcntl(), MatMumpsSetCntl(), MatMumpsGetCntl(), MatMumpsGetInfo(), MatMumpsGetInfog(), MatMumpsGetRinfo(), MatMumpsGetRinfog()

External Links

source
PETSc.LibPETSc.MatNestGetISsMethod
MatNestGetISs(petsclib::PetscLibType,A::PetscMat, rows::Vector{IS}, cols::Vector{IS})

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

-seealso: , Mat, MATNEST, MatNestGetSubMat(), MatNestGetSubMats(), MatNestGetSize(), MatNestGetLocalISs(), MatCreateNest(), MatNestSetSubMats()

External Links

source
PETSc.LibPETSc.MatNestGetLocalISsMethod
MatNestGetLocalISs(petsclib::PetscLibType,A::PetscMat, rows::Vector{IS}, cols::Vector{IS})

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

-seealso: , Mat, MATNEST, MatNestGetSubMat(), MatNestGetSubMats(), MatNestGetSize(), MatNestGetISs(), MatCreateNest(), MatNestSetSubMats(), MatNestSetSubMat()

External Links

source
PETSc.LibPETSc.MatNestGetSizeMethod
M::PetscInt,N::PetscInt = MatNestGetSize(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATNEST, MatNestGetSubMat(), MatNestGetSubMats(), MatCreateNest(), MatNestGetLocalISs(), MatNestGetISs()

External Links

source
PETSc.LibPETSc.MatNestGetSubMatMethod
MatNestGetSubMat(petsclib::PetscLibType,A::PetscMat, idxm::PetscInt, jdxm::PetscInt, sub::PetscMat)

Returns a single, sub

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

-seealso: , Mat, MATNEST, MatNestGetSize(), MatNestGetSubMats(), MatCreateNest(), MatNestSetSubMat(), MatNestGetLocalISs(), MatNestGetISs()

External Links

source
PETSc.LibPETSc.MatNestGetSubMatsMethod
M::PetscInt,N::PetscInt = MatNestGetSubMats(petsclib::PetscLibType,A::PetscMat, mat::PetscMat)

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

-seealso: , Mat, MATNEST, MatNestGetSize(), MatNestGetSubMat(), MatNestGetLocalISs(), MatCreateNest(), MatNestSetSubMats(), MatNestGetISs(), MatNestSetSubMat()

External Links

source
PETSc.LibPETSc.MatNestSetSubMatMethod
MatNestSetSubMat(petsclib::PetscLibType,A::PetscMat, idxm::PetscInt, jdxm::PetscInt, sub::PetscMat)

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

-seealso: , Mat, MATNEST, MatNestSetSubMats(), MatNestGetSubMats(), MatNestGetLocalISs(), MatCreateNest(), MatNestGetSubMat(), MatNestGetISs(), MatNestGetSize()

External Links

source
PETSc.LibPETSc.MatNestSetSubMatsMethod
MatNestSetSubMats(petsclib::PetscLibType,A::PetscMat, nr::PetscInt, is_row::Vector{IS}, nc::PetscInt, is_col::Vector{IS}, a::Vector{PetscMat})

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 imes nc submatrices, or NULL

Level: advanced

-seealso: , Mat, MATNEST, MatCreateNest(), MatNestSetSubMat(), MatNestGetSubMat(), MatNestGetSubMats()

External Links

source
PETSc.LibPETSc.MatNestSetVecTypeMethod
MatNestSetVecType(petsclib::PetscLibType,A::PetscMat, vtype::VecType)

Sets the type of Vec returned by MatCreateVecs()

Not Collective

Input Parameters:

  • A - MATNEST matrix
  • vtype - VecType to use for creating vectors

Level: developer

-seealso: , Mat, MATNEST, MatCreateVecs(), MatCreateNest(), VecType

External Links

source
PETSc.LibPETSc.MatNormMethod
nrm::PetscReal = MatNorm(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat

External Links

source
PETSc.LibPETSc.MatNormalGetMatMethod
MatNormalGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat)

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

-seealso: , Mat, MATNORMAL, MATNORMALHERMITIAN, MatCreateNormal()

External Links

source
PETSc.LibPETSc.MatNormalHermitianGetMatMethod
MatNormalHermitianGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat)

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

-seealso: , Mat, MATNORMALHERMITIAN, MatCreateNormalHermitian()

External Links

source
PETSc.LibPETSc.MatOrderingRegisterMethod
MatOrderingRegister(petsclib::PetscLibType,sname::Vector{Cchar}, 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

-seealso: Mat, MatOrderingType, MatOrderingRegisterAll(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatPermuteMethod
MatPermute(petsclib::PetscLibType,mat::PetscMat, row::IS, col::IS, B::PetscMat)

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

-seealso: , Mat, MatGetOrdering(), ISAllGather(), MatCreateSubMatrix()

External Links

source
PETSc.LibPETSc.MatPreallocatorPreallocateMethod
MatPreallocatorPreallocate(petsclib::PetscLibType,mat::PetscMat, fill::PetscBool, A::PetscMat)

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

-seealso: MATPREALLOCATOR, MatXAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatProductClearMethod
MatProductClear(petsclib::PetscLibType,mat::PetscMat)

Clears from the matrix any internal data structures related to the computation of the values of the matrix from matrix

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

-seealso: , MatProduct, Mat, MatProductCreate()

External Links

source
PETSc.LibPETSc.MatProductCreateMethod
D::PetscMat = MatProductCreate(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat)

create a matrix to hold the result of a matrix

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: -seealso: , MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductSetAlgorithm(), MatProductClear()

External Links

source
PETSc.LibPETSc.MatProductCreateWithMatMethod
MatProductCreateWithMat(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, D::PetscMat)

Set a given matrix to have its values computed via matrix

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

-seealso: , MatProduct, Mat, MatProductType, MatProductSetType(), MatProductAlgorithm, MatProductSetAlgorithm, MatProductCreate(), MatProductClear()

External Links

source
PETSc.LibPETSc.MatProductGetAlgorithmMethod
MatProductGetAlgorithm(petsclib::PetscLibType,mat::PetscMat, alg::MatProductAlgorithm)

Returns the selected algorithm for a matrix

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

-seealso: , MatProduct, Mat, MatProductSetAlgorithm()

External Links

source
PETSc.LibPETSc.MatProductGetMatsMethod
MatProductGetMats(petsclib::PetscLibType,mat::PetscMat, A::PetscMat, B::PetscMat, C::PetscMat)

Returns the matrices associated with the 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

-seealso: , MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductSetAlgorithm(), MatProductCreate()

External Links

source
PETSc.LibPETSc.MatProductGetTypeMethod
mtype::MatProductType = MatProductGetType(petsclib::PetscLibType,mat::PetscMat)

Returns the type of 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

-seealso: , MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductCreate(), MatProductType, MatProductAlgorithm

External Links

source
PETSc.LibPETSc.MatProductNumericMethod
MatProductNumeric(petsclib::PetscLibType,mat::PetscMat)

Compute a matrix

Collective

Input/Output Parameter:

  • mat - the matrix whose values are computed via a matrix-matrix product operation

Level: intermediate

-seealso: , MatProduct, Mat, MatProductSetAlgorithm(), MatProductSetType(), MatProductCreate(), MatSetType(), MatProductSymbolic()

External Links

source
PETSc.LibPETSc.MatProductReplaceMatsMethod
MatProductReplaceMats(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, D::PetscMat)

Replace the input matrices for the 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

-seealso: , MatProduct, Mat, MatProductCreate(), MatProductSetFromOptions(), MatProductSymbolic(), MatProductClear()

External Links

source
PETSc.LibPETSc.MatProductSetAlgorithmMethod
MatProductSetAlgorithm(petsclib::PetscLibType,mat::PetscMat, alg::MatProductAlgorithm)

Requests a particular algorithm for a 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

-seealso: , MatProduct, Mat, MatProductClear(), MatProductSetType(), MatProductSetFill(), MatProductCreate(), MatProductAlgorithm, MatProductType, MatProductGetAlgorithm()

External Links

source
PETSc.LibPETSc.MatProductSetFillMethod
MatProductSetFill(petsclib::PetscLibType,mat::PetscMat, fill::PetscReal)

Set an expected fill of the matrix whose values are computed via a matrix

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

-seealso: , MatProduct, PETSC_DETERMINE, Mat, MatProductSetFromOptions(), MatProductSetType(), MatProductSetAlgorithm(), MatProductCreate()

External Links

source
PETSc.LibPETSc.MatProductSetFromOptionsMethod
MatProductSetFromOptions(petsclib::PetscLibType,mat::PetscMat)

Sets the options for the computation of a matrix 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

-seealso: , MatProduct, Mat, MatSetFromOptions(), MatProductCreate(), MatProductCreateWithMat(), MatProductNumeric(), MatProductSetType(), MatProductSetAlgorithm(), MatProductAlgorithm

External Links

source
PETSc.LibPETSc.MatProductSetTypeMethod
MatProductSetType(petsclib::PetscLibType,mat::PetscMat, productype::MatProductType)

Sets a particular 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

-seealso: , MatProduct, Mat, MatProductCreate(), MatProductType, MATPRODUCT_AB, MATPRODUCT_AtB, MATPRODUCT_ABt, MATPRODUCT_PtAP, MATPRODUCT_RARt, MATPRODUCT_ABC

External Links

source
PETSc.LibPETSc.MatProductSymbolicMethod
MatProductSymbolic(petsclib::PetscLibType,mat::PetscMat)

Perform the symbolic portion of a matrix 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

-seealso: , MatProduct, Mat, MatProductCreate(), MatProductCreateWithMat(), MatProductSetFromOptions(), MatProductNumeric(), MatProductSetType(), MatProductSetAlgorithm()

External Links

source
PETSc.LibPETSc.MatProductViewMethod
MatProductView(petsclib::PetscLibType,mat::PetscMat, viewer::PetscViewer)

View the private 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

-seealso: , MatProductType, Mat, MatProductSetFromOptions(), MatView(), MatProductCreate(), MatProductCreateWithMat()

External Links

source
PETSc.LibPETSc.MatPropagateSymmetryOptionsMethod
MatPropagateSymmetryOptions(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MatSetOption(), MatIsSymmetricKnown(), MatIsSPDKnown(), MatIsHermitianKnown(), MatIsStructurallySymmetricKnown()

External Links

source
PETSc.LibPETSc.MatPtAPMethod
MatPtAP(petsclib::PetscLibType,A::PetscMat, P::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat)

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

-seealso: , Mat, MatProductCreate(), MatMatMult(), MatRARt()

External Links

source
PETSc.LibPETSc.MatPtAPMultEqualMethod
flg::PetscBool = MatPtAPMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatPythonCreateMethod
A::PetscMat = MatPythonCreate(petsclib::PetscLibType,comm::MPI_Comm, m::PetscInt, n::PetscInt, M::PetscInt, N::PetscInt, pyname::Vector{Cchar})

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

-seealso: , Mat, MatType, MATPYTHON, MatPythonSetType(), PetscPythonInitialize()

External Links

source
PETSc.LibPETSc.MatPythonGetTypeMethod
pyname::Vector{Cchar} = MatPythonGetType(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatType, MatCreate(), MatSetType(), MATPYTHON, PetscPythonInitialize(), MatPythonSetType()

External Links

source
PETSc.LibPETSc.MatPythonSetTypeMethod
MatPythonSetType(petsclib::PetscLibType,mat::PetscMat, pyname::Vector{Cchar})

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

-seealso: , Mat, MatType, MatCreate(), MatSetType(), MATPYTHON, PetscPythonInitialize()

External Links

source
PETSc.LibPETSc.MatQRFactorMethod
MatQRFactor(petsclib::PetscLibType,mat::PetscMat, col::IS, info::MatFactorInfo)

Performs in

Collective

Input Parameters:

  • mat - the matrix
  • col - column permutation
  • info - options for factorization, includes

-seealso: , Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatQRFactorSymbolic(), MatQRFactorNumeric(), MatLUFactor(), MatSetUnfactored()

External Links

source
PETSc.LibPETSc.MatQRFactorNumericMethod
MatQRFactorNumeric(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, info::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

-seealso: , Mat, Matrix Factorization, MatFactorInfo, MatGetFactor(), MatQRFactor(), MatQRFactorSymbolic(), MatLUFactor()

External Links

source
PETSc.LibPETSc.MatQRFactorSymbolicMethod
MatQRFactorSymbolic(petsclib::PetscLibType,fact::PetscMat, mat::PetscMat, col::IS, info::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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatFactorInfo, MatQRFactor(), MatQRFactorNumeric(), MatLUFactor(), MatFactorInfoInitialize()

External Links

source
PETSc.LibPETSc.MatRARtMethod
MatRARt(petsclib::PetscLibType,A::PetscMat, R::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat)

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

-seealso: , Mat, MatProductCreate(), MatMatMult(), MatPtAP()

External Links

source
PETSc.LibPETSc.MatRARtMultEqualMethod
flg::PetscBool = MatRARtMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, n::PetscInt)

Compares matrix

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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatRealPartMethod
MatRealPart(petsclib::PetscLibType,mat::PetscMat)

Zeros out the imaginary part of the matrix

Logically Collective

Input Parameter:

  • mat - the matrix

Level: advanced

-seealso: , Mat, MatImaginaryPart()

External Links

source
PETSc.LibPETSc.MatRegisterMethod
MatRegister(petsclib::PetscLibType,sname::Vector{Cchar}, 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

-seealso: , Mat, MatType, MatSetType(), MatRegisterAll()

External Links

source
PETSc.LibPETSc.MatRegisterRootNameMethod
MatRegisterRootName(petsclib::PetscLibType,rname::Vector{Cchar}, sname::Vector{Cchar}, mname::Vector{Cchar})

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

-seealso: , Mat, MatType, PetscObjectBaseTypeCompare()

External Links

source
PETSc.LibPETSc.MatReorderForNonzeroDiagonalMethod
MatReorderForNonzeroDiagonal(petsclib::PetscLibType,mat::PetscMat, abstol::PetscReal, ris::IS, cis::IS)

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

-seealso: Mat, MatGetFactor(), MatGetOrdering()

External Links

source
PETSc.LibPETSc.MatResetHashMethod
MatResetHash(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatResetPreallocation()

External Links

source
PETSc.LibPETSc.MatResetPreallocationMethod
MatResetPreallocation(petsclib::PetscLibType,A::PetscMat)

Reset matrix to use the original preallocation values provided by the user, for example with MatXAIJSetPreallocation()

Collective

Input Parameter:

  • A - the matrix

Level: beginner

-seealso: , Mat, MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatXAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatResidualMethod
MatResidual(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec, r::PetscVec)

Default routine to calculate the residual r = b

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

-seealso: , Mat, MatMult(), MatMultAdd(), PCMGSetResidual()

External Links

source
PETSc.LibPETSc.MatRestoreColumnIJMethod
n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatRestoreColumnIJ(petsclib::PetscLibType,mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool)

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

-seealso: , Mat, MatGetColumnIJ(), MatRestoreRowIJ()

External Links

source
PETSc.LibPETSc.MatRestoreLocalSubMatrixMethod
MatRestoreLocalSubMatrix(petsclib::PetscLibType,mat::PetscMat, isrow::IS, iscol::IS, submat::PetscMat)

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

-seealso: , Mat, MatGetLocalSubMatrix()

External Links

source
PETSc.LibPETSc.MatRestoreNullSpacesMethod
MatRestoreNullSpaces(petsclib::PetscLibType,n::PetscInt, mat::Vector{PetscMat}, nullsp::Vector{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

-seealso: , Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), MatGetNullSpaces()

External Links

source
PETSc.LibPETSc.MatRestoreRowMethod
ncols::PetscInt,cols::Vector{PetscInt},vals::Vector{PetscScalar} = MatRestoreRow(petsclib::PetscLibType,mat::PetscMat, row::PetscInt)

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

-seealso: , Mat, MatGetRow()

External Links

source
PETSc.LibPETSc.MatRestoreRowIJMethod
n::PetscInt,ia::Vector{PetscInt},ja::Vector{PetscInt},done::PetscBool = MatRestoreRowIJ(petsclib::PetscLibType,mat::PetscMat, shift::PetscInt, symmetric::PetscBool, inodecompressed::PetscBool)

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

-seealso: , Mat, MatGetRowIJ(), MatRestoreColumnIJ()

External Links

source
PETSc.LibPETSc.MatRestrictMethod
MatRestrict(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec)

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

-seealso: , Mat, MatMultAdd(), MatMultTransposeAdd(), MatInterpolate(), PCMG

External Links

source
PETSc.LibPETSc.MatRetrieveValuesMethod
MatRetrieveValues(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatStoreValues()

External Links

source
PETSc.LibPETSc.MatSNESMFGetReuseBaseMethod
use::PetscBool = MatSNESMFGetReuseBase(petsclib::PetscLibType,J::PetscMat)

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

-seealso: , Mat, SNES, MatSNESMFSetReuseBase(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatSNESMFGetSNESMethod
MatSNESMFGetSNES(petsclib::PetscLibType,J::PetscMat, snes::PetscSNES)

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

-seealso: , Mat, SNES, MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatSNESMFMoreSetParametersMethod
MatSNESMFMoreSetParameters(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , SNES, MatCreateSNESMF(), MatCreateSNESMFMore()

External Links

source
PETSc.LibPETSc.MatSNESMFSetReuseBaseMethod
MatSNESMFSetReuseBase(petsclib::PetscLibType,J::PetscMat, 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

-seealso: , SNES, MATMFFD, MatMFFDSetFunction(), SNESSetFunction(), MatCreateSNESMF(), MatSNESMFGetReuseBase()

External Links

source
PETSc.LibPETSc.MatSORMethod
MatSOR(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, omega::PetscReal, flag::MatSORType, shift::PetscReal, its::PetscInt, lits::PetscInt, x::PetscVec)

Computes relaxation (SOR, Gauss

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

-seealso: , Mat, MatMult(), KSP, PC, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetColPermMethod
cperm::PetscBool = MatSTRUMPACKGetColPerm(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, , MatSTRUMPACKSetReordering(), Mat, MatGetFactor(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompAbsTolMethod
atol::PetscReal = MatSTRUMPACKGetCompAbsTol(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatGetFactor(), MatSTRUMPACKSetCompAbsTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompButterflyLevelsMethod
bfly_lvls::PetscInt = MatSTRUMPACKGetCompButterflyLevels(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetCompButterflyLevels()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompLeafSizeMethod
leaf_size::PetscInt = MatSTRUMPACKGetCompLeafSize(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatGetFactor(), MatSTRUMPACKSetCompLeafSize(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompLossyPrecisionMethod
lossy_prec::PetscInt = MatSTRUMPACKGetCompLossyPrecision(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetCompLossyPrecision()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompMinSepSizeMethod
min_sep_size::PetscInt = MatSTRUMPACKGetCompMinSepSize(petsclib::PetscLibType,F::PetscMat)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master minimum separator size for low

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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetCompMinSepSize()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompRelTolMethod
rtol::PetscReal = MatSTRUMPACKGetCompRelTol(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatGetFactor(), MatSTRUMPACKSetCompRelTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetCompressionMethod
MatSTRUMPACKGetCompression(petsclib::PetscLibType,F::PetscMat, comp::MatSTRUMPACKCompressionType)

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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKCompressionType, MatSTRUMPACKSetCompression()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetGPUMethod
gpu::PetscBool = MatSTRUMPACKGetGPU(petsclib::PetscLibType,F::PetscMat)

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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKSetGPU()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKGetReorderingMethod
MatSTRUMPACKGetReordering(petsclib::PetscLibType,F::PetscMat, reordering::MatSTRUMPACKReordering)

Get STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master fill

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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatSTRUMPACKReordering, MatGetFactor(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetColPermMethod
MatSTRUMPACKSetColPerm(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, , MatSTRUMPACKSetReordering(), Mat, MatGetFactor(), MatSTRUMPACKGetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompAbsTolMethod
MatSTRUMPACKSetCompAbsTol(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatGetFactor(), MatSTRUMPACKGetCompAbsTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompButterflyLevelsMethod
MatSTRUMPACKSetCompButterflyLevels(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetCompButterflyLevels()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompLeafSizeMethod
MatSTRUMPACKSetCompLeafSize(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatGetFactor(), MatSTRUMPACKGetCompLeafSize(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompLossyPrecisionMethod
MatSTRUMPACKSetCompLossyPrecision(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetCompLossyPrecision()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompMinSepSizeMethod
MatSTRUMPACKSetCompMinSepSize(petsclib::PetscLibType,F::PetscMat, min_sep_size::PetscInt)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master minimum separator size for low

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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetCompMinSepSize()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompRelTolMethod
MatSTRUMPACKSetCompRelTol(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatGetFactor(), MatSTRUMPACKGetCompRelTol(), MatSTRUMPACKSetReordering(), MatSTRUMPACKSetColPerm()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetCompressionMethod
MatSTRUMPACKSetCompression(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKCompressionType, MatSTRUMPACKGetCompression()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGPUMethod
MatSTRUMPACKSetGPU(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor(), MatSTRUMPACKGetGPU()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGeometricComponentsMethod
MatSTRUMPACKSetGeometricComponents(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGeometricNxyzMethod
MatSTRUMPACKSetGeometricNxyz(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetGeometricWidthMethod
MatSTRUMPACKSetGeometricWidth(petsclib::PetscLibType,F::PetscMat, 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

-seealso: MATSOLVERSTRUMPACK, MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSTRUMPACKSetReorderingMethod
MatSTRUMPACKSetReordering(petsclib::PetscLibType,F::PetscMat, reordering::MatSTRUMPACKReordering)

Set STRUMPACK https://portal.nersc.gov/project/sparse/strumpack/master fill

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

-seealso: MATSOLVERSTRUMPACK, , Mat, MatSTRUMPACKReordering, MatGetFactor(), MatSTRUMPACKSetColPerm(), MatSTRUMPACKGetReordering()

External Links

source
PETSc.LibPETSc.MatScaLAPACKGetBlockSizesMethod
mb::PetscInt,nb::PetscInt = MatScaLAPACKGetBlockSizes(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATSCALAPACK, MatCreateScaLAPACK(), MatScaLAPACKSetBlockSizes()

External Links

source
PETSc.LibPETSc.MatScaLAPACKSetBlockSizesMethod
MatScaLAPACKSetBlockSizes(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MATSCALAPACK, MatCreateScaLAPACK(), MatScaLAPACKGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatScaleMethod
MatScale(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatScatterGetVecScatterMethod
MatScatterGetVecScatter(petsclib::PetscLibType,mat::PetscMat, scatter::VecScatter)

Returns the user

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

-seealso: , Mat, MATSCATTER, MatCreateScatter(), MatScatterSetVecScatter()

External Links

source
PETSc.LibPETSc.MatScatterSetVecScatterMethod
MatScatterSetVecScatter(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MATSCATTER, MatCreateScatter()

External Links

source
PETSc.LibPETSc.MatSchurComplementComputeExplicitOperatorMethod
MatSchurComplementComputeExplicitOperator(petsclib::PetscLibType,A::PetscMat, S::PetscMat)

Compute the Schur complement matrix explicitly

Collective

Input Parameter:

  • A - the matrix obtained with MatCreateSchurComplement()

Output Parameter:

  • S - the Schur complement matrix

Level: advanced

-seealso: , MatCreateSchurComplement(), MatSchurComplementUpdateSubMatrices(), MatSchurComplementGetPmat()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetAinvTypeMethod
ainvtype::MatSchurComplementAinvType = MatSchurComplementGetAinvType(petsclib::PetscLibType,S::PetscMat)

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

-seealso: , MatSchurComplementAinvType, MatCreateSchurComplement(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementSetAinvType()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetKSPMethod
MatSchurComplementGetKSP(petsclib::PetscLibType,S::PetscMat, ksp::PetscKSP)

Gets the KSP object that is used to solve with A00 in the Schur complement matrix S = A11

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

Options Database Key:

  • -fieldsplit_<splitname_0>_XXX - sets KSP and PC options for the 0-split solver inside the Schur complement used in PCFIELDSPLIT; default <splitname_0> is 0.

Level: intermediate

-seealso: , Mat, MatSchurComplementSetKSP(), MatCreateSchurComplement(), MatCreateNormal(), MatMult(), MatCreate()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetPmatMethod
MatSchurComplementGetPmat(petsclib::PetscLibType,S::PetscMat, preuse::MatReuse, Sp::PetscMat)

Obtain a matrix for preconditioning the Schur complement by assembling Sp = A11

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

-seealso: , MatCreateSubMatrix(), PCFIELDSPLIT, MatGetSchurComplement(), MatCreateSchurComplement(), MatSchurComplementSetAinvType()

External Links

source
PETSc.LibPETSc.MatSchurComplementGetSubMatricesMethod
MatSchurComplementGetSubMatrices(petsclib::PetscLibType,S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat)

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

-seealso: , MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatCreateSchurComplement(), MatSchurComplementUpdateSubMatrices()

External Links

source
PETSc.LibPETSc.MatSchurComplementSetAinvTypeMethod
MatSchurComplementSetAinvType(petsclib::PetscLibType,S::PetscMat, 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

-seealso: , MatSchurComplementAinvType, MatCreateSchurComplement(), MatGetSchurComplement(), MatSchurComplementGetPmat(), MatSchurComplementGetAinvType()

External Links

source
PETSc.LibPETSc.MatSchurComplementSetKSPMethod
MatSchurComplementSetKSP(petsclib::PetscLibType,S::PetscMat, ksp::PetscKSP)

Sets the KSP object that is used to solve with A00 in the Schur complement matrix S = A11

Not Collective

Input Parameters:

  • S - matrix created with MatCreateSchurComplement()
  • ksp - the linear solver object

Level: developer

-seealso: , Mat, MatSchurComplementGetKSP(), MatCreateSchurComplement(), MatCreateNormal(), MatMult(), MatCreate(), MATSCHURCOMPLEMENT

External Links

source
PETSc.LibPETSc.MatSchurComplementSetSubMatricesMethod
MatSchurComplementSetSubMatrices(petsclib::PetscLibType,S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat)

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

-seealso: , Mat, MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatSchurComplementUpdateSubMatrices(), MatCreateTranspose(), MatCreateSchurComplement(), MatGetSchurComplement()

External Links

source
PETSc.LibPETSc.MatSchurComplementUpdateSubMatricesMethod
MatSchurComplementUpdateSubMatrices(petsclib::PetscLibType,S::PetscMat, A00::PetscMat, Ap00::PetscMat, A01::PetscMat, A10::PetscMat, A11::PetscMat)

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

-seealso: , Mat, MatCreateNormal(), MatMult(), MatCreate(), MatSchurComplementGetKSP(), MatCreateSchurComplement()

External Links

source
PETSc.LibPETSc.MatSelectVariableBlockSizesMethod
MatSelectVariableBlockSizes(petsclib::PetscLibType,subA::PetscMat, A::PetscMat, isrow::IS)

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

-seealso: , Mat, MatSetVariableBlockSizes(), MatComputeVariableBlockEnvelope()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetArrayMethod
array::Vector{PetscScalar} = MatSeqAIJGetArray(petsclib::PetscLibType,A::PetscMat)

gives read/write 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

-seealso: , Mat, MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetArrayReadMethod
array::Vector{PetscScalar} = MatSeqAIJGetArrayRead(petsclib::PetscLibType,A::PetscMat)

gives read

Not Collective; No Fortran Support

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MatSeqAIJGetArray(), MatSeqAIJRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetArrayWriteMethod
array::Vector{PetscScalar} = MatSeqAIJGetArrayWrite(petsclib::PetscLibType,A::PetscMat)

gives write

Not Collective; No Fortran Support

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MatSeqAIJGetArray(), MatSeqAIJRestoreArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetCSRAndMemTypeMethod
i::Vector{PetscInt},j::Vector{PetscInt},a::Vector{PetscScalar},mtype::PetscMemType = MatSeqAIJGetCSRAndMemType(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatSeqAIJGetArray(), MatSeqAIJGetArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJGetMaxRowNonzerosMethod
nz::PetscInt = MatSeqAIJGetMaxRowNonzeros(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqAIJKronMethod
MatSeqAIJKron(petsclib::PetscLibType,A::PetscMat, B::PetscMat, reuse::MatReuse, C::PetscMat)

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

-seealso: , Mat, MatCreateSeqAIJ(), MATSEQAIJ, MATKAIJ, MatReuse

External Links

source
PETSc.LibPETSc.MatSeqAIJRegisterMethod
MatSeqAIJRegister(petsclib::PetscLibType,sname::Vector{Cchar}, fnc::external)

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

-seealso: , Mat, MatSeqAIJRegisterAll()

External Links

source
PETSc.LibPETSc.MatSeqAIJRestoreArrayMethod
array::Vector{PetscScalar} = MatSeqAIJRestoreArray(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatSeqAIJGetArray()

External Links

source
PETSc.LibPETSc.MatSeqAIJRestoreArrayReadMethod
array::Vector{PetscScalar} = MatSeqAIJRestoreArrayRead(petsclib::PetscLibType,A::PetscMat)

restore the read

Not Collective; No Fortran Support

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MatSeqAIJGetArray(), MatSeqAIJGetArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJRestoreArrayWriteMethod
array::Vector{PetscScalar} = MatSeqAIJRestoreArrayWrite(petsclib::PetscLibType,A::PetscMat)

restore the read

Not Collective; No Fortran Support

Input Parameter:

  • A - a MATSEQAIJ matrix

Output Parameter:

  • array - pointer to the data

Level: intermediate

-seealso: , Mat, MatSeqAIJGetArray(), MatSeqAIJGetArrayRead()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetPreallocationMethod
MatSeqAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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
  • 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

-seealso: , Mat, MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatGetInfo(), MatSeqAIJSetTotalPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetPreallocationCSRMethod
MatSeqAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MATSEQAIJ, MatResetPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetTotalPreallocationMethod
MatSeqAIJSetTotalPreallocation(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatSetOption(), MAT_SORTED_FULL, MatSetValues(), MatSeqAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqAIJSetTypeMethod
MatSeqAIJSetType(petsclib::PetscLibType,mat::PetscMat, matype::MatType)

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

-seealso: , Mat, PCSetType(), VecSetType(), MatCreate(), MatType

External Links

source
PETSc.LibPETSc.MatSeqBAIJGetArrayMethod
array::Vector{PetscScalar} = MatSeqBAIJGetArray(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATSEQBAIJ, MatSeqBAIJRestoreArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqBAIJRestoreArrayMethod
array::Vector{PetscScalar} = MatSeqBAIJRestoreArray(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MatSeqBAIJGetArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqBAIJSetColumnIndicesMethod
indices::PetscInt = MatSeqBAIJSetColumnIndices(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MATSEQBAIJ, MatSetValues()

External Links

source
PETSc.LibPETSc.MatSeqBAIJSetPreallocationMethod
MatSeqBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, nz::PetscInt, nnz::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

-seealso: , Mat, Sparse Matrices, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateBAIJ(), MatGetInfo()

External Links

source
PETSc.LibPETSc.MatSeqBAIJSetPreallocationCSRMethod
MatSeqBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, bs::PetscInt, i::Vector{PetscInt}, j::Vector{PetscInt}, v::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

-seealso: , Mat, MatCreate(), MatCreateSeqBAIJ(), MatSetValues(), MatSeqBAIJSetPreallocation(), MATSEQBAIJ

External Links

source
PETSc.LibPETSc.MatSeqDenseSetPreallocationMethod
MatSeqDenseSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MATSEQDENSE, MatCreate(), MatCreateDense(), MatSetValues(), MatDenseSetLDA()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJGetArrayMethod
array::Vector{PetscScalar} = MatSeqSBAIJGetArray(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATSEQSBAIJ, MatSeqSBAIJRestoreArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJRestoreArrayMethod
array::Vector{PetscScalar} = MatSeqSBAIJRestoreArray(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATSEQSBAIJ, MatSeqSBAIJGetArray(), MatSeqAIJGetArray(), MatSeqAIJRestoreArray()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJSetColumnIndicesMethod
indices::PetscInt = MatSeqSBAIJSetColumnIndices(petsclib::PetscLibType,mat::PetscMat)

Set the column indices for all the rows in a MATSEQSBAIJ matrix.

Input Parameters:

  • mat - the MATSEQSBAIJ matrix
  • indices - the column indices

Level: advanced

-seealso: , Mat, MATSEQSBAIJ, MatCreateSeqSBAIJ

External Links

source
PETSc.LibPETSc.MatSeqSBAIJSetPreallocationMethod
MatSeqSBAIJSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, Sparse Matrices, MATSEQSBAIJ, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatCreateSBAIJ()

External Links

source
PETSc.LibPETSc.MatSeqSBAIJSetPreallocationCSRMethod
MatSeqSBAIJSetPreallocationCSR(petsclib::PetscLibType,B::PetscMat, 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

-seealso: , Mat, MATSEQSBAIJ, MatCreate(), MatCreateSeqSBAIJ(), MatSetValuesBlocked(), MatSeqSBAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetAvgSliceWidthMethod
slicewidth::PetscReal = MatSeqSELLGetAvgSliceWidth(petsclib::PetscLibType,A::PetscMat)

returns the average slice width.

Not Collective

Input Parameter:

  • A - a MATSEQSELL matrix

Output Parameter:

  • slicewidth - average slice width

Level: intermediate

-seealso: MATSEQSELL, MatSeqSELLGetMaxSliceWidth()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetFillRatioMethod
ratio::PetscReal = MatSeqSELLGetFillRatio(petsclib::PetscLibType,A::PetscMat)

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

-seealso: MATSEQSELL, MatSeqSELLGetAvgSliceWidth()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetMaxSliceWidthMethod
slicewidth::PetscInt = MatSeqSELLGetMaxSliceWidth(petsclib::PetscLibType,A::PetscMat)

returns the maximum slice width.

Not Collective

Input Parameter:

  • A - a MATSEQSELL matrix

Output Parameter:

  • slicewidth - maximum slice width

Level: intermediate

-seealso: MATSEQSELL, MatSeqSELLGetAvgSliceWidth()

External Links

source
PETSc.LibPETSc.MatSeqSELLGetVarSliceSizeMethod
variance::PetscReal = MatSeqSELLGetVarSliceSize(petsclib::PetscLibType,A::PetscMat)

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

-seealso: MATSEQSELL, MatSeqSELLSetSliceHeight()

External Links

source
PETSc.LibPETSc.MatSeqSELLSetPreallocationMethod
MatSeqSELLSetPreallocation(petsclib::PetscLibType,B::PetscMat, 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

-seealso: Mat, MATSEQSELL, MATSELL, MatCreate(), MatCreateSELL(), MatSetValues(), MatGetInfo()

External Links

source
PETSc.LibPETSc.MatSetBindingPropagatesMethod
MatSetBindingPropagates(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, VecSetBindingPropagates(), MatGetBindingPropagates()

External Links

source
PETSc.LibPETSc.MatSetBlockSizeMethod
MatSetBlockSize(petsclib::PetscLibType,mat::PetscMat, bs::PetscInt)

Sets the matrix block size.

Logically Collective

Input Parameters:

  • mat - the matrix
  • bs - block size

Level: intermediate

-seealso: , Mat, MATBAIJ, MATSBAIJ, MATAIJ, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatSetBlockSizesMethod
MatSetBlockSizes(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSize(), MatGetBlockSizes()

External Links

source
PETSc.LibPETSc.MatSetBlockSizesFromMatsMethod
MatSetBlockSizesFromMats(petsclib::PetscLibType,mat::PetscMat, fromRow::PetscMat, fromCol::PetscMat)

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

-seealso: , Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes()

External Links

source
PETSc.LibPETSc.MatSetDMMethod
MatSetDM(petsclib::PetscLibType,A::PetscMat, dm::PetscDM)

Sets the DM defining the data layout of the matrix

Not Collective

Input Parameters:

  • A - The Mat
  • dm - The DM

Level: developer

Note: This is rarely used in practice, rather DMCreateMatrix() is used to create a matrix associated with a particular DM

Developer Note: Since the Mat class doesn't know about the DM class the DM object is associated with the Mat through a PetscObjectCompose() operation

See also:

DM, MatGetDM(), DMCreateMatrix(), DMSetMatType()

External Links

source
PETSc.LibPETSc.MatSetErrorIfFailureMethod
MatSetErrorIfFailure(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, PCSetErrorIfFailure(), KSPConvergedReason, SNESConvergedReason

External Links

source
PETSc.LibPETSc.MatSetFactorTypeMethod
MatSetFactorType(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , 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.MatSetFromOptionsMethod
MatSetFromOptions(petsclib::PetscLibType,B::PetscMat)

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()

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

Level: beginner

-seealso: , Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert()

External Links

source
PETSc.LibPETSc.MatSetHPLMethod
MatSetHPL(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatCreate()

External Links

source
PETSc.LibPETSc.MatSetLayoutsMethod
MatSetLayouts(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, PetscLayout, MatCreateVecs(), MatGetLocalToGlobalMapping(), MatGetLayouts()

External Links

source
PETSc.LibPETSc.MatSetLocalToGlobalMappingMethod
MatSetLocalToGlobalMapping(petsclib::PetscLibType,x::PetscMat, rmapping::ISLocalToGlobalMapping, cmapping::ISLocalToGlobalMapping)

Sets a local 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

-seealso: , Mat, DM, DMCreateMatrix(), MatGetLocalToGlobalMapping(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetValuesLocal(), MatGetValuesLocal()

External Links

source
PETSc.LibPETSc.MatSetNearNullSpaceMethod
MatSetNearNullSpace(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatNullSpace, MatCreate(), MatNullSpaceCreate(), MatSetNullSpace(), MatNullSpaceCreateRigidBody(), MatGetNearNullSpace()

External Links

source
PETSc.LibPETSc.MatSetNullSpaceMethod
MatSetNullSpace(petsclib::PetscLibType,mat::PetscMat, nullsp::MatNullSpace)

attaches a null space to a matrix.

Logically Collective

Input Parameters:

  • mat - the matrix
  • nullsp - the null space object

Level: advanced

-seealso: , Mat, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), KSPSetPCSide()

External Links

source
PETSc.LibPETSc.MatSetOptionMethod
MatSetOption(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , MatOption, Mat, MatGetOption()

External Links

source
PETSc.LibPETSc.MatSetOptionsPrefixMethod
MatSetOptionsPrefix(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar})

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

-seealso: , Mat, MatSetFromOptions(), MatSetOptionsPrefixFactor()

External Links

source
PETSc.LibPETSc.MatSetOptionsPrefixFactorMethod
MatSetOptionsPrefixFactor(petsclib::PetscLibType,A::PetscMat, prefix::Vector{Cchar})

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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatSetFromOptions(), MatSetOptionsPrefix(), MatAppendOptionsPrefixFactor()

External Links

source
PETSc.LibPETSc.MatSetPreallocationCOOMethod
MatSetPreallocationCOO(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatSetValuesCOO(), MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatSeqBAIJSetPreallocation(), MatMPIBAIJSetPreallocation(), MatSeqSBAIJSetPreallocation(), MatMPISBAIJSetPreallocation(), MatSetPreallocationCOOLocal(), DMSetMatrixPreallocateSkip(), MatCreateSeqAIJFromTriple()

External Links

source
PETSc.LibPETSc.MatSetPreallocationCOOLocalMethod
MatSetPreallocationCOOLocal(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatSetValuesCOO(), MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatSeqBAIJSetPreallocation(), MatMPIBAIJSetPreallocation(), MatSeqSBAIJSetPreallocation(), MatMPISBAIJSetPreallocation(), MatSetPreallocationCOO(), DMSetMatrixPreallocateSkip()

External Links

source
PETSc.LibPETSc.MatSetRandomMethod
MatSetRandom(petsclib::PetscLibType,x::PetscMat, rctx::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: -seealso: , Mat, PetscRandom, PetscRandomCreate(), MatZeroEntries(), MatSetValues(), PetscRandomDestroy()

External Links

source
PETSc.LibPETSc.MatSetSizesMethod
MatSetSizes(petsclib::PetscLibType,A::PetscMat, m::PetscInt, n::PetscInt, M::PetscInt, 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

-seealso: , Mat, MatGetSize(), PetscSplitOwnership(), MatGetOwnershipRange(), MatGetOwnershipRanges(), MatGetOwnershipRangeColumn(), MatGetOwnershipRangesColumn(), PetscLayout, VecSetSizes()

External Links

source
PETSc.LibPETSc.MatSetStencilMethod
MatSetStencil(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatStencil, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal() MatSetValues(), MatSetValuesBlockedStencil(), MatSetValuesStencil()

External Links

source
PETSc.LibPETSc.MatSetTransposeNullSpaceMethod
MatSetTransposeNullSpace(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatNullSpace, MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove(), KSPSetPCSide()

External Links

source
PETSc.LibPETSc.MatSetTypeMethod
MatSetType(petsclib::PetscLibType,mat::PetscMat, matype::MatType)

Builds matrix object for a particular matrix type

Collective

Input Parameters:

  • mat - the matrix object
  • matype - matrix type

Options Database Key:

  • -mat_type <method> - Sets the type; see MatType

Level: intermediate

-seealso: , Mat, PCSetType(), VecSetType(), MatCreate(), MatType

External Links

source
PETSc.LibPETSc.MatSetUnfactoredMethod
MatSetUnfactored(petsclib::PetscLibType,mat::PetscMat)

Resets a factored matrix to be treated as unfactored.

Logically Collective

Input Parameter:

  • mat - the factored matrix to be reset

Level: developer

-seealso: , Mat, PCFactorSetUseInPlace(), PCFactorGetUseInPlace()

External Links

source
PETSc.LibPETSc.MatSetUpMethod
MatSetUp(petsclib::PetscLibType,A::PetscMat)

Sets up the internal matrix data structures for later use by the matrix

Collective

Input Parameter:

  • A - the matrix

Level: advanced

-seealso: , Mat, MatMult(), MatCreate(), MatDestroy(), MatXAIJSetPreallocation()

External Links

source
PETSc.LibPETSc.MatSetValuesMethod
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

-seealso: , Mat, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesBatchMethod
MatSetValuesBatch(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES, MatSetValues(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatSetValuesBlockedMethod
MatSetValuesBlocked(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatSetBlockSize(), MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetValuesBlockedLocal()

External Links

source
PETSc.LibPETSc.MatSetValuesBlockedLocalMethod
MatSetValuesBlockedLocal(petsclib::PetscLibType,mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::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
  • 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.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES to replace existing entries with new values

Level: intermediate

-seealso: , Mat, MatSetBlockSize(), MatSetLocalToGlobalMapping(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesLocal(), MatSetValuesBlocked()

External Links

source
PETSc.LibPETSc.MatSetValuesBlockedStencilMethod
MatSetValuesBlockedStencil(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, DMDA, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal() MatSetValues(), MatSetValuesStencil(), MatSetStencil(), DMCreateMatrix(), DMDAVecGetArray(), MatStencil, MatSetBlockSize(), MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatSetValuesCOOMethod
MatSetValuesCOO(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, MatSetPreallocationCOO(), MatSetPreallocationCOOLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesISMethod
MatSetValuesIS(petsclib::PetscLibType,mat::PetscMat, ism::IS, isn::IS, 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

-seealso: , Mat, MatSetOption(), MatSetValues(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesLocalMethod
MatSetValuesLocal(petsclib::PetscLibType,mat::PetscMat, nrow::PetscInt, irow::Vector{PetscInt}, ncol::PetscInt, icol::Vector{PetscInt}, y::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
  • 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.

  • addv - either ADD_VALUES to add values to any existing entries, or INSERT_VALUES to replace existing entries with new values

Level: intermediate

-seealso: , Mat, MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), MatSetLocalToGlobalMapping(), MatGetValuesLocal()

External Links

source
PETSc.LibPETSc.MatSetValuesRowMethod
MatSetValuesRow(petsclib::PetscLibType,mat::PetscMat, row::PetscInt, v::Vector{PetscScalar})

Inserts a row (block row for MATBAIJ matrices) of nonzero values into a matrix

Not Collective

Input Parameters:

  • mat - the matrix
  • row - the (block) row to set
  • v - a logically two-dimensional (column major) array of values for block matrices with blocksize larger than one, otherwise a one dimensional array of values

Level: advanced

-seealso: , Mat, MatSetValues(), MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES

External Links

source
PETSc.LibPETSc.MatSetValuesRowLocalMethod
MatSetValuesRowLocal(petsclib::PetscLibType,mat::PetscMat, row::PetscInt, v::Vector{PetscScalar})

Inserts a row (block row for MATBAIJ matrices) of nonzero values into a matrix

Not Collective

Input Parameters:

  • mat - the matrix
  • row - the (block) row to set
  • v - a one-dimensional array that contains the values. For MATBAIJ they are 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: intermediate

-seealso: , Mat, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal(), InsertMode, INSERT_VALUES, ADD_VALUES, MatSetValues(), MatSetValuesRow(), MatSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.MatSetValuesStencilMethod
MatSetValuesStencil(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, DMDA, MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValuesBlocked(), MatSetValuesLocal() MatSetValues(), MatSetValuesBlockedStencil(), MatSetStencil(), DMCreateMatrix(), DMDAVecGetArray(), MatStencil

External Links

source
PETSc.LibPETSc.MatSetVariableBlockSizesMethod
MatSetVariableBlockSizes(petsclib::PetscLibType,mat::PetscMat, nblocks::PetscInt, bsizes::Vector{PetscInt})

Sets diagonal point

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

-seealso: , Mat, MatCreateSeqBAIJ(), MatCreateBAIJ(), MatGetBlockSize(), MatSetBlockSizes(), MatGetBlockSizes(), MatGetVariableBlockSizes(), MatComputeVariableBlockEnvelope(), PCVPBJACOBI

External Links

source
PETSc.LibPETSc.MatSetVecTypeMethod
MatSetVecType(petsclib::PetscLibType,mat::PetscMat, vtype::VecType)

Set the vector type the matrix will return with MatCreateVecs()

Collective

Input Parameters:

  • mat - the matrix object
  • vtype - vector type

Level: advanced

-seealso: , Mat, VecType, VecSetType(), MatGetVecType()

External Links

source
PETSc.LibPETSc.MatShellGetContextMethod
MatShellGetContext(petsclib::PetscLibType,mat::PetscMat, ctx::Cvoid)

Returns the user

Not Collective

Input Parameter:

  • mat - the matrix, should have been created with MatCreateShell()

Output Parameter:

  • ctx - the user provided context

Level: advanced

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellSetOperation(), MatShellSetContext()

External Links

source
PETSc.LibPETSc.MatShellSetContextMethod
MatShellSetContext(petsclib::PetscLibType,mat::PetscMat, ctx::Cvoid)

sets the context for a MATSHELL shell matrix

Logically Collective

Input Parameters:

  • mat - the MATSHELL shell matrix
  • ctx - the context

Level: advanced

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation()

External Links

source
PETSc.LibPETSc.MatShellSetContextDestroyMethod
MatShellSetContextDestroy(petsclib::PetscLibType,mat::PetscMat, f::PetscCtxDestroyFn)

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

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellSetContext(), PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.MatShellSetManageScalingShiftsMethod
MatShellSetManageScalingShifts(petsclib::PetscLibType,A::PetscMat)

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

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellSetContext(), MatShellSetOperation()

External Links

source
PETSc.LibPETSc.MatShellSetMatProductOperationMethod
MatShellSetMatProductOperation(petsclib::PetscLibType,A::PetscMat, ptype::MatProductType, symbolic::external, numeric::external, destroy::external, Btype::MatType, Ctype::MatType)

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

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellSetContext(), MatSetOperation(), MatProductType, MatType, MatSetUp()

External Links

source
PETSc.LibPETSc.MatShellSetOperationMethod
MatShellSetOperation(petsclib::PetscLibType, mat::PetscMat, 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

-seealso: Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellSetContext(), MatSetOperation(), MatShellSetManageScalingShifts(), MatShellSetMatProductOperation()

External Links

source
PETSc.LibPETSc.MatShellSetVecTypeMethod
MatShellSetVecType(petsclib::PetscLibType,mat::PetscMat, vtype::VecType)

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

-seealso: , Mat, MATSHELL, MatCreateVecs()

External Links

source
PETSc.LibPETSc.MatShellTestMultMethod
flg::PetscBool = MatShellTestMult(petsclib::PetscLibType,mat::PetscMat, f::external, base::PetscVec, ctx::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

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellTestMultTranspose()

External Links

source
PETSc.LibPETSc.MatShellTestMultTransposeMethod
flg::PetscBool = MatShellTestMultTranspose(petsclib::PetscLibType,mat::PetscMat, f::external, base::PetscVec, ctx::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

-seealso: , Mat, MATSHELL, MatCreateShell(), MatShellGetContext(), MatShellGetOperation(), MatShellTestMult()

External Links

source
PETSc.LibPETSc.MatShiftMethod
MatShift(petsclib::PetscLibType,Y::PetscMat, 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

-seealso: , Mat, MatDiagonalSet(), MatScale(), MatDiagonalScale()

External Links

source
PETSc.LibPETSc.MatSolveMethod
MatSolve(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec)

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

-seealso: , Mat, Matrix Factorization, MatGetFactor(), MatLUFactor(), MatSolveAdd(), MatSolveTranspose(), MatSolveTransposeAdd()

External Links

source
PETSc.LibPETSc.MatSolveAddMethod
MatSolveAdd(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec)

Computes x = y + A^{

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

-seealso: , Mat, Matrix Factorization, MatSolve(), MatGetFactor(), MatSolveTranspose(), MatSolveTransposeAdd()

External Links

source
PETSc.LibPETSc.MatSolveTransposeMethod
MatSolveTranspose(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, x::PetscVec)

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

-seealso: , Mat, MatGetFactor(), KSP, MatSolve(), MatSolveAdd(), MatSolveTransposeAdd()

External Links

source
PETSc.LibPETSc.MatSolveTransposeAddMethod
MatSolveTransposeAdd(petsclib::PetscLibType,mat::PetscMat, b::PetscVec, y::PetscVec, x::PetscVec)

Computes x = y + 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

-seealso: , Mat, MatGetFactor(), MatSolve(), MatSolveAdd(), MatSolveTranspose()

External Links

source
PETSc.LibPETSc.MatSolverTypeRegisterMethod
MatSolverTypeRegister(petsclib::PetscLibType,package::MatSolverType, mtype::MatType, 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

-seealso: , Mat, Matrix Factorization, MatFactorGetSolverType(), MatCopy(), MatDuplicate(), MatGetFactorAvailable(), MatGetFactor()

External Links

source
PETSc.LibPETSc.MatSolvesMethod
MatSolves(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, Vecs, MatSolveAdd(), MatSolveTranspose(), MatSolveTransposeAdd(), MatSolve()

External Links

source
PETSc.LibPETSc.MatStashGetInfoMethod
nstash::PetscInt,reallocs::PetscInt,bnstash::PetscInt,breallocs::PetscInt = MatStashGetInfo(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , MatAssemblyBegin(), MatAssemblyEnd(), Mat, MatStashSetInitialSize()

External Links

source
PETSc.LibPETSc.MatStashSetInitialSizeMethod
MatStashSetInitialSize(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , MatAssemblyBegin(), MatAssemblyEnd(), Mat, MatStashGetInfo()

External Links

source
PETSc.LibPETSc.MatStoreValuesMethod
MatStoreValues(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatRetrieveValues()

External Links

source
PETSc.LibPETSc.MatSubMatrixVirtualUpdateMethod
MatSubMatrixVirtualUpdate(petsclib::PetscLibType,N::PetscMat, A::PetscMat, isrow::IS, iscol::IS)

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

-seealso: , Mat, MATSUBMATRIX, MatCreateSubMatrixVirtual()

External Links

source
PETSc.LibPETSc.MatSubdomainsCreateCoalesceMethod
n::PetscInt,iss::Vector{IS} = MatSubdomainsCreateCoalesce(petsclib::PetscLibType,A::PetscMat, 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

-seealso: , Mat, IS

External Links

source
PETSc.LibPETSc.MatSuperluSetILUDropTolMethod
MatSuperluSetILUDropTol(petsclib::PetscLibType,F::PetscMat, 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

-seealso: , Mat, MatGetFactor(), MATSOLVERSUPERLU

External Links

source
PETSc.LibPETSc.MatTransColoringApplyDenToSpMethod
MatTransColoringApplyDenToSp(petsclib::PetscLibType,matcoloring::MatTransposeColoring, Cden::PetscMat, Csp::PetscMat)

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

-seealso: , Mat, MatTransposeColoringCreate(), MatTransposeColoringDestroy(), MatTransColoringApplySpToDen()

External Links

source
PETSc.LibPETSc.MatTransColoringApplySpToDenMethod
MatTransColoringApplySpToDen(petsclib::PetscLibType,coloring::MatTransposeColoring, B::PetscMat, Btdense::PetscMat)

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

-seealso: , Mat, MatTransposeColoringCreate(), MatTransposeColoringDestroy(), MatTransColoringApplyDenToSp()

External Links

source
PETSc.LibPETSc.MatTransposeMethod
MatTranspose(petsclib::PetscLibType,mat::PetscMat, reuse::MatReuse, B::PetscMat)

Computes the transpose of a matrix, either in

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

-seealso: , Mat, MatTransposeSetPrecursor(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX, MatTransposeSymbolic(), MatCreateTranspose()

External Links

source
PETSc.LibPETSc.MatTransposeGetMatMethod
MatTransposeGetMat(petsclib::PetscLibType,A::PetscMat, M::PetscMat)

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

-seealso: , Mat, MATTRANSPOSEVIRTUAL, MatCreateTranspose()

External Links

source
PETSc.LibPETSc.MatTransposeMatMultMethod
MatTransposeMatMult(petsclib::PetscLibType,A::PetscMat, B::PetscMat, scall::MatReuse, fill::PetscReal, C::PetscMat)

Performs matrix

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

-seealso: , Mat, MatProductCreate(), MATPRODUCT_AtB, MatMatMult(), MatMatTransposeMult(), MatPtAP()

External Links

source
PETSc.LibPETSc.MatTransposeMatMultEqualMethod
flg::PetscBool = MatTransposeMatMultEqual(petsclib::PetscLibType,A::PetscMat, B::PetscMat, C::PetscMat, 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

-seealso: Mat, MatMatMultEqual(), MatMultEqual(), MatMultAddEqual(), MatMultTransposeEqual()

External Links

source
PETSc.LibPETSc.MatTransposeSetPrecursorMethod
MatTransposeSetPrecursor(petsclib::PetscLibType,mat::PetscMat, B::PetscMat)

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

-seealso: , Mat, MatTransposeSymbolic(), MatTranspose(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX

External Links

source
PETSc.LibPETSc.MatTransposeSymbolicMethod
MatTransposeSymbolic(petsclib::PetscLibType,A::PetscMat, B::PetscMat)

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

-seealso: , Mat, MatTransposeSetPrecursor(), MatTranspose(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX

External Links

source
PETSc.LibPETSc.MatUpdateMPIAIJWithArrayMethod
MatUpdateMPIAIJWithArray(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), MATMPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays(), MatUpdateMPIAIJWithArrays(), MatSetPreallocationCOO(), MatSetValuesCOO()

External Links

source
PETSc.LibPETSc.MatUpdateMPIAIJWithArraysMethod
MatUpdateMPIAIJWithArrays(petsclib::PetscLibType,mat::PetscMat, m::PetscInt, n::PetscInt, M::PetscInt, 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

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

External Links

source
PETSc.LibPETSc.MatViewMethod
MatView(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, PetscViewerPushFormat(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewer, PetscViewerSocketOpen(), PetscViewerBinaryOpen(), MatLoad(), MatViewFromOptions()

External Links

source
PETSc.LibPETSc.MatViewFromOptionsMethod
MatViewFromOptions(petsclib::PetscLibType,A::PetscMat, obj::PetscObject, name::Vector{Cchar})

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:

  • -mat_view [viewertype]:... - the viewer and its options

Level: intermediate

-seealso: , Mat, MatView(), PetscObjectViewFromOptions(), MatCreate()

External Links

source
PETSc.LibPETSc.MatXAIJSetPreallocationMethod
MatXAIJSetPreallocation(petsclib::PetscLibType,A::PetscMat, bs::PetscInt, dnnz::Vector{PetscInt}, onnz::Vector{PetscInt}, dnnzu::Vector{PetscInt}, onnzu::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

-seealso: , Mat, MatSeqAIJSetPreallocation(), MatMPIAIJSetPreallocation(), MatSeqBAIJSetPreallocation(), MatMPIBAIJSetPreallocation(), MatSeqSBAIJSetPreallocation(), MatMPISBAIJSetPreallocation(), PetscSplitOwnership()

External Links

source
PETSc.LibPETSc.MatZeroEntriesMethod
MatZeroEntries(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MatZeroRows(), MatZeroRowsColumns()

External Links

source
PETSc.LibPETSc.MatZeroRowsMethod
MatZeroRows(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil(), PCREDISTRIBUTE, MAT_KEEP_NONZERO_PATTERN

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsMethod
MatZeroRowsColumns(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRows(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsISMethod
MatZeroRowsColumnsIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRows(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsLocalMethod
MatZeroRowsColumnsLocal(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRows(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsLocalISMethod
MatZeroRowsColumnsLocalIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRows(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsColumnsStencilMethod
MatZeroRowsColumnsStencil(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRows()

External Links

source
PETSc.LibPETSc.MatZeroRowsISMethod
MatZeroRowsIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRows(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil(), IS

External Links

source
PETSc.LibPETSc.MatZeroRowsLocalMethod
MatZeroRowsLocal(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{PetscInt}, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRows(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsLocalISMethod
MatZeroRowsLocalIS(petsclib::PetscLibType,mat::PetscMat, is::IS, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRows(), MatZeroRowsStencil(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatZeroRowsStencilMethod
MatZeroRowsStencil(petsclib::PetscLibType,mat::PetscMat, numRows::PetscInt, rows::Vector{MatStencil}, diag::PetscScalar, x::PetscVec, b::PetscVec)

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

-seealso: , Mat, MatStencil, MatZeroRowsIS(), MatZeroRowsColumns(), MatZeroRowsLocalIS(), MatZeroRows(), MatZeroEntries(), MatZeroRowsLocal(), MatSetOption(), MatZeroRowsColumnsLocal(), MatZeroRowsColumnsLocalIS(), MatZeroRowsColumnsIS(), MatZeroRowsColumnsStencil()

External Links

source
PETSc.LibPETSc.MatCoarsenApplyMethod
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

-seealso: MatCoarsen, MatCoarsenSetFromOptions(), MatCoarsenSetType(), MatCoarsenRegister(), MatCoarsenCreate(), MatCoarsenDestroy(), MatCoarsenSetAdjacency() MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenCreateMethod
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

-seealso: MatCoarsen, MatCoarsenSetType(), MatCoarsenApply(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenGetDataMethod
MatCoarsenGetData(petsclib::PetscLibType,coarser::MatCoarsen, llist::PetscCoarsenData)

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

-seealso: MatCoarsen, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType(), PetscCoarsenData

External Links

source
PETSc.LibPETSc.MatCoarsenGetTypeMethod
type::MatCoarsenType = 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

-seealso: MatCoarsen, MatCoarsenCreate(), MatCoarsenType, MatCoarsenSetType(), MatCoarsenRegister()

External Links

source
PETSc.LibPETSc.MatCoarsenMISKGetDistanceMethod
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

-seealso: MATCOARSENMISK, MatCoarsen, MatCoarsenSetFromOptions(), MatCoarsenSetType(), MatCoarsenRegister(), MatCoarsenCreate(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenMISKSetDistanceMethod
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

-seealso: MATCOARSENMISK, MatCoarsen, MatCoarsenSetFromOptions(), MatCoarsenSetType(), MatCoarsenRegister(), MatCoarsenCreate(), MatCoarsenDestroy(), MatCoarsenSetAdjacency(), MatCoarsenMISKGetDistance() MatCoarsenGetData()

External Links

source
PETSc.LibPETSc.MatCoarsenRegisterMethod
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

-seealso: MatCoarsen, MatCoarsenType, MatCoarsenSetType(), MatCoarsenCreate(), MatCoarsenRegisterDestroy(), MatCoarsenRegisterAll()

External Links

source
PETSc.LibPETSc.MatCoarsenSetAdjacencyMethod
MatCoarsenSetAdjacency(petsclib::PetscLibType,agg::MatCoarsen, adj::PetscMat)

Sets the adjacency graph (matrix) of the thing to be coarsened.

Collective

Input Parameters:

  • agg - the coarsen context
  • adj - the adjacency matrix

Level: advanced

-seealso: MatCoarsen, MatCoarsenSetFromOptions(), Mat, MatCoarsenCreate(), MatCoarsenApply()

External Links

source
PETSc.LibPETSc.MatCoarsenSetFromOptionsMethod
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 <type> - mis: maximal independent set based; misk: distance k MIS; hem: heavy edge matching
  • -mat_coarsen_max_it <its> number of iterations to use in the coarsening process - see MatCoarsenSetMaximumIterations()

Level: advanced

-seealso: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType(), MatCoarsenSetMaximumIterations()

External Links

source
PETSc.LibPETSc.MatCoarsenSetGreedyOrderingMethod
MatCoarsenSetGreedyOrdering(petsclib::PetscLibType,coarser::MatCoarsen, perm::IS)

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

-seealso: MatCoarsen, MatCoarsenType, MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetMaximumIterationsMethod
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 <default=4> - Maximum MATCOARSENHEM iterations to use

Level: intermediate

-seealso: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetStrengthIndexMethod
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

-seealso: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetStrictAggsMethod
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

-seealso: MatCoarsen, MatCoarsenCreate(), MatCoarsenSetFromOptions()

External Links

source
PETSc.LibPETSc.MatCoarsenSetThresholdMethod
MatCoarsenSetThreshold(petsclib::PetscLibType,coarse::MatCoarsen, b::PetscReal)

Set the threshold for HEM

Logically Collective

Input Parameters:

  • coarse - the coarsen context
  • b - threshold value

Options Database Key:

  • -mat_coarsen_threshold <-1> - threshold

Level: intermediate

-seealso: MatCoarsen, MatCoarsenType, MatCoarsenApply(), MatCoarsenCreate(), MatCoarsenSetType()

External Links

source
PETSc.LibPETSc.MatCoarsenSetTypeMethod
MatCoarsenSetType(petsclib::PetscLibType,coarser::MatCoarsen, type::MatCoarsenType)

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

-seealso: MatCoarsen, MatCoarsenCreate(), MatCoarsenApply(), MatCoarsenType, MatCoarsenGetType()

External Links

source
PETSc.LibPETSc.MatCoarsenViewMethod
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

-seealso: MatCoarsen, PetscViewer, PetscViewerASCIIOpen(), MatCoarsenViewFromOptions

External Links

source
PETSc.LibPETSc.MatCoarsenViewFromOptionsMethod
MatCoarsenViewFromOptions(petsclib::PetscLibType,A::MatCoarsen, obj::PetscObject, 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:

  • -mat_coarsen_view [viewertype]:... - the viewer and its options

-seealso: MatCoarsen, MatCoarsenView, PetscObjectViewFromOptions(), MatCoarsenCreate()

External Links

source
PETSc.LibPETSc.MatColoringApplyMethod
MatColoringApply(petsclib::PetscLibType,mc::MatColoring, coloring::ISColoring)

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

-seealso: ISColoring, MatColoring, MatColoringCreate()

External Links

source
PETSc.LibPETSc.MatColoringCreateMethod
mcptr::MatColoring = MatColoringCreate(petsclib::PetscLibType,m::PetscMat)

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

-seealso: MatColoringSetFromOptions(), MatColoring, MatColoringApply(), MatFDColoringCreate(), DMCreateColoring(), MatColoringType

External Links

source
PETSc.LibPETSc.MatColoringDestroyMethod
MatColoringDestroy(petsclib::PetscLibType,mc::MatColoring)

Destroys the matrix coloring context

Collective

Input Parameter:

  • mc - the MatColoring context

Level: beginner

-seealso: MatColoring, MatColoringCreate(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringGetDistanceMethod
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

-seealso: MatColoring, MatColoringSetDistance(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringGetMaxColorsMethod
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

-seealso: MatColoring, MatColoringSetMaxColors(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringPatchMethod
MatColoringPatch(petsclib::PetscLibType,mat::PetscMat, ncolors::PetscInt, n::PetscInt, colorarray::Vector{ISColoringValue}, iscoloring::ISColoring)

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

-seealso: , Mat, MatGetRowIJ(), MatGetColumnIJ()

External Links

source
PETSc.LibPETSc.MatColoringRegisterMethod
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

-seealso: MatColoringType, MatColoringRegisterDestroy(), MatColoringRegisterAll()

External Links

source
PETSc.LibPETSc.MatColoringSetDistanceMethod
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

-seealso: MatColoring, MatColoringSetFromOptions(), MatColoringGetDistance(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetFromOptionsMethod
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

-seealso: MatColoring, MatColoringApply(), MatColoringSetDistance(), MatColoringSetType(), SNESComputeJacobianDefaultColor(), MatColoringType

External Links

source
PETSc.LibPETSc.MatColoringSetMaxColorsMethod
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

-seealso: MatColoring, MatColoringGetMaxColors(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetTypeMethod
MatColoringSetType(petsclib::PetscLibType,mc::MatColoring, type::MatColoringType)

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

-seealso: MatColoring, MatColoringSetFromOptions(), MatColoringType, MatColoringCreate(), MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringSetWeightTypeMethod
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

-seealso: MatColoring, MatColoringWeightType, MatColoringApply()

External Links

source
PETSc.LibPETSc.MatColoringViewMethod
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

-seealso: PetscViewer, MatColoring, MatColoringApply()

External Links

source
PETSc.LibPETSc.MatFDColoringApplyMethod
MatFDColoringApply(petsclib::PetscLibType,J::PetscMat, coloring::MatFDColoring, x1::PetscVec, sctx::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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringDestroy(), MatFDColoringView(), MatFDColoringSetFunction(), MatFDColoringSetValues()

External Links

source
PETSc.LibPETSc.MatFDColoringCreateMethod
color::MatFDColoring = MatFDColoringCreate(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: Mat, MatFDColoring, MatFDColoringDestroy(), SNESComputeJacobianDefaultColor(), ISColoringCreate(), MatFDColoringSetFunction(), MatFDColoringSetFromOptions(), MatFDColoringApply(), MatFDColoringView(), MatFDColoringSetParameters(), MatColoringCreate(), DMCreateColoring(), MatFDColoringSetValues()

External Links

source
PETSc.LibPETSc.MatFDColoringDestroyMethod
MatFDColoringDestroy(petsclib::PetscLibType,c::MatFDColoring)

Destroys a matrix coloring context that was created via MatFDColoringCreate().

Collective

Input Parameter:

  • c - coloring context

Level: intermediate

-seealso: Mat, MatFDColoring, MatFDColoringCreate()

External Links

source
PETSc.LibPETSc.MatFDColoringGetFunctionMethod
MatFDColoringGetFunction(petsclib::PetscLibType,matfd::MatFDColoring, f::MatFDColoringFn, fctx::Cvoid)

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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringSetFunction(), MatFDColoringSetFromOptions(), MatFDColoringFn

External Links

source
PETSc.LibPETSc.MatFDColoringGetPerturbedColumnsMethod
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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringDestroy(), MatFDColoringView(), MatFDColoringApply()

External Links

source
PETSc.LibPETSc.MatFDColoringSetBlockSizeMethod
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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringSetFromOptions()

External Links

source
PETSc.LibPETSc.MatFDColoringSetFromOptionsMethod
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 -seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringView(), MatFDColoringSetParameters()

External Links

source
PETSc.LibPETSc.MatFDColoringSetFunctionMethod
MatFDColoringSetFunction(petsclib::PetscLibType,matfd::MatFDColoring, f::MatFDColoringFn, fctx::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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringGetFunction(), MatFDColoringSetFromOptions(), MatFDColoringFn

External Links

source
PETSc.LibPETSc.MatFDColoringSetParametersMethod
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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringSetFromOptions()

External Links

source
PETSc.LibPETSc.MatFDColoringSetTypeMethod
MatFDColoringSetType(petsclib::PetscLibType,matfd::MatFDColoring, type::MatMFFDType)

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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringView(), MatFDColoringSetParameters()

External Links

source
PETSc.LibPETSc.MatFDColoringSetUpMethod
MatFDColoringSetUp(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: Mat, MatFDColoring, MatFDColoringCreate(), MatFDColoringDestroy()

External Links

source
PETSc.LibPETSc.MatFDColoringSetValuesMethod
MatFDColoringSetValues(petsclib::PetscLibType,J::PetscMat, 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

-seealso: , Mat, MatFDColoringCreate(), ISColoring, ISColoringCreate(), ISColoringSetType(), IS_COLORING_LOCAL, MatFDColoringSetBlockSize()

External Links

source
PETSc.LibPETSc.MatFDColoringUseDMMethod
MatFDColoringUseDM(petsclib::PetscLibType,coloring::PetscMat, 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

Developer Note: This routine exists because the PETSc Mat library does not know about the DM objects

See also:

DM, MatFDColoring, MatFDColoringCreate(), ISColoringType

External Links

source
PETSc.LibPETSc.MatFDColoringViewMethod
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

-seealso: Mat, MatFDColoring, MatFDColoringCreate()

External Links

source
PETSc.LibPETSc.MatMFFDCheckPositivityMethod
MatMFFDCheckPositivity(petsclib::PetscLibType,dummy::Cvoid, U::PetscVec, a::PetscVec, h::PetscScalar)

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 <bool> - Ensure that U + h*a is nonnegative

Level: advanced

-seealso: , Mat, MATMFFD, MatMFFDSetCheckh()

External Links

source
PETSc.LibPETSc.MatMFFDComputeJacobianMethod
MatMFFDComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, jac::PetscMat, B::PetscMat, dummy::Cvoid)

Tells the matrix 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 user 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

-seealso: , MatMFFDGetH(), MatCreateSNESMF(), MatMFFDSetBase(), MatCreateMFFD(), MATMFFD, MatMFFDSetHHistory(), MatMFFDSetFunctionError(), SNESSetJacobian()

External Links

source
PETSc.LibPETSc.MatMFFDDSSetUminMethod
MatMFFDDSSetUmin(petsclib::PetscLibType,A::PetscMat, 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

-seealso: MATMFFD, MatMFFDSetFunctionError(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatMFFDGetHMethod
h::PetscScalar = MatMFFDGetH(petsclib::PetscLibType,mat::PetscMat)

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

-seealso: , Mat, MATMFFD, MatCreateSNESMF(), MatMFFDSetHHistory(), MatCreateMFFD(), MatMFFDResetHHistory()

External Links

source
PETSc.LibPETSc.MatMFFDRegisterMethod
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

-seealso: , Mat, MATMFFD, MatMFFDRegisterAll(), MatMFFDRegisterDestroy()

External Links

source
PETSc.LibPETSc.MatMFFDResetHHistoryMethod
MatMFFDResetHHistory(petsclib::PetscLibType,J::PetscMat)

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

-seealso: , Mat, MATMFFD, MatMFFDGetH(), MatCreateSNESMF(), MatMFFDSetHHistory(), MatMFFDSetFunctionError()

External Links

source
PETSc.LibPETSc.MatMFFDSetBaseMethod
MatMFFDSetBase(petsclib::PetscLibType,J::PetscMat, U::PetscVec, F::PetscVec)

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

-seealso: , Mat, MATMFFD, MatMult()

External Links

source
PETSc.LibPETSc.MatMFFDSetCheckhMethod
MatMFFDSetCheckh(petsclib::PetscLibType,J::PetscMat, fun::MatMFFDCheckhFn, ctx::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 <bool> - Ensure that U + h*a is non-negative

Level: advanced

-seealso: , Mat, MATMFFD, MatMFFDCheckhFn, MatMFFDCheckPositivity()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctionMethod
MatMFFDSetFunction(petsclib::PetscLibType,mat::PetscMat, func::MatMFFDFn, funcctx::Cvoid)

Sets the function used in applying the 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

-seealso: , Mat, MATMFFD, MatMFFDFn, MatCreateSNESMF(), MatMFFDGetH(), MatCreateMFFD(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESSetFunction()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctionErrorMethod
MatMFFDSetFunctionError(petsclib::PetscLibType,mat::PetscMat, error::PetscReal)

Sets the error_rel for the approximation of 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

-seealso: , Mat, MATMFFD, MatCreateSNESMF(), MatMFFDGetH(), MatCreateMFFD(), MatMFFDSetHHistory(), MatMFFDResetHHistory()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctioniMethod
MatMFFDSetFunctioni(petsclib::PetscLibType,mat::PetscMat, funci::MatMFFDiFn)

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

-seealso: , Mat, MATMFFD, MatMFFDiFn, MatCreateSNESMF(), MatMFFDGetH(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESSetFunction(), MatGetDiagonal()

External Links

source
PETSc.LibPETSc.MatMFFDSetFunctioniBaseMethod
MatMFFDSetFunctioniBase(petsclib::PetscLibType,mat::PetscMat, func::MatMFFDiBaseFn)

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

-seealso: , Mat, MATMFFD, MatCreateSNESMF(), MatMFFDGetH(), MatCreateMFFD(), MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESSetFunction(), MatGetDiagonal()

External Links

source
PETSc.LibPETSc.MatMFFDSetHHistoryMethod
MatMFFDSetHHistory(petsclib::PetscLibType,J::PetscMat, 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

-seealso: , Mat, MATMFFD, MatMFFDGetH(), MatCreateSNESMF(), MatMFFDResetHHistory(), MatMFFDSetFunctionError()

External Links

source
PETSc.LibPETSc.MatMFFDSetOptionsPrefixMethod
MatMFFDSetOptionsPrefix(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MATMFFD, MatSetFromOptions(), MatCreateSNESMF(), MatCreateMFFD()

External Links

source
PETSc.LibPETSc.MatMFFDSetPeriodMethod
MatMFFDSetPeriod(petsclib::PetscLibType,mat::PetscMat, period::PetscInt)

Sets how often the step

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

-seealso: , Mat, MATMFFD, MatCreateSNESMF(), MatMFFDGetH(), MatMFFDSetHHistory(), MatMFFDResetHHistory()

External Links

source
PETSc.LibPETSc.MatMFFDSetTypeMethod
MatMFFDSetType(petsclib::PetscLibType,mat::PetscMat, ftype::MatMFFDType)

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

-seealso: , Mat, MATMFFD, MATMFFD_WP, MATMFFD_DS, MatCreateSNESMF(), MatMFFDRegister(), MatMFFDSetFunction(), MatCreateMFFD()

External Links

source
PETSc.LibPETSc.MatMFFDWPSetComputeNormUMethod
MatMFFDWPSetComputeNormU(petsclib::PetscLibType,A::PetscMat, flag::PetscBool)

Sets whether it computes the ||U|| used by the Walker 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

-seealso: MATMFFD_WP, MATMFFD, MatMFFDSetFunctionError(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.MatNullSpaceCreateMethod
SP::MatNullSpace = MatNullSpaceCreate(petsclib::PetscLibType,comm::MPI_Comm, has_cnst::PetscBool, n::PetscInt, vecs::Vector{PetscVec})

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

-seealso: , Mat, MatNullSpace, MatNullSpaceDestroy(), MatNullSpaceRemove(), MatSetNullSpace(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceCreateRigidBodyMethod
sp::MatNullSpace = MatNullSpaceCreateRigidBody(petsclib::PetscLibType,coords::PetscVec)

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

-seealso: , Mat, MatNullSpace, MatNullSpaceCreate(), MatSetNearNullSpace(), MatSetNullSpace(), PCGAMG

External Links

source
PETSc.LibPETSc.MatNullSpaceDestroyMethod
MatNullSpaceDestroy(petsclib::PetscLibType,sp::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

-seealso: , Mat, MatNullSpace, MatNullSpaceCreate(), MatNullSpaceRemove(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceGetVecsMethod
has_const::PetscBool,n::PetscInt = MatNullSpaceGetVecs(petsclib::PetscLibType,sp::MatNullSpace, vecs::Vector{PetscVec})

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

-seealso: , Mat, MatNullSpace, MatNullSpaceCreate(), MatGetNullSpace(), MatGetNearNullSpace()

External Links

source
PETSc.LibPETSc.MatNullSpaceRemoveMethod
MatNullSpaceRemove(petsclib::PetscLibType,sp::MatNullSpace, vec::PetscVec)

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

-seealso: , Mat, MatNullSpace, MatNullSpaceCreate(), MatNullSpaceDestroy(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceSetFunctionMethod
MatNullSpaceSetFunction(petsclib::PetscLibType,sp::MatNullSpace, rem::MatNullSpaceRemoveFn, ctx::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

-seealso: , Mat, MatNullSpace, MatNullSpaceDestroy(), MatNullSpaceRemove(), MatSetNullSpace(), MatNullSpaceCreate(), MatNullSpaceRemoveFn

External Links

source
PETSc.LibPETSc.MatNullSpaceTestMethod
isNull::PetscBool = MatNullSpaceTest(petsclib::PetscLibType,sp::MatNullSpace, mat::PetscMat)

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

-seealso: , Mat, MatNullSpace, MatNullSpaceCreate(), MatNullSpaceDestroy(), MatNullSpaceSetFunction()

External Links

source
PETSc.LibPETSc.MatNullSpaceViewMethod
MatNullSpaceView(petsclib::PetscLibType,sp::MatNullSpace, viewer::PetscViewer)

Visualizes a null space object.

Collective

Input Parameters:

  • sp - the null space
  • viewer - visualization context

Level: advanced

-seealso: , Mat, MatNullSpace, PetscViewer, MatNullSpaceCreate(), PetscViewerASCIIOpen()

External Links

source
PETSc.LibPETSc.MatPartitioningApplyMethod
MatPartitioningApply(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS)

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().

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningRegister(), MatPartitioningCreate(), MatPartitioningDestroy(), MatPartitioningSetAdjacency(), ISPartitioningToNumbering(), ISPartitioningCount()

External Links

source
PETSc.LibPETSc.MatPartitioningApplyNDMethod
MatPartitioningApplyND(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS)

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

-seealso: , Mat, MatPartitioningRegister(), MatPartitioningCreate(), MatPartitioningDestroy(), MatPartitioningSetAdjacency(), ISPartitioningToNumbering(), ISPartitioningCount()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetEigenNumberMethod
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

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenNumber()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetEigenSolverMethod
MatPartitioningChacoGetEigenSolver(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoEigenType)

Get the eigensolver used by the Chaco partitioner.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • method - the method

Level: advanced

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenSolver()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetEigenTolMethod
tol::PetscReal = MatPartitioningChacoGetEigenTol(petsclib::PetscLibType,part::MatPartitioning)

Gets the eigensolver tolerance used by Chaco

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • tol - the tolerance

Level: advanced

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenTol()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetGlobalMethod
MatPartitioningChacoGetGlobal(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoGlobalType)

Get the global method used by the Chaco partitioner.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • method - the method

Level: advanced

-seealso: MatPartitioningType, MATPARTITIONINGCHACO, MatPartitioningChacoSetGlobal()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoGetLocalMethod
MatPartitioningChacoGetLocal(petsclib::PetscLibType,part::MatPartitioning, method::MPChacoLocalType)

Get local method used by the Chaco partitioner.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • method - the method

Level: advanced

-seealso: MatPartitioningType, MATPARTITIONINGCHACO, MatPartitioningChacoSetLocal()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetCoarseLevelMethod
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

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetEigenNumberMethod
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

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenSolver(), MatPartitioningChacoGetEigenTol()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetEigenSolverMethod
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

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenTol(), MatPartitioningChacoSetEigenNumber(), MatPartitioningChacoGetEigenSolver()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetEigenTolMethod
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

-seealso: MatPartitioningType, MatPartitioning, MATPARTITIONINGCHACO, MatPartitioningChacoSetEigenSolver(), MatPartitioningChacoGetEigenTol()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetGlobalMethod
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

-seealso: MatPartitioning, MatPartioningSetType(), MatPartitioningType, MATPARTITIONINGCHACO, MatPartitioningChacoSetLocal(), MatPartitioningChacoGetGlobal()

External Links

source
PETSc.LibPETSc.MatPartitioningChacoSetLocalMethod
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

-seealso: MatPartitioningType, MATPARTITIONINGCHACO, MatPartitioningChacoSetGlobal(), MatPartitioningChacoGetLocal()

External Links

source
PETSc.LibPETSc.MatPartitioningCreateMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningSetType(), MatPartitioningApply(), MatPartitioningDestroy(), MatPartitioningSetAdjacency()

External Links

source
PETSc.LibPETSc.MatPartitioningDestroyMethod
MatPartitioningDestroy(petsclib::PetscLibType,part::MatPartitioning)

Destroys the partitioning context.

Collective

Input Parameter:

  • part - the partitioning context

Level: beginner

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatPartitioningGetTypeMethod
type::MatPartitioningType = 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

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate(), MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()

External Links

source
PETSc.LibPETSc.MatPartitioningGetUseEdgeWeightsMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningSetType(), MatPartitioningSetVertexWeights(), MatPartitioningSetPartitionWeights(), MatPartitioningSetUseEdgeWeights

External Links

source
PETSc.LibPETSc.MatPartitioningImproveMethod
MatPartitioningImprove(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS)

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

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningApply(), MatPartitioningCreate(), MatPartitioningDestroy(), MatPartitioningSetAdjacency(), ISPartitioningToNumbering(), ISPartitioningCount()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchGetImbalanceMethod
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

-seealso: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetImbalance()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchGetStrategyMethod
MatPartitioningPTScotchGetStrategy(petsclib::PetscLibType,part::MatPartitioning, strategy::MPPTScotchStrategyType)

Gets the strategy used in PTScotch.

Not Collective

Input Parameter:

  • part - the partitioning context

Output Parameter:

  • strategy - the strategy

Level: advanced

-seealso: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetStrategy()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchSetImbalanceMethod
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

-seealso: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetStrategy(), MatPartitioningPTScotchGetImbalance()

External Links

source
PETSc.LibPETSc.MatPartitioningPTScotchSetStrategyMethod
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

-seealso: MATPARTITIONINGSCOTCH, MatPartitioningPTScotchSetImbalance(), MatPartitioningPTScotchGetStrategy()

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetBipartMethod
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

-seealso: MATPARTITIONINGPARTY

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetCoarseLevelMethod
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

-seealso: MATPARTITIONINGPARTY

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetGlobalMethod
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

-seealso: MATPARTITIONINGPARTY, MatPartitioningPartySetLocal()

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetLocalMethod
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

-seealso: MATPARTITIONINGPARTY, MatPartitioningPartySetGlobal()

External Links

source
PETSc.LibPETSc.MatPartitioningPartySetMatchOptimizationMethod
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

-seealso: MATPARTITIONINGPARTY

External Links

source
PETSc.LibPETSc.MatPartitioningRegisterMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate(), MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()

External Links

source
PETSc.LibPETSc.MatPartitioningSetAdjacencyMethod
MatPartitioningSetAdjacency(petsclib::PetscLibType,part::MatPartitioning, adj::PetscMat)

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

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatPartitioningSetFromOptionsMethod
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

-seealso: , Mat, MatPartitioning

External Links

source
PETSc.LibPETSc.MatPartitioningSetNPartsMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningApply()

External Links

source
PETSc.LibPETSc.MatPartitioningSetPartitionWeightsMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningSetVertexWeights(), MatPartitioningCreate(), MatPartitioningSetType()

External Links

source
PETSc.LibPETSc.MatPartitioningSetTypeMethod
MatPartitioningSetType(petsclib::PetscLibType,part::MatPartitioning, type::MatPartitioningType)

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), use -help for a list of available methods or see MatPartitioningType

Level: intermediate

-seealso: , Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningApply(), MatPartitioningType

External Links

source
PETSc.LibPETSc.MatPartitioningSetUseEdgeWeightsMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningSetType(), MatPartitioningSetVertexWeights(), MatPartitioningSetPartitionWeights()

External Links

source
PETSc.LibPETSc.MatPartitioningSetVertexWeightsMethod
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

-seealso: , Mat, MatPartitioning, MatPartitioningCreate(), MatPartitioningSetType(), MatPartitioningSetPartitionWeights(), MatPartitioningSetNumberVertexWeights()

External Links

source
PETSc.LibPETSc.MatPartitioningViewMethod
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

-seealso: , Mat, MatPartitioning, PetscViewer, PetscViewerASCIIOpen()

External Links

source
PETSc.LibPETSc.MatPartitioningViewFromOptionsMethod
MatPartitioningViewFromOptions(petsclib::PetscLibType,A::MatPartitioning, obj::PetscObject, 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:

  • -mat_partitioning_view [viewertype]:... - the viewer and its options

Level: intermediate

-seealso: , Mat, MatPartitioning, MatPartitioningView(), PetscObjectViewFromOptions(), MatPartitioningCreate()

External Links

source
PETSc.LibPETSc.MatPartitioningViewImbalanceMethod
MatPartitioningViewImbalance(petsclib::PetscLibType,matp::MatPartitioning, partitioning::IS)

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

-seealso: , Mat, MatPartitioning, MatPartitioningType, MatPartitioningApply(), MatPartitioningView()

External Links

source
PETSc.LibPETSc.MatTransposeColoringCreateMethod
color::MatTransposeColoring = MatTransposeColoringCreate(petsclib::PetscLibType,mat::PetscMat, 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

-seealso: , Mat, MatTransposeColoringDestroy(), MatTransColoringApplySpToDen(), MatTransColoringApplyDenToSp()

External Links

source
PETSc.LibPETSc.MatTransposeColoringDestroyMethod
MatTransposeColoringDestroy(petsclib::PetscLibType,c::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

-seealso: , Mat, MatTransposeColoringCreate()

External Links

source