# MatH2OpusSetSamplingMat
Set a matrix to be sampled from matrix vector product to construct a hierarchical matrix. 
## Synopsis
```
PetscErrorCode MatH2OpusSetSamplingMat(Mat A, Mat B, PetscInt bs, PetscReal tol)
```

## Input Parameters

- ***A -*** the hierarchical matrix
- ***B -*** the matrix to be sampled
- ***bs -*** maximum number of samples to be taken concurrently
- ***tol -*** relative tolerance for construction



## Notes
You need to call `MatAssemblyBegin()` and `MatAssemblyEnd()` to update the hierarchical matrix.




## See Also
 `MatCreate()`, `MATH2OPUS`, `MatCreateH2OpusFromMat()`, `MatCreateH2OpusFromKernel()`, `MatH2OpusCompress()`, `MatH2OpusOrthogonalize()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/h2opus/cuda/math2opus.cu.html#MatH2OpusSetSamplingMat">src/mat/impls/h2opus/cuda/math2opus.cu</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/h2opus/cuda/math2opus.cu)


[Index of all Mat routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
