You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/ext/base/gsumors/README.md
+15-32
Original file line number
Diff line number
Diff line change
@@ -36,33 +36,29 @@ limitations under the License.
36
36
var gsumors =require( '@stdlib/blas/ext/base/gsumors' );
37
37
```
38
38
39
-
#### gsumors( N, x, stride )
39
+
#### gsumors( N, x, strideX )
40
40
41
41
Computes the sum of strided array elements using ordinary recursive summation.
42
42
43
43
```javascript
44
44
var x = [ 1.0, -2.0, 2.0 ];
45
-
varN=x.length;
46
45
47
-
var v =gsumors( N, x, 1 );
46
+
var v =gsumors( x.length, x, 1 );
48
47
// returns 1.0
49
48
```
50
49
51
50
The function has the following parameters:
52
51
53
52
-**N**: number of indexed elements.
54
53
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
55
-
-**stride**: index increment for `x`.
54
+
-**strideX**: stride length.
56
55
57
-
The `N` and `stride` parameters determine which elements in `x`are accessed at runtime. For example, to compute the sum of every other element in `x`,
56
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element:
58
57
59
58
```javascript
60
-
var floor =require( '@stdlib/math/base/special/floor' );
61
-
62
59
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ];
63
-
varN=floor( x.length/2 );
64
60
65
-
var v =gsumors( N, x, 2 );
61
+
var v =gsumors( 4, x, 2 );
66
62
// returns 5.0
67
63
```
68
64
@@ -72,42 +68,35 @@ Note that indexing is relative to the first index. To introduce an offset, use [
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
79
74
80
-
varN=floor( x0.length/2 );
81
-
82
-
var v =gsumors( N, x1, 2 );
75
+
var v =gsumors( 4, x1, 2 );
83
76
// returns 5.0
84
77
```
85
78
86
-
#### gsumors.ndarray( N, x, stride, offset )
79
+
#### gsumors.ndarray( N, x, strideX, offsetX )
87
80
88
81
Computes the sum of strided array elements using ordinary recursive summation and alternative indexing semantics.
89
82
90
83
```javascript
91
84
var x = [ 1.0, -2.0, 2.0 ];
92
-
varN=x.length;
93
85
94
-
var v =gsumors.ndarray( N, x, 1, 0 );
86
+
var v =gsumors.ndarray( x.length, x, 1, 0 );
95
87
// returns 1.0
96
88
```
97
89
98
90
The function has the following additional parameters:
99
91
100
-
-**offset**: starting index for `x`.
92
+
-**offsetX**: starting index.
101
93
102
-
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 calculate the sum of every other value in `x`starting from the second value
94
+
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 calculate the sum of every other element starting from the second element:
103
95
104
96
```javascript
105
-
var floor =require( '@stdlib/math/base/special/floor' );
106
-
107
97
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
108
-
varN=floor( x.length/2 );
109
98
110
-
var v =gsumors.ndarray( N, x, 2, 1 );
99
+
var v =gsumors.ndarray( 4, x, 2, 1 );
111
100
// returns 5.0
112
101
```
113
102
@@ -134,18 +123,12 @@ var v = gsumors.ndarray( N, x, 2, 1 );
134
123
<!-- eslint no-undef: "error" -->
135
124
136
125
```javascript
137
-
var randu =require( '@stdlib/random/base/randu' );
138
-
var round =require( '@stdlib/math/base/special/round' );
0 commit comments