Compare two abstract arrays for type equality.
Arguments
- e1
(
AbstractArray)
First array to compare.- e2
(
AbstractArray)
Second array to compare.- ambiguity
(
logical(1))
Whether to consider the ambiguous field when comparing. IfTRUE, arrays with different ambiguity are not equal. IfFALSE, only dtype and shape are compared.
Examples
a <- nv_aval("f32", c(2L, 3L))
b <- nv_aval("f32", c(2L, 3L))
# Same dtype and shape
eq_type(a, b, ambiguity = FALSE)
#> [1] TRUE
# Different dtype
eq_type(a, nv_aval("i32", c(2L, 3L)), ambiguity = FALSE)
#> [1] FALSE
# Different shape
eq_type(a, nv_aval("f32", c(3L, 2L)), ambiguity = FALSE)
#> [1] FALSE
# ambiguity parameter controls whether ambiguous field is compared
c <- nv_aval("f32", c(2L, 3L), ambiguous = TRUE)
eq_type(a, c, ambiguity = FALSE)
#> [1] TRUE
eq_type(a, c, ambiguity = TRUE)
#> [1] FALSE
# neq_type is the negation of eq_type
neq_type(a, b, ambiguity = FALSE)
#> [1] FALSE