Skip to content

Commit 01395e4

Browse files
committed
chore: update markdown file
--- 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 af6e6a8 commit 01395e4

File tree

1 file changed

+45
-80
lines changed
  • lib/node_modules/@stdlib/blas/base/zdotu

1 file changed

+45
-80
lines changed

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

Lines changed: 45 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [dot product][dot-product] (or scalar product) is defined as
2929
<!-- <equation class="equation" label="eq:dot_product" align="center" raw="\mathbf{x}\cdot\mathbf{y} = \sum_{i=0}^{N-1} x_i y_i = x_0 y_0 + x_1 y_1 + \ldots + x_{N-1} y_{N-1}" alt="Dot product definition."> -->
3030

3131
```math
32-
\mathbf{zx}\cdot\mathbf{zy} = \sum_{i=0}^{N-1} zx_i zy_i = zx_0 zy_0 + zx_1 zy_1 + \ldots + zx_{N-1} zy_{N-1}
32+
\mathbf{x}\cdot\mathbf{y} = \sum_{i=0}^{N-1} x_i y_i = x_0 y_0 + x_1 y_1 + \ldots + x_{N-1} y_{N-1}
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="\mathbf{x}\cdot\mathbf{y} = \sum_{i=0}^{N-1} x_i y_i = x_0 y_0 + x_1 y_1 + \ldots + x_{N-1} y_{N-1}" data-equation="eq:dot_product">
@@ -51,54 +51,38 @@ The [dot product][dot-product] (or scalar product) is defined as
5151
var zdotu = require( '@stdlib/blas/base/zdotu' );
5252
```
5353

54-
#### zdotu( N, zx, strideX, zy, strideY )
54+
#### zdotu( N, x, strideX, y, strideY )
5555

56-
Calculates the dot product of vectors `zx` and `zy`.
56+
Calculates the dot product of vectors `x` and `y`.
5757

5858
```javascript
5959
var Complex128Array = require( '@stdlib/array/complex128' );
60-
var real = require( '@stdlib/complex/float64/real' );
61-
var imag = require( '@stdlib/complex/float64/imag' );
6260

63-
var zx = new Complex128Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] );
64-
var zy = new Complex128Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] );
61+
var x = new Complex128Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] );
62+
var y = new Complex128Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] );
6563

66-
var z = zdotu( 3, zx, 1, zy, 1 );
67-
// returns <Complex128>
68-
69-
var re = real( z );
70-
// returns -52.0
71-
72-
var im = imag( z );
73-
// returns 82.0
64+
var z = zdotu( 3, x, 1, y, 1 );
65+
// returns <Complex128>[ -52.0, 82.0 ]
7466
```
7567

7668
The function has the following parameters:
7769

7870
- **N**: number of indexed elements.
79-
- **zx**: input [`Complex128Array`][@stdlib/array/complex128].
80-
- **strideX**: index increment for `zx`.
81-
- **zy**: input [`Complex128Array`][@stdlib/array/complex128].
82-
- **strideY**: index increment for `zy`.
71+
- **x**: input [`Complex128Array`][@stdlib/array/complex128].
72+
- **strideX**: stride kength for `x`.
73+
- **y**: input [`Complex128Array`][@stdlib/array/complex128].
74+
- **strideY**: stride kength for `y`.
8375

84-
The `N` and strides parameters determine which elements in the strided arrays are accessed at runtime. For example, to calculate the dot product of every other value in `zx` and the first `N` elements of `zy` in reverse order,
76+
The `N` and strides parameters determine which elements in the strided arrays are accessed at runtime. For example, to calculate the dot product of every other value in `x` and the first `N` elements of `y` in reverse order,
8577

8678
```javascript
8779
var Complex128Array = require( '@stdlib/array/complex128' );
88-
var real = require( '@stdlib/complex/float64/real' );
89-
var imag = require( '@stdlib/complex/float64/imag' );
90-
91-
var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
92-
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
9380

94-
var z = zdotu( 2, zx, 2, zy, -1 );
95-
// returns <Complex128>
81+
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
82+
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
9683

97-
var re = real( z );
98-
// returns -2.0
99-
100-
var im = imag( z );
101-
// returns 14.0
84+
var z = zdotu( 2, x, 2, y, -1 );
85+
// returns <Complex128>[ -2.0, 14.0 ]
10286
```
10387

