@@ -181,7 +181,7 @@ Computes the L2-norm of a complex single-precision floating-point vector.
181
181
const float cx[] = { 0.3f, 0.1f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.2f };
182
182
183
183
float norm = c_scnrm2( 4, (void * )cx, 1 );
184
- // returns 0.8
184
+ // returns 0.8f
185
185
```
186
186
187
187
The function accepts the following arguments:
@@ -194,6 +194,27 @@ The function accepts the following arguments:
194
194
float c_scnrm2( const CBLAS_INT N, const void *CX, const CBLAS_INT strideX );
195
195
```
196
196
197
+ #### c_scnrm2_ndarray( N, \* CX, strideX, offsetX )
198
+
199
+ Computes the L2-norm of a complex single-precision floating-point vector using alternative indexing semantics.
200
+
201
+ ``` c
202
+ const float cx[] = { 0.3f, 0.1f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.2f };
203
+
204
+ float norm = c_scnrm2_ndarray( 4, (void * )cx, 1, 0 );
205
+ // returns 0.8f
206
+ ```
207
+
208
+ The function accepts the following arguments:
209
+
210
+ - **N**: `[in] CBLAS_INT` number of indexed elements.
211
+ - **CX**: `[in] void*` input array.
212
+ - **strideX**: `[in] CBLAS_INT` index increment for `CX`.
213
+
214
+ ```c
215
+ float c_scnrm2_ndarray( const CBLAS_INT N, const void *CX, const CBLAS_INT strideX, const CBLAS_INT offsetX );
216
+ ```
217
+
197
218
</section >
198
219
199
220
<!-- /.usage -->
@@ -227,7 +248,13 @@ int main( void ) {
227
248
const int strideX = 1;
228
249
229
250
// Compute the L2-norm:
230
- c_scnrm2( N, (void *)cx, strideX );
251
+ float norm = c_scnrm2( N, (void *)cx, strideX );
252
+
253
+ // Print the result:
254
+ printf( "L2-norm: %f\n", norm );
255
+
256
+ // Compute the L2-norm using alternative indexing semantics:
257
+ norm = c_scnrm2_ndarray( N, (void *)cx, -strideX, N-1 );
231
258
232
259
// Print the result:
233
260
printf( "L2-norm: %f\n", norm );
0 commit comments