Skip to content

polykin.math.roots¤

VectorRootResult dataclass ¤

Dataclass with vector root solution results.

ATTRIBUTE DESCRIPTION
method

Method used to find the root.

TYPE: str

success

If True, the root was found.

TYPE: bool

message

Description of the exit status.

TYPE: str

nfeval

Number of function evaluations.

TYPE: int

njeval

Number of Jacobian evaluations.

TYPE: int | None

niter

Number of iterations.

TYPE: int

x

Root value.

TYPE: FloatVector

f

Function (residual) value at root.

TYPE: FloatVector

jac

Last Jacobian value evaluated or estimated.

TYPE: FloatMatrix

Source code in src/polykin/math/roots/results.py
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
@dataclass
class VectorRootResult:
    """Dataclass with vector root solution results.

    Attributes
    ----------
    method: str
        Method used to find the root.
    success: bool
        If `True`, the root was found.
    message: str
        Description of the exit status.
    nfeval: int
        Number of function evaluations.
    njeval: int | None
        Number of Jacobian evaluations.
    niter: int
        Number of iterations.
    x: FloatVector
        Root value.
    f: FloatVector
        Function (residual) value at root.
    jac: FloatMatrix
        Last Jacobian value evaluated or estimated.
    """

    method: str
    success: bool
    message: str
    nfeval: int
    njeval: int | None
    niter: int
    x: FloatVector
    f: FloatVector
    jac: FloatMatrix | None

    def __repr__(self) -> str:
        """Return a string representation of the vector root result."""
        return (
            f" method: {self.method}\n"
            f"success: {colored_bool(self.success)}\n"
            f"message: {self.message}\n"
            f" nfeval: {self.nfeval}\n"
            f" njeval: {self.njeval}\n"
            f"  niter: {self.niter}\n"
            f"      x: {self.x}\n"
            f"      f: {self.f}\n"
            f"    jac: {self.jac}"
        )

__repr__ ¤

__repr__() -> str

Return a string representation of the vector root result.

Source code in src/polykin/math/roots/results.py
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
def __repr__(self) -> str:
    """Return a string representation of the vector root result."""
    return (
        f" method: {self.method}\n"
        f"success: {colored_bool(self.success)}\n"
        f"message: {self.message}\n"
        f" nfeval: {self.nfeval}\n"
        f" njeval: {self.njeval}\n"
        f"  niter: {self.niter}\n"
        f"      x: {self.x}\n"
        f"      f: {self.f}\n"
        f"    jac: {self.jac}"
    )