:orphan:
# VecAXPBY
Computes `y = alpha x + beta y`.
## Synopsis
```
#include "petscvec.h"
PetscErrorCode VecAXPBY(Vec y, PetscScalar alpha, PetscScalar beta, Vec x)
```
Logically Collective
## Input Parameters
- ***alpha -*** first scalar
- ***beta -*** second scalar
- ***x -*** the first scaled vector
- ***y -*** the second scaled vector
## Output Parameter
- ***y -*** output vector
## Developer Note
The implementation is optimized for `alpha` and/or `beta` values of 0.0 and 1.0
## See Also
[](ch_vectors), `Vec`, `VecAYPX()`, `VecMAXPY()`, `VecWAXPY()`, `VecAXPY()`, `VecAXPBYPCZ()`
## Level
intermediate
## Location
src/vec/vec/interface/rvector.c
## Implementations
VecAXPBY_Nest in src/vec/vec/impls/nest/vecnest.c
VecAXPBY_Seq in src/vec/vec/impls/seq/bvec1.c
VecAXPBY_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecAXPBY_SeqViennaCL in src/vec/vec/impls/seq/seqviennacl/vecviennacl.cxx
---
[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](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)