Skip to content

Add volume() support for Spectrahedron via S3 dispatch + Rcpp stub#37

Draft
Mohit-Lakra wants to merge 2 commits into
GeomScale:developfrom
Mohit-Lakra:feat/spectrahedron-volume
Draft

Add volume() support for Spectrahedron via S3 dispatch + Rcpp stub#37
Mohit-Lakra wants to merge 2 commits into
GeomScale:developfrom
Mohit-Lakra:feat/spectrahedron-volume

Conversation

@Mohit-Lakra
Copy link
Copy Markdown

@Mohit-Lakra Mohit-Lakra commented Feb 14, 2026

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:

testthat::test_file("tests/testthat/test_spectrahedron_volume.R", load_package = "source")

Output :-

image

@Mohit-Lakra Mohit-Lakra force-pushed the feat/spectrahedron-volume branch from d2bc277 to 3013afa Compare February 14, 2026 17:34
@Mohit-Lakra
Copy link
Copy Markdown
Author

Drafting for now, becaue currently its computing stub value, later will add functionality to compute real volume

@Mohit-Lakra Mohit-Lakra marked this pull request as draft February 14, 2026 18:38
@Mohit-Lakra Mohit-Lakra force-pushed the feat/spectrahedron-volume branch from 9616afe to e294edf Compare February 18, 2026 12:35
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.

1 participant