Add volume() support for Spectrahedron via S3 dispatch + Rcpp stub#37
Draft
Mohit-Lakra wants to merge 2 commits into
Draft
Add volume() support for Spectrahedron via S3 dispatch + Rcpp stub#37Mohit-Lakra wants to merge 2 commits into
Mohit-Lakra wants to merge 2 commits into
Conversation
d2bc277 to
3013afa
Compare
Author
|
Drafting for now, becaue currently its computing stub value, later will add functionality to compute real volume |
9616afe to
e294edf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR adds the R-level plumbing needed for volume() to accept Spectrahedron objects, without changing the existing polytope / zonotope behavior.
Makes volume() an S3 generic and preserves existing behavior in volume.default() (so current users are unaffected).
Adds volume.Spectrahedron() with a strict verbosity flag:
0 = silent (no messages)
1 = coarse progress messages
2 = debug messages
The function validates that verbosity is a single integer in {0,1,2} and errors otherwise.
Adds a minimal Rcpp entry point volume_spectrahedra() which currently stops with a clear “not implemented yet” error (to avoid returning fabricated / incorrect numeric results).
Adds testthat coverage for:
invalid verbosity values,
message/no-message behavior controlled by verbosity,
and the expected backend stop.
Why
Spectrahedron support is being built incrementally. This PR puts the user-facing R API + native symbol + tests in place first, so follow-up PRs can implement the actual volume estimator without changing the interface again.
How to test
Run the new test file only:
Output :-