Skip to content

Add shape support to VectorParam (fixes #58)#59

Merged
rbouckaert merged 1 commit intomasterfrom
vector-shape
Apr 7, 2026
Merged

Add shape support to VectorParam (fixes #58)#59
rbouckaert merged 1 commit intomasterfrom
vector-shape

Conversation

@alexeid
Copy link
Copy Markdown
Member

@alexeid alexeid commented Apr 7, 2026

Summary

  • Adds optional shape input to KeyVectorParam that allows flat vector storage to be interpreted as a multi-dimensional array (e.g. shape="3 4" for a 3x4 matrix)
  • rank() and shape() reflect the tensor dimensions; get(int... idx) supports multi-dimensional indexing via row-major strides
  • Wired up in both RealVectorParam and IntVectorParam
  • Backward compatible: vectors without shape behave exactly as before
  • Replaces the deprecated minordimension on Parameter.Base
  • Convenience methods: nrows(), ncols() for the common 2D case

Test plan

  • 4 new tests in RealVectorParamTest: basic 3x4 matrix indexing, default (no shape), shape/dimension mismatch, wrong index count
  • All 386 beast-base tests pass (0 failures, 0 errors)

Closes #58

Add optional shape input to KeyVectorParam that allows flat vector
storage to be interpreted as a multi-dimensional array. When shape
is set (e.g. shape="3 4" for a 3x4 matrix), rank() and shape()
reflect the tensor dimensions, and get(int... idx) supports
multi-dimensional indexing via row-major strides.

Wired up in both RealVectorParam and IntVectorParam. Backward
compatible: vectors without shape behave exactly as before.

Replaces the deprecated minordimension on Parameter.Base.
@alexeid alexeid requested a review from rbouckaert April 7, 2026 15:56
@rbouckaert rbouckaert merged commit d5b1085 into master Apr 7, 2026
1 check passed
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.

Add shape support to VectorParam (replaces minordimension)

2 participants