Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

flatten

Lindsey Kuper edited this page Feb 9, 2015 · 4 revisions

Description

flatten flattens an n-dimensional ParallelArray to n-1 dimensions. It takes no arguments and returns a new ParallelArray whose outermost two dimensions have been collapsed into one.

Synopsis

myParallelArray.flatten()

Arguments

None.

Returns

A freshly minted ParallelArray whose outermost two dimensions have been collapsed into one.

Examples

var pa = new ParallelArray([ [1,2], [3,4] ]); // `pa` has shape [2,2]
var paFlat = pa.flatten(); // `paFlat` has shape [4]

var pa1 = new ParallelArray([ [ [1, 1], [2, 2] ], [ [3, 3], [4, 4] ] ]); // `pa1` has shape [2,2,2]
var pa1Flat = pa1.flatten(); // `pa1Flat` has shape [4,2]; its first element is [1, 1]
Clone this wiki locally