# Path: qmeq/indexing.py
# def szrange(charge, nsingle):
#     """
#     Make a list giving :math:`S_{z}` values for given charge.
# 
#     Parameters
#     ----------
#     charge : int
#         Value of the charge.
#     nsingle : int
#         Number of single particle states.
# 
#     Returns
#     -------
#     list
#         List containing :math:`S_{z}` values for given charge.
#     """
#     szmax = min(charge, nsingle-charge)
#     return list(range(-szmax, szmax+1, +2))
#     # return range(szmax, -szmax-1, -2)
# 
# Path: qmeq/indexing.py
# def ssqrange(charge, sz, nsingle):
#     """
#     Make a list giving all possible :math:`S^{2}` values for given charge and :math:`S_{z}`.
# 
#     Parameters
#     ----------
#     charge : int
#         Value of the charge.
#     sz : int
#         Value of sz.
#     nsingle : int
#         Number of single particle states.
# 
#     Returns
#     -------
#     list
#         List of all possible :math:`S^{2}` values for given charge and :math:`S_{z}`.
#     """
#     szmax = min(charge, nsingle-charge)
#     return list(range(abs(sz), szmax+1, +2))
# 
# Path: qmeq/indexing.py
# def sz_to_ind(sz, charge, nsingle):
#     """
#     Converts :math:`S_{z}` to a list index.
# 
#     Parameters
#     ----------
#     sz : int
#         Value :math:`S_{z}` of a spin projection in the z direction.
#     charge : int
#         Value of the charge.
#     nsingle : int
#         Number of single particle states.
# 
#     Returns
#     -------
#     int
#         Value of the list index corresponding to sz.
#     """
#     szmax = min(charge, nsingle-charge)
#     return int((szmax+sz)/2)
# 
# Path: qmeq/indexing.py
# def ssq_to_ind(ssq, sz):
#     """
#     Convert the value of :math:`S^{2}` for a given :math:`S_{z}` to an index.
# 
#     Parameters
#     ----------
#     ssq : int
#         Value of :math:`S^{2}`.
#     sz : int
#         Value of :math:`S_{z}`.
# 
#     Returns
#     -------
#     int
#         An index corresponding to given :math:`S^{2}` and :math:`S_{z}`.
#     """
#     return int((ssq-abs(sz))/2)
# 
# Path: qmeq/wrappers/mytypes.py



import itertools
import numbers
import numpy as np
from .indexing import szrange
from .indexing import ssqrange
from .indexing import sz_to_ind
from .indexing import ssq_to_ind
from .wrappers.mytypes import doublenp
        tleads_array[lead, state] = tleads[(lead, state)]

    return tleads_array

def make_array(lst_old, lst, si, npar=None, use_symmetry=True):
    """
    Converts dictionary or list of mulst, tlst or dlst to an array.

    Parameters
    ----------
    lst_old,lst : list, dict, or ndarray
        Contains lead parameters.
    si : StateIndexing
        StateIndexing or StateIndexingDM object.
    npar : int
        Number of entries in the returned array. Default is si.nleads_sym.
    use_symmetry : bool
        Flag indicating whether symmetry specified in si.symmetry should be used.

    Returns
    -------
    lst_arr : ndarray
        Numpy array containing lead parameters.
    """
    #
    if npar is None:
        npar = si.nleads_sym

    if isinstance(lst, dict):
        if lst_old is None:

# Path: qmeq/indexing.py
# def szrange(charge, nsingle):
#     """
#     Make a list giving :math:`S_{z}` values for given charge.
# 
#     Parameters
#     ----------
#     charge : int
#         Value of the charge.
#     nsingle : int
#         Number of single particle states.
# 
#     Returns
#     -------
#     list
#         List containing :math:`S_{z}` values for given charge.
#     """
#     szmax = min(charge, nsingle-charge)
#     return list(range(-szmax, szmax+1, +2))
#     # return range(szmax, -szmax-1, -2)
# 
# Path: qmeq/indexing.py
# def ssqrange(charge, sz, nsingle):
#     """
#     Make a list giving all possible :math:`S^{2}` values for given charge and :math:`S_{z}`.
# 
#     Parameters
#     ----------
#     charge : int
#         Value of the charge.
#     sz : int
#         Value of sz.
#     nsingle : int
#         Number of single particle states.
# 
#     Returns
#     -------
#     list
#         List of all possible :math:`S^{2}` values for given charge and :math:`S_{z}`.
#     """
#     szmax = min(charge, nsingle-charge)
#     return list(range(abs(sz), szmax+1, +2))
# 
# Path: qmeq/indexing.py
# def sz_to_ind(sz, charge, nsingle):
#     """
#     Converts :math:`S_{z}` to a list index.
# 
#     Parameters
#     ----------
#     sz : int
#         Value :math:`S_{z}` of a spin projection in the z direction.
#     charge : int
#         Value of the charge.
#     nsingle : int
#         Number of single particle states.
# 
#     Returns
#     -------
#     int
#         Value of the list index corresponding to sz.
#     """
#     szmax = min(charge, nsingle-charge)
#     return int((szmax+sz)/2)
# 
# Path: qmeq/indexing.py
# def ssq_to_ind(ssq, sz):
#     """
#     Convert the value of :math:`S^{2}` for a given :math:`S_{z}` to an index.
# 
#     Parameters
#     ----------
#     ssq : int
#         Value of :math:`S^{2}`.
#     sz : int
#         Value of :math:`S_{z}`.
# 
#     Returns
#     -------
#     int
#         An index corresponding to given :math:`S^{2}` and :math:`S_{z}`.
#     """
#     return int((ssq-abs(sz))/2)
# 
# Path: qmeq/wrappers/mytypes.py



# Path: qmeq/leadstun.py
import itertools
import numbers
import numpy as np
from .indexing import szrange
from .indexing import ssqrange
from .indexing import sz_to_ind
from .indexing import ssq_to_ind
from .wrappers.mytypes import doublenp

        tleads_array[lead, state] = tleads[(lead, state)]

    return tleads_array

def make_array(lst_old, lst, si, npar=None, use_symmetry=True):
    """
    Converts dictionary or list of mulst, tlst or dlst to an array.

    Parameters
    ----------
    lst_old,lst : list, dict, or ndarray
        Contains lead parameters.
    si : StateIndexing
        StateIndexing or StateIndexingDM object.
    npar : int
        Number of entries in the returned array. Default is si.nleads_sym.
    use_symmetry : bool
        Flag indicating whether symmetry specified in si.symmetry should be used.

    Returns
    -------
    lst_arr : ndarray
        Numpy array containing lead parameters.
    """
    #
    if npar is None:
        npar = si.nleads_sym

    if isinstance(lst, dict):
        if lst_old is None:

            lst_arr = np.zeros(npar, dtype=doublenp)