'use strict';

/**
* Blas level 1 routine to multiply `x` and a constant and add the result to `y`.
*
* @module @stdlib/math/base/blas/daxpy
*
* @example
* var daxpy = require( '@stdlib/math/base/blas/daxpy' );
*
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* var y = new Float64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] );
* var alpha = 5.0;
*
* daxpy( x.length, alpha, x, 1, y, 1 );
* // y => <Float64Array>[ 6.0, 11.0, 16.0, 21.0, 26.0 ]
*
*
* @example
* var daxpy = require( '@stdlib/math/base/blas/daxpy' );
*
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* var y = new Float64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] );
* var alpha = 5.0;
*
* daxpy.ndarray( x.length, alpha, x, 1, 0, y, 1, 0 );
* // y => <Float64Array>[ 6.0, 11.0, 16.0, 21.0, 26.0 ]
*
* @example
* // Use the `wasm` interface:
* var wasm = require( '@stdlib/math/base/blas/daxpy' ).wasm;
*
* // Number of data elements:
* var N = 5;
*
* // Allocate space on the heap:
* var xbytes = wasm.malloc( N * 8 ); // 8 bytes per double
* var ybytes = wasm.malloc( N * 8 );
*
* // Create Float64Array views:
* var x = new Float64Array( xbytes.buffer, xbytes.byteOffset, N );
* var y = new Float64Array( ybytes.buffer, ybytes.byteOffset, N );
*
* // Copy data to the heap:
* x.set( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* y.set( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] );
*
* // Multiply and add:
* daxpy( N, 5.0, xbytes, 1, ybytes, 1 );
*
* // Extract the results from the heap:
* var z = new Float64Array( N );
* var i;
* for ( i = 0; i < N; i++ ) {
*     z[ i ] = y[ i ];
* }
* // z => <Float64Array>[ 6.0, 11.0, 16.0, 21.0, 26.0 ]
*
* // Free the memory:
* wasm.free( xbytes );
* wasm.free( ybytes );
*/

// MODULES //

var join = require( 'path' ).join;
var isBrowser = require( '@stdlib/utils/is-browser' );
var tryRequire = require( '@stdlib/utils/try-require' );
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
var wasm = require( './wasm.js' );


// MAIN //

var daxpy;
if ( isBrowser ) {
	daxpy = require( './main.js' );
} else {
	daxpy = tryRequire( join( __dirname, './native.js' ) );
	if ( daxpy instanceof Error ) {
		daxpy = require( './main.js' );
	}
}
setReadOnly( daxpy, 'wasm', wasm );


// EXPORTS //

module.exports = daxpy;

'use strict';

/**
* Blas level 1 routine to multiply `x` and a constant and add the result to `y`.
*
* @module @stdlib/math/base/blas/daxpy
*
* @example
* var daxpy = require( '@stdlib/math/base/blas/daxpy' );
*
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* var y = new Float64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] );
* var alpha = 5.0;
*
* daxpy( x.length, alpha, x, 1, y, 1 );
* // y => <Float64Array>[ 6.0, 11.0, 16.0, 21.0, 26.0 ]
*
*
* @example
* var daxpy = require( '@stdlib/math/base/blas/daxpy' );
*
* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* var y = new Float64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] );
* var alpha = 5.0;
*
* daxpy.ndarray( x.length, alpha, x, 1, 0, y, 1, 0 );
* // y => <Float64Array>[ 6.0, 11.0, 16.0, 21.0, 26.0 ]
*
* @example
* // Use the `wasm` interface:
* var wasm = require( '@stdlib/math/base/blas/daxpy' ).wasm;
*
* // Number of data elements:
* var N = 5;
*
* // Allocate space on the heap:
* var xbytes = wasm.malloc( N * 8 ); // 8 bytes per double
* var ybytes = wasm.malloc( N * 8 );
*
* // Create Float64Array views:
* var x = new Float64Array( xbytes.buffer, xbytes.byteOffset, N );
* var y = new Float64Array( ybytes.buffer, ybytes.byteOffset, N );
*
* // Copy data to the heap:
* x.set( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* y.set( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] );
*
* // Multiply and add:
* wasm( N, 5.0, xbytes, 1, ybytes, 1 );
*
* // Extract the results from the heap:
* var z = new Float64Array( N );
* var i;
* for ( i = 0; i < N; i++ ) {
*     z[ i ] = y[ i ];
* }
* // z => <Float64Array>[ 6.0, 11.0, 16.0, 21.0, 26.0 ]
*
* // Free the memory:
* wasm.free( xbytes );
* wasm.free( ybytes );
*/

// MODULES //

var join = require( 'path' ).join;
var isBrowser = require( '@stdlib/utils/is-browser' );
var tryRequire = require( '@stdlib/utils/try-require' );
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
var wasm = require( './wasm.js' );


// MAIN //

var daxpy;
if ( isBrowser ) {
	daxpy = require( './main.js' );
} else {
	daxpy = tryRequire( join( __dirname, './native.js' ) );
	if ( daxpy instanceof Error ) {
		daxpy = require( './main.js' );
	}
}
setReadOnly( daxpy, 'wasm', wasm );


// EXPORTS //

module.exports = daxpy;

Fix function name