Skip to contents

Reverses the order of an Armadillo Vector

Usage

reverse_vec(x)

Arguments

x

A column vector of length N

Value

A column vector with its contents reversed.

Details

Consider a vector x=[1,2,3,4,5], the function would output x=[5,4,3,2,1].

Author

JJB

Examples

x = 1:5
reverse_vec(x)
#>      [,1]
#> [1,]    5
#> [2,]    4
#> [3,]    3
#> [4,]    2
#> [5,]    1