Skip to content
This repository has been 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

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

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