Skip to main content
`Ctrl`+`K`

# MatProductSetFromOptions

Sets the options for the computation of a matrix-matrix product operation where the type, the algorithm etc are determined from the options database.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatProductSetFromOptions(Mat mat)

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

## Note

The `-mat_product_clear` option reduces memory usage but means that the matrix cannot be re-used for a matrix-matrix product operation

## See Also

Matrices, `MatProduct`, `Mat`, `MatSetFromOptions()`, `MatProductCreate()`, `MatProductCreateWithMat()`, `MatProductNumeric()`, `MatProductSetType()`, `MatProductSetAlgorithm()`, `MatProductAlgorithm`

## Level

intermediate

## Location

src/mat/interface/matproduct.c

## Examples

src/tao/pde_constrained/tutorials/parabolic.c

## Implementations

MatProductSetFromOptions_MPIAIJKokkos() in src/mat/impls/aij/mpi/kokkos/mpiaijkok.kokkos.cxx
MatProductSetFromOptions_MPIAIJBACKEND() in src/mat/impls/aij/mpi/mpiaij.c
MatProductSetFromOptions_MPIAIJ() in src/mat/impls/aij/mpi/mpimatmatmult.c
MatProductSetFromOptions_SeqAIJMKL() in src/mat/impls/aij/seq/aijmkl/aijmkl.c
MatProductSetFromOptions_SeqAIJKokkos() in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatProductSetFromOptions_SeqAIJ() in src/mat/impls/aij/seq/matmatmult.c
MatProductSetFromOptions_SeqAIJCUSPARSE() in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatProductSetFromOptions_SeqAIJHIPSPARSE() in src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cxx
MatProductSetFromOptions_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatProductSetFromOptions_SeqDense() in src/mat/impls/dense/seq/dense.c
MatProductSetFromOptions_Elemental() in src/mat/impls/elemental/matelem.cxx
MatProductSetFromOptions_H2OPUS() in src/mat/impls/h2opus/cuda/math2opus.cu
MatProductSetFromOptions_Htool() in src/mat/impls/htool/htool.cxx
MatProductSetFromOptions_HYPRE() in src/mat/impls/hypre/mhypre.c
MatProductSetFromOptions_ScaLAPACK() in src/mat/impls/scalapack/matscalapack.c
MatProductSetFromOptions_CF() in src/mat/impls/shell/shellcnv.c
MatProductSetFromOptions_HT() in src/mat/impls/transpose/htransm.c
MatProductSetFromOptions_Transpose() in src/mat/impls/transpose/transm.c

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