Skip to content

Commit 8d24b7d

Browse files
feat: enhance README and examples for c_dlacpy and c_dlacpy_ndarray functions
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: failed ---
1 parent b84901f commit 8d24b7d

File tree

5 files changed

+100
-15
lines changed

5 files changed

+100
-15
lines changed

lib/node_modules/@stdlib/lapack/base/dlacpy/README.md

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,65 @@ console.log( ndarray2array( B, shape, strides, 0, order ) );
191191
#include "stdlib/lapack/base/dlacpy.h"
192192
```
193193

194-
#### TODO
194+
#### c_dlacpy( order, uplo, M, N, \*A, LDA, \*B, LDB )
195195

196-
TODO.
196+
Copies all or part of a matrix `A` to another matrix `B`.
197+
198+
```c
199+
#include "stdlib/blas/base/shared.h"
200+
201+
double A[] = { 1.0, 2.0, 3.0, 4.0 };
202+
double B[] = { 0.0, 0.0, 0.0, 0.0 };
203+
204+
c_dlacpy( CblasColMajor, CblasUpper, 2, 2, A, 2, B, 2 );
205+
```
206+
207+
The function accepts the following arguments:
208+
209+
- **order**: `[in] CBLAS_LAYOUT` storage layout of `A` and `B`
210+
- **uplo**: `[in] CBLAS_UPLO` specifies whether to copy the upper or lower triangular/trapezoidal part of matrix `A`
211+
- **M**: `[in] CBLAS_INT` number of rows in matrix `A`
212+
- **N**: `[in] CBLAS_INT` number of columns in matrix `A`
213+
- **A**: `[in] double*` input matrix
214+
- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
215+
- **B**: `[in] double*` output matrix
216+
- **LDB**: `[in] CBLAS_INT` stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`)
217+
218+
```c
219+
void c_dlacpy( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT LDA, double *B, const CBLAS_INT LDB )
220+
```
221+
222+
<!--lint disable maximum-heading-length-->
223+
224+
#### c_dlacpy_ndarry( uplo, M, N, \*A, strideA1, strideA2, offsetA, \*B, strideB1, strideB2, offsetB )
225+
226+
Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics.
197227

198228
```c
199-
TODO
229+
#include "stdlib/blas/base/shared.h"
230+
231+
double A[] = { 1.0, 2.0, 3.0, 4.0, 5.0 };
232+
double B[] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
233+
234+
c_dlacpy_ndarray( CblasUpper, 2, 2, A, 2, 1, 1, B, 2, 1, 2 );
200235
```
201236
202-
TODO
237+
The function accepts the following arguments:
238+
239+
- **uplo**: `[in] CBLAS_UPLO` specifies whether to copy the upper or lower triangular/trapezoidal part of matrix `A`
240+
- **M**: `[in] CBLAS_INT` number of rows in matrix `A`
241+
- **N**: `[in] CBLAS_INT` number of columns in matrix `A`
242+
- **A**: `[in] double*` input matrix
243+
- **strideA1**: `[in] CBLAS_INT` stride of the first dimension of `A`
244+
- **strideA2**: `[in] CBLAS_INT` stride of the second dimension of `A`
245+
- **offsetB**: `[in] CBLAS_INT` starting index for `A`
246+
- **B**: `[in] double*` output matrix
247+
- **strideB1**: `[in] CBLAS_INT` stride of the first dimension of `B`
248+
- **strideB2**: `[in] CBLAS_INT` stride of the second dimension of `B`
249+
- **offsetB**: `[in] CBLAS_INT` starting index for `B`
203250
204251
```c
205-
TODO
252+
void c_dlacpy_ndarray( const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB )
206253
```
207254

208255
</section>
@@ -224,7 +271,35 @@ TODO
224271
### Examples
225272

226273
```c
227-
TODO
274+
#include "stdlib/lapack/base/dlacpy.h"
275+
#include "stdlib/blas/base/shared.h"
276+
277+
int main( void ) {
278+
// Create strided arrays:
279+
const double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
280+
double B[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
281+
282+
// Specify the number of elements along each dimension of `A`:
283+
const int N = 3;
284+
285+
// Copies all or part of a matrix `A` to another matrix `B`:
286+
c_dlacpy( CblasColMajor, CblasUpper, N, N, A, N, B, N );
287+
288+
// Print the result:
289+
for ( int i = 0; i < N*N; i++ ) {
290+
printf( "B[ %i ] = %f\n", i, B[ i ] );
291+
}
292+
293+
// Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics:
294+
c_dlacpy_ndarray( CblasLower, N, N, A, 1, N, 0, B, 1, N, 0 );
295+
296+
// Print the result:
297+
for ( int i = 0; i < N*N; i++ ) {
298+
printf( "B[ %i ] = %f\n", i, B[ i ] );
299+
}
300+
301+
return 0;
302+
}
228303
```
229304
230305
</section>

