@stdlib/blas-base-ccopy 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +146 -62
- package/dist/index.js +7 -7
- package/dist/index.js.map +4 -4
- package/docs/types/index.d.ts +8 -48
- package/include/stdlib/blas/base/ccopy.h +11 -4
- package/include/stdlib/blas/base/ccopy_cblas.h +6 -4
- package/include/stdlib/blas/base/ccopy_fortran.h +4 -4
- package/lib/ccopy.js +7 -52
- package/lib/ccopy.native.js +2 -12
- package/lib/index.js +4 -24
- package/lib/ndarray.js +2 -12
- package/lib/ndarray.native.js +5 -23
- package/manifest.json +289 -9
- package/package.json +14 -13
- package/src/addon.c +23 -3
- package/src/ccopy.c +7 -35
- package/src/ccopy.f +9 -9
- package/src/ccopy_cblas.c +26 -2
- package/src/ccopy_f.c +25 -1
- package/src/ccopy_ndarray.c +56 -0
- package/include.gypi +0 -70
package/src/ccopy.f
CHANGED
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support.
|
|
49
49
|
!
|
|
50
50
|
! @param {integer} N - number of indexed elements
|
|
51
|
-
! @param {Array<complex>}
|
|
52
|
-
! @param {integer} strideX - `
|
|
53
|
-
! @param {Array<complex>}
|
|
54
|
-
! @param {integer} strideY - `
|
|
51
|
+
! @param {Array<complex>} x - input array
|
|
52
|
+
! @param {integer} strideX - `x` stride length
|
|
53
|
+
! @param {Array<complex>} y - output array
|
|
54
|
+
! @param {integer} strideY - `y` stride length
|
|
55
55
|
!<
|
|
56
|
-
subroutine ccopy( N,
|
|
56
|
+
subroutine ccopy( N, x, strideX, y, strideY )
|
|
57
57
|
implicit none
|
|
58
58
|
! ..
|
|
59
59
|
! Scalar arguments:
|
|
60
60
|
integer :: strideX, strideY, N
|
|
61
61
|
! ..
|
|
62
62
|
! Array arguments:
|
|
63
|
-
complex ::
|
|
63
|
+
complex :: x(*), y(*)
|
|
64
64
|
! ..
|
|
65
65
|
! Local scalars:
|
|
66
66
|
integer :: ix, iy, i
|
|
@@ -71,7 +71,7 @@ subroutine ccopy( N, cx, strideX, cy, strideY )
|
|
|
71
71
|
! ..
|
|
72
72
|
if ( strideX == 1 .AND. strideY == 1 ) then
|
|
73
73
|
do i = 1, N
|
|
74
|
-
|
|
74
|
+
y( i ) = x( i )
|
|
75
75
|
end do
|
|
76
76
|
else
|
|
77
77
|
if ( strideX < 0 ) then
|
|
@@ -85,10 +85,10 @@ subroutine ccopy( N, cx, strideX, cy, strideY )
|
|
|
85
85
|
iy = 1
|
|
86
86
|
end if
|
|
87
87
|
do i = 1, N
|
|
88
|
-
|
|
88
|
+
y( iy ) = x( ix )
|
|
89
89
|
ix = ix + strideX
|
|
90
90
|
iy = iy + strideY
|
|
91
91
|
end do
|
|
92
92
|
end if
|
|
93
93
|
return
|
|
94
|
-
end subroutine ccopy
|
|
94
|
+
end subroutine ccopy
|
package/src/ccopy_cblas.c
CHANGED
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
#include "stdlib/blas/base/ccopy.h"
|
|
20
20
|
#include "stdlib/blas/base/ccopy_cblas.h"
|
|
21
|
+
#include "stdlib/blas/base/shared.h"
|
|
22
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
23
|
+
#include "stdlib/strided/base/min_view_buffer_index.h"
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.
|
|
@@ -28,6 +31,27 @@
|
|
|
28
31
|
* @param Y output array
|
|
29
32
|
* @param strideY Y stride length
|
|
30
33
|
*/
|
|
31
|
-
void c_ccopy( const
|
|
32
|
-
cblas_ccopy( N, X, strideX, Y, strideY );
|
|
34
|
+
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
35
|
+
API_SUFFIX(cblas_ccopy)( N, X, strideX, Y, strideY );
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
40
|
+
*
|
|
41
|
+
* @param N number of indexed elements
|
|
42
|
+
* @param X input array
|
|
43
|
+
* @param strideX X stride length
|
|
44
|
+
* @param offsetX starting index for X
|
|
45
|
+
* @param Y output array
|
|
46
|
+
* @param strideY Y stride length
|
|
47
|
+
* @param offsetY starting index for Y
|
|
48
|
+
*/
|
|
49
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
|
|
50
|
+
stdlib_complex64_t *x = (stdlib_complex64_t *)X;
|
|
51
|
+
stdlib_complex64_t *y = (stdlib_complex64_t *)Y;
|
|
52
|
+
|
|
53
|
+
x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer
|
|
54
|
+
y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); // adjust array pointer
|
|
55
|
+
|
|
56
|
+
API_SUFFIX(cblas_ccopy)( N, (void *)x, strideX, (void *)y, strideY );
|
|
33
57
|
}
|
package/src/ccopy_f.c
CHANGED
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
#include "stdlib/blas/base/ccopy.h"
|
|
20
20
|
#include "stdlib/blas/base/ccopy_fortran.h"
|
|
21
|
+
#include "stdlib/blas/base/shared.h"
|
|
22
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
23
|
+
#include "stdlib/strided/base/min_view_buffer_index.h"
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.
|
|
@@ -28,6 +31,27 @@
|
|
|
28
31
|
* @param Y output array
|
|
29
32
|
* @param strideY Y stride length
|
|
30
33
|
*/
|
|
31
|
-
void c_ccopy( const
|
|
34
|
+
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
32
35
|
ccopy( &N, X, &strideX, Y, &strideY );
|
|
33
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
40
|
+
*
|
|
41
|
+
* @param N number of indexed elements
|
|
42
|
+
* @param X input array
|
|
43
|
+
* @param strideX X stride length
|
|
44
|
+
* @param offsetX starting index for X
|
|
45
|
+
* @param Y output array
|
|
46
|
+
* @param strideY Y stride length
|
|
47
|
+
* @param offsetY starting index for Y
|
|
48
|
+
*/
|
|
49
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
|
|
50
|
+
stdlib_complex64_t *x = (stdlib_complex64_t *)X;
|
|
51
|
+
stdlib_complex64_t *y = (stdlib_complex64_t *)Y;
|
|
52
|
+
|
|
53
|
+
x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX );
|
|
54
|
+
y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY );
|
|
55
|
+
|
|
56
|
+
ccopy( &N, (void *)x, &strideX, (void *)y, &strideY );
|
|
57
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#include "stdlib/blas/base/ccopy.h"
|
|
20
|
+
#include "stdlib/blas/base/shared.h"
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
24
|
+
*
|
|
25
|
+
* @param N number of indexed elements
|
|
26
|
+
* @param X input array
|
|
27
|
+
* @param strideX X stride length
|
|
28
|
+
* @param offsetX starting index for X
|
|
29
|
+
* @param Y output array
|
|
30
|
+
* @param strideY Y stride length
|
|
31
|
+
* @param offsetY starting index for Y
|
|
32
|
+
*/
|
|
33
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
|
|
34
|
+
const float *x = (float *)X;
|
|
35
|
+
float *y = (float *)Y;
|
|
36
|
+
CBLAS_INT ix;
|
|
37
|
+
CBLAS_INT iy;
|
|
38
|
+
CBLAS_INT sx;
|
|
39
|
+
CBLAS_INT sy;
|
|
40
|
+
CBLAS_INT i;
|
|
41
|
+
|
|
42
|
+
if ( N <= 0 ) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
sx = strideX * 2;
|
|
46
|
+
sy = strideY * 2;
|
|
47
|
+
ix = offsetX * 2;
|
|
48
|
+
iy = offsetY * 2;
|
|
49
|
+
for ( i = 0; i < N; i++ ) {
|
|
50
|
+
y[ iy ] = x[ ix ];
|
|
51
|
+
y[ iy+1 ] = x[ ix+1 ];
|
|
52
|
+
ix += sx;
|
|
53
|
+
iy += sy;
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
package/include.gypi
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# @license Apache-2.0
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2020 The Stdlib Authors.
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# A GYP include file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors.
|
|
20
|
-
#
|
|
21
|
-
# Main documentation:
|
|
22
|
-
#
|
|
23
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
24
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
25
|
-
#
|
|
26
|
-
# Variable nesting hacks:
|
|
27
|
-
#
|
|
28
|
-
# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi
|
|
29
|
-
# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004
|
|
30
|
-
{
|
|
31
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
32
|
-
'variables': {
|
|
33
|
-
'variables': {
|
|
34
|
-
# Host BLAS library (to override -Dblas=<blas>):
|
|
35
|
-
'blas%': '',
|
|
36
|
-
|
|
37
|
-
# Path to BLAS library (to override -Dblas_dir=<path>):
|
|
38
|
-
'blas_dir%': '',
|
|
39
|
-
}, # end variables
|
|
40
|
-
|
|
41
|
-
# Source directory:
|
|
42
|
-
'src_dir': './src',
|
|
43
|
-
|
|
44
|
-
# Include directories:
|
|
45
|
-
'include_dirs': [
|
|
46
|
-
'<@(blas_dir)',
|
|
47
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
# Add-on destination directory:
|
|
51
|
-
'addon_output_dir': './src',
|
|
52
|
-
|
|
53
|
-
# Source files:
|
|
54
|
-
'src_files': [
|
|
55
|
-
'<(src_dir)/addon.c',
|
|
56
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
57
|
-
],
|
|
58
|
-
|
|
59
|
-
# Library dependencies:
|
|
60
|
-
'libraries': [
|
|
61
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
62
|
-
],
|
|
63
|
-
|
|
64
|
-
# Library directories:
|
|
65
|
-
'library_dirs': [
|
|
66
|
-
'<@(blas_dir)',
|
|
67
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
68
|
-
],
|
|
69
|
-
}, # end variables
|
|
70
|
-
}
|