def __init__(self, domain_dim: int, ssp_dim: int, axis_matrix=None, phase_matrix=None, domain_bounds=None, length_scale=1):
    self.sample_points = None
    self.sample_ssps = None
    self.domain_dim = domain_dim
    self.ssp_dim = ssp_dim
    if ((not isinstance(length_scale, np.ndarray)) or (length_scale.size == 1)):
        self.length_scale = (length_scale * np.ones((self.domain_dim,)))
    if (domain_bounds is not None):
        assert (domain_bounds.shape[0] == domain_dim)
    self.domain_bounds = domain_bounds
    if ((axis_matrix is None) & (phase_matrix is None)):
        raise RuntimeError('SSP spaces must be defined by either a axis matrix or phase matrix. Use subclasses to construct spaces with predefined axes.')
    elif (phase_matrix is None):
        assert (axis_matrix.shape[0] == ssp_dim), f'Expected ssp_dim {axis_matrix.shape[0]}, got {ssp_dim}.'
        assert (axis_matrix.shape[1] == domain_dim)
        self.axis_matrix = axis_matrix
        self.phase_matrix = ((- 1j) * np.log(np.fft.fft(axis_matrix, axis=0))).real
    elif (axis_matrix is None):
        assert (phase_matrix.shape[0] == ssp_dim)
        assert (phase_matrix.shape[1] == domain_dim)
        self.phase_matrix = phase_matrix
        self.axis_matrix = np.fft.ifft(np.exp((1j * phase_matrix)), axis=0).real
def __init__(self, domain_dim: int, ssp_dim: int, axis_matrix=None, phase_matrix=None, domain_bounds=None, length_scale=1):
    self.sample_points = None
    self.sample_ssps = None
    self.domain_dim = domain_dim
    self.ssp_dim = ssp_dim
    if ((not isinstance(length_scale, np.ndarray)) or (length_scale.size == 1)):
        self.length_scale = (length_scale * np.ones((self.domain_dim,)))
    if (domain_bounds is not None):
        assert (domain_bounds.shape[0] == domain_dim)
    self.domain_bounds = domain_bounds
    if ((axis_matrix is None) & (phase_matrix is None)):
        raise RuntimeError('SSP spaces must be defined by either a axis matrix or phase matrix. Use subclasses to construct spaces with predefined axes.')
    elif (phase_matrix is None):
        assert (axis_matrix.shape[0] == ssp_dim), f'Expected ssp_dim {axis_matrix.shape[0]}, got {ssp_dim}.'
        assert (axis_matrix.shape[1] == domain_dim)
        self.axis_matrix = axis_matrix
        self.phase_matrix = ((- 1j) * np.log(np.fft.fft(axis_matrix, axis=0))).real
    elif (axis_matrix is None):
        assert (phase_matrix.shape[0] == ssp_dim)
        assert (phase_matrix.shape[1] == domain_dim)
        self.phase_matrix = phase_matrix
        self.axis_matrix = np.fft.ifft(np.exp((1j * phase_matrix)), axis=0).real