:orphan:
# MatHtoolSetKernel
Sets the kernel and context used for the assembly of a `MATHTOOL`. 
## Synopsis
```
#include "petscmat.h" 
PETSC_EXTERN PetscErrorCode MatHtoolSetKernel(Mat A, MatHtoolKernel kernel, void *kernelctx)
```

## Input Parameters

- ***A -*** hierarchical matrix
- ***kernel -*** computational kernel (or `NULL`)
- ***kernelctx -*** kernel context (if kernel is `NULL`, the pointer must be of type htool::VirtualGenerator<PetscScalar>*)





## See Also
 [](ch_matrices), `Mat`, `MATHTOOL`, `MatCreateHtoolFromKernel()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/htool/htool.cxx.html#MatHtoolSetKernel">src/mat/impls/htool/htool.cxx</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/htool/htool.cxx.html#MatHtoolSetKernel_Htool">MatHtoolSetKernel_Htool in src/mat/impls/htool/htool.cxx</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/htool/htool.cxx)


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