10488
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
@@ -107,72 +91,48 @@ Note that indexing is relative to the first index. To introduce an offset, use [
10791

10892
```javascript
10993
var Complex128Array = require( '@stdlib/array/complex128' );
110-
var real = require( '@stdlib/complex/float64/real' );
111-
var imag = require( '@stdlib/complex/float64/imag' );
11294

11395
// Initial arrays...
114-
var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
115-
var zy0 = new Complex128Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
96+
var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
97+
var y0 = new Complex128Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
11698

11799
// Create offset views...
118-
var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
119-
var zy1 = new Complex128Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // start at 3th element
120-
121-
var z = zdotu( 1, zx1, 1, zy1, 1 );
122-
// returns <Complex128>
123-
124-
var re = real( z );
125-
// returns -15.0
100+
var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
101+
var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3th element
126102

127-
var im = imag( z );
128-
// returns 80.0
103+
var z = zdotu( 1, x1, 1, y1, 1 );
104+
// returns <Complex128>[ -15.0, 80.0 ]
129105
```
130106

131-
#### zdotu.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY )
107+
#### zdotu.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )
132108

133-
Calculates the dot product of `zx` and `zy` using alternative indexing semantics.
109+
Calculates the dot product of `x` and `y` using alternative indexing semantics.
134110

135111
```javascript
136112
var Complex128Array = require( '@stdlib/array/complex128' );
137-
var real = require( '@stdlib/complex/float64/real' );
138-
var imag = require( '@stdlib/complex/float64/imag' );
139113

140-
var zx = new Complex128Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] );
141-
var zy = new Complex128Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] );
114+
var x = new Complex128Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] );
115+
var y = new Complex128Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] );
142116

143-
var z = zdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0 );
144-
// returns <Complex128>
145-
146-
var re = real( z );
147-
// returns -52.0
148-
149-
var im = imag( z );
150-
// returns 82.0
117+
var z = zdotu.ndarray( x.length, x, 1, 0, y, 1, 0 );
118+
// returns <Complex128>[ -52.0, 82.0 ]
151119
```
152120

153121
The function has the following additional parameters:
154122

155-
- **offsetX**: starting index for `zx`.
156-
- **offsetY**: starting index for `zy`.
123+
- **offsetX**: starting index for `x`.
124+
- **offsetY**: starting index for `y`.
157125

158-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the dot product of every other value in `zx` starting from the second value with the last 2 elements in `zy` in reverse order
126+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the dot product of every other value in `x` starting from the second value with the last 2 elements in `y` in reverse order
159127

160128
```javascript
161129
var Complex128Array = require( '@stdlib/array/complex128' );
162-
var real = require( '@stdlib/complex/float64/real' );
163-
var imag = require( '@stdlib/complex/float64/imag' );
164-
165-
var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
166-
var zy = new Complex128Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); // eslint-disable-line max-len
167130

168-
var z = zdotu.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 );
169-
// returns <Complex128>
131+
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
132+
var y = new Complex128Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); // eslint-disable-line max-len
170133

171-
var re = real( z );
172-
// returns -40.0
173-
174-
var im = imag( z );
175-
// returns 310.0
134+
var z = zdotu.ndarray( 2, x, 2, 1, y, -1, y.length-1 );
135+
// returns <Complex128>[ -40.0, 310.0 ]
176136
```
177137

178138
</section>
@@ -206,13 +166,18 @@ function rand() {
206166
return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) );
207167
}
208168

209-
var zx = filledarrayBy( 10, 'complex128', rand );
210-
console.log( zx.toString() );
169+
var x = filledarrayBy( 10, 'complex128', rand );
170+
console.log( x.toString() );
171+
172+
var y = filledarrayBy( 10, 'complex128', rand );
173+
console.log( y.toString() );
211174

212-
var zy = filledarrayBy( 10, 'complex128', rand );
213-
console.log( zy.toString() );
175+
// Compute the dot product:
176+
var out = zdotu( x.length, x, 1, 0, y, -1, y.length-1 );
177+
console.log( out.toString() );
214178

215-
var out = zdotu.ndarray( zx.length, zx, 1, 0, zy, -1, zy.length-1 );
179+
// Compute the dot product using alternative indexing semantics:
180+
out = zdotu.ndarray( x.length, x, 1, 0, y, -1, y.length-1 );
216181
console.log( out.toString() );
217182
```
218183

0 commit comments

Comments
 (0)