# 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)


import numpy as np
from ..indexing import szrange
from ..indexing import ssqrange
from ..indexing import sz_to_ind
from ..indexing import ssq_to_ind

    Returns
    --------
    Ea_ext : ndarray
        | A two-dimensional numpy array containing in the zeroth row energies,
          first row charge, and etc. We have such convention:
          Ea_ext[property number, state number]
        |
        | For example, for 'charge' indexing we have such properties:
        | 0 - energy
        | 1 - charge
        | 2 - state number
        |
        | and for 'ssq' indexing we have:
        | 0 - energy
        | 1 - charge
        | 2 - spin projection :math:`S_{z}`
        | 3 - total spin :math:`S^{2}`
        | 4 - state number
    """
    (si, Ea) = (self.si, self.qd.Ea)
    if si.indexing == 'sz':
        Ea_ext = np.zeros((4, len(Ea)), dtype=float)
        Ea_ext[0] = self.qd.Ea
        Ea_ext[3] = np.arange(si.nmany)
        # Iterate over charges
        for charge in range(si.ncharge):
            # Iterate over spin projection sz
            for sz in szrange(charge, si.nsingle):
                # Iterate over many-body states for given charge and sz

# 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/builder/various.py
import numpy as np
from ..indexing import szrange
from ..indexing import ssqrange
from ..indexing import sz_to_ind
from ..indexing import ssq_to_ind


    Returns
    --------
    Ea_ext : ndarray
        | A two-dimensional numpy array containing in the zeroth row energies,
          first row charge, and etc. We have such convention:
          Ea_ext[property number, state number]
        |
        | For example, for 'charge' indexing we have such properties:
        | 0 - energy
        | 1 - charge
        | 2 - state number
        |
        | and for 'ssq' indexing we have:
        | 0 - energy
        | 1 - charge
        | 2 - spin projection :math:`S_{z}`
        | 3 - total spin :math:`S^{2}`
        | 4 - state number
    """
    (si, Ea) = (self.si, self.qd.Ea)
    if si.indexing == 'sz':
        Ea_ext = np.zeros((4, len(Ea)), dtype=float)
        Ea_ext[0] = self.qd.Ea
        Ea_ext[3] = np.arange(si.nmany)
        # Iterate over charges
        for charge in range(si.ncharge):
            # Iterate over spin projection sz
            for sz in szrange(charge, si.nsingle):
                # Iterate over many-body states for given charge and sz

                szind = sz_to_ind(sz, charge, si.nsingle)