MatProductCreate#
create a matrix to hold the result of a matrix-matrix (or matrix-matrix-matrix) product operation
Synopsis#
#include "petscmat.h"
PetscErrorCode MatProductCreate(Mat A, Mat B, Mat C, Mat *D)
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
Example#
MatProductCreate(A,B,C,&D); or MatProductCreateWithMat(A,B,C,D)
MatProductSetType(D, MATPRODUCT_AB or MATPRODUCT_AtB or MATPRODUCT_ABt or MATPRODUCT_PtAP or MATPRODUCT_RARt or MATPRODUCT_ABC)
MatProductSetAlgorithm(D, alg)
MatProductSetFill(D,fill)
MatProductSetFromOptions(D)
MatProductSymbolic(D)
MatProductNumeric(D)
Change numerical values in some of the matrices
MatProductNumeric(D)
Notes#
Use MatProductCreateWithMat() if D the matrix you wish computed already exists.
The information computed during the symbolic stage can be reused for new numerical computations with the same non-zero structure of the input matrices.
Developer Notes#
It is undocumented what happens if the nonzero structure of the input matrices changes. Is the symbolic stage automatically redone? Does it crash? Is there error checking for it?
On this call, auxiliary data needed to compute the product is stored in D in a Mat_Product context. A call to MatProductClear() frees this
information.
Each MatProductAlgorithm associated with a particular MatType stores additional data needed for the product computation
(generally this data is computed in MatProductSymbolic()) inside the Mat_Product context in a MatProductCtx_XXX data structure
and provides a MatProductCtxDestroy_XXX() routine to free that data. The MatProductAlgorithm and MatType specific destroy routine is called by
MatProductClear().
See Also#
Matrices, MatProduct, Mat, MatProductCreateWithMat(), MatProductSetType(), MatProductSetAlgorithm(), MatProductClear(),
MatProductSymbolic(), MatProductNumeric(), MatProductAlgorithm, MatProductType
Level#
intermediate
Location#
Examples#
src/tao/pde_constrained/tutorials/parabolic.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages