Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Apr 27, 2024
1 parent b747106 commit 8f3624c
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 24 deletions.
2 changes: 1 addition & 1 deletion base/ddot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ console.log( out );

#### c_ddot( N, X, strideX, Y, strideY )

Computes the sum of absolute values.
Computes the dot product of two double-precision floating-point vectors.

```c
const double x[] = { 4.0, 2.0, -3.0, 5.0, -1.0 };
Expand Down
95 changes: 95 additions & 0 deletions base/dnrm2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,101 @@ console.log( out );

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/blas/base/dnrm2.h"
```

#### c_dnrm2( N, X, stride )

Computes the L2-norm of a double-precision floating-point vector.

```c
const double x[] = { 1.0, -2.0, 2.0 };

double v = c_dnrm2( 3, x, 1 );
// returns 3.0
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] double*` input array.
- **stride**: `[in] CBLAS_INT` index increment for `X`.
```c
double c_dnrm2( const CBLAS_INT N, const double *X, const CBLAS_INT stride );
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
#include "stdlib/blas/base/dnrm2.h"
#include <stdio.h>

int main( void ) {
// Create a strided array:
const double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };

// Specify the number of elements:
const int N = 8;

// Specify a stride:
const int strideX = 1;

// Compute the L2-norm:
double l2 = c_dnrm2( N, x, strideX );

// Print the result:
printf( "L2-norm: %lf\n", l2 );
}
```
</section>
<!-- /.examples -->
</section>
<!-- /.c -->
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
<section class="related">
Expand Down
4 changes: 3 additions & 1 deletion base/dnrm2/include/stdlib/blas/base/dnrm2.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef DNRM2_H
#define DNRM2_H

#include "stdlib/blas/base/shared.h"

/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
Expand All @@ -32,7 +34,7 @@ extern "C" {
/**
* Computes the L2-norm of a double-precision floating-point vector.
*/
double c_dnrm2( const int N, const double *X, const int stride );
double c_dnrm2( const CBLAS_INT N, const double *X, const CBLAS_INT stride );

#ifdef __cplusplus
}
Expand Down
4 changes: 3 additions & 1 deletion base/dnrm2/include/stdlib/blas/base/dnrm2_cblas.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef DNRM2_CBLAS_H
#define DNRM2_CBLAS_H

#include "stdlib/blas/base/shared.h"

/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
Expand All @@ -32,7 +34,7 @@ extern "C" {
/**
* Computes the L2-norm of a double-precision floating-point vector.
*/
double cblas_dnrm2( const int N, const double *X, const int stride );
double cblas_dnrm2( const CBLAS_INT N, const double *X, const CBLAS_INT stride );

#ifdef __cplusplus
}
Expand Down
76 changes: 62 additions & 14 deletions base/dnrm2/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -66,7 +67,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},
{
"task": "examples",
Expand All @@ -83,7 +88,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},

{
Expand All @@ -103,6 +112,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -126,7 +136,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -144,7 +156,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -163,6 +177,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -185,7 +200,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},
{
"task": "examples",
Expand All @@ -202,7 +221,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},

{
Expand All @@ -221,6 +244,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -243,7 +267,9 @@
"-lblas"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -260,7 +286,9 @@
"-lblas"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -280,6 +308,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -303,7 +332,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -321,7 +352,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -340,11 +373,14 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
"@stdlib/napi/argv-strided-float64array",
"@stdlib/napi/create-double"
"@stdlib/napi/create-double",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},
{
Expand All @@ -362,7 +398,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},
{
"task": "examples",
Expand All @@ -379,7 +419,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
},

{
Expand All @@ -397,7 +441,11 @@
"-lm"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/math/base/special/abs",
"@stdlib/math/base/special/sqrt"
]
}
]
}
Loading

0 comments on commit 8f3624c

Please sign in to comment.