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
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the maximum absolute value of every other element in `x`,
61
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the maximum absolute value of every other element in `x`,
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
84
81
85
-
varN=floor( x0.length/2 );
86
-
87
-
var v =dmaxabssorted( N, x1, 2 );
82
+
var v =dmaxabssorted( 4, x1, 2 );
88
83
// returns 4.0
89
84
```
90
85
91
-
#### dmaxabssorted.ndarray( N, x, stride, offset )
86
+
#### dmaxabssorted.ndarray( N, x, strideX, offsetX )
92
87
93
88
Computes the maximum absolute value of a sorted double-precision floating-point strided array using alternative indexing semantics.
94
89
@@ -102,18 +97,16 @@ var v = dmaxabssorted.ndarray( x.length, x, 1, 0 );
102
97
103
98
The function has the following additional parameters:
104
99
105
-
-**offset**: starting index for `x`.
100
+
-**offsetX**: starting index for `x`.
106
101
107
-
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 maximum absolute value for every other value in `x` starting from the second value
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 maximum absolute value for every other element in `x` starting from the second element
var dmaxabssorted =require( '@stdlib/stats/base/dmaxabssorted' );
144
137
145
-
var x;
146
-
var i;
147
-
148
-
x =newFloat64Array( 10 );
149
-
for ( i =0; i <x.length; i++ ) {
150
-
x[ i ] = i -5.0;
151
-
}
138
+
var options = {
139
+
'dtype':'float64'
140
+
};
141
+
var x =linspace( -5.0, 5.0, 10, options );
152
142
console.log( x );
153
143
154
144
var v =dmaxabssorted( x.length, x, 1 );
@@ -159,6 +149,123 @@ console.log( v );
159
149
160
150
<!-- /.examples -->
161
151
152
+
<!-- C interface documentation. -->
153
+
154
+
* * *
155
+
156
+
<sectionclass="c">
157
+
158
+
## C APIs
159
+
160
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
161
+
162
+
<sectionclass="intro">
163
+
164
+
</section>
165
+
166
+
<!-- /.intro -->
167
+
168
+
<!-- C usage documentation. -->
169
+
170
+
<sectionclass="usage">
171
+
172
+
### Usage
173
+
174
+
```c
175
+
#include"stdlib/stats/base/dmaxabssorted.h"
176
+
```
177
+
178
+
#### stdlib_strided_dmaxabssorted( N, \*X, strideX )
179
+
180
+
Computes the maximum absolute value of a sorted double-precision floating-point strided array.
0 commit comments