lib/node_modules/@stdlib/lapack/base/dlacpy/examples/c/example.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
int main( void ) {
2323
// Create strided arrays:
24-
double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
24+
const double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
2525
double B[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2626

2727
// Specify the number of elements along each dimension of `A`:
@@ -34,4 +34,14 @@ int main( void ) {
3434
for ( int i = 0; i < N*N; i++ ) {
3535
printf( "B[ %i ] = %f\n", i, B[ i ] );
3636
}
37+
38+
// Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics:
39+
c_dlacpy_ndarray( CblasLower, N, N, A, 1, N, 0, B, 1, N, 0 );
40+
41+
// Print the result:
42+
for ( int i = 0; i < N*N; i++ ) {
43+
printf( "B[ %i ] = %f\n", i, B[ i ] );
44+
}
45+
46+
return 0;
3747
}

lib/node_modules/@stdlib/lapack/base/dlacpy/include/stdlib/lapack/base/dlacpy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ extern "C" {
3131
/**
3232
* Copies all or part of a matrix `A` to another matrix `B`.
3333
*/
34-
void API_SUFFIX(c_dlacpy)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT LDA, double *B, const CBLAS_INT LDB );
34+
void API_SUFFIX(c_dlacpy)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT LDA, double *B, const CBLAS_INT LDB );
3535

3636
/**
3737
* Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics.
3838
*/
39-
void API_SUFFIX(c_dlacpy_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB );
39+
void API_SUFFIX(c_dlacpy_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB );
4040

4141
#ifdef __cplusplus
4242
}

lib/node_modules/@stdlib/lapack/base/dlacpy/lib/dlacpy.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function dlacpy( order, uplo, M, N, A, LDA, B, LDB ) {
7575
if ( resolvedUplo === null ) {
7676
resolvedUplo = 0; // fallback
7777
}
78-
addon( resolveOrder( order ), resolvedUplo, M, N, A, LDA, B, LDB ); // eslint-disable-line max-len
78+
addon( resolveOrder( order ), resolvedUplo, M, N, A, LDA, B, LDB );
7979
return B;
8080
}
8181

lib/node_modules/@stdlib/lapack/base/dlacpy/src/dlacpy.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @param strideB2 stride of the second dimension of `B`
3737
* @param offsetB starting index for `B`
3838
*/
39-
void c_copy_all( const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
39+
void API_SUFFIX(c_copy_all)( const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
4040
CBLAS_INT ia;
4141
CBLAS_INT ib;
4242
CBLAS_INT i0;
@@ -68,7 +68,7 @@ void c_copy_all( const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_IN
6868
* @param strideB2 stride of the second dimension of `B`
6969
* @param offsetB starting index for `B`
7070
*/
71-
void c_copy_upper( const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
71+
void API_SUFFIX(c_copy_upper)( const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
7272
CBLAS_INT ia;
7373
CBLAS_INT ib;
7474
CBLAS_INT i0;
@@ -113,7 +113,7 @@ void c_copy_upper( const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_
113113
* @param strideB2 stride of the second dimension of `B`
114114
* @param offsetB starting index for `B`
115115
*/
116-
void c_copy_lower( const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
116+
void API_SUFFIX(c_copy_lower)( const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
117117
CBLAS_INT ia;
118118
CBLAS_INT ib;
119119
CBLAS_INT i0;
@@ -155,7 +155,7 @@ void c_copy_lower( const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_
155155
* @param B output matrix
156156
* @param LDB stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`)
157157
*/
158-
void API_SUFFIX(c_dlacpy)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT LDA, double *B, const CBLAS_INT LDB ) {
158+
void API_SUFFIX(c_dlacpy)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT LDA, double *B, const CBLAS_INT LDB ) {
159159
CBLAS_INT sa1;
160160
CBLAS_INT sa2;
161161
CBLAS_INT sb1;
@@ -198,7 +198,7 @@ void API_SUFFIX(c_dlacpy)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, cons
198198
* @param strideB2 stride of the second dimension of `B`
199199
* @param offsetB starting index for `B`
200200
*/
201-
void API_SUFFIX(c_dlacpy_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
201+
void API_SUFFIX(c_dlacpy_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT M, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB ) {
202202
if ( uplo == CblasUpper ) {
203203
c_copy_upper( M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB );
204204
return;

0 commit comments

Comments
 (0)