Skip to content

fix: initializer keyword types - #570

Merged
MartinuzziFrancesco merged 1 commit into
masterfrom
fm/fix-init-keywords-weights
Oct 27, 2026
Merged

MartinuzziFrancesco merged 1 commit into
masterfrom
fm/fix-init-keywords-weights

Conversation

@MartinuzziFrancesco

@MartinuzziFrancesco MartinuzziFrancesco commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

chebyshev_mapping threw a DomainError from acos for amplitude > 1; it now throws an ArgumentError for abs(amplitude) > 1, the range where the mapping is defined.

Integer and Rational values were rejected for radius and the other numeric initializer keywords (TypeError, or a MethodError in scale_radius!). The keywords now take Real, and scale_radius! has a Real method that forwards float(radius); float radii take the same path as before.

double_cycle and selfloop_backward_cycle accepted vector weights in their signatures but failed when assigning them. Vectors of length res_size are now placed per entry, and other lengths throw a DimensionMismatch. Scalar weights give the same matrices as before.

permute_matrix! had no method without an rng; it now uses the default rng.

low_connectivity with radius=nothing was still rescaled to spectral radius 1 by build_cycle's own default radius, and computed the eigenvalues twice. build_cycle no longer rescales: radius=nothing leaves the matrix unscaled and an explicit radius is applied once (outputs change only by rounding).

The pseudo_svd docstring now describes sparsity as the threshold on the nonzero to zero ratio that the code uses.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

…y radius

chebyshev_mapping threw a DomainError from acos for amplitude > 1; it now
throws an ArgumentError for abs(amplitude) > 1, the range where the mapping
is defined.

Integer and Rational values were rejected for radius and the other numeric
initializer keywords (TypeError, or a MethodError in scale_radius!). The
keywords now take Real, and scale_radius! has a Real method that forwards
float(radius); float radii take the same path as before.

double_cycle and selfloop_backward_cycle accepted vector weights in their
signatures but failed when assigning them. Vectors of length res_size are now
placed per entry, and other lengths throw a DimensionMismatch. Scalar
weights give the same matrices as before.

permute_matrix! had no method without an rng; it now uses the default rng.

low_connectivity with radius=nothing was still rescaled to spectral radius 1
by build_cycle's own default radius, and computed the eigenvalues twice.
build_cycle no longer rescales: radius=nothing leaves the matrix unscaled and
an explicit radius is applied once (outputs change only by rounding).

The pseudo_svd docstring now describes sparsity as the threshold on the
nonzero to zero ratio that the code uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MartinuzziFrancesco
MartinuzziFrancesco merged commit 8e2719a into master Oct 27, 2026
60 checks passed
@MartinuzziFrancesco
MartinuzziFrancesco deleted the fm/fix-init-keywords-weights branch October 27, 2026 06:38
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