use crate::DType;
use crate::optimize::roots::{RootOptions, RootTensorResult};
use numr::error::Result;
use numr::runtime::Runtime;
use numr::tensor::Tensor;
#[derive(Debug, Clone)]
pub struct AndersonOptions {
pub base: RootOptions,
pub m: usize,
pub alpha: f64,
}
impl Default for AndersonOptions {
fn default() -> Self {
Self {
base: RootOptions::default(),
m: 5,
alpha: 1.0,
}
}
}
pub trait AndersonAlgorithms<R: Runtime<DType = DType>> {
fn anderson<G>(
&self,
g: G,
x0: &Tensor<R>,
options: &AndersonOptions,
) -> Result<RootTensorResult<R>>
where
G: Fn(&Tensor<R>) -> Result<Tensor<R>>;
}