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 MATAIJ matrix

  • B - the second MATAIJ matrix (can be NULL, in which case it is treated as the identity, and this is equivalent to MatCreateKAIJ())

  • 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#

Notes#

The created matrix is of the following form:

    [B \otimes S + A \otimes T]

where

  S is a dense (p \times q) matrix
  T is a dense (p \times q) matrix
  A is a `MATAIJ`  (n \times n) matrix
  B is a `MATAIJ`  (n \times n) matrix, or the identity if `NULL`

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#

src/mat/impls/kaij/kaij.c

Examples#

src/mat/tests/ex277.c


Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages