https://github.com/juliaarrays/indirectarrays.jl
Julia implementation of indexed or "lookup" arrays
https://github.com/juliaarrays/indirectarrays.jl
Last synced: 22 days ago
JSON representation
Julia implementation of indexed or "lookup" arrays
- Host: GitHub
- URL: https://github.com/juliaarrays/indirectarrays.jl
- Owner: JuliaArrays
- License: other
- Created: 2016-07-20T11:41:43.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T11:22:12.000Z (about 2 years ago)
- Last Synced: 2025-02-16T16:48:18.829Z (over 1 year ago)
- Language: Julia
- Size: 116 KB
- Stars: 19
- Watchers: 5
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# IndirectArrays
[](https://travis-ci.org/JuliaArrays/IndirectArrays.jl)
[](http://codecov.io/github/JuliaArrays/IndirectArrays.jl?branch=master)
An `IndirectArray` is one that encodes data using a combination of an
`index` and a `value` table. Each element is assigned its own index, which
is used to retrieve the value from the `value` table. Concretely, if
`A` is an `IndirectArray`, then `A[i,j...] = value[index[i,j,...]]`.
Among other uses, `IndirectArrays` can represent
[indexed images](https://en.wikipedia.org/wiki/Indexed_color),
sometimes called "colormap images" or "paletted images."
## Installation
```jl
Pkg.add("IndirectArrays")
```
## Usage
For example:
```
using IndirectArrays, Colors
colors = distinguishable_colors(6)
index = rand(1:6, 32, 32)
A = IndirectArray(index, colors)
```

which has only 6 colors in it.
The `value` array can be of any type; it does not have to be color information.
## Related packages
- [CategoricalArrays](https://github.com/nalimilan/CategoricalArrays.jl) offers an even more flexible interface for dealing with arrays in which values are looked up in an index.
- [PooledArrays](https://github.com/JuliaComputing/PooledArrays.jl)