Skip to content

Commit

Permalink
docs: document C API
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Sep 10, 2024
1 parent ae54d13 commit 44ebe3c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions lib/node_modules/@stdlib/blas/base/daxpy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,32 @@ The function accepts the following arguments:
void c_daxpy( const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY );
```

#### c_daxpy_ndarray( N, alpha, \*X, strideX, offsetX, \*Y, strideY, offsetY )

Multiplies a vector `X` by a constant and adds the result to `Y` using alternative indexing semantics.

```c
const double x[] = { 1.0, 2.0, 3.0, 4.0 };
double y[] = { 0.0, 0.0, 0.0, 0.0 };

c_daxpy( 4, 5.0, x, 1, 0, y, 1, 0 );
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **alpha**: `[in] double` scalar constant.
- **X**: `[in] double*` input array.
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
- **Y**: `[inout] double*` output array.
- **strideY**: `[in CBLAS_INT` index increment for `Y`.
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
```c
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 );
```

</section>

<!-- /.usage -->
Expand Down Expand Up @@ -254,6 +280,14 @@ int main( void ) {
for ( int i = 0; i < 8; i++ ) {
printf( "y[ %i ] = %lf\n", i, y[ i ] );
}

// Compute `a*x + y`:
c_daxpy_ndarray( N, 5.0, x, strideX, 1, y, strideY, 7 );

// Print the result:
for ( int i = 0; i < 8; i++ ) {
printf( "y[ %i ] = %lf\n", i, y[ i ] );
}
}
```
Expand Down

1 comment on commit 44ebe3c

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
blas/base/daxpy $\color{green}420/420$
$\color{green}+100.00\%$
$\color{green}30/30$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}420/420$
$\color{green}+100.00\%$
blas/base/dnrm2 $\color{green}408/408$
$\color{green}+100.00\%$
$\color{green}32/32$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}408/408$
$\color{green}+100.00\%$
blas/base/gaxpy $\color{green}254/254$
$\color{green}+100.00\%$
$\color{green}38/38$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}254/254$
$\color{green}+100.00\%$
blas/base/saxpy $\color{green}436/436$
$\color{green}+100.00\%$
$\color{green}30/30$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}436/436$
$\color{green}+100.00\%$
napi/export $\color{green}100/100$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}100/100$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.