Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
40 changes: 6 additions & 34 deletions lib/node_modules/@stdlib/blas/ext/linspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,8 @@ var linspace = require( '@stdlib/blas/ext/linspace' );
Returns a new [ndarray][@stdlib/ndarray/ctor] filled with linearly spaced values over a specified interval along one or more [ndarray][@stdlib/ndarray/ctor] dimensions.

```javascript
var ndarray2array = require( '@stdlib/ndarray/to-array' );

var x = linspace( [ 4 ], 1.0, 4.0 );
// returns <ndarray>

var arr = ndarray2array( x );
// returns [ 1.0, 2.0, 3.0, 4.0 ]
// returns <ndarray>[ 1.0, 2.0, 3.0, 4.0 ]
```

The function has the following parameters:
Expand All @@ -63,77 +58,54 @@ The function accepts the following options:
By default, the function always includes the end of the interval in the list of values written to an output [ndarray][@stdlib/ndarray/ctor]. To exclude the end of the interval, provide an `endpoint` argument.

```javascript
var ndarray2array = require( '@stdlib/ndarray/to-array' );

var x = linspace( [ 4 ], 1.0, 5.0, false );
// returns <ndarray>

var arr = ndarray2array( x );
// returns [ 1.0, 2.0, 3.0, 4.0 ]
// returns <ndarray>[ 1.0, 2.0, 3.0, 4.0 ]
```

When provided scalar or zero-dimensional [ndarray][@stdlib/ndarray/ctor] `start`, `stop`, and `endpoint` arguments, the values are broadcast across all elements in the shape defined by the complement of those dimensions specified by `options.dims`. To specify separate sub-array configurations, provide non-zero-dimensional [ndarray][@stdlib/ndarray/ctor] arguments.

```javascript
var array = require( '@stdlib/ndarray/array' );
var BooleanArray = require( '@stdlib/array/bool' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );

var start = array( [ 1.0, 5.0 ] );
var end = array( [ 3.0, 8.0 ] );
var endpoint = array( new BooleanArray( [ true, false ] ) );

var x = linspace( [ 2, 3 ], start, end, endpoint );
// returns <ndarray>

var arr = ndarray2array( x );
// returns [ [ 1.0, 2.0, 3.0 ], [ 5.0, 6.0, 7.0 ] ]
// returns <ndarray>[ [ 1.0, 2.0, 3.0 ], [ 5.0, 6.0, 7.0 ] ]
```

By default, the function generates linearly spaced values along the last dimension of an output [ndarray][@stdlib/ndarray/ctor]. To perform the operation over specific dimensions, provide a `dims` option.

```javascript
var ndarray2array = require( '@stdlib/ndarray/to-array' );

var x = linspace( [ 2, 2 ], 1.0, 4.0, {
'dims': [ 0, 1 ]
});
// returns <ndarray>

var arr = ndarray2array( x );
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
// returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
```

To specify the output [ndarray][@stdlib/ndarray/ctor] [data type][@stdlib/ndarray/dtypes], provide a `dtype` option.

```javascript
var ndarray2array = require( '@stdlib/ndarray/to-array' );

var x = linspace( [ 4 ], 1.0, 4.0, {
'dtype': 'float32'
});
// returns <ndarray>

var arr = ndarray2array( x );
// returns [ 1.0, 2.0, 3.0, 4.0 ]
// returns <ndarray>[ 1.0, 2.0, 3.0, 4.0 ]
```

#### linspace.assign( out, start, stop\[, endpoint]\[, options] )

Fills an [ndarray][@stdlib/ndarray/ctor] with linearly spaced values over a specified interval along one or more [ndarray][@stdlib/ndarray/ctor] dimensions.

```javascript
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var zeros = require( '@stdlib/ndarray/zeros' );

var x = zeros( [ 4 ] );
// returns <ndarray>

var out = linspace.assign( x, 1.0, 4.0 );
// returns <ndarray>

var arr = ndarray2array( out );
// returns [ 1.0, 2.0, 3.0, 4.0 ]
// returns <ndarray>[ 1.0, 2.0, 3.0, 4.0 ]

var bool = ( x === out );
// returns true
Expand Down
10 changes: 4 additions & 6 deletions lib/node_modules/@stdlib/blas/ext/linspace/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@

Examples
--------
> var out = {{alias}}( [ 4 ], 1.0, 4.0 );
> {{alias:@stdlib/ndarray/to-array}}( out )
[ 1.0, 2.0, 3.0, 4.0 ]
> var out = {{alias}}( [ 4 ], 1.0, 4.0 )
<ndarray>[ 1.0, 2.0, 3.0, 4.0 ]


{{alias}}.assign( out, start, stop[, endpoint][, options] )
Expand Down Expand Up @@ -220,9 +219,8 @@
Examples
--------
> var x = {{alias:@stdlib/ndarray/zeros}}( [ 4 ] );
> var out = {{alias}}.assign( x, 1.0, 4.0 );
> {{alias:@stdlib/ndarray/to-array}}( out )
[ 1.0, 2.0, 3.0, 4.0 ]
> var out = {{alias}}.assign( x, 1.0, 4.0 )
<ndarray>[ 1.0, 2.0, 3.0, 4.0 ]
> var bool = ( out === x )
true

Expand Down
81 changes: 12 additions & 69 deletions lib/node_modules/@stdlib/blas/ext/linspace/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,10 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, {
* 'dtype': 'float64'
* });
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends RealStart = RealStart, U extends RealStop = RealStop>( shape: number | ArrayLike<number>, start: T, stop: U, options: OptionsWithDataType ): OutputArray; // TODO: we lose some type specificity here. We could likely improve specificity here by using type maps

Expand All @@ -150,13 +145,8 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, {} );
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends RealStart = RealStart, U extends RealStop = RealStop>( shape: number | ArrayLike<number>, start: T, stop: U, options: Options ): RealOutputArray; // NOTE: we lose some type specificity here, as the output ndarray data type is determined according to type promotion rules

Expand All @@ -171,15 +161,10 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, true, {
* 'dtype': 'float64'
* });
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends RealStart = RealStart, U extends RealStop = RealStop, V extends Endpoint = Endpoint>( shape: number | ArrayLike<number>, start: T, stop: U, endpoint: V, options: OptionsWithDataType ): OutputArray; // TODO: we lose some type specificity here. We could likely improve specificity here by using type maps

Expand All @@ -194,13 +179,8 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0 );
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends RealStart = RealStart, U extends RealStop = RealStop, V extends Endpoint = Endpoint>( shape: number | ArrayLike<number>, start: T, stop: U, endpoint?: V, options?: Options ): RealOutputArray; // NOTE: we lose some type specificity here, as the output ndarray data type is determined according to type promotion rules

Expand All @@ -214,15 +194,10 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, {
* 'dtype': 'float64'
* });
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends Start = Start, U extends Stop = Stop>( shape: number | ArrayLike<number>, start: T, stop: U, options: OptionsWithDataType ): ComplexOutputArray; // TODO: we lose some type specificity here. We could likely improve specificity here by using type maps

Expand All @@ -236,13 +211,8 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, {} );
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends Start = Start, U extends Stop = Stop>( shape: number | ArrayLike<number>, start: T, stop: U, options: Options ): ComplexOutputArray; /* eslint-disable-line @typescript-eslint/unified-signatures */ // NOTE: we lose some type specificity here, as the output ndarray data type is determined according to type promotion rules

Expand All @@ -257,15 +227,10 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, true, {
* 'dtype': 'float64'
* });
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends Start = Start, U extends Stop = Stop, V extends Endpoint = Endpoint>( shape: number | ArrayLike<number>, start: T, stop: U, endpoint: V, options: OptionsWithDataType ): ComplexOutputArray; // TODO: we lose some type specificity here. We could likely improve specificity here by using type maps

Expand All @@ -280,13 +245,8 @@ interface Linspace {
* @returns output ndarray
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0, true );
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
<T extends Start = Start, U extends Stop = Stop, V extends Endpoint = Endpoint>( shape: number | ArrayLike<number>, start: T, stop: U, endpoint?: V, options?: Options ): ComplexOutputArray; // NOTE: we lose some type specificity here, as the output ndarray data type is determined according to type promotion rules

Expand All @@ -301,19 +261,15 @@ interface Linspace {
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var x = zeros( [ 2, 4 ] );
* // returns <ndarray>
*
* var out = linspace.assign( x, 0.0, 3.0 );
* // returns <ndarray>
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* var bool = ( out === x );
* // returns true
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
assign<T extends OutputArray = OutputArray>( out: T, start: Start, stop: Stop, options: BaseOptions ): T;

Expand All @@ -329,19 +285,15 @@ interface Linspace {
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var x = zeros( [ 2, 4 ] );
* // returns <ndarray>
*
* var out = linspace.assign( x, 0.0, 3.0 );
* // returns <ndarray>
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* var bool = ( out === x );
* // returns true
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
assign<T extends OutputArray = OutputArray>( out: T, start: Start, stop: Stop, endpoint?: Endpoint, options?: BaseOptions ): T;
}
Expand All @@ -356,29 +308,20 @@ interface Linspace {
* @param options - function options
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0 );
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var x = zeros( [ 2, 4 ] );
* // returns <ndarray>
*
* var out = linspace.assign( x, 0.0, 3.0 );
* // returns <ndarray>
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* var bool = ( out === x );
* // returns true
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
declare const linspace: Linspace;

Expand Down
6 changes: 1 addition & 5 deletions lib/node_modules/@stdlib/blas/ext/linspace/lib/assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,15 @@ var base = require( './base.js' );
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
*
* var x = zeros( [ 2, 4 ] );
* // returns <ndarray>
*
* var out = assign( x, 0.0, 3.0 );
* // returns <ndarray>
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* var bool = ( out === x );
* // returns true
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/
function assign( x, start, stop ) {
var endpoint;
Expand Down
6 changes: 1 addition & 5 deletions lib/node_modules/@stdlib/blas/ext/linspace/lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ var options = {
* var Float64Array = require( '@stdlib/array/float64' );
* var BooleanArray = require( '@stdlib/array/bool' );
* var array = require( '@stdlib/ndarray/array' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
* var ndarray = require( '@stdlib/ndarray/ctor' );
*
* // Create a data buffer:
Expand Down Expand Up @@ -110,10 +109,7 @@ var options = {
* var out = linspace( x, start, end, endpoint, {
* 'dims': [ -1 ]
* });
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ [ 1.0, 2.0, 3.0 ] ], [ [ 4.0, 5.0, 6.0 ] ] ]
* // returns <ndarray>[ [ [ 1.0, 2.0, 3.0 ] ], [ [ 4.0, 5.0, 6.0 ] ] ]
*/
var linspace = factory( table, [ DTYPES.idtypes0, DTYPES.idtypes1, DTYPES.idtypes2 ], DTYPES.odtypes, options ); // eslint-disable-line max-len

Expand Down
12 changes: 2 additions & 10 deletions lib/node_modules/@stdlib/blas/ext/linspace/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,23 @@
* @module @stdlib/blas/ext/linspace
*
* @example
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
* var linspace = require( '@stdlib/blas/ext/linspace' );
*
* var out = linspace( [ 2, 4 ], 0.0, 3.0 );
* // returns <ndarray>
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
* var linspace = require( '@stdlib/blas/ext/linspace' );
*
* var x = zeros( [ 2, 4 ] );
* // returns <ndarray>
*
* var out = linspace.assign( x, 0.0, 3.0 );
* // returns <ndarray>
* // returns <ndarray>[ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*
* var bool = ( out === x );
* // returns true
*
* var arr = ndarray2array( out );
* // returns [ [ 0.0, 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0, 3.0 ] ]
*/

// MODULES //
Expand Down
Loading