Skip to content

Latest commit

 

History

History
262 lines (157 loc) · 9.51 KB

File metadata and controls

262 lines (157 loc) · 9.51 KB
About stdlib...

We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.

The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.

When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.

To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

rowcat

NPM version Build Status Coverage Status

Concatenate a list of one-dimensional or two-dimensional ndarrays as rows.

Usage

import rowcat from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-rowcat@deno/mod.js';

You can also import the following named exports from the package:

import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-rowcat@deno/mod.js';

rowcat( arrays )

Concatenates a list of one-dimensional or two-dimensional ndarrays as rows.

import array from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-array@deno/mod.js';

var x = array( [ 1.0, 2.0, 3.0 ] );
// returns <ndarray>[ 1.0, 2.0, 3.0 ]

var y = array( [ [ 4.0, 5.0, 6.0 ], [ 7.0, 8.0, 9.0 ] ] );
// returns <ndarray>[ [ 4.0, 5.0, 6.0 ], [ 7.0, 8.0, 9.0 ] ]

var out = rowcat( [ x, y ] );
// returns <ndarray>[ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ], [ 7.0, 8.0, 9.0 ] ]

The function accepts the following arguments:

rowcat.assign( arrays, out )

Concatenates a list of one-dimensional or two-dimensional ndarrays as rows and assigns results to a provided output ndarray.

import array from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-array@deno/mod.js';
import zeros from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-zeros@deno/mod.js';

var x = array( [ 1.0, 2.0, 3.0 ] );
// returns <ndarray>[ 1.0, 2.0, 3.0 ]

var y = array( [ [ 4.0, 5.0, 6.0 ], [ 7.0, 8.0, 9.0 ] ] );
// returns <ndarray>[ [ 4.0, 5.0, 6.0 ], [ 7.0, 8.0, 9.0 ] ]

var z = zeros( [ 3, 3 ] );
// returns <ndarray>[ [ 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0 ] ]

var out = rowcat.assign( [ x, y ], z );
// returns <ndarray>[ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ], [ 7.0, 8.0, 9.0 ] ]

var bool = ( out === z );
// returns true

The function accepts the following arguments:

  • One-dimensional input ndarrays having length N are promoted to two-dimensional ndarrays having shape [1, N].
  • Input ndarrays must have the same number of columns.

Examples

import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-discrete-uniform@deno/mod.js';
import ndarray2array from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-to-array@deno/mod.js';
import rowcat from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-rowcat@deno/mod.js';

var x = discreteUniform( [ 3 ], 0, 10, {
    'dtype': 'generic'
});
console.log( ndarray2array( x ) );

var y = discreteUniform( [ 2, 3 ], 0, 10, {
    'dtype': 'generic'
});
console.log( ndarray2array( y ) );

var out = rowcat( [ x, y ] );
console.log( ndarray2array( out ) );

Notice

This package is part of stdlib, a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2026. The Stdlib Authors.