Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

gcopy

Copy values from a one-dimensional ndarray x into a one-dimensional ndarray y.

Usage

var gcopy = require( '@stdlib/blas/base/ndarray/gcopy' );

gcopy( arrays )

Copies values from a one-dimensional ndarray x into a one-dimensional ndarray y.

var vector = require( '@stdlib/ndarray/vector/ctor' );

var x = vector( [ 1.0, 2.0, 3.0, 4.0, 5.0 ], 'generic' );
var y = vector( [ 0.0, 0.0, 0.0, 0.0, 0.0 ], 'generic' );

var z = gcopy( [ x, y ] );
// returns <ndarray>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]

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

The function has the following parameters:

  • arrays: array-like object containing the following ndarrays:

    • a one-dimensional input ndarray.
    • a one-dimensional output ndarray.

Examples

var discreteUniform = require( '@stdlib/random/discrete-uniform' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var gcopy = require( '@stdlib/blas/base/ndarray/gcopy' );

var opts = {
    'dtype': 'generic'
};

var x = discreteUniform( [ 10 ], 0, 100, opts );
console.log( ndarray2array( x ) );

var y = discreteUniform( [ 10 ], 0, 10, opts );
console.log( ndarray2array( y ) );

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