Skip to content

Commit 441d61c

Browse files
authored
feat: add boolean dtype support to strided/base/unary
PR-URL: #2519 Ref: #2500 Reviewed-by: Athan Reines <[email protected]>
1 parent f5ee96c commit 441d61c

File tree

295 files changed

+454
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+454
-290
lines changed

lib/node_modules/@stdlib/strided/base/unary/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Character codes for data types:
191191

192192
<!-- charcodes -->
193193

194+
- **x**: `bool` (boolean).
194195
- **c**: `complex64` (single-precision floating-point complex number).
195196
- **z**: `complex128` (double-precision floating-point complex number).
196197
- **f**: `float32` (single-precision floating-point number).
@@ -6000,6 +6001,47 @@ The function accepts the following arguments:
60006001
void stdlib_strided_u_z_as_z_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );
60016002
```
60026003

6004+
#### stdlib_strided_x_x( \*arrays\[], \*shape, \*strides, \*fcn )
6005+
6006+
Applies a unary callback to strided input array elements and assigns results to elements in a strided output array.
6007+
6008+
```c
6009+
#include <stdbool.h>
6010+
#include <stdint.h>
6011+
6012+
// Create underlying byte arrays:
6013+
uint8_t x[] = { 0, 0, 0 };
6014+
uint8_t out[] = { 0, 0, 0 };
6015+
6016+
// Define a pointer to an array containing pointers to strided arrays:
6017+
uint8_t *arrays[] = { x, out };
6018+
6019+
// Define the strides:
6020+
int64_t strides[] = { 1, 1 };
6021+
6022+
// Define the number of elements over which to iterate:
6023+
int64_t shape[] = { 3 };
6024+
6025+
// Define a callback:
6026+
static bool fcn( bool x ) {
6027+
return x;
6028+
}
6029+
6030+
// Apply the callback:
6031+
stdlib_strided_x_x( arrays, shape, strides, (void *)fcn );
6032+
```
6033+
6034+
The function accepts the following arguments:
6035+
6036+
- **arrays**: `[inout] uint8_t**` array whose first element is a pointer to a strided input array and whose second element is a pointer to a strided output array.
6037+
- **shape**: `[in] int64_t*` array whose only element is the number of elements over which to iterate.
6038+
- **strides**: `[in] int64_t*` array containing strides (in bytes) for each strided array.
6039+
- **fcn**: `[in] void*` a `bool (*f)(bool)` function to apply provided as a `void` pointer.
6040+
6041+
```c
6042+
void stdlib_strided_x_x( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );
6043+
```
6044+
60036045
#### stdlib_strided_z_d_as_z_d( \*arrays\[], \*shape, \*strides, \*fcn )
60046046

60056047
Applies a unary callback to strided input array elements and assigns results to elements in a strided output array.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@
178178
#include "unary/u_z_as_u_z.h"
179179
#include "unary/u_z_as_z_z.h"
180180

181+
#include "unary/x_x.h"
182+
181183
#include "unary/z_d_as_z_d.h"
182184
#include "unary/z_z.h"
183185
// END LOOPS

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_b.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_b_as_u_u.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_c_as_b_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_c_as_c_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_c_as_z_z.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_d.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/strided/base/unary/include/stdlib/strided/base/unary/b_d_as_b_d.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)