# PetscObjectStateIncrease
Increases the state of any `PetscObject` 
## Synopsis
```
#include "petsc/private/petscimpl.h"
PetscErrorCode PetscObjectStateIncrease(PetscObject obj)
```
Logically Collective


## Input Parameter

- ***obj -*** any PETSc object, for example a `Vec`, `Mat` or `KSP`. This must be
cast with a (PetscObject), for example,
`PetscObjectStateIncrease`((`PetscObject`)mat);



## Notes
Object state is a 64 bit integer which gets increased every time
the object is changed internally. By saving and later querying the object state
one can determine whether information about the object is still current.
Currently, state is maintained for `Vec` and `Mat` objects.

This routine is mostly for internal use by PETSc; a developer need only
call it after explicit access to an object's internals. Routines such
as `VecSet()` or `MatScale()` already call this routine. It is also called, as a
precaution, in `VecRestoreArray()`, `MatRestoreRow()`, `MatDenseRestoreArray()`.

Routines such as `VecNorm()` can by-pass the computation if the norm has already been computed and the vector's state has not changed.

This routine is logically collective because state equality comparison needs to be possible without communication.

`Mat` also has `MatGetNonzeroState()` for tracking changes to the nonzero structure.




## See Also
 `PetscObjectStateGet()`, `PetscObject`


## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petsc/private/petscimpl.h.html#PetscObjectStateIncrease">include/petsc/private/petscimpl.h</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex83f.F90.html">src/ksp/ksp/tutorials/ex83f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/utils/dmplexlandau/tutorials/ex2.c.html">src/ts/utils/dmplexlandau/tutorials/ex2.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petsc/private/petscimpl.h)


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