Source code for swarmauri.core.vector_stores.IGradient

from abc import ABC, abstractmethod
from typing import List, Callable

[docs] class IGradient(ABC): """ Interface for calculating the gradient of a scalar field. """
[docs] @abstractmethod def calculate_gradient(self, scalar_field: Callable[[List[float]], float], point: List[float]) -> List[float]: """ Calculate the gradient of a scalar field at a specific point. Parameters: - scalar_field (Callable[[List[float]], float]): The scalar field represented as a function that takes a point and returns a scalar value. - point (List[float]): The point at which the gradient is to be calculated. Returns: - List[float]: The gradient vector at the specified point. """ pass