JSPM

ndarray-concat-rows

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 122
  • Score
    100M100P100Q84245F
  • License MIT

Concatenate ndarrays by row (along the first dimension)

Package Exports

  • ndarray-concat-rows

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ndarray-concat-rows) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ndarray-concat-rows Build Status npm version js-standard-style

Concatenate ndarrays by row (along the first dimension)

Introduction

This module takes a list of input ndarrays and concatenates it along the first dimension. That is, a 3 × 2 ndarray concatenated with a 10 × 2 ndarray yields a 13 × 2 ndarray.

Examples

Understanding (+) in the comments below to indicate row concatenation,

var ndarray = require('ndarray')
var r = require('ndarray-concat-rows')

// Concatenating vectors:
//   [1 2] (+) [3 4] -> [1 2 3 4]
//
r([ ndarray([1, 2]), ndarray([3, 4]) ])
// => ndarray([1, 2, 3, 4])

// Concatenating matrices:
//                       [1  2]
//   [1 2]     [5  6]    [3  4]
//   [3 4] (+) [7  8] -> [4  5]
//             [9 10]    [7  8]
//                       [9 10]
//
r([ ndarray([1, 2, 3, 4], [2, 2]), ndarray([5, 6, 7, 8, 9, 10], [3, 2]) ])
// => ndarray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [5, 2])

Installation

$ npm install ndarray-concat-rows

API

require('ndarray-concat-rows')([output,] input, [options])

Arguments:

  • output (optional): An optional output destination. The shape must match the shape of the concatenated arrays, otherwise an error will be thrown. If not provided, storage will be allocated using ndarray-scratch.
  • input: A javascript Array containing ndarrays to be concatenated. If this is missing or empty, an error will be thrown. Given n-dimensional input, all arguments must have the same dimensionality and the last n-1 dimensions of each arguments must have the same length.
  • options (optional): An optional object containing options. Options are:
    • dtype: If no output ndarray is provided, the dtype of the output will be double (equivalently float64) by default, or otherwise the dtype specified here. See ndarray dtypes.

Returns: A reference to the output ndarray containing the concatenated data.

License

© 2016 Ricky Reusser. MIT License.