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 ab6295f commit 69e7c18
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 22 deletions.
101 changes: 101 additions & 0 deletions base/dcopy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,107 @@ console.log( y );

<!-- /.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/dcopy.h"
```

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

Copies values from `X` into `Y`.

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

c_dcopy( 4, x, 1, y, 1 );
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] double*` input array.
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
- **Y**: `[out] double*` output array.
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
```c
void c_dcopy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *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/dcopy.h"
#include <stdio.h>

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

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

// Specify stride lengths:
const int strideX = 2;
const int strideY = -2;

// Copy elements:
c_dcopy( N, x, strideX, y, strideY );

// Print the result:
for ( int i = 0; i < 8; i++ ) {
printf( "y[ %i ] = %lf\n", i, y[ i ] );
}
}
```
</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/dcopy/include/stdlib/blas/base/dcopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef DCOPY_H
#define DCOPY_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" {
/**
* Copies values from `X` into `Y`.
*/
void c_dcopy( const int N, const double *X, const int strideX, double *Y, const int strideY );
void c_dcopy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY );

#ifdef __cplusplus
}
Expand Down
4 changes: 3 additions & 1 deletion base/dcopy/include/stdlib/blas/base/dcopy_cblas.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef DCOPY_CBLAS_H
#define DCOPY_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" {
/**
* Copies values from `X` into `Y`.
*/
void cblas_dcopy( const int N, const double *X, const int strideX, double *Y, const int strideY );
void cblas_dcopy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY );

#ifdef __cplusplus
}
Expand Down
58 changes: 45 additions & 13 deletions base/dcopy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -62,7 +63,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -77,7 +80,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -97,6 +102,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -119,7 +125,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -137,7 +145,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -155,6 +165,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -174,7 +185,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -189,7 +202,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -208,6 +223,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -229,7 +245,9 @@
"-lblas"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -246,7 +264,9 @@
"-lblas"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -266,6 +286,7 @@
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -288,7 +309,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -306,7 +329,9 @@
"-lpthread"
],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -323,6 +348,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
Expand All @@ -342,7 +368,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},
{
"task": "examples",
Expand All @@ -357,7 +385,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
},

{
Expand All @@ -373,7 +403,9 @@
],
"libraries": [],
"libpath": [],
"dependencies": []
"dependencies": [
"@stdlib/blas/base/shared"
]
}
]
}
11 changes: 6 additions & 5 deletions base/dcopy/src/dcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

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

/**
* Copies values from `X` into `Y`.
Expand All @@ -27,11 +28,11 @@
* @param Y output array
* @param strideY Y stride length
*/
void c_dcopy( const int N, const double *X, const int strideX, double *Y, const int strideY ) {
int ix;
int iy;
int i;
int m;
void c_dcopy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ) {
CBLAS_INT ix;
CBLAS_INT iy;
CBLAS_INT i;
CBLAS_INT m;

if ( N <= 0 ) {
return;
Expand Down
3 changes: 2 additions & 1 deletion base/dcopy/src/dcopy_cblas.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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

/**
* Copies values from `X` into `Y`.
Expand All @@ -28,6 +29,6 @@
* @param Y output array
* @param strideY Y stride length
*/
void c_dcopy( const int N, const double *X, const int strideX, double *Y, const int strideY ) {
void c_dcopy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ) {
cblas_dcopy( N, X, strideX, Y, strideY );
}
3 changes: 2 additions & 1 deletion base/dcopy/src/dcopy_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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

/**
* Copies values from `X` into `Y`.
Expand All @@ -28,6 +29,6 @@
* @param Y output array
* @param strideY Y stride length
*/
void c_dcopy( const int N, const double *X, const int strideX, double *Y, const int strideY ) {
void c_dcopy( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ) {
dcopy( &N, X, &strideX, Y, &strideY );
}

0 comments on commit 69e7c18

Please sign in to comment.