Skip to content

Evizero/CachedArrays.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CachedArrays

Build Status codecov.io

CachedArrays.jl provides a couple of array decorator types that buffer intermediate result when getindex is invoked. This is mainly useful in the combination with other lazy array decorators such as MappedArrays.jl.

Usage

julia> using CachedArrays, MappedArrays

julia> function foo(x)
           println("# expensive computation on ", x)
           x^2
       end

julia> A = mappedarray(foo, [1 2; 3 4]);

julia> B = cachedarray(A);

julia> size(B)
(2, 2)

julia> B[1,2]
# expensive computation on 2
4

julia> B[1,2]
4

julia> B[2,2]
# expensive computation on 4
16

julia> collect(B)
# expensive computation on 1
# expensive computation on 3
2×2 Array{Int64,2}:
 1   4
 9  16

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages