-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
The following caught me by surprise as I was replacing regular vectors in my code with DD equivalents:
# Normal vectors
y = rand(ComplexF64, 5)
@views abs(y[1]) # Success!
# DD
y_dd = DimArray(y, Y)
@views abs(y_dd[1])
# MethodError: no method matching abs(::DimensionalData.DimArray{ComplexF64, 0, Tuple{}, Tuple{DimensionalData.Dimensions.Y{DimensionalData.Dimensions.Lookups.NoLookup{UnitRange{Int64}}}}, SubArray{ComplexF64, 0, Vector{ComplexF64}, Tuple{Int64}, true}, DimensionalData.NoName, DimensionalData.Dimensions.Lookups.NoMetadata})
# The function `abs` exists, but no method is defined for this combination of argument types.
Essentially, calling abs
(possibly other functions too) isn't defined for zero-dimensional DimArrays. The substantial difference between the two examples is that @views y[1]
just returns the scalar object, instead of a zero-dimensional vector.
Thoughts? Would I just have to rewrite my code to get around this?
I'm on DimensionalData v0.29.24
(Julia v1.11.6)
Metadata
Metadata
Assignees
Labels
No labels