Skip to contents

Returns the underlying bytes of an array as a raw vector.

Usage

as_raw(x, ...)

Arguments

x

(AnvlArray)
An array.

...

Additional arguments passed to method:

  • row_major (logical(1))
    Whether to write the elements in row-major order. The default, FALSE, writes them in column-major order, the order in which R stores an array.

Value

(raw)

Details

This is implemented via the generic xlamisc::as_raw().

Examples

x <- nv_array(1:4, shape = c(2, 2), dtype = "f32")
# column-major, the default
as_raw(x)
#>  [1] 00 00 80 3f 00 00 00 40 00 00 40 40 00 00 80 40
as_raw(x, row_major = TRUE)
#>  [1] 00 00 80 3f 00 00 40 40 00 00 00 40 00 00 80 40