Skip to content

Add validation for op argument in spmv routine for special matrices#1087

Open
Mahmood-Sinan wants to merge 3 commits intofortran-lang:masterfrom
Mahmood-Sinan:spmv_error_check_for_operator
Open

Add validation for op argument in spmv routine for special matrices#1087
Mahmood-Sinan wants to merge 3 commits intofortran-lang:masterfrom
Mahmood-Sinan:spmv_error_check_for_operator

Conversation

@Mahmood-Sinan
Copy link
Contributor

This pr adds validation for the optional argument op in stdlib_specialmatrices.
When op is present and not one of N, T, or C, a LINALG_VALUE_ERROR is raised using linalg error handling.

@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.55%. Comparing base (a2065bb) to head (1b3e3fc).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1087      +/-   ##
==========================================
+ Coverage   68.51%   68.55%   +0.03%     
==========================================
  Files         396      396              
  Lines       12746    12746              
  Branches     1376     1376              
==========================================
+ Hits         8733     8738       +5     
+ Misses       4013     4008       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loiseaujc
Copy link
Contributor

If I recall correctly, the sparse matrix-vector product accepts H as input as well for the complex-conjugate matrix-vector product. Maybe you could extend the validation to include it and internally handles the fact that H and C are equivalent.

@Mahmood-Sinan
Copy link
Contributor Author

If I recall correctly, the sparse matrix-vector product accepts H as input as well for the complex-conjugate matrix-vector product. Maybe you could extend the validation to include it and internally handles the fact that H and C are equivalent.

@loiseaujc I have made the changes. The routine now accepts H and maps it internally to C before calling lagtm, since only C is supported there.

@loiseaujc
Copy link
Contributor

LGTM.

@jalvesz
Copy link
Contributor

jalvesz commented Jan 16, 2026

this is looking good. It might be good to add a quick test to check that the error is properly catched when op is different than the expected options.

@Mahmood-Sinan
Copy link
Contributor Author

this is looking good. It might be good to add a quick test to check that the error is properly catched when op is different than the expected options.

Thanks for the suggestion!
I looked into adding a negative test, but spmv calls linalg_error_handling in case of invalid op, which triggers an error stop. I think since this aborts the test executable, the error path cannot be caught.

@jvdp1
Copy link
Member

jvdp1 commented Jan 24, 2026

Thank you @Mahmood-Sinan . This PR looks good. I will merge it. Could you first fix the merge conflit please?

@Mahmood-Sinan Mahmood-Sinan force-pushed the spmv_error_check_for_operator branch from b46c6a8 to 1b3e3fc Compare January 25, 2026 13:44
@Mahmood-Sinan
Copy link
Contributor Author

Thank you @Mahmood-Sinan . This PR looks good. I will merge it. Could you first fix the merge conflit please?

Thank you. I have fixed the merged conflict.

Copy link
Contributor

@loiseaujc loiseaujc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you @Mahmood-Sinan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants