Skip to content

Commit acc04d2

Browse files
committed
feat: add strided for csignumf function
--- 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: na - 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: na - task: lint_c_examples status: na - 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 ---
1 parent 418d3f9 commit acc04d2

File tree

1 file changed

+71
-0
lines changed
  • lib/node_modules/@stdlib/math/base/special/csignumf/lib

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
'use strict';
20+
21+
// MODULES //
22+
23+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
24+
var real = require( '@stdlib/complex/float32/real' );
25+
var imag = require( '@stdlib/complex/float32/imag' );
26+
var csignumf = require( './main.js' );
27+
28+
29+
// MAIN //
30+
31+
/**
32+
* Computes the signum of a single-precision complex number stored in a real-valued strided array view and assigns the result to a provided strided output array.
33+
*
34+
* @param {Float32Array} z - complex number view (interleaved real and imaginary)
35+
* @param {integer} strideZ - stride length for `z`
36+
* @param {NonNegativeInteger} offsetZ - starting index for `z`
37+
* @param {Float32Array} out - output array
38+
* @param {integer} strideOut - stride length for `out`
39+
* @param {NonNegativeInteger} offsetOut - starting index for `out`
40+
* @returns {Float32Array} output array
41+
*
42+
* @example
43+
* var Float32Array = require( '@stdlib/array/float32' );
44+
* var strided = require( '@stdlib/math/base/special/csignumf' ).strided;
45+
*
46+
* var z = new Float32Array( [ 3.0, 4.0 ] );
47+
* var out = new Float32Array( 2 );
48+
*
49+
* strided( z, 1, 0, out, 1, 0 );
50+
* console.log( out );
51+
* // => <Float32Array>[ ~0.6, ~0.8 ]
52+
*/
53+
function strided( z, strideZ, offsetZ, out, strideOut, offsetOut ) {
54+
var result;
55+
var re;
56+
var im;
57+
58+
re = z[ offsetZ ];
59+
im = z[ offsetZ + strideZ ];
60+
result = csignumf( new Complex64( re, im ) );
61+
62+
out[ offsetOut ] = real( result );
63+
out[ offsetOut + strideOut ] = imag( result );
64+
65+
return out;
66+
}
67+
68+
69+
// EXPORTS //
70+
71+
module.exports = strided;

0 commit comments

Comments
 (0)