Calculate the dot product of two one-dimensional double-precision floating-point ndarrays.
The dot product (or scalar product) is defined as
var ddot = require( '@stdlib/blas/base/ndarray/ddot' );Computes the dot product of two one-dimensional double-precision floating-point ndarrays.
var Float64Vector = require( '@stdlib/ndarray/vector/float64' );
var x = new Float64Vector( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
var y = new Float64Vector( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
var z = ddot( [ x, y ] );
// returns -5.0The function has the following parameters:
-
arrays: array-like object containing the following ndarrays:
- first one-dimensional input ndarray.
- second one-dimensional input ndarray.
var discreteUniform = require( '@stdlib/random/discrete-uniform' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var ddot = require( '@stdlib/blas/base/ndarray/ddot' );
var opts = {
'dtype': 'float64'
};
var x = discreteUniform( [ 10 ], 0, 500, opts );
console.log( ndarray2array( x ) );
var y = discreteUniform( [ 10 ], 0, 255, opts );
console.log( ndarray2array( y ) );
var out = ddot( [ x, y ] );
console.log( out );