Skip to contents

Compare two abstract arrays for type equality.

An RData has no data type to compare, so it is an error here, just as dtype() is. Commit it first, e.g. with nv_convert().

Usage

eq_type(e1, e2)

neq_type(e1, e2)

Arguments

e1

(AbstractArray)
First array to compare. Must not be an RData.

e2

(AbstractArray)
Second array to compare. Must not be an RData.

Value

(logical(1))

Examples

a <- nv_aval("f32", c(2L, 3L))
b <- nv_aval("f32", c(2L, 3L))

# same dtype and shape
eq_type(a, b)
#> [1] TRUE

# different dtype
eq_type(a, nv_aval("i32", c(2L, 3L)))
#> [1] FALSE

# different shape
eq_type(a, nv_aval("f32", c(3L, 2L)))
#> [1] FALSE

# neq_type is the negation of eq_type
neq_type(a, b)
#> [1] FALSE