Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evizero/cachedarrays.jl
https://github.com/evizero/cachedarrays.jl
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/evizero/cachedarrays.jl
- Owner: Evizero
- License: other
- Created: 2018-03-20T14:01:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-23T12:18:09.000Z (almost 7 years ago)
- Last Synced: 2024-10-11T14:51:18.446Z (3 months ago)
- Language: Julia
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CachedArrays
[![Build Status](https://travis-ci.org/Evizero/CachedArrays.jl.svg?branch=master)](https://travis-ci.org/Evizero/CachedArrays.jl)
[![codecov.io](http://codecov.io/github/Evizero/CachedArrays.jl/coverage.svg?branch=master)](http://codecov.io/github/Evizero/CachedArrays.jl?branch=master)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](https://github.com/JuliaArrays/MappedArrays.jl).## Usage
```julia
julia> using CachedArrays, MappedArraysjulia> function foo(x)
println("# expensive computation on ", x)
x^2
endjulia> A = mappedarray(foo, [1 2; 3 4]);
julia> B = cachedarray(A);
julia> size(B)
(2, 2)julia> B[1,2]
# expensive computation on 2
4julia> B[1,2]
4julia> B[2,2]
# expensive computation on 4
16julia> collect(B)
# expensive computation on 1
# expensive computation on 3
2×2 Array{Int64,2}:
1 4
9 16
```