Skip to content

Commit 9f1f11d

Browse files
committed
test: add native add-on tests
--- 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: passed - 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 b140344 commit 9f1f11d

File tree

4 files changed

+1473
-3
lines changed

4 files changed

+1473
-3
lines changed

lib/node_modules/@stdlib/blas/base/dger/lib/dger.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
// MODULES //
2222

23-
var max = require( '@stdlib/math/base/special/fast/max' );
24-
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
25-
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
2623
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
24+
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
25+
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
26+
var max = require( '@stdlib/math/base/special/fast/max' );
2727
var format = require( '@stdlib/string/format' );
2828
var base = require( './base.js' );
2929

lib/node_modules/@stdlib/blas/base/dger/lib/dger.native.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
// MODULES //
2222

23+
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
2324
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
2425
var resolve = require( '@stdlib/blas/base/layout-resolve-enum' );
26+
var max = require( '@stdlib/math/base/special/fast/max' );
2527
var format = require( '@stdlib/string/format' );
2628
var addon = require( './../src/addon.node' );
2729

@@ -60,6 +62,7 @@ var addon = require( './../src/addon.node' );
6062
* // A => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
6163
*/
6264
function dger( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) {
65+
var vala;
6366
if ( !isLayout( order ) ) {
6467
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
6568
}
@@ -75,6 +78,18 @@ function dger( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) {
7578
if ( strideY === 0 ) {
7679
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideY ) );
7780
}
81+
if ( isColumnMajor( order ) ) {
82+
vala = M;
83+
} else {
84+
vala = N;
85+
}
86+
if ( LDA < max( 1, vala ) ) {
87+
throw new RangeError( format( 'invalid argument. Tenth argument must be greater than or equal to max(1,%d). Value: `%d`.', vala, LDA ) );
88+
}
89+
// Check if we can early return...
90+
if ( M === 0 || N === 0 || alpha === 0.0 ) {
91+
return A;
92+
}
7893
addon( resolve( order ), M, N, alpha, x, strideX, y, strideY, A, LDA );
7994
return A;
8095
}

0 commit comments

Comments
 (0)