Skip to content

Commit 492e68f

Browse files
authored
Merge branch 'develop' into nd/rot90
2 parents 019b464 + 78898df commit 492e68f

303 files changed

Lines changed: 18038 additions & 371 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
<!-- lint disable expected-html-sections -->
22+
23+
# NumPy
24+
25+
> Migration guide for NumPy.
26+
27+
## Common Operations
28+
29+
<!-- lint disable table-pipe-alignment -->
30+
31+
| Description | NumPy | stdlib |
32+
| ----------- | ----- | ------ |
33+
| Test whether an array contains truthy values | `np.any(x)` | [`any(x)`][@stdlib/ndarray/any] |
34+
| Broadcast an array to a specified shape | `np.broadcast_to(x, shape)` | [`broadcastArray(x, shape)`][@stdlib/ndarray/broadcast-array] |
35+
| Broadcast a scalar to a specified shape | `np.broadcast_to(np.array(scalar), shape)` | [`broadcastScalar(scalar, shape)`][@stdlib/ndarray/broadcast-scalar] |
36+
| Copy an array | `np.copy(x)` | [`copy(x)`][@stdlib/ndarray/copy] |
37+
| Count the number of falsy values in an array | `x.size-np.count_nonzero(x)` | [`countFalsy(x)`][@stdlib/ndarray/count-falsy] |
38+
| Count the number of truthy values in an array | `np.count_nonzeros(x)` | [`countTruthy(x)`][@stdlib/ndarray/count-truthy] |
39+
| Test whether an array includes a specific value | `np.any(np.equal(x,v))` | [`includes(x,v)`][@stdlib/ndarray/includes] |
40+
| Reverse the elements along a dimension | `np.flip(x, axis=dim)` | [`reverseDimension(x, dim)`][@stdlib/ndarray/reverse-dimension] |
41+
| Prepend a a specified number of singleton dimensions | `np.reshape(x, (1,)*n + x.shape)` | [`prependSingletonDimensions(x, n)`][@stdlib/ndarray/prepend-singleton-dimensions] |
42+
| Test whether an array contains at least `n` truthy values | `np.count_nonzero(x) >= n` | [`some(x, n)`][@stdlib/ndarray/some] |
43+
44+
<!-- lint enable table-pipe-alignment -->
45+
46+
## Function Reference
47+
48+
{{table}}
49+
50+
<section class="links">
51+
52+
[@stdlib/ndarray/any]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/any
53+
54+
[@stdlib/ndarray/broadcast-array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/broadcast-array
55+
56+
[@stdlib/ndarray/broadcast-scalar]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/broadcast-scalar
57+
58+
[@stdlib/ndarray/copy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/copy
59+
60+
[@stdlib/ndarray/count-falsy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/count-falsy
61+
62+
[@stdlib/ndarray/count-truthy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/count-truthy
63+
64+
[@stdlib/ndarray/includes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/includes
65+
66+
[@stdlib/ndarray/prepend-singleton-dimensions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/prepend-singleton-dimensions
67+
68+
[@stdlib/ndarray/reverse-dimension]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/reverse-dimension
69+
70+
[@stdlib/ndarray/some]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/some
71+
72+
</section>
73+
74+
<!-- /.links -->

lib/node_modules/@stdlib/blas/base/cgemv/lib/base.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function cgemv( trans, M, N, alpha, A, strideA1, strideA2, offsetA, x, strideX,
143143

144144
// y = beta*y
145145
if ( rebeta === 0.0 && imbeta === 0.0 ) {
146-
cfill( ylen, alpha, y, strideY, offsetY );
146+
cfill( ylen, beta, y, strideY, offsetY );
147147
} else if ( rebeta !== 1.0 || imbeta !== 0.0 ) {
148148
cscal( ylen, beta, y, strideY, offsetY );
149149
}
@@ -160,8 +160,8 @@ function cgemv( trans, M, N, alpha, A, strideA1, strideA2, offsetA, x, strideX,
160160
sign = 1;
161161
}
162162
oa = offsetA * 2;
163-
sa1 = strideA1 *2;
164-
sa2 = strideA2 *2;
163+
sa1 = strideA1 * 2;
164+
sa2 = strideA2 * 2;
165165
ox = offsetX * 2;
166166
oy = offsetY * 2;
167167
sx = strideX * 2;

lib/node_modules/@stdlib/blas/base/cgemv/lib/ndarray.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operatio
2424
var format = require( '@stdlib/string/format' );
2525
var base = require( './base.js' );
2626

27+
28+
// MAIN //
29+
2730
/**
2831
* Performs one of the matrix-vector operations `y = α*A*x + β*y` or `y = α*A^T*x + β*y` or `y = α*A^H*x + β*y`, where `α` and `β` are scalars, `x` and `y` are vectors, and `A` is an `M` by `N` matrix.
2932
*

lib/node_modules/@stdlib/blas/base/docs/types/index.d.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import assert = require( '@stdlib/blas/base/assert' );
2424
import caxpy = require( '@stdlib/blas/base/caxpy' );
2525
import ccopy = require( '@stdlib/blas/base/ccopy' );
26+
import cgemv = require( '@stdlib/blas/base/cgemv' );
2627
import cscal = require( '@stdlib/blas/base/cscal' );
2728
import csrot = require( '@stdlib/blas/base/csrot' );
2829
import csscal = require( '@stdlib/blas/base/csscal' );
@@ -200,6 +201,51 @@ interface Namespace {
200201
*/
201202
ccopy: typeof ccopy;
202203

204+
/**
205+
* Performs one of the matrix-vector operations `y = α*A*x + β*y` or `y = α*A^T*x + β*y` or `y = α*A^H*x + β*y`, where `α` and `β` are scalars, `x` and `y` are vectors, and `A` is an `M` by `N` matrix.
206+
*
207+
* @param order - storage layout
208+
* @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
209+
* @param M - number of rows in the matrix `A`
210+
* @param N - number of columns in the matrix `A`
211+
* @param alpha - scalar constant
212+
* @param A - input matrix
213+
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
214+
* @param x - first input vector
215+
* @param strideX - `x` stride length
216+
* @param beta - scalar constant
217+
* @param y - second input vector
218+
* @param strideY - `y` stride length
219+
* @returns `y`
220+
*
221+
* @example
222+
* var Complex64Array = require( '@stdlib/array/complex64' );
223+
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
224+
*
225+
* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0 ] );
226+
* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0 ] );
227+
* var y = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] );
228+
* var alpha = new Complex64( 0.5, 0.5 );
229+
* var beta = new Complex64( 0.5, -0.5 );
230+
*
231+
* ns.cgemv( 'column-major', 'no-transpose', 4, 2, alpha, A, 4, x, 1, beta, y, 1 );
232+
* // y => <Complex64Array>[ -10.0, 11.0, -12.0, 14.0, -14.0, 17.0, -16.0, 20.0 ]
233+
*
234+
* @example
235+
* var Complex64Array = require( '@stdlib/array/complex64' );
236+
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
237+
*
238+
* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0 ] );
239+
* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0 ] );
240+
* var y = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] );
241+
* var alpha = new Complex64( 0.5, 0.5 );
242+
* var beta = new Complex64( 0.5, -0.5 );
243+
*
244+
* ns.cgemv.ndarray( 'no-transpose', 4, 2, alpha, A, 1, 4, 0, x, 1, 0, beta, y, 1, 0 );
245+
* // y => <Complex64Array>[ -10.0, 11.0, -12.0, 14.0, -14.0, 17.0, -16.0, 20.0 ]
246+
*/
247+
cgemv: typeof cgemv;
248+
203249
/**
204250
* Scales a single-precision complex floating-point vector by a single-precision complex floating-point constant.
205251
*

lib/node_modules/@stdlib/blas/ext/base/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ var o = ns;
6262
- <span class="signature">[`dcusumkbn2( N, sum, x, strideX, y, strideY )`][@stdlib/blas/ext/base/dcusumkbn2]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of double-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.</span>
6363
- <span class="signature">[`dcusumors( N, sum, x, strideX, y, strideY )`][@stdlib/blas/ext/base/dcusumors]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of double-precision floating-point strided array elements using ordinary recursive summation.</span>
6464
- <span class="signature">[`dcusumpw( N, sum, x, strideX, y, strideY )`][@stdlib/blas/ext/base/dcusumpw]</span><span class="delimiter">: </span><span class="description">calculate the cumulative sum of double-precision floating-point strided array elements using pairwise summation.</span>
65+
- <span class="signature">[`ddiff( N, k, x, strideX, N1, prepend, strideP, N2, append, strideA, out, strideOut, workspace, strideW )`][@stdlib/blas/ext/base/ddiff]</span><span class="delimiter">: </span><span class="description">calculate the k-th discrete forward difference of a double-precision floating-point strided array.</span>
6566
- <span class="signature">[`dfill( N, alpha, x, strideX )`][@stdlib/blas/ext/base/dfill]</span><span class="delimiter">: </span><span class="description">fill a double-precision floating-point strided array with a specified scalar constant.</span>
6667
- <span class="signature">[`dindexOfRow( order, M, N, A, LDA, x, strideX, workspace, strideW )`][@stdlib/blas/ext/base/dindex-of-row]</span><span class="delimiter">: </span><span class="description">return the index of the first row in a double-precision floating-point input matrix which has the same elements as a provided search vector.</span>
6768
- <span class="signature">[`dindexOf( N, searchElement, x, strideX )`][@stdlib/blas/ext/base/dindex-of]</span><span class="delimiter">: </span><span class="description">return the first index of a specified search element in a double-precision floating-point strided array.</span>
@@ -307,6 +308,8 @@ console.log( objectKeys( ns ) );
307308

308309
[@stdlib/blas/ext/base/dcusumpw]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/dcusumpw
309310

311+
[@stdlib/blas/ext/base/ddiff]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ddiff
312+
310313
[@stdlib/blas/ext/base/dfill]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/dfill
311314

312315
[@stdlib/blas/ext/base/dindex-of-row]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/dindex-of-row

0 commit comments

Comments
 (0)