Skip to content

feat: add lapack/base/dlange #7195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: loop reordering
---
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
---
  • Loading branch information
aayush0325 committed Jun 4, 2025
commit 9883b180c90fe83d011fd85a86ff3c1d91b6e689
58 changes: 44 additions & 14 deletions lib/node_modules/@stdlib/lapack/base/dlange/lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

var isnan = require( '@stdlib/math/base/assert/is-nan' );
var dlassq = require( '@stdlib/lapack/base/dlassq' ).ndarray;
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
var Float64Array = require( '@stdlib/array/float64' );
var min = require( '@stdlib/math/base/special/min' );
var abs = require( '@stdlib/math/base/special/abs' );
Expand All @@ -31,14 +32,14 @@
// MAIN //

/**
* Returns the value of the one norm, or the frobenius norm, or the infinity norm, or the element with the largest absolute value of a real matrix `A`.

Check warning on line 35 in lib/node_modules/@stdlib/lapack/base/dlange/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "frobenius"
*
* ## Notes
*
* - use `norm` = `max`, to calculate the element with the largest absolute value
* - use `norm` = `one`, to calculate the one norm
* - use `norm` = `infinity`, to calculate the infinity norm
* - use `norm` = `frobenius`, to calculate the frobenius norm

Check warning on line 42 in lib/node_modules/@stdlib/lapack/base/dlange/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "frobenius"
*
* @private
* @param {string} norm - specifies the type of norm to be calculated
Expand Down Expand Up @@ -79,17 +80,32 @@

else if ( norm === 'max' ) {
value = 0.0;
ia1 = offsetA;
for ( i = 0; i < M; i++ ) {
ia2 = 0;
if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
ia1 = offsetA;
for ( i = 0; i < M; i++ ) {
ia2 = 0;
for ( j = 0; j < N; j++ ) {
temp = A[ ia1 + ia2 ];
if ( value < temp || isnan( temp ) ) {
value = temp;
}
ia2 += strideA2;
}
ia1 += strideA1;
}
} else {
ia1 = offsetA;
for ( j = 0; j < N; j++ ) {
temp = A[ ia1 + ia2 ];
if ( value < temp || isnan( temp ) ) {
value = temp;
ia2 = 0;
for ( i = 0; i < M; i++ ) {
temp = A[ ia1 + ia2 ];
if ( value < temp || isnan( temp ) ) {
value = temp;
}
ia2 += strideA1;
}
ia2 += strideA2;
ia1 += strideA2;
}
ia1 += strideA1;
}
}

Expand Down Expand Up @@ -117,16 +133,30 @@
iw += strideWork;
}

ia1 = offsetA;
for ( j = 0; j < N; j++ ) {
ia2 = 0;
if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
ia1 = offsetA;
iw = offsetWork;
for ( i = 0; i < M; i++ ) {
work[ iw ] += abs( A[ ia1 + ia2 ] );
ia2 = 0;
for ( j = 0; j < N; j++ ) {
work[ iw ] += abs( A[ ia1 + ia2 ] );
ia2 += strideA2;
}
ia1 += strideA1;
iw += strideWork;
ia2 += strideA1;
}
ia1 += strideA2;
} else {
ia1 = offsetA;
for ( j = 0; j < N; j++ ) {
ia2 = 0;
iw = offsetWork;
for ( i = 0; i < M; i++ ) {
work[ iw ] += abs( A[ ia1 + ia2 ] );
iw += strideWork;
ia2 += strideA1;
}
ia1 += strideA2;
}
}

value = 0;
Expand Down
Loading