Skip to content

Commit b33c36b

Browse files
committed
docs: update examples and add C documentation
1 parent 8a403b0 commit b33c36b

File tree

2 files changed

+104
-2
lines changed

2 files changed

+104
-2
lines changed

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

+102
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,108 @@ console.log( y.get( y.length-1 ).toString() );
211211

212212
<!-- /.examples -->
213213

214+
<!-- C interface documentation. -->
215+
216+
* * *
217+
218+
<section class="c">
219+
220+
## C APIs
221+
222+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
223+
224+
<section class="intro">
225+
226+
</section>
227+
228+
<!-- /.intro -->
229+
230+
<!-- C usage documentation. -->
231+
232+
<section class="usage">
233+
234+
### Usage
235+
236+
```c
237+
#include "stdlib/blas/base/ccopy.h"
238+
```
239+
240+
#### c_ccopy( N, X, strideX, Y, strideY )
241+
242+
Copies values from `X` into `Y`.
243+
244+
```c
245+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; // interleaved real and imaginary components
246+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
247+
248+
c_ccopy( 2, (void *)x, 1, (void *)Y, 1 );
249+
```
250+
251+
The function accepts the following arguments:
252+
253+
- **N**: `[in] CBLAS_INT` number of indexed elements.
254+
- **X**: `[in] void*` input array.
255+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
256+
- **Y**: `[out] void*` output array.
257+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
258+
259+
```c
260+
void c_ccopy( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
261+
```
262+
263+
</section>
264+
265+
<!-- /.usage -->
266+
267+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
268+
269+
<section class="notes">
270+
271+
</section>
272+
273+
<!-- /.notes -->
274+
275+
<!-- C API usage examples. -->
276+
277+
<section class="examples">
278+
279+
### Examples
280+
281+
```c
282+
#include "stdlib/blas/base/ccopy.h"
283+
#include <stdio.h>
284+
285+
int main( void ) {
286+
// Create strided arrays:
287+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
288+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
289+
290+
// Specify the number of elements:
291+
const int N = 4;
292+
293+
// Specify stride lengths:
294+
const int strideX = 1;
295+
const int strideY = -1;
296+
297+
// Copy elements:
298+
c_ccopy( N, (void *)x, strideX, (void *)y, strideY );
299+
300+
// Print the result:
301+
for ( int i = 0; i < N; i++ ) {
302+
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
303+
}
304+
}
305+
```
306+
307+
</section>
308+
309+
<!-- /.examples -->
310+
311+
</section>
312+
313+
<!-- /.c -->
314+
315+
214316
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
215317
216318
<section class="related">

lib/node_modules/@stdlib/blas/base/ccopy/examples/c/example.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

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

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

0 commit comments

Comments
 (0)