Skip to contents

Permutes the dimensions of an array. You can also use t() for matrices.

Usage

nv_transpose(operand, permutation = NULL)

# S3 method for class 'AnvlArray'
t(x)

Arguments

operand

(arrayish)
Operand.

permutation

(integer() | NULL)
New ordering of dimensions. If NULL (default), reverses the dimensions.

x

(arrayish)
Same as operand; this is the name used by the base R S3 generic.

Value

arrayish
Has the same data type as operand and shape nv_shape(operand)[permutation].

See also

prim_transpose() for the underlying primitive.

Examples

x <- nv_matrix(1:6, nrow = 2)
t(x)
#> AnvlArray
#>  1 2
#>  3 4
#>  5 6
#> [ CPUi32{3,2} ]