Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
322 changes: 322 additions & 0 deletions lib/node_modules/@stdlib/blas/ext/base/dcunone/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
<!--

@license Apache-2.0

Copyright (c) 2026 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

# dcunone

> Cumulatively test whether every element in a double-precision floating-point strided array is falsy.

<section class="intro">

</section>

<!-- /.intro -->

<section class="usage">

## Usage

```javascript
var dcunone = require( '@stdlib/blas/ext/base/dcunone' );
```

#### dcunone( N, x, strideX, out, strideOut )

Cumulatively tests whether every element in a double-precision floating-point strided array is falsy.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var BooleanArray = require( '@stdlib/array/bool' );

var x = new Float64Array( [ 0.0, 0.0, 1.0, 1.0 ] );
var out = new BooleanArray( 4 );

dcunone( x.length, x, 1, out, 1 );
// out => <BooleanArray>[ true, true, false, false ]
```

The function has the following parameters:

- **N**: number of indexed elements.
- **x**: input [`Float64Array`][@stdlib/array/float64].
- **strideX**: stride length for `x`.
- **out**: output [`BooleanArray`][@stdlib/array/bool].
- **strideOut**: stride length for `out`.

The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to cumulatively test every other element:

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var BooleanArray = require( '@stdlib/array/bool' );

var x = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] );
var out = new BooleanArray( 4 );

dcunone( 4, x, 2, out, 1 );
// out => <BooleanArray>[ true, true, false, false ]
```

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.

<!-- eslint-disable stdlib/capitalized-comments -->

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var BooleanArray = require( '@stdlib/array/bool' );

// Initial arrays...
var x0 = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] );
var o0 = new BooleanArray( x0.length );

// Create offset views...
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var o1 = new BooleanArray( o0.buffer, o0.BYTES_PER_ELEMENT*3 ); // start at 4th element

dcunone( 3, x1, 2, o1, 1 );
// o0 => <BooleanArray>[ false, false, false, true, false, false ]
```

#### dcunone.ndarray( N, x, strideX, offsetX, out, strideOut, offsetOut )

Cumulatively tests whether every element in a double-precision floating-point strided array is falsy using alternative indexing semantics.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var BooleanArray = require( '@stdlib/array/bool' );

var x = new Float64Array( [ 0.0, 0.0, 1.0, 1.0 ] );
var out = new BooleanArray( 4 );

dcunone.ndarray( x.length, x, 1, 0, out, 1, 0 );
// out => <BooleanArray>[ true, true, false, false ]
```

The function has the following additional parameters:

- **offsetX**: starting index for `x`.
- **offsetOut**: starting index for `out`.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to cumulatively test every other element starting from the third element:

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var BooleanArray = require( '@stdlib/array/bool' );

var x = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] );
var out = new BooleanArray( 3 );

dcunone.ndarray( 3, x, 2, 2, out, 1, 0 );
// out => <BooleanArray>[ true, false, false ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- If `N <= 0`, both functions return `out` unchanged.

</section>

<!-- /.notes -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var uniform = require( '@stdlib/random/array/uniform' );
var dcunone = require( '@stdlib/blas/ext/base/dcunone' );
var BooleanArray = require( '@stdlib/array/bool' );

var x = uniform( 10, -10.0, 10.0, {
'dtype': 'float64'
});
console.log( x );

var out = new BooleanArray( x.length );
dcunone( x.length, x, 1, out, 1 );
console.log( out );
```

</section>

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/blas/ext/base/dcunone.h"
```

#### stdlib_strided_dcunone( N, \*X, strideX, \*out, strideOut )

Cumulatively tests whether every element in a double-precision floating-point strided array is falsy.

```c
const double x[] = { 0.0, 0.0, 1.0, 1.0 };
bool out[] = { false, false, false, false };

stdlib_strided_dcunone( 4, x, 1, out, 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`.
- **out**: `[out] bool*` output array.
- **strideOut**: `[in] CBLAS_INT` stride length for `out`.

```c
void stdlib_strided_dcunone( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, bool *out, const CBLAS_INT strideOut );
```

<!-- lint disable maximum-heading-length -->

#### stdlib_strided_dcunone_ndarray( N, \*X, strideX, offsetX, \*out, strideOut, offsetOut )

<!-- lint enable maximum-heading-length -->

Cumulatively tests whether every element in a double-precision floating-point strided array is falsy using alternative indexing semantics.

```c
const double x[] = { 0.0, 0.0, 1.0, 1.0 };
bool out[] = { false, false, false, false };

stdlib_strided_dcunone_ndarray( 4, x, 1, 0, out, 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`.
- **out**: `[out] bool*` output array.
- **strideOut**: `[in] CBLAS_INT` stride length for `out`.
- **offsetOut**: `[in] CBLAS_INT` starting index for `out`.

```c
void stdlib_strided_dcunone_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, bool *out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut );
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
#include "stdlib/blas/ext/base/dcunone.h"
#include <stdio.h>
#include <stdbool.h>

int main( void ) {
// Create strided arrays:
const double x[] = { 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 };
bool out[] = { false, false, false, false, false, false, false, false };

// Specify the number of indexed elements:
const int N = 8;

// Specify strides:
const int strideX = 1;
const int strideOut = 1;

// Cumulatively test whether every element is falsy:
stdlib_strided_dcunone( N, x, strideX, out, strideOut );

// Print the results:
for ( int i = 0; i < 8; i++ ) {
printf( "out[ %i ] = %s\n", i, out[ i ] ? "true" : "false" );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[@stdlib/array/float64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/float64

[@stdlib/array/bool]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/bool

[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray

<!-- <related-links> -->

<!-- </related-links> -->

</section>

<!-- /.links -->
Loading
Loading