Skip to content

Commit 24ee434

Browse files
committed
chore: clean-up and support negative strides
--- 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: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 00152da commit 24ee434

File tree

10 files changed

+156
-258
lines changed

10 files changed

+156
-258
lines changed

lib/node_modules/@stdlib/lapack/base/zlacgv/README.md

Lines changed: 13 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# zlacgv
2222

23-
> Conjugates a complex vector.
23+
> Conjugate each element in a double-precision complex floating-point vector.
2424
2525
<section class="usage">
2626

@@ -30,9 +30,9 @@ limitations under the License.
3030
var zlacgv = require( '@stdlib/lapack/base/zlacgv' );
3131
```
3232

33-
#### zlacgv( N, zx, strideX )
33+
#### zlacgv( N, zx, strideZX )
3434

35-
Conjugate values of `zx`.
35+
Conjugates each element in a double-precision complex floating-point vector.
3636

3737
```javascript
3838
var Complex128Array = require( '@stdlib/array/complex128' );
@@ -57,9 +57,9 @@ The function has the following parameters:
5757

5858
- **N**: number of indexed elements.
5959
- **zx**: input [`Complex128Array`][@stdlib/array/complex128].
60-
- **strideX**: index increment for `zx`.
60+
- **strideZX**: stride length for `zx`.
6161

62-
The `N` and stride parameters determine how values from `zx` conjugated. For example, to conjugate every other value in `zx`,
62+
The `N` and stride parameters determine which elements in `zx` are conjugated. For example, to conjugate every other element in `zx`,
6363

6464
```javascript
6565
var Complex128Array = require( '@stdlib/array/complex128' );
@@ -96,7 +96,7 @@ var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
9696
// Create an offset view:
9797
var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
9898

99-
// Conjugates every other value from `zx1`...
99+
// Conjugate every element in `zx1`:
100100
zlacgv( 3, zx1, 1 );
101101

102102
var z = zx0.get( 1 );
@@ -109,9 +109,9 @@ var im = imag( z );
109109
// returns -4.0
110110
```
111111

112-
#### zlacgv.ndarray( N, zx, strideX, offsetX )
112+
#### zlacgv.ndarray( N, zx, strideZX, offsetZX )
113113

114-
Conjugate values from `zx` using alternative indexing semantics.
114+
Conjugates each element in a double-precision floating-point vector using alternative indexing semantics.
115115

116116
```javascript
117117
var Complex128Array = require( '@stdlib/array/complex128' );
@@ -134,9 +134,9 @@ var im = imag( z );
134134

135135
The function has the following additional parameters:
136136

137-
- **offsetX**: starting index for `zx`.
137+
- **offsetZX**: starting index for `zx`.
138138

139-
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 conjugate every other value in the input strided array starting from the second element,
139+
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 conjugate every other element in the input strided array starting from the second element,
140140

141141
```javascript
142142
var Complex128Array = require( '@stdlib/array/complex128' );
@@ -165,8 +165,8 @@ var im = imag( z );
165165

166166
## Notes
167167

168-
- If `N <= 0` or `strideX <= 0` , both functions return `zx` unchanged.
169-
- `zlacgv()` corresponds to the [LAPACK][lapack] BLAS-like level 1 function [`zlacgv`][zlacgv].
168+
- If `N <= 0`, both functions return `zx` unchanged.
169+
- `zlacgv()` corresponds to the [LAPACK][lapack] BLAS-like level 1 routine [`zlacgv`][zlacgv].
170170

171171
</section>
172172

