MatMatTransposeMult#
Performs matrix-matrix multiplication \(C = A B^T\).
Synopsis#
#include "petscmat.h"
PetscErrorCode MatMatTransposeMult(Mat A, Mat B, MatReuse scall, PetscReal fill, Mat *C)
Neighbor-wise Collective
Input Parameters#
A - the left matrix
B - the right matrix
scall - either
MAT_INITIAL_MATRIXorMAT_REUSE_MATRIXfill - expected fill as ratio of nnz(C)/(nnz(A) + nnz(B)), use
PETSC_DETERMINEorPETSC_CURRENTif not known
Output Parameter#
C - the product matrix
Options Database Key#
-matmattransmult_mpidense_mpidense_via (allgatherv|cyclic|backend) - Choose the algorithm for
MATMPIDENSE. The defaultallgathervreplicates the transpose ofBin O(log P) communication steps. Thecyclicalgorithm stores one portion ofBat a time and takes O(P) steps. With matching CUDA or HIP matrices,backendgathersBthroughPetscSFand computes the local product on the device.
Notes#
C will be created if MAT_INITIAL_MATRIX and must be destroyed by the user with MatDestroy().
MAT_REUSE_MATRIX can only be used if the matrices A and B have the same nonzero pattern as in the previous call
To determine the correct fill value, run with -info and search for the string “Fill ratio” to see the value actually needed.
This routine is currently only implemented for pairs of MATSEQAIJ matrices, for the MATSEQDENSE class,
and for pairs of MATMPIDENSE matrices.
This is a convenience routine that wraps the use of the MatProductCreate() with a MatProductType of MATPRODUCT_ABt
functionality into a single function call. For more involved matrix-matrix operations see MatProductCreate().
The deprecated PETSC_DEFAULT in fill also means use the current value
See Also#
Matrices, Mat, MatProductCreate(), MATPRODUCT_ABt, MatMatMult(), MatTransposeMatMult(), MatPtAP(), MatProductAlgorithm, MatProductType
Level#
intermediate
Location#
Examples#
src/mat/tests/ex161.c
src/mat/tests/ex94.c
src/mat/tests/ex1.c
src/mat/tests/ex104.c
src/mat/tests/ex109.c
src/mat/tests/ex178.c
src/mat/tests/ex242.c
src/mat/tests/ex318.c
src/mat/tests/ex39.c
src/mat/tests/ex62.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages