Miscs API
Index
SymBasis.Miscs.all_permutationsSymBasis.Miscs.combos_spin_sumSymBasis.Miscs.perm_kSymBasis.Miscs.perm_wrapper
SymBasis.Miscs.all_permutations — Method
all_permutations(t::NTuple{N,T}) where {N,T}Generate all permutations of the elements in the input tuple t.
Arguments
t::NTuple{N,T}: An N-tuple containing elements of typeT.
Returns
Vector{NTuple{N,T}}: A vector containing all permutations of the input tuplet.
SymBasis.Miscs.combos_spin_sum — Method
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 spinsN.
SymBasis.Miscs.perm_k — Method
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 applyingpermktimes.
SymBasis.Miscs.perm_wrapper — Method
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 aBitPermutations.BitPermutation.
Returns
Union{BitPermutations.BitPermutation{unsigned(T_lsi)}, AbstractVector{T_lsi}}: The wrapped permutation ifbaseis 2, or the original permutation otherwise.