:orphan: # MatCreateKAIJ Creates a matrix of type `MATKAIJ` to be used for matrices of the following form .vb [I \otimes S + A \otimes T] .ve where .vb S is a dense (p \times q) matrix T is a dense (p \times q) matrix A is a `MATAIJ` (n \times n) matrix I is the identity matrix .ve The resulting matrix is (np \times nq) ## Synopsis ``` #include "petscmat.h" PetscErrorCode MatCreateKAIJ(Mat A, PetscInt p, PetscInt q, const PetscScalar S[], const PetscScalar T[], Mat *kaij) ``` `S` and `T` are always stored independently on all processes as `PetscScalar` arrays in column-major format. 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 ## Notes This function increases the reference count on the `MATAIJ` matrix, so the user is free to destroy the matrix if it is not needed. Changes to the entries of the `MATAIJ` matrix will immediately affect the `MATKAIJ` matrix. ## Developer Note In the `MATMPIKAIJ` case, the internal 'AIJ' and 'OAIJ' sequential KAIJ matrices are kept up to date by tracking the object state of the AIJ matrix 'A' that describes the blockwise action of the `MATMPIKAIJ` matrix and, if the object state has changed, lazily rebuilding 'AIJ' and 'OAIJ' just before executing operations with the `MATMPIKAIJ` matrix. If new types of operations are added, routines implementing those must also ensure these are rebuilt when needed (by calling the internal MatKAIJ_build_AIJ_OAIJ() routine). ## See Also [](ch_matrices), `Mat`, `MatKAIJSetAIJ()`, `MatKAIJSetS()`, `MatKAIJSetT()`, `MatKAIJGetAIJ()`, `MatKAIJGetS()`, `MatKAIJGetT()`, `MATKAIJ` ## Level advanced ## Location src/mat/impls/kaij/kaij.c ## Examples src/ksp/ksp/tutorials/ex74.c
src/ksp/ksp/tutorials/ex77.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/kaij/kaij.c) [Index of all Mat routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)