Home

Awesome

ndarray-tile Build Status npm version js-standard-style

Repeat an ndarray

Introduction

This module takes an input ndarray and repeats it some number of times in each dimension.

Examples

var tile = require('ndarray-tile')
var ndarray = require('ndarray')

// Repeat a vector:
tile(ndarray(new Float64Array([1, 2, 3])), [2])
// => 1 2 3 1 2 3


// Repeat a vector in a second dimension:
tile(ndarray(new Float64Array([1, 2, 3])), [1, 2])
// => 1 1
//    2 2
//    3 3


// Tile a matrix in two dimensions:
tile(ndarray(new Float64Array([1, 2, 3, 4]), 2, 2]), [2, 2])
// => 1 2 1 2
//    3 4 3 4
//    1 2 1 2
//    3 4 3 4

Installation

$ npm install ndarray-tile

API

require('ndarray-tile')([output,] input, reps)

Tile ndarray input a number of times according to reps in each dimension.

Arguments:

Returns: a reference to the tiled output

License

© 2016 Ricky Reusser. MIT License.