# VecNormAvailable
Returns the vector norm if it is already known. 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecNormAvailable(Vec x, NormType type, PetscBool *available, PetscReal *val)
```
Not Collective


## Input Parameters

- ***x -*** the vector
- ***type -*** one of NORM_1, NORM_2, NORM_INFINITY.  Also available
NORM_1_AND_2, which computes both norms and stores them
in a two element array.



## Output Parameters

- ***available -*** PETSC_TRUE if the val returned is valid
- ***val -*** the norm



## Notes
```none
NORM_1 denotes sum_i |x_i|
```
```none
NORM_2 denotes sqrt(sum_i (x_i)^2)
```
```none
NORM_INFINITY denotes max_i |x_i|
```




## Performance Issues
```none
per-processor memory bandwidth
```
```none
interprocessor latency
```
```none
work load imbalance that causes certain processes to arrive much earlier than others
```


## Compile Option
PETSC_HAVE_SLOW_BLAS_NORM2 will cause a C (loop unrolled) version of the norm to be used, rather
than the BLAS. This should probably only be used when one is using the FORTRAN BLAS routines
(as opposed to vendor provided) because the FORTRAN BLAS NRM2() routine is very slow.


## See Also
 `VecDot()`, `VecTDot()`, `VecNorm()`, `VecDotBegin()`, `VecDotEnd()`, `VecNorm()`
`VecNormBegin()`, `VecNormEnd()`


## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/rvector.c.html#VecNormAvailable">src/vec/vec/interface/rvector.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/rvector.c)


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