Skip to content

Commit 44ebe3c

Browse files
committed
docs: document C API
1 parent ae54d13 commit 44ebe3c

File tree

1 file changed

+34
-0
lines changed
  • lib/node_modules/@stdlib/blas/base/daxpy

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,32 @@ The function accepts the following arguments:
213213
void c_daxpy( const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY );
214214
```
215215

216+
#### c_daxpy_ndarray( N, alpha, \*X, strideX, offsetX, \*Y, strideY, offsetY )
217+
218+
Multiplies a vector `X` by a constant and adds the result to `Y` using alternative indexing semantics.
219+
220+
```c
221+
const double x[] = { 1.0, 2.0, 3.0, 4.0 };
222+
double y[] = { 0.0, 0.0, 0.0, 0.0 };
223+
224+
c_daxpy( 4, 5.0, x, 1, 0, y, 1, 0 );
225+
```
226+
227+
The function accepts the following arguments:
228+
229+
- **N**: `[in] CBLAS_INT` number of indexed elements.
230+
- **alpha**: `[in] double` scalar constant.
231+
- **X**: `[in] double*` input array.
232+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
233+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
234+
- **Y**: `[inout] double*` output array.
235+
- **strideY**: `[in CBLAS_INT` index increment for `Y`.
236+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
237+
238+
```c
239+
void c_daxpy_ndarray( const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
240+
```
241+
216242
</section>
217243

218244
<!-- /.usage -->
@@ -254,6 +280,14 @@ int main( void ) {
254280
for ( int i = 0; i < 8; i++ ) {
255281
printf( "y[ %i ] = %lf\n", i, y[ i ] );
256282
}
283+
284+
// Compute `a*x + y`:
285+
c_daxpy_ndarray( N, 5.0, x, strideX, 1, y, strideY, 7 );
286+
287+
// Print the result:
288+
for ( int i = 0; i < 8; i++ ) {
289+
printf( "y[ %i ] = %lf\n", i, y[ i ] );
290+
}
257291
}
258292
```
259293

0 commit comments

Comments
 (0)