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 b45cbd8 commit 36bdfb0
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 44 deletions.
5 changes: 0 additions & 5 deletions base/ddot/src/ddot.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
* limitations under the License.
*/

/**
* Compute the dot product of two double-precision floating-point vectors.
*
* @see <a href="http://www.netlib.org/lapack/expolore-html/df/d28/group__single__blas__level1.html">ddot</a>
*/
#include "stdlib/blas/base/ddot.h"
#include "stdlib/blas/base/shared.h"

Expand Down
5 changes: 0 additions & 5 deletions base/ddot/src/ddot_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
* limitations under the License.
*/

/**
* Compute the dot product of two double-precision floating-point vectors.
*
* @see <a href="http://www.netlib.org/lapack/expolore-html/df/d28/group__single__blas__level1.html">ddot</a>
*/
#include "stdlib/blas/base/ddot.h"
#include "stdlib/blas/base/ddot_fortran.h"
#include "stdlib/blas/base/shared.h"
Expand Down
100 changes: 100 additions & 0 deletions base/dsdot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,106 @@ 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/dsdot.h"
```

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

Computes the dot product of two single-precision floating-point vectors with extended accumulation and result.

```c
const float x[] = { 4.0f, 2.0f, -3.0f, 5.0f, -1.0f };
const float y[] = { 2.0f, 6.0f, -1.0f, -4.0f, 8.0f };

double v = c_dsdot( 5, x, 1, y, 1 );
// returns -5.0
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] float*` first input array.
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
- **Y**: `[in] float*` second input array.
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
```c
double c_dsdot( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const float *Y, const CBLAS_INT strideY );
```

</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/dsdot.h"
#include <stdio.h>

int main( void ) {
// Create strided arrays:
const float x[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };
const float y[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };

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

// Specify strides:
const int strideX = 1;
const int strideY = -1;

// Compute the dot product:
double d = c_dsdot( N, x, strideX, y, strideY );

// Print the result:
printf( "dot product: %lf\n", d );
}
```
</section>
<!-- /.examples -->
</section>
<!-- /.c -->
* * *
<section class="references">
Expand Down
4 changes: 2 additions & 2 deletions base/dsdot/examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

int main( void ) {
// Create strided arrays:
const float x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
const float y[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
const float x[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };
const float y[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };

// Specify the number of elements:
const int N = 8;
Expand Down
4 changes: 3 additions & 1 deletion base/dsdot/include/stdlib/blas/base/dsdot.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef DSDOT_H
#define DSDOT_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 dot product of two single-precision floating-point vectors with extended accumulation and result.
*/
double c_dsdot( const int N, const float *X, const int strideX, const float *Y, const int strideY );
double c_dsdot( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const float *Y, const CBLAS_INT strideY );

#ifdef __cplusplus
}
Expand Down
4 changes: 3 additions & 1 deletion base/dsdot/include/stdlib/blas/base/dsdot_cblas.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef DSDOT_CBLAS_H
#define DSDOT_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 dot product of two single-precision floating-point vectors with extended accumulation and result.
*/
double cblas_dsdot( const int N, const float *X, const int strideX, const float *Y, const int strideY );
double cblas_dsdot( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const float *Y, const CBLAS_INT strideY );

#ifdef __cplusplus
}
Expand Down
58 changes: 45 additions & 13 deletions base/dsdot/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 @@ -64,7 +65,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -79,7 +82,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -99,6 +104,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -122,7 +128,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -140,7 +148,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -159,6 +169,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -179,7 +190,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -194,7 +207,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -213,6 +228,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -235,7 +251,9 @@
"-lblas"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -252,7 +270,9 @@
"-lblas"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -272,6 +292,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -295,7 +316,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -313,7 +336,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -330,6 +355,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -350,7 +376,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -365,7 +393,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -381,7 +411,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
}
]
}
Loading

0 comments on commit 36bdfb0

Please sign in to comment.