MatCreateKAIJAB#
Creates a matrix of type MATKAIJ with a general second Kronecker operand.
Synopsis#
#include "petscmat.h"
PetscErrorCode MatCreateKAIJAB(Mat A, Mat B, PetscInt p, PetscInt q, const PetscScalar S[], const PetscScalar T[], Mat *kaij)
Collective
Input Parameters#
A - the
MATAIJmatrixB - the second
MATAIJmatrix (can beNULL, in which case it is treated as the identity, and this is equivalent toMatCreateKAIJ())p - number of rows in
SandTq - number of columns in
SandTS - the
Smatrix (can beNULL), stored as aPetscScalararray (column-major)T - the
Tmatrix (can beNULL), stored as aPetscScalararray (column-major)
Output Parameter#
kaij - the new
MATKAIJmatrix
Notes#
The created matrix is of the following form:
[B \otimes S + A \otimes T]
where
The resulting matrix is (np \times nq)
A common source of a non-identity B is a differential-algebraic equation integrated with an implicit Runge-Kutta
method. In that case the first operand A is the Jacobian \(\partial F/\partial U\) and the second operand B is the
(possibly singular) mass matrix \(M = \partial F/\partial \dot{U}\); a NULL B recovers the identity mass matrix of an
ODE with no algebraic constraints. See TSIRK and TSSetMassMatrix().
B must share the parallel row and column layout of A, and in the MATMPIKAIJ case it must share the nonzero
structure of A (the same off-diagonal ghost columns), for example by assembling both from the same DM. In that
case both operands must be assembled before the MATKAIJ matrix is created.
This function increases the reference count on both MATAIJ matrices, so the user is free to destroy them if they are not needed.
When B is not the identity, MatMult(), MatMultAdd(), MatGetDiagonalBlock(), and MatInvertBlockDiagonal()
(hence PCPBJACOBI) are supported; the remaining operations raise an error in that case. These are MatSOR(),
MatGetRow(), MatConvert(), and the operations built on MatConvert(): MatCreateSubMatrix() and MatView() in
any format other than PETSC_VIEWER_ASCII_INFO, PETSC_VIEWER_ASCII_INFO_DETAIL, or PETSC_VIEWER_ASCII_IMPL. In
particular -mat_view and -ksp_view_mat will error on such a matrix.
See Also#
Matrices, Mat, MatCreateKAIJ(), MatKAIJSetA(), MatKAIJSetB(), MatKAIJSetS(), MatKAIJSetT(), MATKAIJ
Level#
advanced
Location#
Examples#
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages