Miscs API

Index

SymBasis.Miscs.combos_spin_sumMethod
combos_spin_sum(
    s::T_s,
    target::Union{T_s,Int},
    n::T_n
) where {T_s<:Rational,T_n<:Int}

Generate all combinations of spin projections for n spins of size s that sum to the specified target value.

Arguments

  • s::T_s: The spin size (e.g., 1//2, 1//1, 3//2, etc.).
  • target::Union{T_s,Int}: The target sum of spin projections.
  • n::T_n: The number of spins.

Returns

  • Vector: A vector of named tuples, each representing a valid combination of spin projections that sum to the target. Each named tuple contains counts of each spin projection and the total number of spins N.
source
SymBasis.Miscs.perm_kMethod
perm_k(perm::AbstractVector{T_lsi}, k) where {T_lsi<:Integer}

Apply the permutation perm repeatedly k times.

Arguments

  • perm::AbstractVector{T_lsi}: The permutation to be applied.
  • k::Integer: The number of times to apply the permutation.

Returns

  • Vector{T_lsi}: The resulting permutation after applying perm k times.
source
SymBasis.Miscs.perm_wrapperMethod
perm_wrapper(perm::AbstractVector{T_lsi}, base::Integer) where {T_lsi<:Integer}

Wrap the permutation perm in a BitPermutations.BitPermutation if the specified base is 2, otherwise return perm as is.

Arguments

  • perm::AbstractVector{T_lsi}: The permutation to be wrapped.
  • base::Integer: The base to determine whether to wrap the permutation in a BitPermutations.BitPermutation.

Returns

  • Union{BitPermutations.BitPermutation{unsigned(T_lsi)}, AbstractVector{T_lsi}}: The wrapped permutation if base is 2, or the original permutation otherwise.
source