Chris@165: Chris@165: module yetilab.stream.test.test_channels; Chris@165: Chris@165: ch = load yetilab.stream.channels; Chris@165: mat = load yetilab.matrix.matrix; Chris@165: bl = load yetilab.block.block; Chris@165: Chris@165: { compare, compareUsing } = load yetilab.test.test; Chris@165: Chris@165: newMatrix data = mat.newMatrix (ColumnMajor ()) (map bl.fromList data); Chris@165: Chris@165: compareBlocks b1 b2 = Chris@165: compare (bl.list b1) (bl.list b2); Chris@165: Chris@165: [ Chris@165: Chris@165: "interleaved": \( Chris@165: compareBlocks (ch.interleaved (newMatrix [[1,4],[2,5],[3,6]])) Chris@165: (bl.fromList [1,4,2,5,3,6]) and Chris@165: compareBlocks (ch.interleaved (newMatrix [[1],[2],[3]])) Chris@165: (bl.fromList [1,2,3]) Chris@165: ), Chris@165: Chris@165: "deinterleaved": \( Chris@165: compareUsing mat.equal (ch.deinterleaved 2 (bl.fromList [1,4,2,5,3,6])) Chris@165: (newMatrix [[1,4],[2,5],[3,6]]) and Chris@165: compareUsing mat.equal (ch.deinterleaved 1 (bl.fromList [1,2,3])) Chris@165: (newMatrix [[1],[2],[3]]) Chris@165: ), Chris@165: Chris@165: "mixedDown": \( Chris@165: compareBlocks (ch.mixedDown (newMatrix [[1,4],[2,5],[3,6]])) Chris@165: (bl.fromList [5,7,9]) and Chris@165: compareBlocks (ch.mixedDown (newMatrix [])) Chris@165: (bl.fromList []) Chris@165: ), Chris@165: Chris@165: "mixedDownFromInterleaved": \( Chris@165: compareBlocks (ch.mixedDownFromInterleaved 2 (bl.fromList [1,4,2,5,3,6])) Chris@165: (bl.fromList [5,7,9]) and Chris@165: compareBlocks (ch.mixedDownFromInterleaved 1 (bl.fromList [1,2,3])) Chris@165: (bl.fromList [1,2,3]) Chris@165: ), Chris@165: Chris@165: "mixedFromInterleavedTo": \( Chris@165: compareBlocks (ch.mixedFromInterleavedTo 1 2 (bl.fromList [1,4,2,5,3,6])) Chris@165: (bl.fromList [5,7,9]) and Chris@165: compareBlocks (ch.mixedFromInterleavedTo 2 2 (bl.fromList [1,4,2,5,3,6])) Chris@165: (bl.fromList [1,4,2,5,3,6]) and Chris@165: compareBlocks (ch.mixedFromInterleavedTo 3 2 (bl.fromList [1,4,2,5,3,6])) Chris@165: (bl.fromList [1,4,0,2,5,0,3,6,0]) and Chris@165: compareBlocks (ch.mixedFromInterleavedTo 1 1 (bl.fromList [1,2,3])) Chris@165: (bl.fromList [1,2,3]) and Chris@165: compareBlocks (ch.mixedFromInterleavedTo 2 1 (bl.fromList [1,2,3])) Chris@165: (bl.fromList [1,1,2,2,3,3]) and Chris@165: compareBlocks (ch.mixedFromInterleavedTo 3 1 (bl.fromList [1,2,3])) Chris@165: (bl.fromList [1,1,0,2,2,0,3,3,0]) Chris@165: ), Chris@165: Chris@165: "mixedAndInterleavedTo": \( Chris@165: compareBlocks (ch.mixedAndInterleavedTo 1 (newMatrix [[1,4],[2,5],[3,6]])) Chris@165: (bl.fromList [5,7,9]) and Chris@165: compareBlocks (ch.mixedAndInterleavedTo 2 (newMatrix [[1,4],[2,5],[3,6]])) Chris@165: (bl.fromList [1,4,2,5,3,6]) and Chris@165: compareBlocks (ch.mixedAndInterleavedTo 3 (newMatrix [[1,4],[2,5],[3,6]])) Chris@165: (bl.fromList [1,4,0,2,5,0,3,6,0]) and Chris@165: compareBlocks (ch.mixedAndInterleavedTo 1 (newMatrix [[1],[2],[3]])) Chris@165: (bl.fromList [1,2,3]) and Chris@165: compareBlocks (ch.mixedAndInterleavedTo 2 (newMatrix [[1],[2],[3]])) Chris@165: (bl.fromList [1,1,2,2,3,3]) and Chris@165: compareBlocks (ch.mixedAndInterleavedTo 3 (newMatrix [[1],[2],[3]])) Chris@207: (bl.fromList [1,1,1,2,2,2,3,3,3]) Chris@165: ), Chris@165: Chris@165: ] is hash boolean>; Chris@165: Chris@165: