npm install blas-dcopydcopy
===
[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url]
> Copies elements from x into y.
`` bash`
$ npm install blas-dcopy
` javascript`
var copy = require( 'blas-dcopy' );
#### copy( N, x, strideX, offsetX, y, strideY, offsetY )
Copies elements from x into y.
` javascript
var x = [ 1, 2, 3, 4, 5 ];
var y = [ 6, 7, 8, 9, 10 ];
copy( x.length, x, 1, 0, y, 1, 0 );
// y => [ 1, 2, 3, 4, 5 ]
`
The function accepts the following parameters:array
* __N__: number of elements to copy.
* __x__: input [][array] or [typed array][typed-array].x
* __strideX__: index increment for .x
* __offsetX__: starting index for .array
* __y__: destination [][array] or [typed array][typed-array].y
* __strideY__: index increment for .y
* __offsetY__: starting index for .
The N, stride, and offset parameters determine how elements from x are copied into y. For example, to copy every other element in x starting from the second element into the last N elements in y where x[i] = y[n], x[i+2] = y[n-1],...,
` javascript
var x = [ 1, 2, 3, 4, 5, 6 ];
var y = [ 7, 8, 9, 10, 11, 12 ];
var N = Math.floor( x.length / 2 );
copy( N, x, 2, 1, y, -1, y.length-1 );
// y => [ 7, 8, 9, 6, 4, 2 ]
`
If N <= 0, the function returns undefined.
* This module corresponds to the [BLAS][blas] level 1 function [dcopy][dcopy].
` javascript
var copy = require( 'blas-dcopy' );
var x;
var y;
var i;
x = new Float64Array( 10 );
y = new Uint8ClampedArray( 10 );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = Math.round( Math.random()*500 );
y[ i ] = Math.round( Math.random()*255 );
}
console.log( x );
console.log( y );
// Copy elements from x into y starting from the end of y:`
copy( x.length, x, 1, 0, y, -1, y.length-1 );
console.log( y );
To run the example code from the top-level application directory,
` bash`
$ node ./examples/index.js
---
This repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory:
` bash`
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
` bash`
$ make test-cov
Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,
` bash`
$ make view-cov
This repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:
` bash`
$ make test-browsers
To view the tests in a local web browser,
` bash``
$ make view-browser-tests
---
Copyright © 2016. The [Compute.io][compute-io] Authors.
[npm-image]: http://img.shields.io/npm/v/blas-dcopy.svg
[npm-url]: https://npmjs.org/package/blas-dcopy
[build-image]: http://img.shields.io/travis/compute-io/blas-dcopy/master.svg
[build-url]: https://travis-ci.org/compute-io/blas-dcopy
[coverage-image]: https://img.shields.io/codecov/c/github/compute-io/blas-dcopy/master.svg
[coverage-url]: https://codecov.io/github/compute-io/blas-dcopy?branch=master
[dependencies-image]: http://img.shields.io/david/compute-io/blas-dcopy.svg
[dependencies-url]: https://david-dm.org/compute-io/blas-dcopy
[dev-dependencies-image]: http://img.shields.io/david/dev/compute-io/blas-dcopy.svg
[dev-dependencies-url]: https://david-dm.org/dev/compute-io/blas-dcopy
[github-issues-image]: http://img.shields.io/github/issues/compute-io/blas-dcopy.svg
[github-issues-url]: https://github.com/compute-io/blas-dcopy/issues
[tape]: https://github.com/substack/tape
[istanbul]: https://github.com/gotwarlost/istanbul
[testling]: https://ci.testling.com
[compute-io]: https://github.com/compute-io/
[blas]: http://www.netlib.org/blas
[dcopy]: http://www.netlib.org/lapack/explore-html/de/da4/group__double__blas__level1.html
[array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
[typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray