diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/README.md b/lib/node_modules/@stdlib/blas/ext/base/glogspace/README.md new file mode 100644 index 000000000000..920345cfc616 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/README.md @@ -0,0 +1,179 @@ + + +# glogspace + +> Fill a strided array with logarithmically spaced values over a specified interval. + +
+ +## Usage + +```javascript +var glogspace = require( '@stdlib/blas/ext/base/glogspace' ); +``` + +#### glogspace( N, base, start, stop, endpoint, x, strideX ) + +Fills a strided array with logarithmically spaced values over a specified interval. + +```javascript +var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + +glogspace( x.length, 10.0, 0.0, 5.0, true, x, 1 ); +// x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **base**: base of the logarithmic scale. +- **start**: exponent of the starting value, where the starting value is given by `base^start`. +- **stop**: exponent of the final value, where the final value is given by `base^stop`. +- **endpoint**: boolean indicating whether to include the `base^stop` value when writing values to the input array. If `true`, the input array is filled with logarithmically spaced values over the closed interval `[base^start, base^stop]`. If `false`, the input array is filled with logarithmically spaced values over the half-open interval `[base^start, base^stop)`. +- **x**: input array. +- **strideX**: stride length. + +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to fill every other element: + +```javascript +var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + +glogspace( 4, 10.0, 0.0, 3.0, true, x, 2 ); +// x => [ 1.0, 0.0, 10.0, 0.0, 100.0, 0.0, 1000.0, 0.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial array... +var x0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +// Create an offset view... +var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +// Fill every other element... +glogspace( 3, 10.0, 0.0, 2.0, true, x1, 2 ); +// x0 => [ 0.0, 1.0, 0.0, 10.0, 0.0, 100.0 ] +``` + +#### glogspace.ndarray( N, base, start, stop, endpoint, x, strideX, offsetX ) + +Fills a strided array with logarithmically spaced values over a specified interval using alternative indexing semantics. + +```javascript +var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + +glogspace.ndarray( x.length, 10.0, 0.0, 5.0, true, x, 1, 0 ); +// x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +``` + +The function has the following additional parameters: + +- **offsetX**: starting index. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements: + +```javascript +var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + +glogspace.ndarray( 3, 10.0, 0.0, 2.0, true, x, 1, x.length-3 ); +// x => [ 0.0, 0.0, 0.0, 1.0, 10.0, 100.0 ] +``` + +
+ + + +
+ +## Notes + +- Let `M` be the number of generated values (which is either `N` or `N+1` depending on whether `endpoint` is `true` or `false`, respectively). The spacing between the exponents is thus given by + + ```text + Δ = (stop-start)/(M-1) + ``` + + and the generated values are equal to `base^(start+Δ*i)` for `i = 0, 1, ..., M-1`. + +- When the number of generated values is greater than `1` and `endpoint` is `true`, the set of values written to a provided input array is guaranteed to include the `base^start` and `base^stop` values. Beware, however, that values between `base^start` and `base^stop` are subject to floating-point rounding errors. Hence, + + ```javascript + var x = [ 0.0, 0.0, 0.0 ]; + + glogspace( 3, 10.0, 0.0, 1.0, true, x, 1 ); + // x => [ 1.0, ~3.16, 10.0 ] + ``` + + where `x[1]` is only guaranteed to be approximately equal to the square root of `10`. + +- When `N = 1` and `endpoint` is `false`, only the `base^start` value is written to a provided input array. When `N = 1` and `endpoint` is `true`, only the `base^stop` value is written to a provided input array. + +- If `start < stop`, the exponents are written to a provided input array in ascending order; otherwise, they are written in descending order. + +- If `N <= 0`, both functions return `x` unchanged. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var glogspace = require( '@stdlib/blas/ext/base/glogspace' ); + +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( x ); + +glogspace( x.length, 10.0, 0.0, 9.0, true, x, 1 ); +console.log( x ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/benchmark/benchmark.js new file mode 100644 index 000000000000..4cf773a1a8b7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/benchmark/benchmark.js @@ -0,0 +1,103 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var glogspace = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = glogspace( x.length, 10.0, 0.0, i, true, x, 1 ); + if ( isnan( y[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..99732fce5405 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/benchmark/benchmark.ndarray.js @@ -0,0 +1,103 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var glogspace = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = glogspace( x.length, 10.0, 0.0, i, true, x, 1, 0 ); + if ( isnan( y[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/repl.txt new file mode 100644 index 000000000000..77d38912575c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/repl.txt @@ -0,0 +1,142 @@ + +{{alias}}( N, base, start, stop, endpoint, x, strideX ) + Fills a strided array with logarithmically spaced values over a specified + interval. + + If `N = 1` and `endpoint` is `true`, the set of values written to an input + array only includes `base^stop`, but not `base^start`; otherwise, when + `N = 1` and `endpoint` is `false`, the set of values written to an input + array only includes `base^start`, but not `base^stop`. + + If `start` is less than `stop`, the set of values written to an input array + will be written in ascending order, and, if `start` is greater than + `stop`, the set of written values will be in descending order. + + When `N >= 2` and `endpoint` is `true`, the set of values written to an + input array is guaranteed to include the `base^start` and `base^stop` + values. Beware, however, that values between `base^start` and `base^stop` + are subject to floating-point rounding errors. + + The `N` and stride parameters determine which elements in the strided array + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N <= 0`, the function returns `x` unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + base: number + Base of the logarithmic scale. + + start: number + Exponent of the starting value. + + stop: number + Exponent of the final value. + + endpoint: boolean + Boolean indicating whether to include the `base^stop` value when + writing values to the input array. If `false`, the function generates + `N+1` logarithmically spaced values over the interval `[base^start, + base^stop]` and only writes `N` values to the input array, thus + excluding `base^stop` from the input array. Accordingly, for a fixed + `N`, the spacing between adjacent values written to an input array + changes depending on the value of `endpoint`. + + x: Array|TypedArray + Input array. + + strideX: integer + Stride length. + + Returns + ------- + x: Array|TypedArray + Input array. + + Examples + -------- + // Standard Usage: + > var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + > {{alias}}( x.length, 10.0, 0.0, 5.0, true, x, 1 ) + [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] + + // Using `N` and stride parameters: + > x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + > {{alias}}( 3, 10.0, 0.0, 2.0, true, x, 2 ) + [ 1.0, 0.0, 10.0, 0.0, 100.0, 0.0, 0.0 ] + + // Using view offsets: + > var x0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > {{alias}}( 3, 10.0, 0.0, 2.0, true, x1, 2 ) + [ 1.0, 0.0, 10.0, 0.0, 100.0 ] + > x0 + [ 0.0, 1.0, 0.0, 10.0, 0.0, 100.0 ] + + +{{alias}}.ndarray( N, base, start, stop, endpoint, x, strideX, offsetX ) + Fills a strided array with logarithmically spaced values over a specified + interval using alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameter supports indexing semantics based on a starting + index. + + Parameters + ---------- + N: integer + Number of indexed elements. + + base: number + Base of the logarithmic scale. + + start: number + Exponent of the starting value. + + stop: number + Exponent of the final value. + + endpoint: boolean + Boolean indicating whether to include the `base^stop` value when + writing values to the input array. If `false`, the function generates + `N+1` logarithmically spaced values over the interval `[base^start, + base^stop]` and only writes `N` values to the input array, thus + excluding `base^stop` from the input array. Accordingly, for a fixed + `N`, the spacing between adjacent values written to an input array + changes depending on the value of `endpoint`. + + x: Array|TypedArray + Input array. + + strideX: integer + Stride length. + + offsetX: integer + Starting index. + + Returns + ------- + x: Array|TypedArray + Input array. + + Examples + -------- + // Standard Usage: + > var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + > {{alias}}.ndarray( x.length, 10.0, 0.0, 5.0, true, x, 1, 0 ) + [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] + + // Using an index offset: + > x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + > {{alias}}.ndarray( 3, 10.0, 0.0, 2.0, true, x, 2, 1 ) + [ 0.0, 1.0, 0.0, 10.0, 0.0, 100.0 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/types/index.d.ts new file mode 100644 index 000000000000..64c4497a601f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/types/index.d.ts @@ -0,0 +1,117 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Collection, AccessorArrayLike } from '@stdlib/types/array'; + +/** +* Input array. +*/ +type InputArray = Collection | AccessorArrayLike; + +/** +* Interface describing `glogspace`. +*/ +interface Routine { + /** + * Fills a strided array with logarithmically spaced values over a specified interval. + * + * @param N - number of indexed elements + * @param base - base of the logarithmic scale + * @param start - exponent of the starting value + * @param stop - exponent of the final value + * @param endpoint - boolean indicating whether to include the `base^stop` value when writing values to the input array + * @param x - input array + * @param strideX - stride length + * @returns input array + * + * @example + * var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + * + * glogspace( x.length, 10.0, 0.0, 5.0, true, x, 1 ); + * // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] + */ + = InputArray>( N: number, base: number, start: number, stop: number, endpoint: boolean, x: U, strideX: number ): U; + + /** + * Fills a strided array with logarithmically spaced values over a specified interval using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param base - base of the logarithmic scale + * @param start - exponent of the starting value + * @param stop - exponent of the final value + * @param endpoint - boolean indicating whether to include the `base^stop` value when writing values to the input array + * @param x - input array + * @param strideX - stride length + * @param offsetX - starting index + * @returns input array + * + * @example + * var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + * + * glogspace.ndarray( x.length, 10.0, 0.0, 5.0, true, x, 1, 0 ); + * // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] + */ + ndarray = InputArray>( N: number, base: number, start: number, stop: number, endpoint: boolean, x: U, strideX: number, offsetX: number ): U; +} + +/** +* Fills a strided array with logarithmically spaced values over a specified interval. +* +* @param N - number of indexed elements +* @param base - base of the logarithmic scale +* @param start - exponent of the starting value +* @param stop - exponent of the final value +* @param endpoint - boolean indicating whether to include the `base^stop` value when writing values to the input array +* @param x - input array +* @param strideX - stride length +* @returns input array +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, true, x, 1 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, false, x, 1 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0 ] +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace.ndarray( x.length, 10.0, 0.0, 5.0, true, x, 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace.ndarray( x.length, 10.0, 0.0, 5.0, false, x, 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0 ] +*/ +declare var glogspace: Routine; + + +// EXPORTS // + +export = glogspace; diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/types/test.ts new file mode 100644 index 000000000000..08df1824a133 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/docs/types/test.ts @@ -0,0 +1,271 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import glogspace = require( './index' ); + + +// TESTS // + +// The function returns a collection... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace( '10', 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( true, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( false, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( null, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( undefined, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( [], 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( {}, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( ( x: number ): number => x, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, '10', 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, true, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, false, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, null, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, undefined, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, [], 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, {}, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, ( x: number ): number => x, 0.0, 10.0, true, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, 10.0, '10', 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, true, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, false, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, null, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, undefined, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, [], 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, {}, 10.0, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, ( x: number ): number => x, 10.0, true, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, 10.0, 0.0, '10', true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, true, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, false, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, null, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, undefined, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, [], true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, {}, true, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, ( x: number ): number => x, true, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a boolean... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, 10.0, 0.0, 10.0, '10', x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, 99.99, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, null, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, undefined, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, [], x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, {}, x, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, ( x: number ): number => x, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not an array-like object... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, 10.0, 0.0, 10.0, true, 10, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, true, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, false, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, null, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, undefined, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, {}, 1 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace( x.length, 10.0, 0.0, 10.0, true, x, '10' ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, true ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, false ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, null ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, undefined ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, [] ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, {} ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Float64Array( 10 ); + + glogspace(); // $ExpectError + glogspace( x.length ); // $ExpectError + glogspace( x.length, 10.0 ); // $ExpectError + glogspace( x.length, 10.0, 0.0 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0 ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x ); // $ExpectError + glogspace( x.length, 10.0, 0.0, 10.0, true, x, 1, {} ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a collection... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( '10', 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( true, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( false, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( null, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( undefined, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( [], 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( {}, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( ( x: number ): number => x, 10.0, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, '10', 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, true, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, false, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, null, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, undefined, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, [], 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, {}, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, ( x: number ): number => x, 0.0, 10.0, true, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, '10', 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, true, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, false, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, null, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, undefined, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, [], 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, {}, 10.0, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, ( x: number ): number => x, 10.0, true, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, 0.0, '10', true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, true, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, false, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, null, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, undefined, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, [], true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, {}, true, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, ( x: number ): number => x, true, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a boolean... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, '10', x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, 99.99, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, null, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, undefined, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, [], x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, {}, x, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, ( x: number ): number => x, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not an array-like object... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, 10, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, true, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, false, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, null, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, undefined, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, {}, 1, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, '10', 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, true, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, false, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, null, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, undefined, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, [], 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, {}, 0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, '10' ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, true ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, false ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, null ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, undefined ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, [] ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, {} ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Float64Array( 10 ); + + glogspace.ndarray(); // $ExpectError + glogspace.ndarray( x.length ); // $ExpectError + glogspace.ndarray( x.length, 10.0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1 ); // $ExpectError + glogspace.ndarray( x.length, 10.0, 0.0, 10.0, true, x, 1, 0, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/examples/index.js new file mode 100644 index 000000000000..e322a67b75da --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var glogspace = require( './../lib' ); + +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( x ); + +glogspace( x.length, 10.0, 0.0, 9.0, true, x, 1 ); +console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/accessors.js new file mode 100644 index 000000000000..444de479cd93 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/accessors.js @@ -0,0 +1,109 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var pow = require( '@stdlib/math/base/special/pow' ); + + +// MAIN // + +/** +* Fills a strided array with logarithmically spaced values over a specified interval. +* +* @private +* @param {PositiveInteger} N - number of indexed elements +* @param {number} base - base of the logarithmic scale +* @param {number} start - exponent of the starting value +* @param {number} stop - exponent of the final value +* @param {boolean} endpoint - boolean indicating whether to include the `base^stop` value when writing values to the input array +* @param {Object} x - input array object +* @param {Collection} x.data - input array data +* @param {Array} x.accessors - array element accessors +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index +* @returns {Object} input array object +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, true, arraylike2object( toAccessorArray( x ) ), 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, false, arraylike2object( toAccessorArray( x ) ), 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0 ] +*/ +function glogspace( N, base, start, stop, endpoint, x, strideX, offsetX ) { + var xbuf; + var set; + var ix; + var d; + var i; + + // Cache a reference to array data: + xbuf = x.data; + + // Cache a reference to the element accessor: + set = x.accessors[ 1 ]; + + // Set the first value: + ix = offsetX; + if ( N === 1 ) { + if ( endpoint ) { + set( xbuf, ix, pow( base, stop ) ); + } else { + set( xbuf, ix, pow( base, start ) ); + } + return x; + } + set( xbuf, ix, pow( base, start ) ); + ix += strideX; + + // Calculate the increment: + if ( endpoint ) { + N -= 1; + } + d = ( stop-start ) / N; + + // Generate logarithmically spaced values: + for ( i = 1; i < N; i++ ) { + set( xbuf, ix, pow( base, start + (d*i) ) ); + ix += strideX; + } + // Check whether to include the `base^stop` value: + if ( endpoint ) { + set( xbuf, ix, pow( base, stop ) ); + } + return x; +} + + +// EXPORTS // + +module.exports = glogspace; diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/index.js new file mode 100644 index 000000000000..af054f393815 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/index.js @@ -0,0 +1,59 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Fill a strided array with logarithmically spaced values over a specified interval. +* +* @module @stdlib/blas/ext/base/glogspace +* +* @example +* var glogspace = require( '@stdlib/blas/ext/base/glogspace' ); +* +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, true, x, 1 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +* +* @example +* var glogspace = require( '@stdlib/blas/ext/base/glogspace' ); +* +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace.ndarray( x.length, 10.0, 0.0, 5.0, false, x, 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0 ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( main, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "ndarray": "glogspace.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/main.js new file mode 100644 index 000000000000..2817516ecc6b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Fills a strided array with logarithmically spaced values over a specified interval. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} base - base of the logarithmic scale +* @param {number} start - exponent of the starting value +* @param {number} stop - exponent of the final value +* @param {boolean} endpoint - boolean indicating whether to include the `base^stop` value when writing values to the input array +* @param {Collection} x - input array +* @param {integer} strideX - stride length +* @returns {Collection} input array +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, true, x, 1 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, false, x, 1 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0 ] +*/ +function glogspace( N, base, start, stop, endpoint, x, strideX ) { + return ndarray( N, base, start, stop, endpoint, x, strideX, stride2offset( N, strideX ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = glogspace; diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/ndarray.js new file mode 100644 index 000000000000..80fd14d3c8be --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/lib/ndarray.js @@ -0,0 +1,104 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var accessors = require( './accessors.js' ); + + +// MAIN // + +/** +* Fills a strided array with logarithmically spaced values over a specified interval. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} base - base of the logarithmic scale +* @param {number} start - exponent of the starting value +* @param {number} stop - exponent of the final value +* @param {boolean} endpoint - boolean indicating whether to include the `base^stop` value when writing values to the input array +* @param {Collection} x - input array +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index +* @returns {Collection} input array +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, true, x, 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ] +* +* @example +* var x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; +* +* glogspace( x.length, 10.0, 0.0, 5.0, false, x, 1, 0 ); +* // x => [ 1.0, 10.0, 100.0, 1000.0, 10000.0 ] +*/ +function glogspace( N, base, start, stop, endpoint, x, strideX, offsetX ) { + var ix; + var d; + var o; + var i; + + if ( N <= 0 ) { + return x; + } + o = arraylike2object( x ); + if ( o.accessorProtocol ) { + accessors( N, base, start, stop, endpoint, o, strideX, offsetX ); + return x; + } + ix = offsetX; + + // Set the first value: + if ( N === 1 ) { + if ( endpoint ) { + x[ ix ] = pow( base, stop ); + } else { + x[ ix ] = pow( base, start ); + } + return x; + } + x[ ix ] = pow( base, start ); + ix += strideX; + + // Calculate the increment: + if ( endpoint ) { + N -= 1; + } + d = ( stop-start ) / N; + + // Generate logarithmically spaced values: + for ( i = 1; i < N; i++ ) { + x[ ix ] = pow( base, start + (d*i) ); + ix += strideX; + } + // Check whether to include the `base^stop` value: + if ( endpoint ) { + x[ ix ] = pow( base, stop ); + } + return x; +} + + +// EXPORTS // + +module.exports = glogspace; diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/package.json b/lib/node_modules/@stdlib/blas/ext/base/glogspace/package.json new file mode 100644 index 000000000000..e978ff571558 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/blas/ext/base/glogspace", + "version": "0.0.0", + "description": "Fill a strided array with logarithmically spaced values over a specified interval.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "extended", + "fill", + "assign", + "set", + "logspace", + "logarithmic", + "log", + "sequence", + "seq", + "strided", + "array", + "ndarray" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.js new file mode 100644 index 000000000000..d7d9d6ec3c5a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var glogspace = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof glogspace, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof glogspace.ndarray, 'function', 'method is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.main.js new file mode 100644 index 000000000000..013557b76e1a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.main.js @@ -0,0 +1,364 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var Float64Array = require( '@stdlib/array/float64' ); +var glogspace = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof glogspace, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( glogspace.length, 7, 'has expected arity' ); + t.end(); +}); + +tape( 'the function fills a strided array', function test( t ) { + var expected; + var x; + + x = [ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]; + expected = [ + 1.0, + 2.0, + 4.0, + 8.0, + 16.0, + 32.0, + 64.0, + 128.0 + ]; + + glogspace( x.length, 2.0, 0.0, 7.0, true, x, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = [ 0.0, 0.0 ]; + expected = [ 2.0, 4.0 ]; + + glogspace( x.length, 2.0, 1.0, 3.0, false, x, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function fills a strided array (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]; + expected = [ + 1.0, + 2.0, + 4.0, + 8.0, + 16.0, + 32.0, + 64.0, + 128.0 + ]; + + glogspace( x.length, 2.0, 0.0, 7.0, true, toAccessorArray( x ), 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = [ 0.0, 0.0 ]; + expected = [ 2.0, 4.0 ]; + + glogspace( x.length, 2.0, 1.0, 3.0, false, toAccessorArray( x ), 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` equals `1`, the function writes a single value to the input array', function test( t ) { + var expected; + var x; + + // When `endpoint` is `true`, write `base^stop`: + x = [ 0.0 ]; + expected = [ 8.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, true, x, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + // When `endpoint` is `false`, write `base^start`: + x = [ 0.0 ]; + expected = [ 1.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, false, x, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` equals `1`, the function writes a single value to the input array (accessors)', function test( t ) { + var expected; + var x; + + // When `endpoint` is `true`, write `base^stop`: + x = [ 0.0 ]; + expected = [ 8.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, true, toAccessorArray( x ), 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + // When `endpoint` is `false`, write `base^start`: + x = [ 0.0 ]; + expected = [ 1.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, false, toAccessorArray( x ), 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input array', function test( t ) { + var out; + var x; + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + out = glogspace( x.length, 2.0, 0.0, 5.0, false, x, 1 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'the function returns a reference to the input array (accessors)', function test( t ) { + var out; + var x; + + x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + out = glogspace( x.length, 2.0, 0.0, 5.0, false, x, 1 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', function test( t ) { + var expected; + var x; + + x = [ 3.0, -4.0, 1.0 ]; + expected = [ 3.0, -4.0, 1.0 ]; + + glogspace( 0, 2.0, 0.0, 10.0, true, x, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + glogspace( -4, 2.0, 0.0, 10.0, true, x, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged (accessors)', function test( t ) { + var expected; + var x; + + x = [ 3.0, -4.0, 1.0 ]; + expected = [ 3.0, -4.0, 1.0 ]; + + glogspace( 0, 2.0, 0.0, 10.0, true, toAccessorArray( x ), 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + glogspace( -4, 2.0, 0.0, 10.0, true, toAccessorArray( x ), 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 0 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 2 + ]; + expected = [ + 2.0, // 0 + -3.0, + 4.0, // 1 + 7.0, + 8.0 // 2 + ]; + + glogspace( 3, 2.0, 1.0, 4.0, false, x, 2 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a stride (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 0 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 2 + ]; + expected = [ + 2.0, // 0 + -3.0, + 4.0, // 1 + 7.0, + 8.0 // 2 + ]; + + glogspace( 3, 2.0, 1.0, 4.0, false, toAccessorArray( x ), 2 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 2 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 0 + ]; + expected = [ + 8.0, // 2 + -3.0, + 4.0, // 1 + 7.0, + 2.0 // 0 + ]; + + glogspace( 3, 2.0, 1.0, 3.0, true, x, -2 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 2 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 0 + ]; + expected = [ + 8.0, // 2 + -3.0, + 4.0, // 1 + 7.0, + 2.0 // 0 + ]; + + glogspace( 3, 2.0, 1.0, 3.0, true, toAccessorArray( x ), -2 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var expected; + var x0; + var x1; + + x0 = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, + 4.0, // 1 + 5.0, + 6.0 // 2 + ]); + expected = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, + 4.0, // 1 + 5.0, + 8.0 // 2 + ]); + + x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + + glogspace( 3, 2.0, 1.0, 3.0, true, x1, 2 ); + t.deepEqual( x0, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets (accessors)', function test( t ) { + var expected; + var x0; + var x1; + + x0 = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, + 4.0, // 1 + 5.0, + 6.0 // 2 + ]); + expected = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, + 4.0, // 1 + 5.0, + 8.0 // 2 + ]); + + x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + + glogspace( 3, 2.0, 1.0, 3.0, true, toAccessorArray( x1 ), 2 ); + t.deepEqual( x0, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.ndarray.js new file mode 100644 index 000000000000..b6ff4ae6d3cc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/glogspace/test/test.ndarray.js @@ -0,0 +1,357 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var glogspace = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof glogspace, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( glogspace.length, 8, 'has expected arity' ); + t.end(); +}); + +tape( 'the function fills a strided array', function test( t ) { + var expected; + var x; + + x = [ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]; + expected = [ + 1.0, + 2.0, + 4.0, + 8.0, + 16.0, + 32.0, + 64.0, + 128.0 + ]; + + glogspace( x.length, 2.0, 0.0, 7.0, true, x, 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = [ 0.0, 0.0 ]; + expected = [ 2.0, 4.0 ]; + + glogspace( x.length, 2.0, 1.0, 3.0, false, x, 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function fills a strided array (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 4.0, + 2.0, + -3.0, + 5.0, + -1.0, + 2.0, + -5.0, + 6.0 + ]; + expected = [ + 1.0, + 2.0, + 4.0, + 8.0, + 16.0, + 32.0, + 64.0, + 128.0 + ]; + + glogspace( x.length, 2.0, 0.0, 7.0, true, toAccessorArray( x ), 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = [ 0.0, 0.0 ]; + expected = [ 2.0, 4.0 ]; + + glogspace( x.length, 2.0, 1.0, 3.0, false, toAccessorArray( x ), 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` equals `1`, the function writes a single value to the input array', function test( t ) { + var expected; + var x; + + // When `endpoint` is `true`, write `base^stop`: + x = [ 0.0 ]; + expected = [ 8.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, true, x, 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + // When `endpoint` is `false`, write `base^start`: + x = [ 0.0 ]; + expected = [ 1.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, false, x, 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` equals `1`, the function writes a single value to the input array (accessors)', function test( t ) { + var expected; + var x; + + // When `endpoint` is `true`, write `base^stop`: + x = [ 0.0 ]; + expected = [ 8.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, true, toAccessorArray( x ), 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + // When `endpoint` is `false`, write `base^start`: + x = [ 0.0 ]; + expected = [ 1.0 ]; + + glogspace( 1, 2.0, 0.0, 3.0, false, toAccessorArray( x ), 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input array', function test( t ) { + var out; + var x; + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + out = glogspace( x.length, 2.0, 0.0, 5.0, false, x, 1, 0 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'the function returns a reference to the input array (accessors)', function test( t ) { + var out; + var x; + + x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + out = glogspace( x.length, 2.0, 0.0, 5.0, false, x, 1, 0 ); + + t.strictEqual( out, x, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', function test( t ) { + var expected; + var x; + + x = [ 3.0, -4.0, 1.0 ]; + expected = [ 3.0, -4.0, 1.0 ]; + + glogspace( 0, 2.0, 0.0, 10.0, true, x, 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + glogspace( -4, 2.0, 0.0, 10.0, true, x, 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged (accessors)', function test( t ) { + var expected; + var x; + + x = [ 3.0, -4.0, 1.0 ]; + expected = [ 3.0, -4.0, 1.0 ]; + + glogspace( 0, 2.0, 0.0, 10.0, true, toAccessorArray( x ), 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + glogspace( -4, 2.0, 0.0, 10.0, true, toAccessorArray( x ), 1, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 0 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 2 + ]; + expected = [ + 2.0, // 0 + -3.0, + 4.0, // 1 + 7.0, + 8.0 // 2 + ]; + + glogspace( 3, 2.0, 1.0, 4.0, false, x, 2, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a stride (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 0 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 2 + ]; + expected = [ + 2.0, // 0 + -3.0, + 4.0, // 1 + 7.0, + 8.0 // 2 + ]; + + glogspace( 3, 2.0, 1.0, 4.0, false, toAccessorArray( x ), 2, 0 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 2 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 0 + ]; + expected = [ + 8.0, // 2 + -3.0, + 4.0, // 1 + 7.0, + 2.0 // 0 + ]; + + glogspace( 3, 2.0, 1.0, 3.0, true, x, -2, x.length-1 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying a negative stride (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 2.0, // 2 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 0 + ]; + expected = [ + 8.0, // 2 + -3.0, + 4.0, // 1 + 7.0, + 2.0 // 0 + ]; + + glogspace( 3, 2.0, 1.0, 3.0, true, toAccessorArray( x ), -2, x.length-1 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an offset parameter', function test( t ) { + var expected; + var x; + + x = [ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, // 2 + 6.0, + 7.0 + ]; + expected = [ + 1.0, + 0.5, // 0 + 0.25, // 1 + 0.125, // 2 + 6.0, + 7.0 + ]; + + glogspace( 3, 2.0, -1.0, -4.0, false, x, 1, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an offset parameter (accessors)', function test( t ) { + var expected; + var x; + + x = [ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, // 2 + 6.0, + 7.0 + ]; + expected = [ + 1.0, + 0.5, // 0 + 0.25, // 1 + 0.125, // 2 + 6.0, + 7.0 + ]; + + glogspace( 3, 2.0, -1.0, -4.0, false, toAccessorArray( x ), 1, 1 ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +});