Skip to content

Commit fff367c

Browse files
committed
docs: add C documentation
--- 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 3da65b0 commit fff367c

File tree

1 file changed

+101
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/snanmeanors

1 file changed

+101
-0
lines changed

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

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,107 @@ console.log( v );
179179

180180
<!-- /.references -->
181181

182+
<!-- C usage documentation. -->
183+
184+
<section class="usage">
185+
186+
### Usage
187+
188+
```c
189+
#include "stdlib/stats/base/snanmeanors.h"
190+
```
191+
192+
#### stdlib_strided_snanmeanors( N, \*X, strideX )
193+
194+
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation.
195+
196+
```c
197+
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
198+
199+
float v = stdlib_strided_snanmeanors( 4, x, 1 );
200+
// returns ~0.3333f
201+
```
202+
203+
The function accepts the following arguments:
204+
205+
- **N**: `[in] CBLAS_INT` number of indexed elements.
206+
- **X**: `[in] float*` input array.
207+
- **strideX**: `[in] CBLAS_INT` stride length.
208+
209+
```c
210+
float stdlib_strided_snanmeanors( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
211+
```
212+
213+
#### stdlib_strided_snanmeanors_ndarray( N, \*X, strideX, offsetX )
214+
215+
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array, ignoring `NaN` values and using ordinary recursive summation and alternative indexing semantics.
216+
217+
```c
218+
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
219+
220+
float v = stdlib_strided_snanmeanors_ndarray( 4, x, 1, 0 );
221+
// returns ~0.3333f
222+
```
223+
224+
The function accepts the following arguments:
225+
226+
- **N**: `[in] CBLAS_INT` number of indexed elements.
227+
- **X**: `[in] float*` input array.
228+
- **strideX**: `[in] CBLAS_INT` stride length.
229+
- **offsetX**: `[in] CBLAS_INT` starting index.
230+
231+
```c
232+
float stdlib_strided_snanmeanors_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
233+
```
234+
235+
</section>
236+
237+
<!-- /.usage -->
238+
239+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
240+
241+
<section class="notes">
242+
243+
</section>
244+
245+
<!-- /.notes -->
246+
247+
<!-- C API usage examples. -->
248+
249+
<section class="examples">
250+
251+
### Examples
252+
253+
```c
254+
#include "stdlib/stats/base/snanmeanors.h"
255+
#include <stdio.h>
256+
257+
int main( void ) {
258+
// Create a strided array:
259+
const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
260+
261+
// Specify the number of elements:
262+
const int N = 6;
263+
264+
// Specify the stride length:
265+
const int strideX = 2;
266+
267+
// Compute the arithmetic mean:
268+
float v = stdlib_strided_snanmeanors( N, x, strideX );
269+
270+
// Print the result:
271+
printf( "mean: %f\n", v );
272+
}
273+
```
274+
275+
</section>
276+
277+
<!-- /.examples -->
278+
279+
</section>
280+
281+
<!-- /.c -->
282+
182283
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
183284
184285
<section class="related">

0 commit comments

Comments
 (0)