#![allow(deprecated)]
use crate::basis::{FermionicBasis, FiniteTempBasis};
use crate::error::Error;
use crate::kernel::{LogisticKernel, RegularizedBoseKernel};
use crate::sve::{SVEResult, TworkType, compute_sve};
use crate::traits::{Bosonic, Fermionic};
#[test]
fn test_basis_construction() {
let beta = 10.0;
let omega_max = 1.0;
let epsilon = 1e-6;
let kernel = LogisticKernel::new(beta * omega_max).unwrap();
let basis = FermionicBasis::new(kernel, beta, Some(epsilon), None).unwrap();
assert_eq!(basis.beta, beta);
assert!((basis.omega_max() - omega_max).abs() < 1e-10);
assert!(basis.size() > 0);
assert!(basis.accuracy > 0.0);
assert!(basis.accuracy < epsilon);
}
fn invalid(name: &'static str, value: &str, reason: &str) -> Error {
Error::InvalidParameter {
name,
value: value.to_string(),
reason: reason.to_string(),
}
}
#[test]
fn test_basis_new_rejects_invalid_parameters() {
let kernel = LogisticKernel::new(10.0).unwrap();
let cases = [
(
-1.0,
None,
None,
invalid("beta", "-1.0", "must be positive and finite"),
),
(
0.0,
None,
None,
invalid("beta", "0.0", "must be positive and finite"),
),
(
f64::NAN,
None,
None,
invalid("beta", "NaN", "must be positive and finite"),
),
(
f64::INFINITY,
None,
None,
invalid("beta", "inf", "must be positive and finite"),
),
(
10.0,
Some(0.0),
None,
invalid("epsilon", "0.0", "must be in (0, 1)"),
),
(
10.0,
Some(1.0),
None,
invalid("epsilon", "1.0", "must be in (0, 1)"),
),
(
10.0,
Some(2.0),
None,
invalid("epsilon", "2.0", "must be in (0, 1)"),
),
(
10.0,
Some(f64::NAN),
None,
invalid("epsilon", "NaN", "must be in (0, 1)"),
),
(
10.0,
Some(1e-6),
Some(0),
invalid("max_size", "0", "must be positive"),
),
];
for (beta, epsilon, max_size, expected) in cases {
let err = FermionicBasis::new(kernel, beta, epsilon, max_size)
.err()
.expect("must be rejected");
assert_eq!(
err, expected,
"beta = {beta}, epsilon = {epsilon:?}, max_size = {max_size:?}"
);
}
}
#[test]
fn test_basis_from_sve_result_checks_its_parameters() {
let kernel = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve(kernel, Some(1e-6), None, None, TworkType::Auto).unwrap();
let build = |beta, epsilon, max_size| {
FiniteTempBasis::<LogisticKernel, Fermionic>::from_sve_result(
kernel,
beta,
sve.clone(),
epsilon,
max_size,
)
};
let rejected = |beta, epsilon, max_size| {
build(beta, epsilon, max_size)
.err()
.expect("must be rejected")
};
assert_eq!(
rejected(-1.0, None, None),
invalid("beta", "-1.0", "must be positive and finite")
);
assert_eq!(
rejected(10.0, Some(1.0), None),
invalid("epsilon", "1.0", "must be in [0, 1)")
);
assert_eq!(
rejected(10.0, Some(1e-6), Some(0)),
invalid("max_size", "0", "must be positive")
);
assert_eq!(build(10.0, Some(0.0), None).unwrap().size(), sve.s().len());
}
#[test]
fn test_basis_from_sve_result_rejects_an_sve_on_another_domain() {
let kernel = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve(kernel, Some(1e-6), None, None, TworkType::Auto).unwrap();
let knots: Vec<f64> = sve.u().polys()[0].knots().iter().map(|x| 2.0 * x).collect();
let u = sve.u().rescale_domain(knots, None, None).unwrap();
let sve = SVEResult::new(u, sve.s().to_vec(), sve.v().clone(), sve.epsilon()).unwrap();
let err = FiniteTempBasis::<LogisticKernel, Fermionic>::from_sve_result(
kernel, 10.0, sve, None, None,
)
.err()
.expect("must be rejected");
assert!(
matches!(
err,
Error::InvalidParameter {
name: "sve_result",
..
}
),
"{err:?}"
);
}
#[test]
fn test_basis_from_an_sve_just_inside_the_unit_domain() {
use crate::poly::PiecewiseLegendrePolyVector;
let beta = 10.0;
let kernel = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve(kernel, Some(1e-6), None, None, TworkType::Auto).unwrap();
let shrink = |funcs: &PiecewiseLegendrePolyVector| {
let mut knots = funcs.polys()[0].knots().to_vec();
let last = knots.len() - 1;
knots[0] = -1.0 + 1e-13;
knots[last] = 1.0 - 1e-13;
funcs.rescale_domain(knots, None, None).unwrap()
};
let (u, v) = (shrink(sve.u()), shrink(sve.v()));
let sve = SVEResult::new(u, sve.s().to_vec(), v, sve.epsilon()).unwrap();
let basis = FiniteTempBasis::<LogisticKernel, Fermionic>::from_sve_result(
kernel, beta, sve, None, None,
)
.unwrap();
for u in basis.u().polys() {
assert_eq!((u.xmin(), u.xmax()), (0.0, beta));
assert!(u.evaluate(0.0).is_finite() && u.evaluate(beta).is_finite());
}
let wmax = basis.omega_max();
for v in basis.v().polys() {
assert_eq!((v.xmin(), v.xmax()), (-wmax, wmax));
}
}
#[test]
fn test_basis_knots_of_a_kernel_sve_are_the_scaled_knots() {
let beta = 10.0;
let kernel = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve(kernel, Some(1e-6), None, None, TworkType::Auto).unwrap();
let x_knots = sve.u().polys()[0].knots().to_vec();
let x_widths = sve.u().polys()[0].delta_x().to_vec();
let basis = FiniteTempBasis::<LogisticKernel, Fermionic>::from_sve_result(
kernel, beta, sve, None, None,
)
.unwrap();
let u = &basis.u().polys()[0];
let scaled: Vec<f64> = x_knots.iter().map(|&x| beta / 2.0 * (x + 1.0)).collect();
let widths: Vec<f64> = x_widths.iter().map(|&dx| beta / 2.0 * dx).collect();
assert_eq!(u.knots(), scaled);
assert_eq!(u.delta_x(), widths);
}
#[test]
fn test_default_tau_sampling_points_conditioning() {
let beta = 1.0;
let lambda = 10.0;
let epsilon = 1e-6;
let kernel = LogisticKernel::new(lambda).unwrap();
let basis = FermionicBasis::new(kernel, beta, Some(epsilon), None).unwrap();
println!("\n=== Default Tau Sampling Points Test ===");
println!("Beta: {}, Lambda: {}, Epsilon: {}", beta, lambda, epsilon);
println!("Basis size: {}", basis.size());
let tau_points = basis.default_tau_sampling_points().unwrap();
println!("Number of sampling points: {}", tau_points.len());
let beta_half = beta / 2.0;
for &tau in &tau_points {
assert!(
tau >= -beta_half && tau <= beta_half,
"tau={} out of range [{}, {}]",
tau,
-beta_half,
beta_half
);
}
for i in 1..tau_points.len() {
assert!(
tau_points[i] >= tau_points[i - 1],
"Points not sorted: tau[{}]={} < tau[{}]={}",
i,
tau_points[i],
i - 1,
tau_points[i - 1]
);
}
let tol = 1e-10;
for &tau in &tau_points {
let tau_reflected = -tau;
let has_pair = tau_points.iter().any(|&t| (t - tau_reflected).abs() < tol);
assert!(
has_pair || tau.abs() < tol,
"tau={} lacks symmetric pair around 0",
tau
);
}
println!("✅ Sampling points are symmetric around 0");
use crate::basis_trait::Basis;
let matrix = basis.evaluate_tau(&tau_points).unwrap();
let num_points = tau_points.len();
let basis_size = basis.size();
println!("Sampling matrix shape: {}x{}", num_points, basis_size);
let sv = crate::fitters::singular_values(matrix.host_data().unwrap(), num_points, basis_size)
.expect("SVD computation failed");
println!("\nSampling matrix SVD:");
let min_dim = sv.len();
println!(" Rank: {}", min_dim);
println!(" First singular value: {:.6e}", sv[0]);
println!(" Last singular value: {:.6e}", sv[min_dim - 1]);
let condition_number = sv[0] / sv[min_dim - 1];
println!(" Condition number: {:.6e}", condition_number);
let reference_cond = 25.0;
assert!(
condition_number < reference_cond * 2.0,
"Condition number too large: {:.2e} (reference: {:.2e})",
condition_number,
reference_cond
);
assert!(
condition_number < 1e8,
"Sampling matrix is poorly conditioned: cond = {:.6e}",
condition_number
);
println!(
"✅ Condition number: {:.2e} (reference: {:.2e}, threshold: {:.2e})",
condition_number,
reference_cond,
reference_cond * 2.0
);
}
#[test]
fn test_regularized_bose_basis_construction() {
let beta = 10.0;
let omega_max = 1.0;
let epsilon = 1e-6;
let kernel = RegularizedBoseKernel::new(beta * omega_max).unwrap();
let basis =
FiniteTempBasis::<RegularizedBoseKernel, Bosonic>::new(kernel, beta, Some(epsilon), None)
.unwrap();
assert_eq!(basis.beta, beta);
assert!((basis.omega_max() - omega_max).abs() < 1e-10);
assert!(basis.size() > 0);
assert!(basis.accuracy > 0.0);
assert!(basis.accuracy < epsilon);
println!("\n=== RegularizedBoseKernel Basis Test ===");
println!(
"Beta: {}, Omega_max: {}, Epsilon: {}",
beta, omega_max, epsilon
);
println!("Basis size: {}", basis.size());
println!("Accuracy: {:.6e}", basis.accuracy);
}
#[test]
fn test_regularized_bose_basis_different_parameters() {
let test_cases = vec![(1.0, 1.0, 1e-6), (10.0, 10.0, 1e-6), (100.0, 1.0, 1e-6)];
for (beta, omega_max, epsilon) in test_cases {
let kernel = RegularizedBoseKernel::new(beta * omega_max).unwrap();
let basis = FiniteTempBasis::<RegularizedBoseKernel, Bosonic>::new(
kernel,
beta,
Some(epsilon),
None,
)
.unwrap();
assert_eq!(basis.beta, beta);
assert!((basis.omega_max() - omega_max).abs() < 1e-10);
assert!(basis.size() > 0);
assert!(basis.accuracy > 0.0);
assert!(basis.accuracy < epsilon);
println!(
"Beta={}, Omega_max={}: size={}, accuracy={:.6e}",
beta,
omega_max,
basis.size(),
basis.accuracy
);
}
}
#[test]
fn test_default_omega_sampling_points_fermionic() {
let beta = 10000.0;
let wmax = 1.0;
let epsilon = 1e-6;
let kernel = LogisticKernel::new(beta * wmax).unwrap();
let basis =
FiniteTempBasis::<LogisticKernel, Fermionic>::new(kernel, beta, Some(epsilon), None)
.unwrap();
let omega_points = basis.default_omega_sampling_points().unwrap();
assert_eq!(omega_points.len(), basis.size());
for &omega in &omega_points {
assert!(
omega.abs() <= wmax,
"omega = {} exceeds wmax = {}",
omega,
wmax
);
}
let mut sorted = omega_points.clone();
sorted.sort_by(|a, b| a.partial_cmp(b).unwrap());
assert_eq!(omega_points, sorted, "Omega points should be sorted");
}
#[test]
fn test_default_omega_sampling_points_bosonic() {
let beta = 10000.0;
let wmax = 1.0;
let epsilon = 1e-6;
let kernel = LogisticKernel::new(beta * wmax).unwrap();
let basis =
FiniteTempBasis::<LogisticKernel, Bosonic>::new(kernel, beta, Some(epsilon), None).unwrap();
let omega_points = basis.default_omega_sampling_points().unwrap();
assert_eq!(omega_points.len(), basis.size());
for &omega in &omega_points {
assert!(
omega.abs() <= wmax,
"omega = {} exceeds wmax = {}",
omega,
wmax
);
}
let mut sorted = omega_points.clone();
sorted.sort_by(|a, b| a.partial_cmp(b).unwrap());
assert_eq!(omega_points, sorted, "Omega points should be sorted");
}
#[test]
fn test_omega_points_symmetry() {
let beta = 1000.0;
let wmax = 2.0;
let epsilon = 1e-8;
let kernel = LogisticKernel::new(beta * wmax).unwrap();
let basis_f =
FiniteTempBasis::<LogisticKernel, Fermionic>::new(kernel, beta, Some(epsilon), None)
.unwrap();
let omega_points = basis_f.default_omega_sampling_points().unwrap();
let positive: Vec<f64> = omega_points.iter().filter(|&&x| x > 0.0).copied().collect();
let negative: Vec<f64> = omega_points
.iter()
.filter(|&&x| x < 0.0)
.map(|&x| -x)
.collect();
println!("Omega points: {:?}", omega_points);
println!(
"Number of positive: {}, negative: {}",
positive.len(),
negative.len()
);
}
fn regularized_bose_kernel_physical(tau: f64, omega: f64, beta: f64) -> f64 {
if omega == 0.0 {
1.0 / beta
} else if omega > 0.0 {
omega * (-tau * omega).exp() / (1.0 - (-beta * omega).exp())
} else {
omega * ((beta - tau) * omega).exp() / ((beta * omega).exp() - 1.0)
}
}
#[test]
fn test_regularized_bose_basis_represents_physical_kernel() {
for &(beta, omega_max) in &[(10.0, 2.0), (4.0, 2.5), (20.0, 0.5)] {
let kernel = RegularizedBoseKernel::new(beta * omega_max).unwrap();
let basis =
FiniteTempBasis::<RegularizedBoseKernel, Bosonic>::new(kernel, beta, Some(1e-12), None)
.unwrap();
let s = basis.s();
for &tau in &[0.3, 0.37 * beta, 0.8 * beta] {
let u = basis.u().evaluate_at(tau);
for &omega in &[-0.7 * omega_max, 0.0, 0.2 * omega_max, 0.9 * omega_max] {
let v = basis.v().evaluate_at(omega);
let usv: f64 = (0..basis.size()).map(|l| u[l] * s[l] * v[l]).sum();
let exact = regularized_bose_kernel_physical(tau, omega, beta);
assert!(
(usv - exact).abs() <= 1e-8 * omega_max,
"beta={beta}, omega_max={omega_max}, tau={tau}, omega={omega}: \
sum U S V = {usv}, K^B = {exact}"
);
}
}
}
}
#[test]
fn test_regularized_bose_basis_single_pole() {
use crate::freq::MatsubaraFreq;
use num_complex::Complex64;
let (beta, omega_max, omega0) = (10.0, 2.0, 0.6);
let kernel = RegularizedBoseKernel::new(beta * omega_max).unwrap();
let basis =
FiniteTempBasis::<RegularizedBoseKernel, Bosonic>::new(kernel, beta, Some(1e-12), None)
.unwrap();
let v = basis.v().evaluate_at(omega0);
let gl: Vec<f64> = (0..basis.size())
.map(|l| -basis.s()[l] * v[l] / omega0)
.collect();
for n in [0_i64, 2, -4, 10] {
let freq = MatsubaraFreq::<Bosonic>::new(n).unwrap();
let uhat = basis.uhat().evaluate_at(&freq);
let giv: Complex64 = gl.iter().zip(uhat.iter()).map(|(&g, &u)| u * g).sum();
let exact = Complex64::new(1.0, 0.0) / Complex64::new(-omega0, freq.value(beta));
assert!(
(giv - exact).norm() <= 1e-8 * exact.norm(),
"n={n}: sum G_l Uhat_l = {giv}, 1/(iν - ω0) = {exact}"
);
}
}
#[test]
fn test_basis_with_a_large_beta_and_a_moderate_lambda() {
for beta in [1e4, 1e7, 1e10] {
let omega_max = 10.0 / beta;
let kernel = LogisticKernel::new(beta * omega_max).unwrap();
let basis = FermionicBasis::new(kernel, beta, Some(1e-6), None)
.unwrap_or_else(|e| panic!("beta = {beta}: {e}"));
let u = &basis.u().polys()[0];
assert_eq!(u.xmax(), beta);
for tau in [0.0, 0.5 * beta, beta] {
assert!(u.evaluate(tau).is_finite(), "beta = {beta}, tau = {tau}");
}
}
}
#[test]
fn test_default_matsubara_points_from_uhat() {
use crate::basis::default_matsubara_sampling_points_from_uhat;
use crate::polyfourier::PiecewiseLegendreFTVector;
use crate::sve::{SVEOptions, compute_sve_with};
let kernel = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve_with(
kernel,
&SVEOptions::new()
.epsilon(1e-6)
.twork(TworkType::Auto)
.full_domain(true),
)
.unwrap();
let basis =
FiniteTempBasis::<_, Fermionic>::from_sve_result(kernel, 1.0, sve, Some(1e-6), None)
.unwrap();
assert!(
basis
.uhat_full()
.get_polys()
.iter()
.all(|u| u.poly.symm() == 0)
);
let ns = |mitigate, positive_only| -> Vec<i64> {
default_matsubara_sampling_points_from_uhat(
basis.uhat_full(),
basis.size(),
mitigate,
positive_only,
)
.unwrap()
.into_iter()
.map(|f| f.n())
.collect()
};
let full = ns(false, false);
assert_eq!(full.len(), basis.size() + basis.size() % 2, "{full:?}");
assert!(full.iter().all(|n| n % 2 != 0), "{full:?}");
assert!(full.windows(2).all(|w| w[0] < w[1]), "{full:?}");
assert!(full.iter().all(|n| full.contains(&-n)), "{full:?}");
let positive: Vec<i64> = full.iter().copied().filter(|&n| n > 0).collect();
assert_eq!(ns(false, true), positive);
assert!(ns(true, false).len() > full.len());
let empty = PiecewiseLegendreFTVector::<Fermionic>::new();
assert_eq!(
default_matsubara_sampling_points_from_uhat(&empty, 4, false, false).unwrap_err(),
Error::EmptyInput { name: "uhat_full" }
);
}
#[test]
fn test_default_tau_points_of_an_sve_truncated_to_two_functions() {
let kernel = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve(kernel, Some(1e-6), None, Some(2), TworkType::Auto).unwrap();
assert_eq!(sve.s().len(), 2);
fn check<S: crate::traits::StatisticsType + 'static>(
basis: &FiniteTempBasis<LogisticKernel, S>,
) {
let not_supported = |err: Error| {
assert!(
matches!(&err, Error::NotSupported { what } if what.contains("no extrema")),
"{err:?}"
);
};
not_supported(basis.default_tau_sampling_points().unwrap_err());
for n in [2, 3, 10] {
not_supported(
basis
.default_tau_sampling_points_size_requested(n)
.unwrap_err(),
);
}
assert_eq!(
basis
.default_tau_sampling_points_size_requested(0)
.unwrap()
.len(),
0
);
assert_eq!(
basis
.default_tau_sampling_points_size_requested(1)
.unwrap()
.len(),
1
);
assert!(!basis.default_omega_sampling_points().unwrap().is_empty());
assert!(
!basis
.default_matsubara_sampling_points(false)
.unwrap()
.is_empty()
);
}
check(
&FiniteTempBasis::<_, Fermionic>::from_sve_result(kernel, 10.0, sve.clone(), None, None)
.unwrap(),
);
check(&FiniteTempBasis::<_, Bosonic>::from_sve_result(kernel, 10.0, sve, None, None).unwrap());
}
#[test]
fn test_default_sampling_points_rejects_scaled_functions() {
use crate::basis::default_sampling_points;
let basis =
FermionicBasis::new(LogisticKernel::new(10.0).unwrap(), 1.0, Some(1e-6), None).unwrap();
let unit = (-1.0, 1.0);
let err = default_sampling_points(basis.u(), "u", unit, 3).unwrap_err();
assert!(
matches!(err, Error::InvalidParameter { name: "u", .. }),
"{err:?}"
);
let err = default_sampling_points(basis.v(), "v", unit, 3).unwrap_err();
assert!(
matches!(err, Error::InvalidParameter { name: "v", .. }),
"{err:?}"
);
assert!(default_sampling_points(basis.sve_result().u(), "u", unit, 3).is_ok());
}
#[test]
fn test_default_matsubara_points_are_reused() {
use crate::kernel::LogisticKernelWindowed;
use crate::traits::StatisticsType;
fn check<K, S>(kernel: K, beta: f64)
where
K: crate::kernel::BasisKernel,
S: StatisticsType + 'static,
{
let basis = FiniteTempBasis::<K, S>::new(kernel, beta, Some(1e-10), None).unwrap();
let direct = |positive_only| {
crate::basis::default_matsubara_sampling_points_from_uhat(
basis.uhat_full(),
basis.size(),
false,
positive_only,
)
.unwrap()
.iter()
.map(|f| f.n())
.collect::<Vec<_>>()
};
for _ in 0..2 {
for positive_only in [false, true] {
assert_eq!(
basis
.default_matsubara_sampling_points_i64(positive_only)
.unwrap(),
direct(positive_only),
"{:?}, positive_only = {positive_only}",
S::STATISTICS
);
assert_eq!(
basis
.default_matsubara_sampling_points_i64_with_mitigate(
positive_only,
false,
basis.size(),
)
.unwrap(),
direct(positive_only)
);
}
}
}
check::<_, Fermionic>(LogisticKernel::new(1e3).unwrap(), 1e3);
check::<_, Bosonic>(LogisticKernel::new(1e3).unwrap(), 1e3);
check::<_, Bosonic>(RegularizedBoseKernel::new(1e3).unwrap(), 1e3);
let windowed = LogisticKernelWindowed::from_physical(1e2, -0.3, 1.0).unwrap();
check::<_, Fermionic>(windowed, 1e2);
check::<_, Bosonic>(windowed, 1e2);
}
#[test]
fn test_basis_rejects_a_kernel_x_domain_other_than_unit() {
use crate::kernel::{
AbstractKernel, BasisKernel, ExpandableKernel, KernelProperties, LogisticSVEHints,
SVEKernel,
};
use crate::numeric::CustomNumeric;
use crate::traits::StatisticsType;
use std::fmt::Debug;
#[derive(Debug, Clone, Copy)]
struct WideX(LogisticKernel);
impl AbstractKernel for WideX {
fn compute<T: CustomNumeric + Copy + Debug>(&self, x: T, y: T) -> T {
self.0.compute(x, y)
}
}
impl SVEKernel for WideX {
type SVEHintsType<T>
= LogisticSVEHints<T>
where
T: Copy + Debug + Send + Sync + CustomNumeric + 'static;
fn xmax(&self) -> f64 {
2.0
}
fn ymax(&self) -> f64 {
self.0.ymax()
}
fn sve_hints<T>(&self, epsilon: f64) -> Self::SVEHintsType<T>
where
T: Copy + Debug + Send + Sync + CustomNumeric + 'static,
{
self.0.sve_hints::<T>(epsilon)
}
}
impl KernelProperties for WideX {
fn ypower(&self) -> i32 {
self.0.ypower()
}
fn conv_radius(&self) -> f64 {
self.0.conv_radius()
}
fn regularizer<S: StatisticsType + 'static>(&self, beta: f64, omega: f64) -> f64 {
self.0.regularizer::<S>(beta, omega)
}
}
impl ExpandableKernel for WideX {}
impl BasisKernel for WideX {
fn kernel_lambda(&self) -> f64 {
self.0.lambda()
}
}
let logistic = LogisticKernel::new(10.0).unwrap();
let sve = compute_sve(logistic, Some(1e-6), None, None, TworkType::Auto).unwrap();
let result = FiniteTempBasis::<_, Fermionic>::from_sve_result(
WideX(logistic),
10.0,
sve,
Some(1e-6),
None,
);
assert!(
matches!(result, Err(Error::InvalidParameter { name: "kernel", .. })),
"{:?}",
result.err()
);
}
#[test]
fn test_basis_with_max_size_one() {
use crate::basis::FiniteTempBasis;
use crate::kernel::LogisticKernel;
use crate::traits::{Bosonic, Fermionic, StatisticsType};
fn check<S: StatisticsType + 'static>() {
let (beta, kernel) = (10.0, LogisticKernel::new(10.0).unwrap());
let full = FiniteTempBasis::<_, S>::new(kernel, beta, Some(1e-6), None).unwrap();
let basis = FiniteTempBasis::<_, S>::new(kernel, beta, Some(1e-6), Some(1)).unwrap();
assert_eq!(basis.size(), 1);
assert_eq!(basis.s(), &full.s()[..1]);
for tau in [0.0, 0.3 * beta, beta] {
assert_eq!(basis.u()[0].evaluate(tau), full.u()[0].evaluate(tau));
}
for omega in [-1.0, 0.2, 1.0] {
assert_eq!(basis.v()[0].evaluate(omega), full.v()[0].evaluate(omega));
}
}
check::<Fermionic>();
check::<Bosonic>();
}