# MatGetColumnVector
Gets the values from a given column of a matrix. 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatGetColumnVector(Mat A, Vec yy, PetscInt col)
```
Not Collective


## Input Parameters

- ***A -*** the matrix
- ***yy -*** the vector
- ***col -*** the column requested (in global numbering)





## Notes
If a Mat type does not implement the operation, each processor for which this is called
gets the values for its rows using `MatGetRow()`.

The vector must have the same parallel row layout as the matrix.

Contributed by: Denis Vanderstraeten


## See Also
 `MatGetRow()`, `MatGetDiagonal()`, `MatMult()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/utils/getcolv.c.html#MatGetColumnVector">src/mat/utils/getcolv.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/mpi/mpidense.c.html#MatGetColumnVector_MPIDense">MatGetColumnVector_MPIDense in src/mat/impls/dense/mpi/mpidense.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/cuda/densecuda.cu.html#MatGetColumnVector_SeqDenseCUDA">MatGetColumnVector_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/dense.c.html#MatGetColumnVector_SeqDense">MatGetColumnVector_SeqDense in src/mat/impls/dense/seq/dense.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/hip/densehip.hip.c.html#MatGetColumnVector_SeqDenseHIP">MatGetColumnVector_SeqDenseHIP in src/mat/impls/dense/seq/hip/densehip.hip.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/utils/getcolv.c)


[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)  
