diff --git a/lib/node_modules/@stdlib/blas/ext/base/drev/README.md b/lib/node_modules/@stdlib/blas/ext/base/drev/README.md index 303719c37d5d..6f08750b7cd4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/drev/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/drev/README.md @@ -30,7 +30,7 @@ limitations under the License. var drev = require( '@stdlib/blas/ext/base/drev' ); ``` -#### drev( N, x, stride ) +#### drev( N, x, strideX ) Reverses a double-precision floating-point strided array `x` in-place. @@ -47,9 +47,9 @@ The function has the following parameters: - **N**: number of indexed elements. - **x**: input [`Float64Array`][@stdlib/array/float64]. -- **stride**: index increment. +- **strideX**: stride length for `x`. -The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to reverse every other element +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to reverse every other element: ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -76,7 +76,7 @@ drev( 3, x1, 2 ); // x0 => [ 1.0, -6.0, 3.0, -4.0, 5.0, -2.0 ] ``` -#### drev.ndarray( N, x, stride, offset ) +#### drev.ndarray( N, x, strideX, offsetX ) Reverses a double-precision floating-point strided array `x` in-place using alternative indexing semantics. @@ -91,9 +91,9 @@ drev.ndarray( x.length, x, 1, 0 ); The function has the following additional parameters: -- **offset**: starting index. +- **offsetX**: starting index for `x`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of the strided array +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of the strided array: ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -126,11 +126,12 @@ drev.ndarray( 3, x, 1, x.length-3 ); ```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var filledarrayBy = require( '@stdlib/array/filled-by' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var drev = require( '@stdlib/blas/ext/base/drev' ); -var x = filledarrayBy( 10, 'float64', discreteUniform( -100.0, 100.0 ) ); +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'float64' +}); console.log( x ); drev( x.length, x, 1 ); @@ -141,6 +142,123 @@ console.log( x ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/drev.h" +``` + +#### stdlib_strided_drev( N, \*X, strideX ) + +Reverses a double-precision floating-point strided array `X` in-place. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; + +stdlib_strided_drev( 4, x, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] double*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. + +```c +double stdlib_strided_drev( const CBLAS_INT N, double *X, const CBLAS_INT strideX ); +``` + +#### stdlib_strided_drev_ndarray( N, \*X, strideX, offsetX ) + +Reverses a double-precision floating-point strided array `X` in-place using alternative indexing semantics. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; + +stdlib_strided_drev_ndarray( 4, x, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] double*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. + +```c +void stdlib_strided_drev_ndarray( const CBLAS_INT N, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/drev.h" +#include + +int main( void ) { + // Create a strided array: + double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 }; + + // Specify the number of elements: + const int N = 8; + + // Specify a stride: + const int strideX = 1; + + // Reverse the array: + stdlib_strided_drev( N, x, strideX ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + } +} +``` + +
+ + + +
+ + +