Skip to content

Commit

Permalink
Allow sort/sort! for datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Oct 3, 2022
1 parent 70d1ef4 commit 986749e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DelayEmbeddings"
uuid = "5732040d-69e3-5649-938a-b6b4f237613f"
repo = "https://github.com/JuliaDynamics/DelayEmbeddings.jl.git"
version = "2.3.2"
version = "2.3.3"

[deps]
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
Expand Down
10 changes: 9 additions & 1 deletion src/datasets/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ export minmaxima, columns, standardize, dimension

abstract type AbstractDataset{D, T} end

# TODO: Many of these extensions can be wrapped in a simple block like:
# for f in (:length, :size, :eachindex, :eltype,
# :lastindex, :firstindex, :vec, :getindex, :iterate)
# @eval Base.$(f)(d::AbsractDataset, args...) = $(f)(d.data, args...)
# end


"""
dimension(thing) -> D
Return the dimension of the `thing`, in the sense of state-space dimensionality.
Expand All @@ -15,7 +22,8 @@ Base.eltype(::AbstractDataset{D,T}) where {D,T} = T
Base.:(==)(d1::AbstractDataset, d2::AbstractDataset) = d1.data == d2.data
Base.vec(d::AbstractDataset) = d.data
Base.copy(d::AbstractDataset) = typeof(d)(copy(d.data))

Base.sort(d::AbstractDataset) = sort!(copy(d))
Base.sort!(d::AbstractDataset) = sort!(d.data)

# Size:
@inline Base.length(d::AbstractDataset) = length(d.data)
Expand Down

0 comments on commit 986749e

Please sign in to comment.