diff --git a/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts index b8e9836a30eb..3bf8ec2445c0 100644 --- a/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/assert/docs/types/index.d.ts @@ -21,10 +21,13 @@ /* eslint-disable max-lines */ import contains = require( '@stdlib/array/base/assert/contains' ); +import hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' ); +import hasEqualValuesIndexed = require( '@stdlib/array/base/assert/has-equal-values-indexed' ); import hasSameValues = require( '@stdlib/array/base/assert/has-same-values' ); import isAccessorArray = require( '@stdlib/array/base/assert/is-accessor-array' ); import isBooleanDataType = require( '@stdlib/array/base/assert/is-boolean-data-type' ); import isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); +import isByteOrder = require( '@stdlib/array/base/assert/is-byte-order' ); import isComplexFloatingPointDataType = require( '@stdlib/array/base/assert/is-complex-floating-point-data-type' ); import isComplexTypedArray = require( '@stdlib/array/base/assert/is-complex-typed-array' ); import isComplex64Array = require( '@stdlib/array/base/assert/is-complex64array' ); @@ -69,6 +72,46 @@ interface Namespace { */ contains: typeof contains; + /** + * Tests if two arrays have equal values. + * + * ## Notes + * + * - If provided arrays of unequal length, the function returns `false`. + * + * @param x - first input array + * @param y - second input array + * @returns boolean indicating whether both arrays have equal values + * + * @example + * var x = [ 0, 0, 1, 0 ]; + * var y = [ 0, 0, 1, 0 ]; + * + * var out = ns.hasEqualValues( x, y ); + * // returns true + */ + hasEqualValues: typeof hasEqualValues; + + /** + * Tests if two indexed arrays have equal values. + * + * ## Notes + * + * - If provided arrays of unequal length, the function returns `false`. + * + * @param x - first input array + * @param y - second input array + * @returns boolean indicating whether both arrays have equal values + * + * @example + * var x = [ 0, 0, 1, 0 ]; + * var y = [ 0, 0, 1, 0 ]; + * + * var out = ns.hasEqualValuesIndexed( x, y ); + * // returns true + */ + hasEqualValuesIndexed: typeof hasEqualValuesIndexed; + /** * Tests if two arrays have the same values. * @@ -178,6 +221,24 @@ interface Namespace { */ isBooleanArray: typeof isBooleanArray; + /** + * Tests whether an input value is a supported array byte order. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported array byte order + * + * @example + * var bool = ns.isByteOrder( 'little-endian' ); + * // returns true + * + * bool = ns.isByteOrder( 'big-endian' ); + * // returns true + * + * bool = ns.isByteOrder( 'foo' ); + * // returns false + */ + isByteOrder: typeof isByteOrder; + /** * Tests whether an input value is a supported array complex-valued floating-point data type. * diff --git a/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts index e3127bd388bb..aa9834b0f97d 100644 --- a/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/docs/types/index.d.ts @@ -70,6 +70,7 @@ import countSameValueZero = require( '@stdlib/array/base/count-same-value-zero' import countTruthy = require( '@stdlib/array/base/count-truthy' ); import cuany = require( '@stdlib/array/base/cuany' ); import cuevery = require( '@stdlib/array/base/cuevery' ); +import cunone = require( '@stdlib/array/base/cunone' ); import dedupe = require( '@stdlib/array/base/dedupe' ); import every = require( '@stdlib/array/base/every' ); import everyBy = require( '@stdlib/array/base/every-by' ); @@ -139,6 +140,7 @@ import nCartesianProduct = require( '@stdlib/array/base/n-cartesian-product' ); import none = require( '@stdlib/array/base/none' ); import noneBy = require( '@stdlib/array/base/none-by' ); import noneByRight = require( '@stdlib/array/base/none-by-right' ); +import nulls = require( '@stdlib/array/base/nulls' ); import oneTo = require( '@stdlib/array/base/one-to' ); import ones = require( '@stdlib/array/base/ones' ); import ones2d = require( '@stdlib/array/base/ones2d' ); @@ -157,6 +159,7 @@ import quinary3d = require( '@stdlib/array/base/quinary3d' ); import quinary4d = require( '@stdlib/array/base/quinary4d' ); import quinary5d = require( '@stdlib/array/base/quinary5d' ); import reject = require( '@stdlib/array/base/reject' ); +import removeAt = require( '@stdlib/array/base/remove-at' ); import resolveGetter = require( '@stdlib/array/base/resolve-getter' ); import resolveSetter = require( '@stdlib/array/base/resolve-setter' ); import reverse = require( '@stdlib/array/base/reverse' ); @@ -186,6 +189,7 @@ import unarynd = require( '@stdlib/array/base/unarynd' ); import unitspace = require( '@stdlib/array/base/unitspace' ); import where = require( '@stdlib/array/base/where' ); import arrayWith = require( '@stdlib/array/base/with' ); +import without = require( '@stdlib/array/base/without' ); import zeroTo = require( '@stdlib/array/base/zero-to' ); import zeros = require( '@stdlib/array/base/zeros' ); import zeros2d = require( '@stdlib/array/base/zeros2d' ); @@ -1468,6 +1472,27 @@ interface Namespace { */ cuevery: typeof cuevery; + /** + * Cumulatively tests whether every element in a provided array is falsy. + * + * @param x - input array + * @returns output array + * + * @example + * var x = [ false, false, false, true, false ]; + * + * var result = ns.cunone( x ); + * // returns [ true, true, true, false, false ]; + * + * @example + * var x = [ false, false, false, true, false ]; + * var y = [ false, null, false, null, false, null, false, null, false, null ]; + * + * var arr = ns.cunone.assign( x, y, 2, 0 ); + * // returns [ true, null, true, null, true, null, false, null, false, null ]; + */ + cunone: typeof cunone; + /** * Removes consecutive duplicated values. * @@ -1621,7 +1646,7 @@ interface Namespace { /** * Returns a filled "generic" array. * - * @param value - fill value + * @param value - fill value, * @param len - array length * @returns output array * @@ -3082,6 +3107,18 @@ interface Namespace { */ noneByRight: typeof noneByRight; + /** + * Returns a "generic" array filled with nulls. + * + * @param len - array length + * @returns output array + * + * @example + * var out = ns.nulls( 3 ); + * // returns [ null, null, null ] + */ + nulls: typeof nulls; + /** * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. * @@ -3510,6 +3547,28 @@ interface Namespace { */ reject: typeof reject; + /** + * Removes an element from an array. + * + * ## Notes + * + * - The function mutates the input array. + * + * @param x - input array + * @param index - element index + * @returns input array + * + * @example + * var x = [ 1, 1, 2, 3, 3 ]; + * + * var y = ns.removeAt( x, -2 ); + * // returns [ 1, 1, 3, 3 ] + * + * var bool = ( x === y ); + * // returns true + */ + removeAt: typeof removeAt; + /** * Returns an accessor function for retrieving an element from an indexed array-like object. * @@ -4249,11 +4308,56 @@ interface Namespace { * @example * var x = [ 1, 2, 3, 4, 5, 6 ]; * - * var out = ns.arrayWith( x, 2, 8 ); + * var out = ns.arrayWith( x, 1, 8 ); * // returns [ 1, 8, 3, 4, 5, 6 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = [ 1, 2, 3, 4 ]; + * + * var out = new Float64Array( [ 0, 0, 0, 0 ] ); + * var arr = ns.arrayWith.assign( x, 0, 5, out, 1, 0 ); + * // returns [ 5, 2, 3, 4 ] + * + * var bool = ( arr === out ); + * // returns true */ arrayWith: typeof arrayWith; + /** + * Returns a new array containing every element from an input array, except for the element at a specified index. + * + * @param x - input array + * @param index - index of the element to exclude + * @returns output array + * + * @example + * var x = [ 1, 2, 3 ]; + * + * var out = ns.without( x, 0 ); + * // returns [ 2, 3 ] + * + * @example + * var x = [ 1, 2, 3, 4, 5, 6 ]; + * + * var out = ns.without( x, 1 ); + * // returns [ 1, 3, 4, 5, 6 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = [ 1, 2, 3, 4 ]; + * + * var out = new Float64Array( [ 0, 0, 0 ] ); + * var arr = ns.without.assign( x, 0, out, 1, 0 ); + * // returns [ 2, 3, 4 ] + * + * var bool = ( arr === out ); + * // returns true + */ + without: typeof without; + /** * Generates a linearly spaced numeric array whose elements increment by 1 starting from zero. * diff --git a/lib/node_modules/@stdlib/array/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/docs/types/index.d.ts index 771242f23317..04a6003480aa 100644 --- a/lib/node_modules/@stdlib/array/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/docs/types/index.d.ts @@ -23,6 +23,7 @@ import base = require( '@stdlib/array/base' ); import BooleanArray = require( '@stdlib/array/bool' ); import ArrayBuffer = require( '@stdlib/array/buffer' ); +import byteOrders = require( '@stdlib/array/byte-orders' ); import cartesianPower = require( '@stdlib/array/cartesian-power' ); import cartesianProduct = require( '@stdlib/array/cartesian-product' ); import cartesianSquare = require( '@stdlib/array/cartesian-square' ); @@ -40,6 +41,9 @@ import empty = require( '@stdlib/array/empty' ); import emptyLike = require( '@stdlib/array/empty-like' ); import filled = require( '@stdlib/array/filled' ); import filledBy = require( '@stdlib/array/filled-by' ); +import fixedEndianFactory = require( '@stdlib/array/fixed-endian-factory' ); +import Float32ArrayFE = require( '@stdlib/array/fixed-endian-float32' ); +import Float64ArrayFE = require( '@stdlib/array/fixed-endian-float64' ); import Float32Array = require( '@stdlib/array/float32' ); import Float64Array = require( '@stdlib/array/float64' ); import iterator2array = require( '@stdlib/array/from-iterator' ); @@ -52,6 +56,9 @@ import Int8Array = require( '@stdlib/array/int8' ); import Int16Array = require( '@stdlib/array/int16' ); import Int32Array = require( '@stdlib/array/int32' ); import linspace = require( '@stdlib/array/linspace' ); +import littleEndianFactory = require( '@stdlib/array/little-endian-factory' ); +import Float32ArrayLE = require( '@stdlib/array/little-endian-float32' ); +import Float64ArrayLE = require( '@stdlib/array/little-endian-float64' ); import logspace = require( '@stdlib/array/logspace' ); import minDataType = require( '@stdlib/array/min-dtype' ); import mostlySafeCasts = require( '@stdlib/array/mostly-safe-casts' ); @@ -193,6 +200,24 @@ interface Namespace { */ ArrayBuffer: typeof ArrayBuffer; + /** + * Returns a list of byte orders. + * + * ## Notes + * + * - The output array contains the following orders: + * + * - little-endian: bytes are ordered from least-to-most significant byte. + * - big-endian: bytes are ordered from most-to-least significant byte. + * + * @returns list of byte orders + * + * @example + * var list = ns.byteOrders(); + * // e.g., returns [ 'little-endian', 'big-endian' ] + */ + byteOrders: typeof byteOrders; + /** * Returns the Cartesian power. * @@ -1152,8 +1177,6 @@ interface Namespace { /** * Returns a type promotion table displaying array data types with the smallest size and closest "kind" to which array data types can be safely cast. * - * @param dtype1 - array data type - * @param dtype2 - array data type * @returns promotion rule table * * @example @@ -1384,7 +1407,7 @@ interface Namespace { * Returns an iterator which iterates over each element in an array-like object. * * @param src - input value - * @param mapFc - function to invoke for each iterated value + * @param mapFcn - function to invoke for each iterated value * @param thisArg - execution context * @returns iterator * diff --git a/lib/node_modules/@stdlib/assert/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/docs/types/index.d.ts index cf3c08c848c0..cc62ce665707 100644 --- a/lib/node_modules/@stdlib/assert/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/assert/docs/types/index.d.ts @@ -28,9 +28,11 @@ import hasArrayBufferSupport = require( '@stdlib/assert/has-arraybuffer-support' import hasArrowFunctionSupport = require( '@stdlib/assert/has-arrow-function-support' ); import hasAsyncAwaitSupport = require( '@stdlib/assert/has-async-await-support' ); import hasAsyncIteratorSymbolSupport = require( '@stdlib/assert/has-async-iterator-symbol-support' ); +import hasAtobSupport = require( '@stdlib/assert/has-atob-support' ); import hasBigIntSupport = require( '@stdlib/assert/has-bigint-support' ); import hasBigInt64ArraySupport = require( '@stdlib/assert/has-bigint64array-support' ); import hasBigUint64ArraySupport = require( '@stdlib/assert/has-biguint64array-support' ); +import hasBtoaSupport = require( '@stdlib/assert/has-btoa-support' ); import hasClassSupport = require( '@stdlib/assert/has-class-support' ); import hasDataViewSupport = require( '@stdlib/assert/has-dataview-support' ); import hasDefinePropertiesSupport = require( '@stdlib/assert/has-define-properties-support' ); @@ -143,6 +145,7 @@ import isEmptyObject = require( '@stdlib/assert/is-empty-object' ); import isEmptyString = require( '@stdlib/assert/is-empty-string' ); import isEnumerableProperty = require( '@stdlib/assert/is-enumerable-property' ); import isEnumerablePropertyIn = require( '@stdlib/assert/is-enumerable-property-in' ); +import isEqualArray = require( '@stdlib/assert/is-equal-array' ); import isError = require( '@stdlib/assert/is-error' ); import isEvalError = require( '@stdlib/assert/is-eval-error' ); import isEven = require( '@stdlib/assert/is-even' ); @@ -189,6 +192,7 @@ import isnan = require( '@stdlib/assert/is-nan' ); import isNaNArray = require( '@stdlib/assert/is-nan-array' ); import isNativeFunction = require( '@stdlib/assert/is-native-function' ); import isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); +import isndarrayLikeWithDataType = require( '@stdlib/assert/is-ndarray-like-with-data-type' ); import isNegativeInteger = require( '@stdlib/assert/is-negative-integer' ); import isNegativeIntegerArray = require( '@stdlib/assert/is-negative-integer-array' ); import isNegativeNumber = require( '@stdlib/assert/is-negative-number' ); @@ -257,6 +261,7 @@ import isRelativeURI = require( '@stdlib/assert/is-relative-uri' ); import isSafeInteger = require( '@stdlib/assert/is-safe-integer' ); import isSafeIntegerArray = require( '@stdlib/assert/is-safe-integer-array' ); import isSameArray = require( '@stdlib/assert/is-same-array' ); +import isSameArrayLike = require( '@stdlib/assert/is-same-array-like' ); import isSameComplex64 = require( '@stdlib/assert/is-same-complex64' ); import isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); import isSameComplex128 = require( '@stdlib/assert/is-same-complex128' ); @@ -305,6 +310,7 @@ import isUppercase = require( '@stdlib/assert/is-uppercase' ); import isURI = require( '@stdlib/assert/is-uri' ); import isURIError = require( '@stdlib/assert/is-uri-error' ); import isVectorLike = require( '@stdlib/assert/is-vector-like' ); +import isWebAssemblyMemory = require( '@stdlib/assert/is-wasm-memory' ); import IS_WEB_WORKER = require( '@stdlib/assert/is-web-worker' ); import isWhitespace = require( '@stdlib/assert/is-whitespace' ); import IS_WINDOWS = require( '@stdlib/assert/is-windows' ); @@ -550,6 +556,17 @@ interface Namespace { */ hasAsyncIteratorSymbolSupport: typeof hasAsyncIteratorSymbolSupport; + /** + * Tests for native `atob` support. + * + * @returns boolean indicating if an environment has `atob` support + * + * @example + * var bool = ns.hasAtobSupport(); + * // returns + */ + hasAtobSupport: typeof hasAtobSupport; + /** * Tests for native `BigInt` support. * @@ -583,6 +600,17 @@ interface Namespace { */ hasBigUint64ArraySupport: typeof hasBigUint64ArraySupport; + /** + * Tests for native `btoa` support. + * + * @returns boolean indicating if an environment has `btoa` support + * + * @example + * var bool = ns.hasBtoaSupport(); + * // returns + */ + hasBtoaSupport: typeof hasBtoaSupport; + /** * Tests for native `class` support. * @@ -2861,6 +2889,33 @@ interface Namespace { */ isEnumerablePropertyIn: typeof isEnumerablePropertyIn; + /** + * Tests if two arguments are both generic arrays and have equal values. + * + * ## Notes + * + * - The function performs strict equality comparison; thus, the function treats `-0` and `+0` as equal and `NaNs` as distinct. + * + * @param v1 - first input value + * @param v2 - second input value + * @returns boolean indicating whether two arguments are equal + * + * @example + * var x = [ 1.0, 2.0, 3.0 ]; + * var y = [ 1.0, 2.0, 3.0 ]; + * + * var out = ns.isEqualArray( x, y ); + * // returns true + * + * @example + * var x = [ 1.0, 2.0, 3.0 ]; + * var y = [ 1.0, 2.0, 4.0 ]; + * + * var out = ns.isEqualArray( x, y ); + * // returns false + */ + isEqualArray: typeof isEqualArray; + /** * Tests if a value is an `Error` object. * @@ -3341,7 +3396,7 @@ interface Namespace { /** * Tests whether a string contains only hexadecimal digits. * - * @param x - value to test + * @param value - value to test * @returns boolean indicating if a string contains only hexadecimal digits * * @example @@ -3916,6 +3971,26 @@ interface Namespace { */ isndarrayLike: typeof isndarrayLike; + /** + * Tests if a value is an ndarray-like object having a specified data type. + * + * @param v - value to test + * @param dtype - data type + * @returns boolean indicating if a value is an ndarray-like object having a specified data type + * + * @example + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * var arr = ndarray( 'generic', [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); + * + * var bool = ns.isndarrayLikeWithDataType( arr, 'generic' ); + * // returns true + * + * bool = ns.isndarrayLikeWithDataType( [], 'generic' ); + * // returns false + */ + isndarrayLikeWithDataType: typeof isndarrayLikeWithDataType; + /** * Tests if a value is a negative integer. * @@ -5692,6 +5767,33 @@ interface Namespace { */ isSameArray: typeof isSameArray; + /** + * Tests if two arguments are both array-like and have the same values. + * + * ## Notes + * + * - The function differs from the `===` operator in that the function treats `-0` and `+0` as distinct and `NaNs` as the same. + * + * @param v1 - first input value + * @param v2 - second input value + * @returns boolean indicating whether two arguments are the same + * + * @example + * var x = [ 1.0, 2.0, 3.0 ]; + * var y = [ 1.0, 2.0, 3.0 ]; + * + * var out = ns.isSameArrayLike( x, y ); + * // returns true + * + * @example + * var x = [ 1.0, 2.0, 3.0 ]; + * var y = [ 1.0, 2.0, 4.0 ]; + * + * var out = ns.isSameArrayLike( x, y ); + * // returns false + */ + isSameArrayLike: typeof isSameArrayLike; + /** * Tests if two arguments are both single-precision complex floating-point numbers and have the same value. * @@ -6992,6 +7094,27 @@ interface Namespace { */ isVectorLike: typeof isVectorLike; + /** + * Tests if a value is a WebAssembly memory instance. + * + * @param value - value to test + * @returns boolean indicating whether value is a WebAssembly memory instance + * + * @example + * var Memory = require( '@stdlib/wasm/memory' ); + * + * var mem = new Memory({ + * 'initial': 0 + * }); + * var bool = ns.isWebAssemblyMemory( mem ); + * // returns true + * + * @example + * var bool = ns.isWebAssemblyMemory( [] ); + * // returns false + */ + isWebAssemblyMemory: typeof isWebAssemblyMemory; + /** * Boolean indicating if the runtime is a web worker. * diff --git a/lib/node_modules/@stdlib/blas/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/docs/types/index.d.ts index 45f256f63a04..1486179cb38b 100644 --- a/lib/node_modules/@stdlib/blas/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/docs/types/index.d.ts @@ -21,8 +21,10 @@ /* eslint-disable max-lines */ import assert = require( '@stdlib/blas/base/assert' ); +import caxpy = require( '@stdlib/blas/base/caxpy' ); import ccopy = require( '@stdlib/blas/base/ccopy' ); import cscal = require( '@stdlib/blas/base/cscal' ); +import csrot = require( '@stdlib/blas/base/csrot' ); import cswap = require( '@stdlib/blas/base/cswap' ); import dasum = require( '@stdlib/blas/base/dasum' ); import daxpy = require( '@stdlib/blas/base/daxpy' ); @@ -35,10 +37,18 @@ import diagonalTypeResolveStr = require( '@stdlib/blas/base/diagonal-type-resolv import diagonalTypeStr2Enum = require( '@stdlib/blas/base/diagonal-type-str2enum' ); import diagonalTypes = require( '@stdlib/blas/base/diagonal-types' ); import dnrm2 = require( '@stdlib/blas/base/dnrm2' ); +import drot = require( '@stdlib/blas/base/drot' ); import drotg = require( '@stdlib/blas/base/drotg' ); +import drotm = require( '@stdlib/blas/base/drotm' ); import dscal = require( '@stdlib/blas/base/dscal' ); import dsdot = require( '@stdlib/blas/base/dsdot' ); +import dspmv = require( '@stdlib/blas/base/dspmv' ); import dswap = require( '@stdlib/blas/base/dswap' ); +import dsymv = require( '@stdlib/blas/base/dsymv' ); +import dsyr = require( '@stdlib/blas/base/dsyr' ); +import dsyr2 = require( '@stdlib/blas/base/dsyr2' ); +import dtrmv = require( '@stdlib/blas/base/dtrmv' ); +import dznrm2 = require( '@stdlib/blas/base/dznrm2' ); import gasum = require( '@stdlib/blas/base/gasum' ); import gaxpy = require( '@stdlib/blas/base/gaxpy' ); import gcopy = require( '@stdlib/blas/base/gcopy' ); @@ -66,19 +76,32 @@ import operationSides = require( '@stdlib/blas/base/operation-sides' ); import sasum = require( '@stdlib/blas/base/sasum' ); import saxpy = require( '@stdlib/blas/base/saxpy' ); import scabs1 = require( '@stdlib/blas/base/scabs1' ); +import scasum = require( '@stdlib/blas/base/scasum' ); +import scnrm2 = require( '@stdlib/blas/base/scnrm2' ); import scopy = require( '@stdlib/blas/base/scopy' ); import sdot = require( '@stdlib/blas/base/sdot' ); import sdsdot = require( '@stdlib/blas/base/sdsdot' ); +import sgemv = require( '@stdlib/blas/base/sgemv' ); import snrm2 = require( '@stdlib/blas/base/snrm2' ); +import srot = require( '@stdlib/blas/base/srot' ); import srotg = require( '@stdlib/blas/base/srotg' ); +import srotm = require( '@stdlib/blas/base/srotm' ); import sscal = require( '@stdlib/blas/base/sscal' ); +import sspmv = require( '@stdlib/blas/base/sspmv' ); import sswap = require( '@stdlib/blas/base/sswap' ); +import ssymv = require( '@stdlib/blas/base/ssymv' ); +import ssyr = require( '@stdlib/blas/base/ssyr' ); +import ssyr2 = require( '@stdlib/blas/base/ssyr2' ); +import strmv = require( '@stdlib/blas/base/strmv' ); import transposeOperationEnum2Str = require( '@stdlib/blas/base/transpose-operation-enum2str' ); import transposeOperationResolveEnum = require( '@stdlib/blas/base/transpose-operation-resolve-enum' ); import transposeOperationResolveStr = require( '@stdlib/blas/base/transpose-operation-resolve-str' ); import transposeOperationStr2Enum = require( '@stdlib/blas/base/transpose-operation-str2enum' ); import transposeOperations = require( '@stdlib/blas/base/transpose-operations' ); +import zaxpy = require( '@stdlib/blas/base/zaxpy' ); import zcopy = require( '@stdlib/blas/base/zcopy' ); +import zdrot = require( '@stdlib/blas/base/zdrot' ); +import zscal = require( '@stdlib/blas/base/zscal' ); import zswap = require( '@stdlib/blas/base/zswap' ); /** @@ -90,6 +113,61 @@ interface Namespace { */ assert: typeof assert; + /** + * Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant and adds the result to a single-precision complex floating-point vector. + * + * @param N - number of indexed elements + * @param ca - scalar constant + * @param cx - first input array + * @param strideX - `cx` stride length + * @param cy - second input array + * @param strideY - `cy` stride length + * @returns second input array + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * var realf = require( '@stdlib/complex/float32/real' ); + * var imagf = require( '@stdlib/complex/float32/imag' ); + * + * var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var cy = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + * var ca = new Complex64( 2.0, 2.0 ); + * + * ns.caxpy( 2, ca, cx, 2, cy, 2 ); + * + * var z = cy.get( 0 ); + * // returns + * + * var re = realf( z ); + * // returns -1.0 + * + * var im = imagf( z ); + * // returns 7.0 + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * var realf = require( '@stdlib/complex/float32/real' ); + * var imagf = require( '@stdlib/complex/float32/imag' ); + * + * var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var cy = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + * var ca = new Complex64( 2.0, 2.0 ); + * + * ns.caxpy.ndarray( 3, ca, cx, 1, 1, cy, 1, 1 ); + * + * var z = cy.get( 3 ); + * // returns + * + * var re = realf( z ); + * // returns -1.0 + * + * var im = imagf( z ); + * // returns 31.0 + */ + caxpy: typeof caxpy; + /** * Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector. * @@ -191,6 +269,76 @@ interface Namespace { */ cscal: typeof cscal; + /** + * Applies a plane rotation. + * + * @param N - number of indexed elements + * @param cx - first input array + * @param strideX - `cx` stride length + * @param cy - second input array + * @param strideY - `cy` stride length + * @param c - cosine of the angle of rotation + * @param s - sine of the angle of rotation + * @returns `cy` + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var realf = require( '@stdlib/complex/float32/real' ); + * var imagf = require( '@stdlib/complex/float32/imag' ); + * + * var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var cy = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + * + * ns.csrot( 2, cx, 2, cy, 1, 0.8, 0.6 ); + * + * var z = cy.get( 0 ); + * // returns + * + * var re = realf( z ); + * // returns -0.6 + * + * var im = imagf( z ); + * // returns -1.2 + * + * z = cx.get( 0 ); + * // returns + * + * re = realf( z ); + * // returns 0.8 + * + * im = imagf( z ); + * // returns 1.6 + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var realf = require( '@stdlib/complex/float32/real' ); + * var imagf = require( '@stdlib/complex/float32/imag' ); + * + * var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var cy = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + * + * ns.csrot.ndarray( 2, cx, 2, 0, cy, 1, 0, 0.8, 0.6 ); + * + * var z = cy.get( 0 ); + * // returns + * + * var re = realf( z ); + * // returns -0.6 + * + * var im = imagf( z ); + * // returns -1.2 + * + * z = cx.get( 0 ); + * // returns + * + * re = realf( z ); + * // returns 0.8 + * + * im = imagf( z ); + * // returns 1.6 + */ + csrot: typeof csrot; + /** * Interchanges two complex single-precision floating-point vectors. * @@ -490,6 +638,40 @@ interface Namespace { */ dnrm2: typeof dnrm2; + /** + * Applies a plane rotation. + * + * @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 + * @param c - cosine of the angle of rotation + * @param s - sine of the angle of rotation + * @returns `y` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float64Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * + * ns.drot( x.length, x, 1, y, 1, 0.8, 0.6 ); + * // x => [ ~4.4, ~5.8, 7.2, 8.6, 10.0 ] + * // y => [ ~4.2, 4.4, ~4.6, ~4.8, 5.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var y = new Float64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + * + * ns.drot.ndarray( 3, x, 2, 1, y, 2, 1, 0.8, 0.6 ); + * // x => [ 1.0, 6.4, 3.0, 9.2, 5.0, 12.0 ] + * // y => [ 7.0, 5.2, 9.0, 5.6, 11.0, ~6.0 ] + */ + drot: typeof drot; + /** * Constructs a Givens plane rotation. * @@ -513,13 +695,48 @@ interface Namespace { */ drotg: typeof drotg; + /** + * Applies a modified Givens plane rotation. + * + * @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 + * @param param - parameters for the modified Givens transformation + * @returns `y` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float64Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var param = new Float64Array( [ 0.0, 0.0, 2.0, -3.0, 0.0 ] ); + * + * ns.drotm( 2, x, 2, y, 1, param ); + * // x => [ ~-17.0, 2.0, ~-18.0, 4.0, 5.0 ] + * // y => [ ~8.0, ~13.0, 8.0, 9.0, 10.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float64Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var param = new Float64Array( [ 0.0, 0.0, 2.0, -3.0, 0.0 ] ); + * + * ns.drotm.ndarray( 2, x, 1, 0, y, 2, 1, param ); + * // x => [ ~-20.0, ~-25.0, 3.0, 4.0, 5.0 ] + * // y => [ 6.0, ~9.0, 8.0, ~13.0, 10.0 ] + */ + drotm: typeof drotm; + /** * Multiplies a double-precision floating-point vector `x` by a constant `alpha`. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param stride - index increment * @returns input array * * @example @@ -570,6 +787,43 @@ interface Namespace { */ dsdot: typeof dsdot; + /** + * Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param AP - packed form of a symmetric matrix `A` + * @param x - first input array + * @param strideX - `x` stride length + * @param beta - scalar constant + * @param y - second input array + * @param strideY - `y` stride length + * @returns `y` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.dspmv( 'column-major', 'lower', 3, 1.0, AP, x, 1, 1.0, y, -1 ); + * // y => [ 15.0, 12.0, 7.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.dspmv.ndarray( 'column-major', 'lower', 3, 1.0, AP, 0, x, 1, 0, 1.0, y, -1, 2 ); + * // y => [ 15.0, 12.0, 7.0 ] + */ + dspmv: typeof dspmv; + /** * Interchanges two double-precision floating-point vectors. * @@ -602,6 +856,174 @@ interface Namespace { */ dswap: typeof dswap; + /** + * Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is to be referenced + * @param N - number of elements along each dimension in the matrix `A` + * @param alpha - scalar constant + * @param A - matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - first input array + * @param strideX - `x` stride length + * @param beta - scalar constant + * @param y - second input array + * @param strideY - `y` stride length + * @returns `y` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.dsymv( 'row-major', 'upper', 3, 2.0, A, 3, x, 1, 1.0, y, 2 ); + * // y => [ 3.0, 2.0, 11.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.dsymv.ndarray( 'row-major', 'upper', 3, 2.0, A, 3, x, 1, 0, 1.0, y, 2, 0 ); + * // y => [ 3.0, 2.0, 11.0 ] + */ + dsymv: typeof dsymv; + + /** + * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced + * @param N - number of elements along each dimension in the matrix `A` + * @param alpha - scalar constant + * @param x - input vector + * @param strideX - `x` stride length + * @param A - matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns `A` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.dsyr( 'column-major', 'lower', 3, 2.0, x, 1, A, 3 ); + * // y => [ 3.0, 5.0, 7.0, 0.0, 10.0, 14.0, 0.0, 0.0, 21.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.dsyr.ndarray( 'lower', 3, 2.0, x, 1, 0, A, 3, 1, 0 ); + * // y => [ 3.0, 5.0, 7.0, 0.0, 10.0, 14.0, 0.0, 0.0, 21.0 ] + */ + dsyr: typeof dsyr; + + /** + * Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced + * @param N - number of elements along each dimension in the matrix `A` + * @param alpha - scalar constant + * @param x - first input array + * @param strideX - `x` stride length + * @param y - second input array + * @param strideY - `y` stride length + * @param A - matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns `A` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.dsyr2( 'column-major', 'upper', 3, 1.0, x, 1, y, 1, A, 3 ); + * // A => [ 3.0, 0.0, 0.0, 6.0, 9.0, 0.0, 9.0, 14.0, 19.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.dsyr2.ndarray( 'upper', 3, 1.0, x, 1, 0, y, 1, 0, A, 1, 3, 0 ); + * // A => [ 3.0, 0.0, 0.0, 6.0, 9.0, 0.0, 9.0, 14.0, 19.0 ] + */ + dsyr2: typeof dsyr2; + + /** + * Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. + * + * @param order - storage layout + * @param uplo - specifies whether `A` is an upper or lower triangular matrix + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param diag - specifies whether `A` has a unit diagonal + * @param N - number of elements along each dimension in the matrix `A` + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - input vector + * @param strideX - `x` stride length + * @returns `x` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.dtrmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, A, 3, x, 1 ); + * // x => [ 1.0, 5.0, 15.0 ] + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.dtrmv.ndarray( 'lower', 'no-transpose', 'non-unit', 3, A, 3, 1, 0, x, 1, 0 ); + * // x => [ 1.0, 5.0, 15.0 ] + */ + dtrmv: typeof dtrmv; + + /** + * Computes the L2-norm of a complex double-precision floating-point vector. + * + * @param N - number of indexed elements + * @param zx - input array + * @param strideX - stride length for `zx` + * @returns L2-norm + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( [ 3.0, -4.0, 0.0, 0.0, 5.0, -6.0 ] ); + * + * var norm = ns.dznrm2( 2, zx, 2 ); + * // returns ~9.3 + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); + * + * var norm = ns.dznrm2.ndarray( 2, zx, 1, 1 ); + * // returns ~9.3 + */ + dznrm2: typeof dznrm2; + /** * Computes the sum of the absolute values. * @@ -1122,44 +1544,96 @@ interface Namespace { scabs1: typeof scabs1; /** - * Copies values from `x` into `y`. + * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector. * * @param N - number of indexed elements - * @param x - input array - * @param strideX - `x` stride length - * @param y - output array - * @param strideY - `y` stride length - * @returns output array + * @param cx - input array + * @param strideX - `cx` stride length + * @returns out * * @example - * var Float32Array = require( '@stdlib/array/float32' ); + * var Complex64Array = require( '@stdlib/array/complex64' ); * - * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); - * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var cx = new Complex64Array( [ 0.3, 0.1, 5.0, 8.0, 0.5, 0.0, 6.0, 9.0, 0.0, 0.5, 8.0, 3.0, 0.0, 0.2, 9.0, 4.0 ] ); * - * ns.scopy( x.length, x, 1, y, 1 ); - * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] + * var out = ns.scasum( 4, cx, 2 ); + * // returns ~1.6 * * @example - * var Float32Array = require( '@stdlib/array/float32' ); + * var Complex64Array = require( '@stdlib/array/complex64' ); * - * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); - * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var cx = new Complex64Array( [ 0.3, 0.1, 5.0, 8.0, 0.5, 0.0, 6.0, 9.0, 0.0, 0.5, 8.0, 3.0, 0.0, 0.2, 9.0, 4.0 ] ); * - * ns.scopy.ndarray( x.length, x, 1, 0, y, 1, 0 ); - * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] + * var out = ns.scasum.ndarray( 4, cx, 2, 0 ); + * // returns ~1.6 */ - scopy: typeof scopy; + scasum: typeof scasum; /** - * Computes the dot product of `x` and `y`. + * Computes the L2-norm of a complex single-precision floating-point vector. * * @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 dot product + * @param cx - input array + * @param strideX - stride length for `cx` + * @returns L2-norm + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var cx = new Complex64Array( [ 0.3, 0.1, 5.0, 8.0, 0.5, 0.0, 6.0, 9.0, 0.0, 0.5, 8.0, 3.0, 0.0, 0.2, 9.0, 4.0 ] ); + * + * var norm = ns.scnrm2( 4, cx, 2 ); + * // returns ~0.8 + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var cx = new Complex64Array( [ 0.3, 0.1, 5.0, 8.0, 0.5, 0.0, 6.0, 9.0, 0.0, 0.5, 8.0, 3.0, 0.0, 0.2, 9.0, 4.0 ] ); + * + * var norm = ns.scnrm2.ndarray( 4, cx, 2, 0 ); + * // returns ~0.8 + */ + scnrm2: typeof scnrm2; + + /** + * Copies values from `x` into `y`. + * + * @param N - number of indexed elements + * @param x - input array + * @param strideX - `x` stride length + * @param y - output array + * @param strideY - `y` stride length + * @returns output array + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * + * ns.scopy( x.length, x, 1, y, 1 ); + * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * + * ns.scopy.ndarray( x.length, x, 1, 0, y, 1, 0 ); + * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] + */ + scopy: typeof scopy; + + /** + * Computes the dot product of `x` and `y`. + * + * @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 dot product * * @example * var Float32Array = require( '@stdlib/array/float32' ); @@ -1212,6 +1686,45 @@ interface Namespace { */ sdsdot: typeof sdsdot; + /** + * Performs one of the matrix-vector operations `y = α*A*x + β*y` or `y = α*A^T*x + β*y`, where `α` and `β` are scalars, `x` and `y` are vectors, and `A` is an `M` by `N` matrix. + * + * @param order - storage layout + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - first input vector + * @param strideX - `x` stride length + * @param beta - scalar constant + * @param y - second input vector + * @param strideY - `y` stride length + * @returns `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.sgemv( 'row-major', 'no-transpose', 3, 3, 1.0, A, 3, x, -1, 1.0, y, -1 ); + * // y => [ 25.0, 16.0, 7.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.sgemv.ndarray( 'no-transpose', 3, 3, 1.0, A, 3, 1, 0, x, -1, 2, 1.0, y, -1, 2 ); + * // y => [ 25.0, 16.0, 7.0 ] + */ + sgemv: typeof sgemv; + /** * Computes the L2-norm of a single-precision floating-point vector. * @@ -1238,6 +1751,40 @@ interface Namespace { */ snrm2: typeof snrm2; + /** + * Applies a plane rotation. + * + * @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 + * @param c - cosine of the angle of rotation + * @param s - sine of the angle of rotation + * @returns `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var y = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + * + * ns.srot( 3, x, 2, y, 2, 0.8, 0.6 ); + * // x => [ 5.0, 2.0, ~7.8, 4.0, ~10.6, 6.0 ] + * // y => [ 5.0, 8.0, ~5.4, 10.0, ~5.8, 12.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * + * ns.srot.ndarray( 4, x, 1, 1, y, 1, 1, 0.8, 0.6 ); + * // x => [ 1.0, ~5.8, ~7.2, ~8.6, 10.0 ] + * // y => [ 6.0, ~4.4, ~4.6, ~4.8, 5.0 ] + */ + srot: typeof srot; + /** * Constructs a Givens plane rotation. * @@ -1261,6 +1808,41 @@ interface Namespace { */ srotg: typeof srotg; + /** + * Applies a modified Givens plane rotation. + * + * @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 + * @param param - parameters for the modified Givens transformation + * @returns `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var param = new Float32Array( [ 0.0, 0.0, 2.0, -3.0, 0.0 ] ); + * + * ns.srotm( 2, x, 2, y, 1, param ); + * // x => [ ~-17.0, 2.0, ~-18.0, 4.0, 5.0 ] + * // y => [ ~8.0, ~13.0, 8.0, 9.0, 10.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + * var y = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var param = new Float32Array( [ 0.0, 0.0, 2.0, -3.0, 0.0 ] ); + * + * ns.srotm.ndarray( 2, x, 1, 0, y, 2, 1, param ); + * // x => [ ~-20.0, ~-25.0, 3.0, 4.0, 5.0 ] + * // y => [ 6.0, ~9.0, 8.0, ~13.0, 10.0 ] + */ + srotm: typeof srotm; + /** * Multiplies a single-precision floating-point vector `x` by a constant `alpha`. * @@ -1288,6 +1870,43 @@ interface Namespace { */ sscal: typeof sscal; + /** + * Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param AP - packed form of a symmetric matrix `A` + * @param x - first input array + * @param strideX - `x` stride length + * @param beta - scalar constant + * @param y - second input array + * @param strideY - `y` stride length + * @returns `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var AP = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.sspmv( 'column-major', 'lower', 3, 1.0, AP, x, 1, 1.0, y, -1 ); + * // y => [ 15.0, 12.0, 7.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var AP = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.sspmv.ndarray( 'column-major', 'lower', 3, 1.0, AP, x, 1, 0, 1.0, y, -1, 2 ); + * // y => [ 15.0, 12.0, 7.0 ] + */ + sspmv: typeof sspmv; + /** * Interchanges two single-precision floating-point vectors. * @@ -1320,6 +1939,148 @@ interface Namespace { */ sswap: typeof sswap; + /** + * Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is to be referenced + * @param N - number of elements along each dimension in the matrix `A` + * @param alpha - scalar constant + * @param A - matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - first input array + * @param strideX - `x` stride length + * @param beta - scalar constant + * @param y - second input array + * @param strideY - `y` stride length + * @returns `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.ssymv( 'row-major', 'upper', 3, 2.0, A, 3, x, 1, 1.0, y, 2 ); + * // y => [ 3.0, 2.0, 11.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.ssymv.ndarray( 'row-major', 'upper', 3, 2.0, A, 3, x, 1, 0, 1.0, y, 2, 0 ); + * // y => [ 3.0, 2.0, 11.0 ] + */ + ssymv: typeof ssymv; + + /** + * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced + * @param N - number of elements along each dimension in the matrix `A` + * @param alpha - scalar constant + * @param x - input vector + * @param strideX - `x` stride length + * @param A - matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns `A` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.ssyr( 'column-major', 'lower', 3, 2.0, x, 1, A, 3 ); + * // y => [ 3.0, 5.0, 7.0, 0.0, 10.0, 14.0, 0.0, 0.0, 21.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.ssyr.ndarray( 'lower', 3, 2.0, x, 1, 0, A, 3, 1, 0 ); + * // y => [ 3.0, 5.0, 7.0, 0.0, 10.0, 14.0, 0.0, 0.0, 21.0 ] + */ + ssyr: typeof ssyr; + + /** + * Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced + * @param N - number of elements along each dimension in the matrix `A` + * @param alpha - scalar constant + * @param x - first input array + * @param strideX - `x` stride length + * @param y - second input array + * @param strideY - `y` stride length + * @param A - matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns `A` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 ] ); + * var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.ssyr2( 'column-major', 'upper', 3, 1.0, x, 1, y, 1, A, 3 ); + * // A => [ 3.0, 0.0, 0.0, 6.0, 9.0, 0.0, 9.0, 14.0, 19.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 1.0, 1.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0 ] ); + * var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + * + * ns.ssyr2.ndarray( 'upper', 3, 1.0, x, 1, 0, y, 1, 0, A, 1, 3, 0 ); + * // A => [ 3.0, 0.0, 0.0, 6.0, 9.0, 0.0, 9.0, 14.0, 19.0 ] + */ + ssyr2: typeof ssyr2; + + /** + * Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. + * + * @param order - storage layout + * @param uplo - specifies whether `A` is an upper or lower triangular matrix + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param diag - specifies whether `A` has a unit diagonal + * @param N - number of elements along each dimension in the matrix `A` + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - input vector + * @param strideX - `x` stride length + * @returns `x` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.strmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, A, 3, x, 1 ); + * // x => [ 1.0, 5.0, 15.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * + * ns.strmv.ndarray( 'lower', 'no-transpose', 'non-unit', 3, A, 3, 1, 0, x, 1, 0 ); + * // x => [ 1.0, 5.0, 15.0 ] + */ + strmv: typeof strmv; + /** * Returns the BLAS transpose operation string associated with a BLAS transpose operation enumeration constant. * @@ -1394,6 +2155,61 @@ interface Namespace { */ transposeOperations: typeof transposeOperations; + /** + * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant and adds the result to a double-precision complex floating-point vector. + * + * @param N - number of indexed elements + * @param za - scalar constant + * @param zx - first input array + * @param strideX - `zx` stride length + * @param zy - second input array + * @param strideY - `zy` stride length + * @returns second input array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + * var za = new Complex128( 2.0, 2.0 ); + * + * ns.zaxpy( 2, za, zx, 2, zy, 2 ); + * + * var z = zy.get( 0 ); + * // returns + * + * var re = real( z ); + * // returns -1.0 + * + * var im = imag( z ); + * // returns 7.0 + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + * var za = new Complex128( 2.0, 2.0 ); + * + * ns.zaxpy.ndarray( 3, za, zx, 1, 1, zy, 1, 1 ); + * + * var z = zy.get( 3 ); + * // returns + * + * var re = real( z ); + * // returns -1.0 + * + * var im = imag( z ); + * // returns 31.0 + */ + zaxpy: typeof zaxpy; + /** * Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector. * @@ -1444,6 +2260,127 @@ interface Namespace { */ zcopy: typeof zcopy; + /** + * Applies a plane rotation. + * + * @param N - number of indexed elements + * @param zx - first input array + * @param strideX - `zx` stride length + * @param zy - second input array + * @param strideY - `zy` stride length + * @param c - cosine of the angle of rotation + * @param s - sine of the angle of rotation + * @returns `zy` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var zy = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + * + * ns.zdrot( 2, zx, 2, zy, 1, 0.8, 0.6 ); + * + * var z = zy.get( 0 ); + * // returns + * + * var re = real( z ); + * // returns -0.6 + * + * var im = imag( z ); + * // returns -1.2 + * + * z = zx.get( 0 ); + * // returns + * + * re = real( z ); + * // returns 0.8 + * + * im = imag( z ); + * // returns 1.6 + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var zy = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + * + * ns.zdrot.ndarray( 2, zx, 2, 0, zy, 1, 0, 0.8, 0.6 ); + * + * var z = zy.get( 0 ); + * // returns + * + * var re = real( z ); + * // returns -0.6 + * + * var im = imag( z ); + * // returns -1.2 + * + * z = zx.get( 0 ); + * // returns + * + * re = real( z ); + * // returns 0.8 + * + * im = imag( z ); + * // returns 1.6 + */ + zdrot: typeof zdrot; + + /** + * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. + * + * @param N - number of indexed elements + * @param za - scalar constant + * @param zx - input array + * @param strideX - `zx` stride length + * @returns input array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var za = new Complex128( 2.0, 2.0 ); + * + * ns.zscal( 3, za, zx, 1 ); + * + * var z = zx.get( 1 ); + * // returns + * + * var re = real( z ); + * // returns -2.0 + * + * var im = imag( z ); + * // returns 14.0 + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var za = new Complex128( 2.0, 2.0 ); + * + * ns.zscal.ndarray( 2, za, zx, 1, 1 ); + * + * var z = zx.get( 1 ); + * // returns + * + * var re = real( z ); + * // returns -2.0 + * + * var im = imag( z ); + * // returns 14.0 + */ + zscal: typeof zscal; + /** * Interchanges two complex double-precision floating-point vectors. * diff --git a/lib/node_modules/@stdlib/blas/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/docs/types/index.d.ts index f0198d11bcd4..b8c2b9a5bf0a 100644 --- a/lib/node_modules/@stdlib/blas/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/docs/types/index.d.ts @@ -41,11 +41,23 @@ interface Namespace { /** * Computes the dot product of two double-precision floating-point vectors. * + * ## Notes + * + * - If provided at least one input array having more than one dimension, the input arrays are broadcasted to a common shape. + * - For multi-dimensional input arrays, the function performs batched computation, such that the function computes the dot product for each pair of vectors in `x` and `y` according to the specified dimension index. + * - The size of the contracted dimension must be the same for both input arrays. + * - The function resolves the dimension index for which to compute the dot product **before** broadcasting. + * - If provided empty vectors, the dot product is `0`. + * - Negative indices are resolved relative to the last array dimension, with the last dimension corresponding to `-1`. + * - The output array has the same data type as the input arrays and has a shape which is determined by broadcasting and excludes the contracted dimension. + * * @param x - first input array * @param y - second input array - * @throws first argument must be a 1-dimensional `ndarray` containing double-precision floating-point numbers - * @throws second argument must be a 1-dimensional `ndarray` containing double-precision floating-point numbers - * @throws input arrays must be the same length + * @param dim - dimension for which to compute the dot product (default: -1) + * @throws first argument must be a non-zero-dimensional ndarray containing double-precision floating-point numbers + * @throws second argument must be a non-zero-dimensional ndarray containing double-precision floating-point numbers + * @throws input arrays must be broadcast-compatible + * @throws the size of the contracted dimension must be the same for both input arrays * @returns dot product * * @example @@ -56,6 +68,9 @@ interface Namespace { * var y = array( new Float64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ) ); * * var z = ns.ddot( x, y ); + * returns + * + * var v = z.get(); * // returns -5.0 */ ddot: typeof ddot; @@ -63,11 +78,18 @@ interface Namespace { /** * Interchanges two double-precision floating-point vectors. * + * ## Notes + * + * - For multi-dimensional input arrays, the function performs batched computation, such that the function interchanges each pair of vectors in `x` and `y` according to the specified dimension index. + * - Both input arrays must have the same shape. + * - Negative indices are resolved relative to the last array dimension, with the last dimension corresponding to `-1`. + * * @param x - first input array * @param y - second input array - * @throws first argument must be a 1-dimensional `ndarray` containing double-precision floating-point numbers - * @throws second argument must be a 1-dimensional `ndarray` containing double-precision floating-point numbers - * @throws input arrays must be the same length + * @param dim - dimension along which to interchange vectors (default: -1) + * @throws first argument must be a non-zero-dimensional ndarray containing double-precision floating-point numbers + * @throws second argument must be a non-zero-dimensional ndarray containing double-precision floating-point numbers + * @throws input arrays must have the same shape * @returns `y` * * @example @@ -142,11 +164,23 @@ interface Namespace { /** * Computes the dot product of two single-precision floating-point vectors. * + * ## Notes + * + * - If provided at least one input array having more than one dimension, the input arrays are broadcasted to a common shape. + * - For multi-dimensional input arrays, the function performs batched computation, such that the function computes the dot product for each pair of vectors in `x` and `y` according to the specified dimension index. + * - The size of the contracted dimension must be the same for both input arrays. + * - The function resolves the dimension index for which to compute the dot product **before** broadcasting. + * - If provided empty vectors, the dot product is `0`. + * - Negative indices are resolved relative to the last array dimension, with the last dimension corresponding to `-1`. + * - The output array has the same data type as the input arrays and has a shape which is determined by broadcasting and excludes the contracted dimension. + * * @param x - first input array * @param y - second input array - * @throws first argument must be a 1-dimensional `ndarray` containing single-precision floating-point numbers - * @throws second argument must be a 1-dimensional `ndarray` containing single-precision floating-point numbers - * @throws input arrays must be the same length + * @param dim - dimension for which to compute the dot product (default: -1) + * @throws first argument must be a non-zero-dimensional ndarray containing single-precision floating-point numbers + * @throws second argument must be a non-zero-dimensional ndarray containing single-precision floating-point numbers + * @throws input arrays must be broadcast-compatible + * @throws the size of the contracted dimension must be the same for both input arrays * @returns dot product * * @example @@ -157,6 +191,9 @@ interface Namespace { * var y = array( new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ) ); * * var z = ns.sdot( x, y ); + * returns + * + * var v = z.get(); * // returns -5.0 */ sdot: typeof sdot; @@ -164,11 +201,18 @@ interface Namespace { /** * Interchanges two single-precision floating-point vectors. * + * ## Notes + * + * - For multi-dimensional input arrays, the function performs batched computation, such that the function interchanges each pair of vectors in `x` and `y` according to the specified dimension index. + * - Both input arrays must have the same shape. + * - Negative indices are resolved relative to the last array dimension, with the last dimension corresponding to `-1`. + * * @param x - first input array * @param y - second input array - * @throws first argument must be a 1-dimensional `ndarray` containing single-precision floating-point numbers - * @throws second argument must be a 1-dimensional `ndarray` containing single-precision floating-point numbers - * @throws input arrays must be the same length + * @param dim - dimension along which to interchange vectors (default: -1) + * @throws first argument must be a non-zero-dimensional ndarray containing single-precision floating-point numbers + * @throws second argument must be a non-zero-dimensional ndarray containing single-precision floating-point numbers + * @throws input arrays must have the same shape * @returns `y` * * @example diff --git a/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts index b04e94083f3d..a6a159c1ddf4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/docs/types/index.d.ts @@ -140,12 +140,12 @@ import ssumpw = require( '@stdlib/blas/ext/base/ssumpw' ); */ interface Namespace { /** - * Adds a constant to each element in a double-precision floating-point strided array. + * Adds a scalar constant to each element in a double-precision floating-point strided array. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns input array * * @example @@ -167,12 +167,12 @@ interface Namespace { dapx: typeof dapx; /** - * Adds a constant to each double-precision floating-point strided array element and computes the sum. + * Adds a scalar constant to each double-precision floating-point strided array element and computes the sum. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -194,12 +194,12 @@ interface Namespace { dapxsum: typeof dapxsum; /** - * Adds a constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm. + * Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -221,12 +221,12 @@ interface Namespace { dapxsumkbn: typeof dapxsumkbn; /** - * Adds a constant to each double-precision floating-point strided array element and computes the sum using a second-order iterative Kahan–Babuška algorithm. + * Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using a second-order iterative Kahan–Babuška algorithm. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -248,12 +248,12 @@ interface Namespace { dapxsumkbn2: typeof dapxsumkbn2; /** - * Adds a constant to each double-precision floating-point strided array element and computes the sum using ordinary recursive summation. + * Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using ordinary recursive summation. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -275,12 +275,12 @@ interface Namespace { dapxsumors: typeof dapxsumors; /** - * Adds a constant to each double-precision floating-point strided array element and computes the sum using pairwise summation. + * Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using pairwise summation. * * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -306,7 +306,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -315,7 +315,7 @@ interface Namespace { * var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); * * var v = ns.dasumpw( x.length, x, 1 ); - * // returns 1.0 + * // returns 5.0 * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -323,7 +323,7 @@ interface Namespace { * var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); * * var v = ns.dasumpw.ndarray( x.length, x, 1, 0 ); - * // returns 1.0 + * // returns 5.0 */ dasumpw: typeof dasumpw; @@ -488,7 +488,7 @@ interface Namespace { * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns input array * * @example @@ -514,7 +514,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -540,7 +540,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -716,7 +716,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -742,7 +742,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -768,7 +768,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -794,7 +794,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -846,7 +846,7 @@ interface Namespace { * * @param N - number of indexed elements * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns `x` * * @example @@ -895,12 +895,12 @@ interface Namespace { dsapxsum: typeof dsapxsum; /** - * Adds a constant to each single-precision floating-point strided array element and computes the sum using pairwise summation with extended accumulation and returning an extended precision result. + * Adds a constant to each single-precision floating-point strided array element, and computes the sum using pairwise summation with extended accumulation and returning an extended precision result. * * @param N - number of indexed elements - * @param alpha - constant + * @param alpha - scalar constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns sum * * @example @@ -1593,13 +1593,13 @@ interface Namespace { * var x = [ 1.0, -2.0, 2.0 ]; * * var v = ns.gasumpw( x.length, x, 1 ); - * // returns 1.0 + * // returns 5.0 * * @example * var x = [ 1.0, -2.0, 2.0 ]; * * var v = ns.gasumpw.ndarray( x.length, x, 1, 0 ); - * // returns 1.0 + * // returns 5.0 */ gasumpw: typeof gasumpw; @@ -2428,7 +2428,7 @@ interface Namespace { * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] ); * * var v = ns.sasumpw( x.length, x, 1 ); - * // returns 1.0 + * // returns 5.0 * * @example * var Float32Array = require( '@stdlib/array/float32' ); @@ -2436,7 +2436,7 @@ interface Namespace { * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] ); * * var v = ns.sasumpw.ndarray( x.length, x, 1, 0 ); - * // returns 1.0 + * // returns 5.0 */ sasumpw: typeof sasumpw; @@ -2759,7 +2759,7 @@ interface Namespace { * @param N - number of indexed elements * @param alpha - constant * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns input array * * @example @@ -3024,9 +3024,9 @@ interface Namespace { * @param N - number of indexed elements * @param order - sort order * @param x - first input array - * @param strideX - `x` stride length + * @param strideX - first stride length * @param y - second input array - * @param strideY - `y` stride length + * @param strideY - second stride length * @returns `x` * * @example @@ -3093,7 +3093,7 @@ interface Namespace { * @param order - sort order * @param x - input array * @param stride - stride length - * @returns `x` + * @returns input array * * @example * var Float32Array = require( '@stdlib/array/float32' ); diff --git a/lib/node_modules/@stdlib/blas/tools/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/tools/docs/types/index.d.ts index a50850a48740..eee6bfec2100 100644 --- a/lib/node_modules/@stdlib/blas/tools/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/tools/docs/types/index.d.ts @@ -23,11 +23,33 @@ import swapFactory = require( '@stdlib/blas/tools/swap-factory' ); /** -* Interface describing the namespace. +* Interface describing the `tools` namespace. */ interface Namespace { /** - * TODO + * Returns a function which interchanges two vectors. + * + * @param base - "base" function which interchanges two vectors + * @param dtype - array data type + * @returns function wrapper + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var array = require( '@stdlib/ndarray/array' ); + * var dswap = require( '@stdlib/blas/base/dswap' ).ndarray; + * + * var swap = ns.swapFactory( dswap, 'float64' ); + * + * var x = array( new Float64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] ) ); + * var y = array( new Float64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ) ); + * + * swap( x, y ); + * + * var xbuf = x.data; + * // returns [ 2.0, 6.0, -1.0, -4.0, 8.0 ] + * + * var ybuf = y.data; + * // returns [ 4.0, 2.0, -3.0, 5.0, -1.0 ] */ swapFactory: typeof swapFactory; } diff --git a/lib/node_modules/@stdlib/complex/docs/types/index.d.ts b/lib/node_modules/@stdlib/complex/docs/types/index.d.ts index df8536aeb457..83b8926bf31e 100644 --- a/lib/node_modules/@stdlib/complex/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/complex/docs/types/index.d.ts @@ -114,8 +114,6 @@ interface Namespace { /** * Returns a type promotion table displaying complex number data types with the smallest size and closest "kind" to which data types can be safely cast. * - * @param dtype1 - data type - * @param dtype2 - data type * @returns promotion rule table * * @example diff --git a/lib/node_modules/@stdlib/iter/docs/types/index.d.ts b/lib/node_modules/@stdlib/iter/docs/types/index.d.ts index b22fb9ea7e91..2004c99e64be 100644 --- a/lib/node_modules/@stdlib/iter/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/iter/docs/types/index.d.ts @@ -1607,7 +1607,8 @@ interface Namespace { * v = iter.next().value; * // returns 4 * - * var bool = iter.ne + * var bool = iter.next().done; + * // returns true */ iterUniqueByHash: typeof iterUniqueByHash; diff --git a/lib/node_modules/@stdlib/lapack/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/docs/types/index.d.ts index 31df21c8eacc..78ba02be4ecd 100644 --- a/lib/node_modules/@stdlib/lapack/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/docs/types/index.d.ts @@ -24,6 +24,8 @@ import dlacpy = require( '@stdlib/lapack/base/dlacpy' ); import dlassq = require( '@stdlib/lapack/base/dlassq' ); import dlaswp = require( '@stdlib/lapack/base/dlaswp' ); import dpttrf = require( '@stdlib/lapack/base/dpttrf' ); +import slacpy = require( '@stdlib/lapack/base/slacpy' ); +import spttrf = require( '@stdlib/lapack/base/spttrf' ); /** * Interface describing the `base` namespace. @@ -155,6 +157,69 @@ interface Namespace { * // E => [ 0.25, ~0.4210 ] */ dpttrf: typeof dpttrf; + + /** + * Copies all or part of a matrix `A` to another matrix `B`. + * + * @param order - storage layout of `A` and `B` + * @param uplo - specifies whether to copy the upper or lower triangular/trapezoidal part of matrix `A` + * @param M - number of rows in matrix `A` + * @param N - number of columns in matrix `A` + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param B - output matrix + * @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) + * @returns `B` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var B = new Float32Array( 4 ); + * + * ns.slacpy( 'row-major', 'all', 2, 2, A, 2, B, 2 ); + * // B => [ 1.0, 2.0, 3.0, 4.0 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] ); + * var B = new Float32Array( [ 0.0, 0.0, 11.0, 312.0, 53.0, 412.0 ] ); + * + * ns.slacpy.ndarray( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); + * // B => [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] + */ + slacpy: typeof slacpy; + + /** + * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`. + * + * @param N - order of matrix `A` + * @param D - the `N` diagonal elements of `A` + * @param E - the `N-1` subdiagonal elements of `A` + * @returns status code + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var D = new Float32Array( [ 4.0, 5.0, 6.0 ] ); + * var E = new Float32Array( [ 1.0, 2.0 ] ); + * + * ns.spttrf( 3, D, E ); + * // D => [ 4, 4.75, ~5.15789 ] + * // E => [ 0.25, ~0.4210 ] + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var D = new Float32Array( [ 4.0, 5.0, 6.0 ] ); + * var E = new Float32Array( [ 1.0, 2.0 ] ); + * + * ns.spttrf.ndarray( 3, D, 1, 0, E, 1, 0 ); + * // D => [ 4, 4.75, ~5.15789 ] + * // E => [ 0.25, ~0.4210 ] + */ + spttrf: typeof spttrf; } /** diff --git a/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts index 03dc6bcb12b6..892f47c00bf7 100644 --- a/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts @@ -279,7 +279,7 @@ import xlogy = require( '@stdlib/math/base/special/xlogy' ); */ interface Namespace { /** - * Computes the absolute value of double-precision floating-point number `x`. + * Computes the absolute value of a double-precision floating-point number `x`. * * @param x - input value * @returns absolute value @@ -1311,7 +1311,7 @@ interface Namespace { * * @example * var y = ns.bernoulli( 1 ); - * // returns 0.0 + * // returns 0.5 * * @example * var y = ns.bernoulli( 2 ); @@ -2000,7 +2000,7 @@ interface Namespace { cbrtf: typeof cbrtf; /** - * Rounds a double-precision complex floating-point number toward positive infinity. + * Rounds each component of a double-precision complex floating-point number toward positive infinity. * * @param z - input value * @returns result @@ -2628,22 +2628,22 @@ interface Namespace { * * @param x - input value (in degrees) * @returns cosine - * - * @example - * var v = ns.cosd( 0.0 ); - * // returns 1.0 - * - * @example - * var v = ns.cosd( 60.0 ); - * // returns ~0.5 - * - * @example - * var v = ns.cosd( 90.0); - * // returns 0 - * - * @example - * var v = ns.cosd( NaN ); - * // returns NaN + * + * @example + * var v = ns.cosd( 0.0 ); + * // returns 1.0 + * + * @example + * var v = ns.cosd( 60.0 ); + * // returns ~0.5 + * + * @example + * var v = ns.cosd( 90.0); + * // returns 0 + * + * @example + * var v = ns.cosd( NaN ); + * // returns NaN */ cosd: typeof cosd; @@ -2724,26 +2724,26 @@ interface Namespace { * * @param x - input value (in radians) * @returns cotangent - * - * @example - * var v = ns.cot( 0.0 ); - * // returns Infinity - * - * @example - * var v = ns.cot( 3.141592653589793/2.0 ); - * // returns ~0.0 - * - * @example - * var v = ns.cot( -3.141592653589793/4.0 ); - * // returns ~-1.0 - * - * @example - * var v = ns.cot( 3.141592653589793/4.0 ); - * // returns ~1.0 - * - * @example - * var v = ns.cot( NaN ); - * // returns NaN + * + * @example + * var v = ns.cot( 0.0 ); + * // returns Infinity + * + * @example + * var v = ns.cot( 3.141592653589793/2.0 ); + * // returns ~0.0 + * + * @example + * var v = ns.cot( -3.141592653589793/4.0 ); + * // returns ~-1.0 + * + * @example + * var v = ns.cot( 3.141592653589793/4.0 ); + * // returns ~1.0 + * + * @example + * var v = ns.cot( NaN ); + * // returns NaN */ cot: typeof cot; @@ -2752,22 +2752,22 @@ interface Namespace { * * @param x - input value (in degrees) * @returns cotangent - * - * @example - * var v = ns.cotd( 0.0 ); - * // returns Infinity - * - * @example - * var v = ns.cotd( 60.0 ); - * // returns ~0.58 - * - * @example - * var v = ns.cotd( 90.0 ); - * // returns 0.0 - * - * @example - * var v = ns.cotd( NaN ); - * // returns NaN + * + * @example + * var v = ns.cotd( 0.0 ); + * // returns Infinity + * + * @example + * var v = ns.cotd( 60.0 ); + * // returns ~0.58 + * + * @example + * var v = ns.cotd( 90.0 ); + * // returns 0.0 + * + * @example + * var v = ns.cotd( NaN ); + * // returns NaN */ cotd: typeof cotd; @@ -4439,8 +4439,8 @@ interface Namespace { * - If both `a` and `b` are `0`, the function returns `0`. * - Both `a` and `b` must have integer values; otherwise, the function returns `NaN`. * - * @param a - integer - * @param b - integer + * @param a - first number + * @param b - second number * @returns greatest common divisor * * @example @@ -5148,7 +5148,7 @@ interface Namespace { ln: typeof ln; /** - * Computes the base `b` logarithm of `x`. + * Computes the base `b` logarithm of a double-precision floating-point number. * * @param x - input value * @param b - base diff --git a/lib/node_modules/@stdlib/math/iter/tools/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/iter/tools/docs/types/index.d.ts index 40d64e3ec8cd..61d5d1b89112 100644 --- a/lib/node_modules/@stdlib/math/iter/tools/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/iter/tools/docs/types/index.d.ts @@ -131,7 +131,7 @@ interface Namespace { * * @param iter0 - first iterator * @param iter1 - second iterator - * @param iter1 - third iterator + * @param iter2 - third iterator * @param fcn - function which transforms iterated values * @param options - options * @param options.invalid - return value when an input iterator yields a non-numeric value diff --git a/lib/node_modules/@stdlib/ndarray/base/assert/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/assert/docs/types/index.d.ts index 8409150cb9b9..1d7dd395fa53 100644 --- a/lib/node_modules/@stdlib/ndarray/base/assert/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/assert/docs/types/index.d.ts @@ -20,7 +20,9 @@ /* eslint-disable max-lines */ +import hasEqualShape = require( '@stdlib/ndarray/base/assert/has-equal-shape' ); import isAllowedDataTypeCast = require( '@stdlib/ndarray/base/assert/is-allowed-data-type-cast' ); +import isBooleanDataType = require( '@stdlib/ndarray/base/assert/is-boolean-data-type' ); import isBufferLengthCompatible = require( '@stdlib/ndarray/base/assert/is-buffer-length-compatible' ); import isBufferLengthCompatibleShape = require( '@stdlib/ndarray/base/assert/is-buffer-length-compatible-shape' ); import isCastingMode = require( '@stdlib/ndarray/base/assert/is-casting-mode' ); @@ -50,6 +52,24 @@ import isUnsignedIntegerDataType = require( '@stdlib/ndarray/base/assert/is-unsi * Interface describing the `assert` namespace. */ interface Namespace { + /** + * Tests whether two ndarrays have the same shape. + * + * @param x - first input ndarray + * @param y - second input ndarray + * @returns boolean indicating whether two ndarrays have the same shape + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * + * var x = array( [ [ 1, 2 ], [ 3, 4 ] ] ); + * var y = array( [ [ 5, 6 ], [ 7, 8 ] ] ); + * + * var bool = ns.hasEqualShape( x, y ); + * // returns true + */ + hasEqualShape: typeof hasEqualShape; + /** * Returns a boolean indicating if a provided ndarray data type can be cast to another ndarray data type according to a specified casting mode. * @@ -67,6 +87,54 @@ interface Namespace { */ isAllowedDataTypeCast: typeof isAllowedDataTypeCast; + /** + * Tests whether an input value is a supported ndarray boolean data type. + * + * @param v - value to test + * @returns boolean indicating whether an input value is a supported ndarray boolean data type + * + * @example + * var bool = ns.isBooleanDataType( 'binary' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'bool' ); + * // returns true + * + * bool = ns.isBooleanDataType( 'float32' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'float64' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'generic' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'int16' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'int32' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'int8' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'uint16' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'uint32' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'uint8' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'uint8c' ); + * // returns false + * + * bool = ns.isBooleanDataType( 'foo' ); + * // returns false + */ + isBooleanDataType: typeof isBooleanDataType; + /** * Returns a boolean indicating if a buffer length is compatible with provided ndarray meta data. * diff --git a/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts index 2497ce2b8949..5f16277634d6 100644 --- a/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts @@ -65,6 +65,7 @@ import maybeBroadcastArrays = require( '@stdlib/ndarray/base/maybe-broadcast-arr import metaDataProps = require( '@stdlib/ndarray/base/meta-data-props' ); import minViewBufferIndex = require( '@stdlib/ndarray/base/min-view-buffer-index' ); import minmaxViewBufferIndex = require( '@stdlib/ndarray/base/minmax-view-buffer-index' ); +import ndarraylike2ndarray = require( '@stdlib/ndarray/base/ndarraylike2ndarray' ); import ndarraylike2object = require( '@stdlib/ndarray/base/ndarraylike2object' ); import ndims = require( '@stdlib/ndarray/base/ndims' ); import nextCartesianIndex = require( '@stdlib/ndarray/base/next-cartesian-index' ); @@ -1568,7 +1569,23 @@ interface Namespace { minmaxViewBufferIndex: typeof minmaxViewBufferIndex; /** - * Converts an ndarray-like to an object likely to have the same "shape". + * Converts an ndarray-like object to an ndarray. + * + * @param x - input ndarray + * @returns ndarray + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * + * var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] ); + * + * var out = ns.ndarraylike2ndarray( x ); + * // returns + */ + ndarraylike2ndarray: typeof ndarraylike2ndarray; + + /** + * Converts an ndarray-like object to an object likely to have the same "shape". * * ## Notes * @@ -2004,19 +2021,19 @@ interface Namespace { * var ndarray = require( '@stdlib/ndarray/ctor' ); * var ndarray2array = require( '@stdlib/ndarray/to-array' ); * - * var buffer = [ 1, 2, 3, 4, 5, 6 ]; + * var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' ); * var shape = [ 3, 2 ]; * var strides = [ 2, 1 ]; * var offset = 0; * - * var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); + * var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' ); * // returns * * var sh = x.shape; * // returns [ 3, 2 ] * * var arr = ndarray2array( x ); - * // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] + * // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ] * * var y = ns.reverse( x, false ); * // returns @@ -2025,7 +2042,7 @@ interface Namespace { * // returns [ 3, 2 ] * * arr = ndarray2array( y ); - * // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ] + * // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ] */ reverse: typeof reverse; @@ -2346,6 +2363,7 @@ interface Namespace { * Returns a shifted view of an input ndarray along a specified dimension. * * @param x - input array + * @param dim - index of dimension to slice * @param start - starting index (inclusive) * @param strict - boolean indicating whether to enforce strict bounds checking * @param writable - boolean indicating whether a returned array should be writable @@ -2384,6 +2402,7 @@ interface Namespace { * Returns a truncated view of an input ndarray along a specified dimension. * * @param x - input array + * @param dim - index of dimension to slice * @param stop - ending index (exclusive) * @param strict - boolean indicating whether to enforce strict bounds checking * @param writable - boolean indicating whether a returned array should be writable @@ -2829,6 +2848,7 @@ interface Namespace { * - **sh**: dimensions sorted in loop order. * - **sx**: input ndarray strides sorted in loop order. * - **sy**: output ndarray strides sorted in loop order. + * - **idx**: dimension indices sorted in loop order. * * - When iterating over the elements of a multi-dimensional array, accessing elements which are closer in memory can improve performance. To this end, loop interchange is a technique used in loop nest optimization to improve locality of reference and take advantage of CPU cache. * @@ -2860,6 +2880,9 @@ interface Namespace { * * var ssy = o.sy; * // returns [ 6, -2, 1 ] + * + * var idx = o.idx; + * // returns [ 2, 1, 0 ] */ unaryLoopOrder: typeof unaryLoopOrder; diff --git a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts index 34ac4485fb9a..05bc9b1b4a4b 100644 --- a/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts @@ -45,6 +45,7 @@ import maybeBroadcastArray = require( '@stdlib/ndarray/maybe-broadcast-array' ); import maybeBroadcastArrays = require( '@stdlib/ndarray/maybe-broadcast-arrays' ); import minDataType = require( '@stdlib/ndarray/min-dtype' ); import mostlySafeCasts = require( '@stdlib/ndarray/mostly-safe-casts' ); +import ndarraylike2ndarray = require( '@stdlib/ndarray/ndarraylike2ndarray' ); import ndims = require( '@stdlib/ndarray/ndims' ); import nextDataType = require( '@stdlib/ndarray/next-dtype' ); import numel = require( '@stdlib/ndarray/numel' ); @@ -840,6 +841,30 @@ interface Namespace { */ mostlySafeCasts: typeof mostlySafeCasts; + /** + * Converts an ndarray-like object to an ndarray. + * + * ## Notes + * + * - If provided a read-only ndarray, the function returns a read-only ndarray. + * + * @param x - input ndarray + * @param options - function options + * @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw') + * @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']) + * @param options.readonly - specifies whether an array should be read-only + * @returns ndarray + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * + * var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] ); + * + * var out = ns.ndarraylike2ndarray( x ); + * // returns + */ + ndarraylike2ndarray: typeof ndarraylike2ndarray; + /** * Returns the number of ndarray dimensions. * @@ -1192,6 +1217,7 @@ interface Namespace { * Returns a read-only shifted view of an input ndarray along a specified dimension. * * @param x - input array + * @param dim - index of dimension to slice * @param start - starting index (inclusive) * @param options - function options * @param options.strict - boolean indicating whether to enforce strict bounds checking @@ -1230,6 +1256,7 @@ interface Namespace { * Returns a read-only truncated view of an input ndarray along a specified dimension. * * @param x - input array + * @param dim - index of dimension to slice * @param stop - ending index (exclusive) * @param options - function options * @param options.strict - boolean indicating whether to enforce strict bounds checking diff --git a/lib/node_modules/@stdlib/ndarray/iter/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/iter/docs/types/index.d.ts index 2562091a32f0..c133fbda31c1 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/iter/docs/types/index.d.ts @@ -24,10 +24,14 @@ import nditerColumnEntries = require( '@stdlib/ndarray/iter/column-entries' ); import nditerColumns = require( '@stdlib/ndarray/iter/columns' ); import nditerEntries = require( '@stdlib/ndarray/iter/entries' ); import nditerIndices = require( '@stdlib/ndarray/iter/indices' ); +import nditerInterleaveSubarrays = require( '@stdlib/ndarray/iter/interleave-subarrays' ); import nditerMatrices = require( '@stdlib/ndarray/iter/matrices' ); import nditerMatrixEntries = require( '@stdlib/ndarray/iter/matrix-entries' ); import nditerRowEntries = require( '@stdlib/ndarray/iter/row-entries' ); import nditerRows = require( '@stdlib/ndarray/iter/rows' ); +import nditerSelectDimension = require( '@stdlib/ndarray/iter/select-dimension' ); +import nditerStacks = require( '@stdlib/ndarray/iter/stacks' ); +import nditerSubarrays = require( '@stdlib/ndarray/iter/subarrays' ); import nditer2arrayEach = require( '@stdlib/ndarray/iter/to-array-each' ); import nditerValues = require( '@stdlib/ndarray/iter/values' ); @@ -187,6 +191,45 @@ interface Namespace { */ nditerIndices: typeof nditerIndices; + /** + * Returns an iterator which iterates over interleaved subarrays. + * + * ## Notes + * + * - The function throws an error if a provided broadcast-incompatible ndarrays. + * - For input ndarrays supporting read-only views, the function returns *read-only* views of interleaved subarrays. As input ndarrays may be broadcasted, a view is typically *not* contiguous. As more than one element of a returned view may refer to the same memory location, writing to a view may affect multiple elements. If you need to write to a subarray, copy the subarray before attempting mutation. + * + * @param arr - input ndarrays + * @param ndims - number of dimensions to stack + * @returns iterator + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ], { + * 'dtype': 'float64' + * }); + * // returns + * + * var iter = ns.nditerInterleaveSubarrays( [ x, x ], 2 ); + * + * var v = iter.next().value; + * // returns + * + * var arr = ndarray2array( v ); + * // returns [ [ 1, 2 ], [ 3, 4 ] ] + * + * v = iter.next().value; + * // returns + * + * arr = ndarray2array( v ); + * // returns [ [ 1, 2 ], [ 3, 4 ] ] + * + * // ... + */ + nditerInterleaveSubarrays: typeof nditerInterleaveSubarrays; + /** * Returns an iterator which iterates over each matrix in a stack of matrices. * @@ -353,6 +396,115 @@ interface Namespace { */ nditerRows: typeof nditerRows; + /** + * Returns an iterator which iterates over each view along a specified dimension. + * + * @param x - input value + * @param dim - dimension index + * @param options - function options + * @param options.readonly - boolean indicating whether returned views should be read-only + * @param options.keepdim - boolean indicating whether returned views should include the selected dimension as a singleton dimension + * @returns iterator + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ], { + * 'dtype': 'float64' + * }); + * // returns + * + * var iter = ns.nditerSelectDimension( x, 0 ); + * + * var v = iter.next().value; + * // returns + * + * var arr = ndarray2array( v ); + * // returns [ [ 1, 2 ], [ 3, 4 ] ] + * + * v = iter.next().value; + * // returns + * + * arr = ndarray2array( v ); + * // returns [ [ 5, 6 ], [ 7, 8 ] ] + * + * // ... + */ + nditerSelectDimension: typeof nditerSelectDimension; + + /** + * Returns an iterator which iterates over each subarray in a stack of subarrays according to a list of specified stack dimensions. + * + * @param x - input value + * @param dims - indices of dimensions to stack + * @param options - function options + * @param options.readonly - boolean indicating whether returned views should be read-only + * @returns iterator + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ], { + * 'dtype': 'float64' + * }); + * // returns + * + * var iter = ns.nditerStacks( x, [ 1, 2 ] ); + * + * var v = iter.next().value; + * // returns + * + * var arr = ndarray2array( v ); + * // returns [ [ 1, 2 ], [ 3, 4 ] ] + * + * v = iter.next().value; + * // returns + * + * arr = ndarray2array( v ); + * // returns [ [ 5, 6 ], [ 7, 8 ] ] + * + * // ... + */ + nditerStacks: typeof nditerStacks; + + /** + * Returns an iterator which iterates over each subarray in a stack of subarrays. + * + * @param x - input value + * @param ndims - number of dimensions to stack + * @param options - function options + * @param options.readonly - boolean indicating whether returned views should be read-only + * @returns iterator + * + * @example + * var array = require( '@stdlib/ndarray/array' ); + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * + * var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ], { + * 'dtype': 'float64' + * }); + * // returns + * + * var iter = ns.nditerSubarrays( x, 2 ); + * + * var v = iter.next().value; + * // returns + * + * var arr = ndarray2array( v ); + * // returns [ [ 1, 2 ], [ 3, 4 ] ] + * + * v = iter.next().value; + * // returns + * + * arr = ndarray2array( v ); + * // returns [ [ 5, 6 ], [ 7, 8 ] ] + * + * // ... + */ + nditerSubarrays: typeof nditerSubarrays; + /** * Returns an iterator which converts each iterated ndarray to a generic array. * diff --git a/lib/node_modules/@stdlib/nlp/docs/types/index.d.ts b/lib/node_modules/@stdlib/nlp/docs/types/index.d.ts index 872a536443f1..2347f7c10739 100644 --- a/lib/node_modules/@stdlib/nlp/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/nlp/docs/types/index.d.ts @@ -74,7 +74,7 @@ interface Namespace { * @param documents - document corpus * @param K - number of topics * @param options - options object - * @param options.alpha - Dirichlet hyper-parameter of topic vector theta: + * @param options.alpha - Dirichlet hyper-parameter of topic vector theta * @param options.beta - Dirichlet hyper-parameter for word vector phi * @throws second argument must be a positive integer * @throws must provide valid options diff --git a/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts b/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts index 88c008d52d0a..b7e29d5d78e8 100644 --- a/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/random/array/tools/docs/types/index.d.ts @@ -115,6 +115,7 @@ interface Namespace { * // returns */ unary: typeof unary; + } /** diff --git a/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts index 812aa4697c3c..7dd4d3d092d6 100644 --- a/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/strided/base/docs/types/index.d.ts @@ -47,6 +47,7 @@ import nullaryAddonDispatch = require( '@stdlib/strided/base/nullary-addon-dispa import offsetView = require( '@stdlib/strided/base/offset-view' ); import quaternary = require( '@stdlib/strided/base/quaternary' ); import quinary = require( '@stdlib/strided/base/quinary' ); +import readDataView = require( '@stdlib/strided/base/read-dataview' ); import reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); import reinterpretComplex = require( '@stdlib/strided/base/reinterpret-complex' ); import reinterpretComplex64 = require( '@stdlib/strided/base/reinterpret-complex64' ); @@ -56,12 +57,14 @@ import smap2 = require( '@stdlib/strided/base/smap2' ); import smskmap = require( '@stdlib/strided/base/smskmap' ); import smskmap2 = require( '@stdlib/strided/base/smskmap2' ); import stride2offset = require( '@stdlib/strided/base/stride2offset' ); +import strided2object = require( '@stdlib/strided/base/strided2object' ); import ternary = require( '@stdlib/strided/base/ternary' ); import unary = require( '@stdlib/strided/base/unary' ); import unaryAddonDispatch = require( '@stdlib/strided/base/unary-addon-dispatch' ); import unaryBy = require( '@stdlib/strided/base/unary-by' ); import unaryDtypeSignatures = require( '@stdlib/strided/base/unary-dtype-signatures' ); import unarySignatureCallbacks = require( '@stdlib/strided/base/unary-signature-callbacks' ); +import writeDataView = require( '@stdlib/strided/base/write-dataview' ); import zmap = require( '@stdlib/strided/base/zmap' ); /** @@ -1050,6 +1053,47 @@ interface Namespace { */ quinary: typeof quinary; + /** + * Copies elements from an input strided DataView to elements in an output strided array. + * + * @param N - number of indexed elements + * @param view - output DataView + * @param strideView - `view` stride length (in bytes) + * @param out - output array + * @param strideOut - `out` stride length + * @param littleEndian - boolean indicating whether the data is stored in little-endian format + * @returns output DataView + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var DataView = require( '@stdlib/array/dataview' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var view = new DataView( x.buffer ); + * + * var y = new Float64Array( x.length ); + * var out = ns.readDataView( x.length, view, 8, y, 1, true ); + * // e.g., returns [ 1.0, 2.0, 3.0, 4.0 ] + * + * var bool = ( out === y ); + * // returns true + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var DataView = require( '@stdlib/array/dataview' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var view = new DataView( x.buffer ); + * + * var y = new Float64Array( x.length ); + * var out = ns.readDataView.ndarray( x.length, view, 8, 0, y, 1, 0, true ); + * // e.g., returns [ 1.0, 2.0, 3.0, 4.0 ] + * + * var bool = ( out === y ); + * // returns true + */ + readDataView: typeof readDataView; + /** * Reinterprets a `BooleanArray` as a `Uint8Array`. * @@ -1304,6 +1348,51 @@ interface Namespace { */ stride2offset: typeof stride2offset; + /** + * Converts a strided array and associated metadata to an object likely to have the same "shape". + * + * ## Notes + * + * - This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding strided array metadata to ensure that internal functions operating on strided arrays are provided consistent argument "shapes". + * + * - The returned object has the following properties: + * + * - **data**: reference to the input array. + * - **dtype**: array data type. + * - **length**: number of indexed elements. + * - **stride**: index increment. + * - **offset**: starting index. + * - **accessorProtocol**: boolean indicating whether the input array uses accessors for getting and setting elements. + * - **accessors**: a two-element array whose first element is an accessor for retrieving an array element and whose second element is an accessor for setting an array element. + * + * @param N - number of indexed elements + * @param x - input array + * @param stride - index increment + * @param offset - index offset + * @returns object containing strided array data + * + * @example + * var x = { + * '0': 1, + * '1': 2, + * '2': 3, + * '4': 4, + * 'length': 4 + * }; + * var obj = ns.strided2object( 4, x, 1, 0 ); + * // returns {...} + * + * var bool = obj.accessorProtocol; + * // returns false + * + * var fcns = obj.accessors; + * // returns [ , ] + * + * var v = fcns[ 0 ]( x.data, 2 ); + * // returns 3 + */ + strided2object: typeof strided2object; + /** * Applies a ternary callback to strided input array elements and assigns results to elements in a strided output array. * @@ -1558,6 +1647,55 @@ interface Namespace { */ unarySignatureCallbacks: typeof unarySignatureCallbacks; + /** + * Copies elements from an input strided array to elements in a strided DataView. + * + * @param N - number of indexed elements + * @param x - input array + * @param strideX - `x` stride length + * @param view - output DataView + * @param strideView - `view` stride length (in bytes) + * @param littleEndian - boolean indicating whether to store the data in little-endian format + * @returns output DataView + * + * @example + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * var DataView = require( '@stdlib/array/dataview' ); + * + * var x = [ 1.0, 2.0, 3.0, 4.0 ]; + * + * var buf = new ArrayBuffer( 32 ); + * var view = new DataView( buf ); + * + * var out = ns.writeDataView( 4, x, 1, view, 8, true ); + * // returns + * + * var bool = ( out === view ); + * // returns true + * + * var v = view.getFloat64( 0, true ); + * // returns 1.0 + * + * @example + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * var DataView = require( '@stdlib/array/dataview' ); + * + * var x = [ 1.0, 2.0, 3.0, 4.0 ]; + * + * var buf = new ArrayBuffer( 32 ); + * var view = new DataView( buf ); + * + * var out = ns.writeDataView.ndarray( 4, x, 1, 0, view, 8, 0, true ); + * // returns + * + * var bool = ( out === view ); + * // returns true + * + * var v = view.getFloat64( 0, true ); + * // returns 1.0 + */ + writeDataView: typeof writeDataView; + /** * Applies a unary function to a double-precision complex floating-point strided input array and assigns results to a double-precision complex floating-point strided output array. * diff --git a/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts index 16e54b0afb8b..77e48d913b73 100644 --- a/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/base/docs/types/index.d.ts @@ -21,6 +21,8 @@ /* eslint-disable max-lines */ import altcase = require( '@stdlib/string/base/altcase' ); +import atob = require( '@stdlib/string/base/atob' ); +import base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); import camelcase = require( '@stdlib/string/base/camelcase' ); import capitalize = require( '@stdlib/string/base/capitalize' ); import codePointAt = require( '@stdlib/string/base/code-point-at' ); @@ -99,6 +101,39 @@ interface Namespace { */ altcase: typeof altcase; + /** + * Decodes a string of data which has been encoded using Base64 encoding. + * + * @param str - binary string containing base64-encoded data + * @returns an ASCII string containing decoded data + * + * @example + * var out = ns.atob( 'SGVsbG8sIHdvcmxk' ); + * // returns 'Hello, world' + */ + atob: typeof atob; + + /** + * Converts a base64-encoded string to a Uint8Array. + * + * ## Notes + * + * - If provided a string containing non-ASCII characters, the function returns `null`. + * + * @param str - base64-encoded string + * @returns output array + * + * @example + * var string2buffer = require( '@stdlib/buffer/from-string' ); + * + * var str = string2buffer( 'Hello World!' ).toString( 'base64' ); + * // returns 'SGVsbG8gV29ybGQh' + * + * var out = ns.base64ToUint8Array( str ); + * // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ] + */ + base64ToUint8Array: typeof base64ToUint8Array; + /** * Converts a string to camel case. * @@ -932,7 +967,7 @@ interface Namespace { * return capitalize( p1 ); * } * - * var out = ns.replace( str, /([^\s]*)/gi, ns.replacer); + * var out = ns.replace( str, /([^\s]*)/gi, ns.replacer ); * // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' */ replace: typeof replace; @@ -1308,24 +1343,24 @@ interface Namespace { startsWith: typeof startsWith; /** - * Converts a string to "sticky caps" case. - * - * @param str - input string - * @param p - probability of capitalization (default: 0.5) - * @returns sticky case string - * - * @example - * var str = ns.stickycase( 'hello world' ); - * // returns - * - * @example - * var str = ns.stickycase( 'hello world', 0.2 ); - * // returns - * - * @example - * var str = ns.stickycase( 'hello world', 0.8 ); - * // returns - */ + * Converts a string to "sticky caps" case. + * + * @param str - input string + * @param p - probability of capitalization (default: 0.5) + * @returns sticky case string + * + * @example + * var str = ns.stickycase( 'hello world' ); + * // returns + * + * @example + * var str = ns.stickycase( 'hello world', 0.2 ); + * // returns + * + * @example + * var str = ns.stickycase( 'hello world', 0.8 ); + * // returns + */ stickycase: typeof stickycase; /** diff --git a/lib/node_modules/@stdlib/string/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/docs/types/index.d.ts index 1b643fcc47db..ef15ba912e50 100644 --- a/lib/node_modules/@stdlib/string/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/docs/types/index.d.ts @@ -1211,7 +1211,7 @@ interface Namespace { * Returns an iterator which iterates over each grapheme cluster in a string. * * @param src - input value - * @param mapFc - function to invoke for each iterated value + * @param mapFcn - function to invoke for each iterated value * @param thisArg - execution context * @returns iterator * @@ -1233,7 +1233,7 @@ interface Namespace { * Returns an iterator which iterates from right to left over each grapheme cluster in a string. * * @param src - input value - * @param mapFc - function to invoke for each iterated value + * @param mapFcn - function to invoke for each iterated value * @param thisArg - execution context * @returns iterator * diff --git a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts index fc5637c4c777..c0aad43c1388 100644 --- a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts @@ -2591,7 +2591,7 @@ interface Namespace { * @param obj - input object * @param options - function options * @param options.thisArg - execution context - * @param options.returns - if `values`, values are returned; if `keys`, keys are returned; if `*`, both keys and values are returned (default: 'values') + * @param options.returns - if `'values'`, values are returned; if `'indices'`, indices are returned; if `'*'`, both indices and values are returned (default: 'values') * @param indicator - indicator function indicating which group an element in the input object belongs to * @returns group results * @@ -2600,45 +2600,16 @@ interface Namespace { * return v[ 0 ]; * } * var obj = { - * 'a': 'beep', - * 'b': 'boop', - * 'c': 'foo', - * 'd': 'bar' - * }; - * var out = ns.groupOwn( obj, indicator ); - * // e.g., returns { 'b': [ 'beep', 'boop', 'bar' ], 'f': [ 'foo' ] } - * - * @example - * function indicator( v ) { - * return v[ 0 ]; - * } - * var obj = { - * 'a': 'beep', - * 'b': 'boop', - * 'c': 'foo', - * 'd': 'bar' - * }; - * var opts = { - * 'returns': 'keys' - * }; - * var out = ns.groupOwn( obj, opts, indicator ); - * // e.g., returns { 'b': [ 'a', 'b', 'd' ], 'f': [ 'c' ] } - * - * @example - * function indicator( v ) { - * return v[ 0 ]; - * } - * var obj = { - * 'a': 'beep', - * 'b': 'boop', - * 'c': 'foo', - * 'd': 'bar' + * 'a': 'apple', + * 'b': 'banana', + * 'c': 'cherry', + * 'd': 'date' * }; * var opts = { - * 'returns': '*' + * 'returns': 'values' * }; * var out = ns.groupOwn( obj, opts, indicator ); - * // e.g., returns { 'b': [ [ 'a', 'beep' ], [ 'b', 'boop' ], [ 'd', 'bar' ] ], 'f': [ [ 'c', 'foo' ] ] } + * // e.g., returns { 'a': [ 'apple' ], 'b': [ 'banana' ], 'c': [ 'cherry' ], 'd': [ 'date' ] } */ groupOwn: typeof groupOwn; @@ -3328,13 +3299,18 @@ interface Namespace { * } * * function clbk( v ) { + * this.count += 1; * return v * 2; * } * - * var bar = ns.mapArguments( foo, clbk ); + * var thisArg = { 'count': 0 }; + * var bar = ns.mapArguments( foo, clbk, thisArg ); * * var out = bar( 1, 2, 3 ); * // returns [ 2, 4, 6 ] + * + * var count = thisArg.count; + * // returns 3 */ mapArguments: typeof mapArguments; @@ -4356,8 +4332,8 @@ interface Namespace { * Inverts an object, such that keys become values and values become keys. * * @param obj - input object - * @param opts - function options - * @param opts.duplicates - boolean indicating whether to store duplicate keys (default: true) + * @param options - function options + * @param options.duplicates - boolean indicating whether to store duplicate keys (default: true) * @returns inverted object * * @example diff --git a/lib/node_modules/@stdlib/wasm/base/docs/types/index.d.ts b/lib/node_modules/@stdlib/wasm/base/docs/types/index.d.ts index b20e2bbb2028..76212a317e49 100644 --- a/lib/node_modules/@stdlib/wasm/base/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/wasm/base/docs/types/index.d.ts @@ -21,19 +21,171 @@ /* eslint-disable max-lines */ import array2dtype = require( '@stdlib/wasm/base/array2dtype' ); +import arrays2ptrs = require( '@stdlib/wasm/base/arrays2ptrs' ); +import dtype2wasm = require( '@stdlib/wasm/base/dtype2wasm' ); +import strided2object = require( '@stdlib/wasm/base/strided2object' ); /** -* Interface describing the namespace. +* Interface describing the `base` namespace. */ interface Namespace { /** - * TODO. + * Returns the WebAssembly data type for a provided array. + * + * ## Notes + * + * - If provided an argument having an unknown or unsupported type, the function assumes that the values can be stored as double-precision floating-point numbers and returns `'float64'`. + * + * @param array - input value + * @returns data type + * + * @example + * var dt = ns.array2dtype( [ 1, 2, 3 ] ); + * // returns 'float64' + * + * var dt = ns.array2dtype( 'beep' ); + * // returns 'float64' */ array2dtype: typeof array2dtype; + + /** + * Converts a list of arrays to "pointers" (i.e., byte offsets) in WebAssembly module memory. + * + * ## Notes + * + * - Beware that this function may reallocate module memory, resulting in `ArrayBuffer` detachment and the invalidation of any typed array views which were views of the previously allocated memory. Additionally, this function may write to module memory and does so without regard for any existing memory content. Users are thus encouraged to take suitable precautions (e.g., copying results out of module memory prior to subsequent invocation) in order to avoid unexpected results. + * - If an array's data is copied to module memory, the data is copied to a contiguous segment of module memory, and the respective array object in the returned array will have unit stride and an offset of zero. + * + * @param ctx - module context + * @param list - list of array objects + * @returns list of pointers + * + * @example + * var setReadOnlyAccessor = require( '@stdlib/utils/define-configurable-read-only-accessor' ); + * var ArrayBuffer = require( '@stdlib/array/buffer' ); + * var DataView = require( '@stdlib/array/dataview' ); + * var Float64Array = require( '@stdlib/array/float64' ); + * var dtype2wasm = require( '@stdlib/wasm/base/dtype2wasm' ); + * + * function Context() { + * this._buffer = new ArrayBuffer( 100 ); + * return this; + * } + * + * Context.prototype.isView = function isView( arr ) { + * return ( arr.buffer ) ? ( arr.buffer === this._buffer ) : false; + * }; + * + * Context.prototype.realloc = function realloc( nbytes ) { + * this._buffer = new ArrayBuffer( nbytes ); + * }; + * + * setReadOnlyAccessor( Context.prototype, 'view', function getter() { + * return new DataView( this._buffer ); + * }); + * + * // ... + * + * var ctx = new Context(); + * + * // ... + * + * var x = new Float64Array( 4 ); + * var y = new Float64Array( 4 ); + * + * // ... + * + * var xobj = { + * 'dtype': 'float64', + * 'wdtype': dtype2wasm( 'float64' ), + * 'length': x.length, + * 'data': x, + * 'stride': 1, + * 'offset': 0 + * }; + * + * var yobj = { + * 'dtype': 'float64', + * 'wdtype': dtype2wasm( 'float64' ), + * 'length': y.length, + * 'data': y, + * 'stride': 1, + * 'offset': 0 + * }; + * + * var out = ns.arrays2ptrs( ctx, [ xobj, yobj ] ); + * // returns [...] + */ + arrays2ptrs: typeof arrays2ptrs; + + /** + * Returns the WebAssembly data type associated with a provided array data type value. + * + * ## Notes + * + * - If provided a "generic" or unknown array data type, the function assumes that the values can be stored as double-precision floating-point numbers. + * + * @param dtype - array data type + * @returns WebAssembly data type + * + * @example + * var out = ns.dtype2wasm( 'float64' ); + * // returns 'float64' + * + * out = ns.dtype2wasm( 'generic' ); + * // returns 'float64' + */ + dtype2wasm: typeof dtype2wasm; + + /** + * Converts a strided array and associated metadata to an object likely to have the same "shape". + * + * ## Notes + * + * - This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding strided array metadata to ensure that internal functions operating on strided arrays are provided consistent argument "shapes". + * + * - The returned object has the following properties: + * + * - **data**: reference to the input array. + * - **dtype**: array data type. + * - **wdtype**: WebAssembly data type. + * - **length**: number of indexed elements. + * - **stride**: index increment. + * - **offset**: starting index. + * - **accessorProtocol**: boolean indicating whether the input array uses accessors for getting and setting elements. + * - **accessors**: a two-element array whose first element is an accessor for retrieving an array element and whose second element is an accessor for setting an array element. + * + * @param N - number of indexed elements + * @param x - input array + * @param stride - index increment + * @param offset - index offset + * @returns object containing strided array data + * + * @example + * var x = { + * '0': 1, + * '1': 2, + * '2': 3, + * '4': 4, + * 'length': 4 + * }; + * var obj = ns.strided2object( 4, x, 1, 0 ); + * // returns {...} + * + * var bool = obj.accessorProtocol; + * // returns false + * + * var fcns = obj.accessors; + * // returns [ , ] + * + * var v = fcns[ 0 ]( x.data, 2 ); + * // returns 3 + */ + strided2object: typeof strided2object; } /** -* WebAssembly "base" utilities. +* Base (i.e., lower-level) WebAssembly utilities. */ declare var ns: Namespace; diff --git a/lib/node_modules/@stdlib/wasm/docs/types/index.d.ts b/lib/node_modules/@stdlib/wasm/docs/types/index.d.ts index 5eaa78dd1b29..7c3514269c0d 100644 --- a/lib/node_modules/@stdlib/wasm/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/wasm/docs/types/index.d.ts @@ -20,16 +20,28 @@ /* eslint-disable max-lines */ +import base = require( '@stdlib/wasm/base' ); import Memory = require( '@stdlib/wasm/memory' ); +import ModuleWrapper = require( '@stdlib/wasm/module-wrapper' ); /** -* Interface describing the namespace. +* Interface describing the `wasm` namespace. */ interface Namespace { /** - * TODO. + * Base (i.e., lower-level) WebAssembly utilities. + */ + base: typeof base; + + /** + * Class for creating WebAssembly memory instances. */ Memory: typeof Memory; + + /** + * Class for creating a WebAssembly module wrapper. + */ + ModuleWrapper: typeof ModuleWrapper; } /**