Skip to main content
`Ctrl`+`K`

# MatMultEqual

Compares matrix-vector products of two matrices using `n` random vectors

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatMultEqual(Mat A, Mat B, PetscInt n, PetscBool *flg)

Collective

## Input Parameters

- A - the first matrix

- B - the second matrix

- n - number of random vectors to be tested

## Output Parameter

- flg - `PETSC_TRUE` if the products are equal; `PETSC_FALSE` otherwise.

## Note

The tolerance for equality is a generous `PETSC_SQRT_MACHINE_EPSILON` in the norm of the difference of the two computed vectors to allow for differences in the numerical computations. Hence this routine may indicate equality even if there is a small systematic difference between the two matrices.

## See Also

`Mat`, `MatMultAddEqual()`, `MatMultTransposeEqual()`, `MatMultTransposeAddEqual()`, `MatIsLinear()`, `MatEqual()`

## Level

intermediate

## Location

src/mat/utils/multequal.c

## Examples

src/ksp/ksp/tutorials/ex81.c

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