# MatCreateH2OpusFromMat
Creates a `MATH2OPUS` sampling from a user-supplied operator. 
## Synopsis
```
PetscErrorCode MatCreateH2OpusFromMat(Mat B, PetscInt spacedim, const PetscReal coords[], PetscBool cdist, PetscReal eta, PetscInt leafsize, PetscInt maxrank, PetscInt bs, PetscReal rtol, Mat *nA)
```

## Input Parameters

- ***B -*** the matrix to be sampled
- ***spacedim -*** dimension of the space coordinates
- ***coords -*** coordinates of the points
- ***cdist -*** whether or not coordinates are distributed
- ***eta -*** admissibility condition tolerance
- ***leafsize -*** leaf size in cluster tree
- ***maxrank -*** maximum rank allowed
- ***bs -*** maximum number of samples to be taken concurrently
- ***rtol -*** relative tolerance for construction



## Output Parameter

- ***nA -*** matrix



## Options Database Keys

- ***-mat_h2opus_leafsize <`PetscInt`> -*** Leaf size of cluster tree
- ***-mat_h2opus_eta <`PetscReal`> -*** Admissibility condition tolerance
- ***-mat_h2opus_maxrank <`PetscInt`> -*** Maximum rank when constructed from matvecs
- ***-mat_h2opus_samples <`PetscInt`> -*** Maximum number of samples to be taken concurrently when constructing from matvecs
- ***-mat_h2opus_rtol <`PetscReal`> -*** Relative tolerance for construction from sampling
- ***-mat_h2opus_check <`PetscBool`> -*** Check error when constructing from sampling during MatAssemblyEnd()
- ***-mat_h2opus_hara_verbose <`PetscBool`> -*** Verbose output from hara construction
- ***-mat_h2opus_normsamples <`PetscInt`> -*** Maximum bumber of samples to be when estimating norms



## Note
Not available in parallel




## See Also
 `MatCreate()`, `MATH2OPUS`, `MatCreateH2OpusFromKernel()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/h2opus/cuda/math2opus.cu.html#MatCreateH2OpusFromMat">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)  
