Skip to content

Commit 01d5280

Browse files
committed
docs: update README.md
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent d7f2772 commit 01d5280

File tree

1 file changed

+128
-20
lines changed
  • lib/node_modules/@stdlib/stats/base/dnanminabs

1 file changed

+128
-20
lines changed

lib/node_modules/@stdlib/stats/base/dnanminabs/README.md

Lines changed: 128 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,33 @@ limitations under the License.
3636
var dnanminabs = require( '@stdlib/stats/base/dnanminabs' );
3737
```
3838

39-
#### dnanminabs( N, x, stride )
39+
#### dnanminabs( N, x, strideX )
4040

4141
Computes the minimum absolute value of a double-precision floating-point strided array `x`, ignoring `NaN` values.
4242

4343
```javascript
4444
var Float64Array = require( '@stdlib/array/float64' );
4545

4646
var x = new Float64Array( [ 1.0, -2.0, NaN, 2.0 ] );
47-
var N = x.length;
4847

49-
var v = dnanminabs( N, x, 1 );
48+
var v = dnanminabs( x.length, x, 1 );
5049
// returns 1.0
5150
```
5251

5352
The function has the following parameters:
5453

5554
- **N**: number of indexed elements.
5655
- **x**: input [`Float64Array`][@stdlib/array/float64].
57-
- **stride**: index increment for `x`.
56+
- **strideX**: stride length for `x`.
5857

59-
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the minimum absolute value of every other element in `x`,
58+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the minimum absolute value of every other element in `x`,
6059

6160
```javascript
6261
var Float64Array = require( '@stdlib/array/float64' );
63-
var floor = require( '@stdlib/math/base/special/floor' );
6462

6563
var x = new Float64Array( [ 1.0, 2.0, -7.0, -2.0, 4.0, 3.0, NaN, NaN ] );
66-
var N = floor( x.length / 2 );
6764

68-
var v = dnanminabs( N, x, 2 );
65+
var v = dnanminabs( 4, x, 2 );
6966
// returns 1.0
7067
```
7168

@@ -75,45 +72,39 @@ Note that indexing is relative to the first index. To introduce an offset, use [
7572

7673
```javascript
7774
var Float64Array = require( '@stdlib/array/float64' );
78-
var floor = require( '@stdlib/math/base/special/floor' );
7975

8076
var x0 = new Float64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
8177
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
8278

83-
var N = floor( x0.length / 2 );
84-
85-
var v = dnanminabs( N, x1, 2 );
79+
var v = dnanminabs( 4, x1, 2 );
8680
// returns 1.0
8781
```
8882

89-
#### dnanminabs.ndarray( N, x, stride, offset )
83+
#### dnanminabs.ndarray( N, x, strideX, offsetX )
9084

9185
Computes the minimum absolute value of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
9286

9387
```javascript
9488
var Float64Array = require( '@stdlib/array/float64' );
9589

9690
var x = new Float64Array( [ 1.0, -2.0, NaN, 2.0 ] );
97-
var N = x.length;
9891

99-
var v = dnanminabs.ndarray( N, x, 1, 0 );
92+
var v = dnanminabs.ndarray( x.length, x, 1, 0 );
10093
// returns 1.0
10194
```
10295

10396
The function has the following additional parameters:
10497

105-
- **offset**: starting index for `x`.
98+
- **offsetX**: starting index for `x`.
10699

107-
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 calculate the minimum absolute value for every other value in `x` starting from the second value
100+
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 calculate the minimum absolute value for every other element in `x` starting from the second element
108101

109102
```javascript
110103
var Float64Array = require( '@stdlib/array/float64' );
111-
var floor = require( '@stdlib/math/base/special/floor' );
112104

113105
var x = new Float64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
114-
var N = floor( x.length / 2 );
115106

116-
var v = dnanminabs.ndarray( N, x, 2, 1 );
107+
var v = dnanminabs.ndarray( 4, x, 2, 1 );
117108
// returns 1.0
118109
```
119110

@@ -164,6 +155,123 @@ console.log( v );
164155

165156
<!-- /.examples -->
166157

158+
<!-- C interface documentation. -->
159+
160+
* * *
161+
162+
<section class="c">
163+
164+
## C APIs
165+
166+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
167+
168+
<section class="intro">
169+
170+
</section>
171+
172+
<!-- /.intro -->
173+
174+
<!-- C usage documentation. -->
175+
176+
<section class="usage">
177+
178+
### Usage
179+
180+
```c
181+
#include "stdlib/stats/base/dnanminabs.h"
182+
```
183+
184+
#### stdlib_strided_dnanminabs( N, \*X, strideX )
185+
186+
Calculate the minimum absolute value of a double-precision floating-point strided array, ignoring `NaN` values.
187+
188+
```c
189+
const double x[] = { 1.0, -2.0, 0.0 / 0.0, -4.0 };
190+
191+
double v = stdlib_strided_dnanminabs( 4, x, 1 );
192+
// returns 1.0
193+
```
194+
195+
The function accepts the following arguments:
196+
197+
- **N**: `[in] CBLAS_INT` number of indexed elements.
198+
- **X**: `[in] double*` input array.
199+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
200+
201+
```c
202+
double stdlib_strided_dnanminabs( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );
203+
```
204+
205+
#### stdlib_strided_dnanminabs_ndarray( N, \*X, strideX, offsetX )
206+
207+
Computes the minimum absolute value of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
208+
209+
```c
210+
const double x[] = { 1.0, -2.0, 0.0 / 0.0, -4.0 };
211+
212+
double v = stdlib_strided_dnanminabs_ndarray( 4, x, 1, 0 );
213+
// returns 1.0
214+
```
215+
216+
The function accepts the following arguments:
217+
218+
- **N**: `[in] CBLAS_INT` number of indexed elements.
219+
- **X**: `[in] double*` input array.
220+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
221+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
222+
223+
```c
224+
double stdlib_strided_dnanminabs_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
225+
```
226+
227+
</section>
228+
229+
<!-- /.usage -->
230+
231+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
232+
233+
<section class="notes">
234+
235+
</section>
236+
237+
<!-- /.notes -->
238+
239+
<!-- C API usage examples. -->
240+
241+
<section class="examples">
242+
243+
### Examples
244+
245+
```c
246+
#include "stdlib/stats/base/dnanminabs.h"
247+
#include <stdio.h>
248+
249+
int main( void ) {
250+
// Create a strided array:
251+
const double x[] = { 1.0, -2.0, -3.0, 4.0, -5.0, -6.0, 7.0, 8.0, 0.0/0.0, 0.0/0.0 };
252+
253+
// Specify the number of elements:
254+
const int N = 5;
255+
256+
// Specify the stride length:
257+
const int strideX = 2;
258+
259+
// Compute the minimum absolute value:
260+
double v = stdlib_strided_dnanminabs( N, x, strideX );
261+
262+
// Print the result:
263+
printf( "minabs: %lf\n", v );
264+
}
265+
```
266+
267+
</section>
268+
269+
<!-- /.examples -->
270+
271+
</section>
272+
273+
<!-- /.c -->
274+
167275
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
168276
169277
<section class="related">

0 commit comments

Comments
 (0)