@@ -191,7 +191,7 @@ function rand() {
191191
var zx = filledarrayBy( 10, 'complex128', rand );
192192
console.log( zx.toString() );
193193

194-
// Conjugates elements from `zx`:
194+
// Conjugate elements:
195195
zlacgv( zx.length, zx, 1 );
196196
console.log( zx.get( zx.length-1 ).toString() );
197197
```
@@ -200,102 +200,6 @@ console.log( zx.get( zx.length-1 ).toString() );
200200

201201
<!-- /.examples -->
202202

203-
<!-- C interface documentation. -->
204-
205-
* * *
206-
207-
<section class="c">
208-
209-
## C APIs
210-
211-
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
212-
213-
<section class="intro">
214-
215-
</section>
216-
217-
<!-- /.intro -->
218-
219-
<!-- C usage documentation. -->
220-
221-
<section class="usage">
222-
223-
### Usage
224-
225-
```c
226-
#include "stdlib/lapack/base/zlacgv.h"
227-
```
228-
229-
#### c_zlacgv( N, \*ZX, strideX )
230-
231-
Conjugate values from `ZX`.
232-
233-
```c
234-
double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
235-
236-
c_zlacgv( 4, (void *)zx, 1 );
237-
```
238-
239-
The function accepts the following arguments:
240-
241-
- **N**: `[in] CBLAS_INT` number of indexed elements.
242-
- **ZX**: `[inout] void*` input array.
243-
- **strideX**: `[in] CBLAS_INT` index increment for `ZX`.
244-
245-
```c
246-
void c_zlacgv( const CBLAS_INT N, void *ZX, const CBLAS_INT strideX );
247-
```
248-
249-
</section>
250-
251-
<!-- /.usage -->
252-
253-
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
254-
255-
<section class="notes">
256-
257-
</section>
258-
259-
<!-- /.notes -->
260-
261-
<!-- C API usage examples. -->
262-
263-
<section class="examples">
264-
265-
### Examples
266-
267-
```c
268-
#include "stdlib/lapack/base/zlacgv.h"
269-
#include <stdio.h>
270-
271-
int main( void ) {
272-
// Create a strided array of interleaved real and imaginary components:
273-
double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
274-
275-
// Specify the number of elements:
276-
const int N = 4;
277-
278-
// Specify stride length:
279-
const int strideX = 1;
280-
281-
// Conjugate elements of the array:
282-
c_zlacgv( N, (void *)zx, strideX );
283-
284-
// Print the result:
285-
for ( int i = 0; i < N; i++ ) {
286-
printf( "zx[ %i ] = %f + %fj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] );
287-
}
288-
}
289-
```
290-
291-
</section>
292-
293-
<!-- /.examples -->
294-
295-
</section>
296-
297-
<!-- /.c -->
298-
299203
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
300204

301205
<section class="related">

lib/node_modules/@stdlib/lapack/base/zlacgv/docs/repl.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11

2-
{{alias}}( N, zx, strideX )
3-
Conjugates a double-precision complex floating-point vector.
2+
{{alias}}( N, zx, strideZX )
3+
Conjugates each element in a double-precision complex floating-point vector.
44

5-
The `N` and stride parameters determine how values from `zx` are
5+
The `N` and stride parameters determine which elements in `zx` are
66
conjugated.
77

88
Indexing is relative to the first index. To introduce an offset, use typed
99
array views.
1010

11-
If `N` or `strideX` is less than or equal to `0`, the function returns `zx`
12-
unchanged.
13-
11+
If `N` is less than or equal to `0`, the function returns `zx` unchanged.
1412

1513
Parameters
1614
----------
@@ -20,8 +18,8 @@
2018
zx: Complex128Array
2119
Input array.
2220

23-
strideX: integer
24-
Index increment for `zx`.
21+
strideZX: integer
22+
Stride length for `zx`.
2523

2624
Returns
2725
-------
@@ -59,9 +57,9 @@
5957
-4.0
6058

6159

62-
{{alias}}.ndarray( N, zx, strideX, offsetX )
63-
Conjugates a double-precision complex floating-point vector using
64-
alternative indexing semantics.
60+
{{alias}}.ndarray( N, zx, strideZX, offsetZX )
61+
Conjugates each element in a double-precision complex floating-point vector
62+
using alternative indexing semantics.
6563

6664
While typed array views mandate a view offset based on the underlying
6765
buffer, the offset parameter supports indexing semantics based on a starting
@@ -75,10 +73,10 @@
7573
zx: Complex128Array
7674
Input array.
7775

78-
strideX: integer
79-
Index increment for `zx`.
76+
strideZX: integer
77+
Stride length for `zx`.
8078

81-
offsetX: integer
79+
offsetZX: integer
8280
Starting index for `zx`.
8381

8482
Returns

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import { Complex128Array } from '@stdlib/types/array';
2727
*/
2828
interface Routine {
2929
/**
30-
* Conjugates a double-precision complex floating-point vector.
30+
* Conjugates each element in a double-precision complex floating-point vector.
3131
*
3232
* @param N - number of indexed elements
3333
* @param zx - input array
34-
* @param strideX - `zx` stride length
34+
* @param strideZX - `zx` stride length
3535
* @returns input array
3636
*
3737
* @example
@@ -52,15 +52,15 @@ interface Routine {
5252
* var im = imag( z );
5353
* // returns -2.0
5454
*/
55-
( N: number, zx: Complex128Array, strideX: number ): Complex128Array;
55+
( N: number, zx: Complex128Array, strideZX: number ): Complex128Array;
5656

5757
/**
58-
* Conjugates a double-precision complex floating-point vector.
58+
* Conjugates each element in a double-precision complex floating-point vector.
5959
*
6060
* @param N - number of indexed elements
6161
* @param zx - input array
62-
* @param strideX - `zx` stride length
63-
* @param offsetX - starting index for `zx`
62+
* @param strideZX - `zx` stride length
63+
* @param offsetZX - starting index for `zx`
6464
* @returns input array
6565
*
6666
* @example
@@ -81,15 +81,15 @@ interface Routine {
8181
* var im = imag( z );
8282
* // returns -2.0
8383
*/
84-
ndarray( N: number, zx: Complex128Array, strideX: number, offsetX: number ): Complex128Array;
84+
ndarray( N: number, zx: Complex128Array, strideZX: number, offsetZX: number ): Complex128Array;
8585
}
8686

8787
/**
88-
* Conjugates a double-precision complex floating-point vector.
88+
* Conjugates each element in a double-precision complex floating-point vector.
8989
*
9090
* @param N - number of indexed elements
9191
* @param zx - input array
92-
* @param strideX - `zx` stride length
92+
* @param strideZX - `zx` stride length
9393
* @returns input array
9494
*
9595
* @example

lib/node_modules/@stdlib/lapack/base/zlacgv/examples/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
2222
var filledarrayBy = require( '@stdlib/array/filled-by' );
2323
var Complex128 = require( '@stdlib/complex/float64/ctor' );
24-
var zlacgv = require( '@stdlib/lapack/base/zlacgv' );
24+
var zlacgv = require( './../lib' );
2525

2626
function rand() {
2727
return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) );
@@ -30,6 +30,6 @@ function rand() {
3030
var zx = filledarrayBy( 10, 'complex128', rand );
3131
console.log( zx.toString() );
3232

33-
// Conjugate elements of `zx`:
33+
// Conjugate elements:
3434
zlacgv( zx.length, zx, 1 );
3535
console.log( zx.get( zx.length-1 ).toString() );

lib/node_modules/@stdlib/lapack/base/zlacgv/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* LAPACK BLAS-like level-1 routine to conjugate a double-precision complex floating-point vector.
22+
* LAPACK BLAS-like level-1 routine to conjugate each element in a double-precision complex floating-point vector.
2323
*
2424
* @module @stdlib/lapack/base/zlacgv
2525
*

lib/node_modules/@stdlib/lapack/base/zlacgv/lib/ndarray.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' );
2626
// MAIN //
2727

2828
/**
29-
* Conjugates a double-precision complex floating-point vector.
29+
* Conjugates each element in a double-precision complex floating-point vector.
3030
*
3131
* @param {PositiveInteger} N - number of indexed elements
3232
* @param {Complex128Array} zx - input array
33-
* @param {integer} strideX - `zx` stride length
34-
* @param {NonNegativeInteger} offsetX - starting `zx` index
33+
* @param {integer} strideZX - `zx` stride length
34+
* @param {NonNegativeInteger} offsetZX - starting `zx` index
3535
* @returns {Complex128Array} input array
3636
*
3737
* @example
@@ -52,29 +52,27 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' );
5252
* var im = imag( z );
5353
* // returns -2.0
5454
*/
55-
function zlacgv( N, zx, strideX, offsetX ) {
55+
function zlacgv( N, zx, strideZX, offsetZX ) {
5656
var zx64;
5757
var ix;
5858
var sx;
5959
var i;
6060

61-
if ( N <= 0 || strideX <= 0 ) {
61+
if ( N <= 0 ) {
6262
return zx;
6363
}
64-
65-
// Interpret the complex input array as a float64 array
64+
// Reinterpret the input array as a real-valued array of interleaved real and imaginary components:
6665
zx64 = reinterpret( zx, 0 );
6766

68-
// Compute a stride and an index to be incremented
69-
sx = strideX*2;
70-
ix = (offsetX*2) + 1;
67+
// Adjust the strides and offset:
68+
sx = strideZX * 2;
69+
ix = ( offsetZX * 2 ) + 1; // index of the first imaginary component
7170

72-
// Conjugate the complex elements
71+
// Conjugate each element by negating the imaginary components...
7372
for ( i = 0; i < N; i++ ) {
7473
zx64[ ix ] = -zx64[ ix ];
7574
ix += sx;
7675
}
77-
7876
return zx;
7977
}
8078

0 commit comments

Comments
 (0)