Skip to content

brahmap.utilities.ShapeError

Bases: Exception

Exception class for handling shape mismatch errors.

Exception raised when defining a linear operator of the wrong shape or multiplying a linear operator with a vector of the wrong shape.

Source code in brahmap/utilities/tools.py
class ShapeError(Exception):
    """
    Exception class for handling shape mismatch errors.

    Exception raised when defining a linear operator of the wrong shape or
    multiplying a linear operator with a vector of the wrong shape.

    """

    def __init__(self, value):
        super(ShapeError, self).__init__()
        self.value = value

    def __str__(self):
        return repr(self.value)