Skip to content

Julia array type supporting a default value, useful for storing very sparse information in a space efficient manner, the internal design uses "Dict" for storage, thanks to Tamas K. Papp @ https://github.com/tpapp

License

Notifications You must be signed in to change notification settings

francescoalemanno/DefaultArrays.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DefaultArrays

Build Status

codecov

Coverage Status

Docs

Julia array type supporting a default value, useful for storing very sparse information in a space efficient manner, the internal design uses "Dict" for storage

Installation:

Since this package is now registered do:

using Pkg; pkg"add DefaultArrays";

Usage:

It can be used like any other common julia array:

M=DefaultArray(0.0,100,100) #0.0 is the default value
M.=rand([zeros(50);1],100,100)

for i in eachnondefault(M)
    M[i]=rand()
end
Q=sin.(M)

sum(Q)  #->  some random value
length(Q.elements) #-> MUCH less space occupied than 100*100 = 10000

original idea of Tamas K. Papp @ https://github.com/tpapp

About

Julia array type supporting a default value, useful for storing very sparse information in a space efficient manner, the internal design uses "Dict" for storage, thanks to Tamas K. Papp @ https://github.com/tpapp

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages