lu-rescaling.map-operations
merge-into-cross-map
(merge-into-cross-map source-map target-maps)
Returns a cross map of values.
source-map: A source hash-map, whose keys are identifiers.
target-maps: A list of hash-maps with reference values.
returns: A hash-map with values from the source map as keys
and values from the other maps which are located
at the same positions as values.
## Usage
(require '[lu-rescaling.map-operations :refer :all])
(def source-map {0 {0 [1 2] 1 [0 1 2] 2 [2]}
1 {0 [0] 2 [0 1]}})
(def target-maps {"id1" {0 {2 [1]} 1 {1 [2]} 2 {1 [0 1] 2 [0]} 3 {0 [0 1 2] 2 [2]}}
"id2" {1 {0 [1 2] 1 [0 1 2]} 2 {0 [0] 2 [0 1 2]}}})
(merge-into-cross-map source-map target-maps)
=> {0 {"id1" [3 3 2 2 1 3]
"id2" [1 1 1 1 1 2]}
1 {"id1" [3 2 0]
"id2" [2 2 2]}}
reverse-map
(reverse-map source-map)
Returns a reversed map with position keys.
source-map: A map with value keys.
returns: A reversed hash-map with position keys.
## Usage
(require '[lu-rescaling.map-operations :refer :all])
(def map {1 {0 [0 1 2] 1 [1]}
2 {1 [0] 2 [1 2]}
3 {1 [2] 2 [0]}})
(reverse-map map)
=> {[0 0] 1
[0 1] 1
[0 2] 1
[1 0] 2
[1 1] 1
[1 2] 3
[2 0] 3
[2 2] 2}