ggebbie / UnitfulLinearAlgebra.jl

Low-cost linear algebra functions for matrices with units
MIT License
6 stars 3 forks source link

removing refdims causes slice error #34

Closed ggebbie closed 1 year ago

ggebbie commented 1 year ago

removing refdims from UnitfulMatrix causes error when calling F[:,1], for example

error attached


julia> 

julia> DimensionalData.slicedims(getindex,F.vectors,(:,1))
ERROR: MethodError: no method matching _slicedims(::typeof(getindex), ::Tuple{UnitfulLinearAlgebra.Units{DimensionalData.Dimensions.LookupArrays.Categorical{Unitful.FreeUnits{N, D, nothing} where {N, D}, Vector{Unitful.FreeUnits{N, D, nothing} where {N, D}}, DimensionalData.Dimensions.LookupArrays.Unordered, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, UnitfulLinearAlgebra.Units{Vector{Unitful.FreeUnits{(), NoDims, nothing}}}}, ::Tuple{Colon, Int64})
Closest candidates are:
  _slicedims(::Any, ::Tuple, ::Tuple, ::Tuple{}) at ~/projects/UnitfulLinearAlgebra/src/UnitfulLinearAlgebra.jl:136
  _slicedims(::Any, ::Tuple, ::Tuple, ::Tuple) at ~/projects/UnitfulLinearAlgebra/src/UnitfulLinearAlgebra.jl:118
Stacktrace:
 [1] slicedims(f::Function, x::UnitfulMatrix{Float64, 2, Tuple{UnitfulLinearAlgebra.Units{DimensionalData.Dimensions.LookupArrays.Categorical{Unitful.FreeUnits{N, D, nothing} where {N, D}, Vector{Unitful.FreeUnits{N, D, nothing} where {N, D}}, DimensionalData.Dimensions.LookupArrays.Unordered, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, UnitfulLinearAlgebra.Units{Vector{Unitful.FreeUnits{(), NoDims, nothing}}}}, Matrix{Float64}}, I::Tuple{Colon, Int64})
   @ UnitfulLinearAlgebra ~/projects/UnitfulLinearAlgebra/src/UnitfulLinearAlgebra.jl:116
 [2] top-level scope
   @ REPL[79]:1
ggebbie commented 1 year ago

Solved primarily by making dummy functions for metadata, name, and refdims that returns an empty tuple.