Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function main( context ) {
node.arguments.length > 0
Comment thread
Planeshifter marked this conversation as resolved.
) {
args = node.arguments;
lastElem = args[ args.length-1 ];
lastElem = args[ args.length - 1 ];
if (
lastElem &&
lastElem.type === 'ObjectExpression' &&
Expand All @@ -105,7 +105,7 @@ function main( context ) {
lastElem.type === 'ArrayExpression' &&
lastElem.elements.length > 0
) {
elem = lastElem.elements[ lastElem.elements.length-1 ];
elem = lastElem.elements[ lastElem.elements.length - 1 ];
if (
elem &&
elem.type === 'ObjectExpression' &&
Expand Down Expand Up @@ -138,7 +138,7 @@ function main( context ) {
node.type === 'ArrayExpression' &&
node.elements.length > 0
) {
elem = node.elements[ node.elements.length-1 ];
elem = node.elements[ node.elements.length - 1 ];
if (
elem &&
elem.type === 'ObjectExpression' &&
Expand Down
65 changes: 65 additions & 0 deletions lib/node_modules/@stdlib/blas/base/ndarray/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

Comment thread
Planeshifter marked this conversation as resolved.
import caxpy = require( '@stdlib/blas/base/ndarray/caxpy' );
import ccopy = require( '@stdlib/blas/base/ndarray/ccopy' );
import cscal = require( '@stdlib/blas/base/ndarray/cscal' );
import cswap = require( '@stdlib/blas/base/ndarray/cswap' );
import dasum = require( '@stdlib/blas/base/ndarray/dasum' );
import daxpy = require( '@stdlib/blas/base/ndarray/daxpy' );
Expand All @@ -33,6 +34,7 @@ import gasum = require( '@stdlib/blas/base/ndarray/gasum' );
import gaxpy = require( '@stdlib/blas/base/ndarray/gaxpy' );
import gcopy = require( '@stdlib/blas/base/ndarray/gcopy' );
import gdot = require( '@stdlib/blas/base/ndarray/gdot' );
import gscal = require( '@stdlib/blas/base/ndarray/gscal' );
import gswap = require( '@stdlib/blas/base/ndarray/gswap' );
import sasum = require( '@stdlib/blas/base/ndarray/sasum' );
import saxpy = require( '@stdlib/blas/base/ndarray/saxpy' );
Expand Down Expand Up @@ -109,6 +111,38 @@ interface Namespace {
*/
ccopy: typeof ccopy;

/**
* Multiplies a one-dimensional single-precision complex floating-point ndarray by a scalar constant.
*
* ## Notes
*
* - The function expects the following ndarrays:
*
* - a one-dimensional input ndarray.
* - a zero-dimensional ndarray containing a scalar constant.
*
* @param arrays - array-like object containing ndarrays
* @returns input ndarray
*
* @example
* var Complex64Vector = require( '@stdlib/ndarray/vector/complex64' );
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
*
* var x = new Complex64Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
*
* var alpha = scalar2ndarray( new Complex64( 2.0, 0.0 ), {
* 'dtype': 'complex64'
* });
*
* var y = ns.cscal( [ x, alpha ] );
* // returns <ndarray>[ <Complex64>[ 2.0, 4.0 ], <Complex64>[ 6.0, 8.0 ], <Complex64>[ 10.0, 12.0 ] ]
*
* var bool = ( y === x );
* // returns true
*/
cscal: typeof cscal;

/**
* Interchanges two one-dimensional single-precision complex floating-point ndarrays.
*
Expand Down Expand Up @@ -408,6 +442,37 @@ interface Namespace {
*/
gdot: typeof gdot;

/**
* Multiplies a one-dimensional ndarray by a scalar constant.
*
* ## Notes
*
* - The function expects the following ndarrays:
*
* - a one-dimensional input ndarray.
* - a zero-dimensional ndarray containing a scalar constant.
*
* @param arrays - array-like object containing ndarrays
* @returns input ndarray
*
* @example
* var vector = require( '@stdlib/ndarray/vector/ctor' );
* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
*
* var x = vector( [ 1.0, 2.0, 3.0, 4.0, 5.0 ], 'generic' );
*
* var alpha = scalar2ndarray( 5.0, {
* 'dtype': 'generic'
* });
*
* var y = ns.gscal( [ x, alpha ] );
* // returns <ndarray>[ 5.0, 10.0, 15.0, 20.0, 25.0 ]
*
* var bool = ( y === x );
* // returns true
*/
gscal: typeof gscal;

/**
* Interchanges two one-dimensional ndarrays.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ The function has the following parameters:
- **strideX**: stride length for `x`.
- **offsetX**: starting index for `x`.
- **out**: output [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
- **strideOut1**: stride length for the first dimension of `out`.
- **strideOut2**: stride length for the second dimension of `out`.
- **strideOut1**: stride length of the first dimension of `out`.
- **strideOut2**: stride length of the second dimension of `out`.
- **offsetOut**: starting index for `out`.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to access only the last two elements:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var K = 2;
// FUNCTIONS //

/**
* Creates a benchmark function.
* Create a benchmark function.
Comment thread
Planeshifter marked this conversation as resolved.
Outdated
*
* @private
* @param {PositiveInteger} len - array length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var K = 2;
// FUNCTIONS //

/**
* Creates a benchmark function.
* Create a benchmark function.
Comment thread
Planeshifter marked this conversation as resolved.
Outdated
*
* @private
* @param {PositiveInteger} len - array length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

# dcorrelation

> Calculate the [correlation distance][correlation-distance] between two double-precision floating-point strided arrays.
> Compute the [correlation distance][correlation-distance] between two double-precision floating-point strided arrays.

<section class="intro">

Expand All @@ -36,8 +36,6 @@ D(X, Y) = 1 - \frac{\displaystyle\sum_{i=0}^{N-1} (x_i - \bar{x})(y_i - \bar{y})

where `x_i` and `y_i` are the _ith_ components of vectors **X** and **Y**, respectively.

<!-- </equation> -->


</section>

Expand All @@ -53,7 +51,7 @@ var dcorrelation = require( '@stdlib/stats/strided/distances/dcorrelation' );

#### dcorrelation( N, x, strideX, y, strideY )

Computes the [correlation distance][correlation-distance] of two double-precision floating-point strided arrays.
Computes the [correlation distance][correlation-distance] between two double-precision floating-point strided arrays.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -104,7 +102,7 @@ var c = dcorrelation( 4, x1, 2, y1, 2 );

#### dcorrelation.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )

Computes the [correlation distance][correlation-distance] of two double-precision floating-point strided arrays using alternative indexing semantics.
Computes the [correlation distance][correlation-distance] between two double-precision floating-point strided arrays using alternative indexing semantics.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Indexing is relative to the first index. To introduce an offset, use a typed
array view.

If `N <= 0`, the function returns `NaN`.
If `N <= 1`, the function returns `NaN`.
Comment thread
Planeshifter marked this conversation as resolved.
Outdated

Parameters
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ import dcorrelation = require( './index' );
dcorrelation.ndarray( x.length, x ); // $ExpectError
dcorrelation.ndarray( x.length, x, 1 ); // $ExpectError
dcorrelation.ndarray( x.length, x, 1, 0 ); // $ExpectError
dcorrelation.ndarray( x.length, x, 1, 0 ); // $ExpectError
dcorrelation.ndarray( x.length, x, 1, 0, y ); // $ExpectError
dcorrelation.ndarray( x.length, x, 1, 0, y, 1 ); // $ExpectError
dcorrelation.ndarray( x.length, x, 1, 0, y, 1, 0, 0 ); // $ExpectError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

#ifndef STDLIB_STATS_STRIDED_DCORRELATION_H
#define STDLIB_STATS_STRIDED_DCORRELATION_H
#ifndef STDLIB_STATS_STRIDED_DISTANCES_DCORRELATION_H
#define STDLIB_STATS_STRIDED_DISTANCES_DCORRELATION_H

#include "stdlib/blas/base/shared.h"

Expand All @@ -42,4 +42,4 @@ double API_SUFFIX(stdlib_strided_dcorrelation_ndarray)( const CBLAS_INT N, const
}
#endif

#endif // !STDLIB_STATS_STRIDED_DCORRELATION_H
#endif // !STDLIB_STATS_STRIDED_DISTANCES_DCORRELATION_H
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

Comment thread
Planeshifter marked this conversation as resolved.
import dchebyshev = require( '@stdlib/stats/strided/distances/dchebyshev' );
import dcityblock = require( '@stdlib/stats/strided/distances/dcityblock' );
import dcorrelation = require( '@stdlib/stats/strided/distances/dcorrelation' );
import dcosineDistance = require( '@stdlib/stats/strided/distances/dcosine-distance' );
import dcosineSimilarity = require( '@stdlib/stats/strided/distances/dcosine-similarity' );
import deuclidean = require( '@stdlib/stats/strided/distances/deuclidean' );
Expand Down Expand Up @@ -92,6 +93,36 @@ interface Namespace {
*/
dcityblock: typeof dcityblock;

/**
* Computes the correlation distance between two double-precision floating-point strided arrays.
*
* @param N - number of indexed elements
* @param x - first input array
* @param strideX - `x` stride length
* @param y - second input array
* @param strideY - `y` stride length
* @returns correlation distance
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
* var y = new Float64Array( [ 2.0, -2.0, 1.0 ] );
*
* var z = ns.dcorrelation( x.length, x, 1, y, 1 );
* // returns ~0.115
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
* var y = new Float64Array( [ 2.0, -2.0, 1.0 ] );
*
* var z = ns.dcorrelation.ndarray( x.length, x, 1, 0, y, 1, 0 );
* // returns ~0.115
*/
dcorrelation: typeof dcorrelation;

/**
* Computes the cosine distance between two double-precision floating-point strided arrays.
*
Expand Down