Repos.jl

An array-style data structure that allows to organize the array elements in numbered "classes"
Author bridgewalker
Popularity
2 Stars
Updated Last
3 Years Ago
Started In
August 2020

Repos.jl

Repos provides a highly efficient data structure (Repo) that can be used for organizing data into a set of "classes".

Repo behaves like an array, where you can additionally assign each element of the array to a "class". You can dynamically change the an element's class, find out how many elements are in a certain class, iterate through the elements in a given class or pick a single element from a class (e.g. at random).

Importantly, the time required for these operations is independent of the number of elements stored in Repo and only linearly increases with the number of classes. Thereby Repo enables extremely fast (linear time) agent-based simulations.

Example

julia> using Repos

julia> a=["Pepsis grossa","Smilodon populator","Nothrotheriops texanus","Phoberomys pattersoni"]
4-element Array{String,1}:
 "Pepsis grossa"
 "Smilodon populator"
 "Nothrotheriops texanus"
 "Phoberomys pattersoni"

julia> animals=Repo(a,2)
Repository of 4 objects in 2 classes

julia> alive=class(animals,2)
Class of 0 objects

julia> setclass!(animals,1,2)

julia> print_repo(animals)
Repository of 2 classes
  Class 1
    1 - 4: Phoberomys pattersoni
    2 - 2: Smilodon populator
    3 - 3: Nothrotheriops texanus
  Class 2
    1 - 1: Pepsis grossa

julia> print_repo(alive)
Class of 1 objects
    1 - 1: Pepsis grossa

julia> alive[1]
"Pepsis grossa"

Installation

Install with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and

pkg> add Repos

Alternatively from Julia

julia> import Pkg

julia> Pkg.add("Repos")

Documentation

Full documentation can be found here: https://bridgewalker.github.io/Repos.jl

Project Status

This package was tested on Julia 1.4.2 on Windows.

Acknowledgements

The original development of Repo was supported by the Volkswagen foundation. The current implementation in Julia was developed at HIFMB, a collaboration between the Alfred-Wegener-Institute, Helmholtz-Center for Polar and Marine Research, and the Carl-von-Ossietzky University Oldenburg, initially funded by the Ministry for Science and Culture of Lower Saxony (MWK) and the Volkswagen Foundation through the “Niedersächsisches Vorab” grant program (grant number ZN3285).

Required Packages

No packages found.

Used By Packages