Skip to main content

sim_fundata

Function sim_fundata 

Source
pub fn sim_fundata(
    n: usize,
    t: &[f64],
    big_m: usize,
    efun_type: EFunType,
    eval_type: EValType,
    seed: Option<u64>,
) -> FdMatrix
Expand description

Simulate functional data with specified eigenfunction and eigenvalue types.

Convenience function that combines eigenfunction and eigenvalue generation with KL simulation.

§Arguments

  • n - Number of curves to generate
  • t - Evaluation points
  • big_m - Number of eigenfunctions/eigenvalues to use
  • efun_type - Type of eigenfunction basis
  • eval_type - Type of eigenvalue decay
  • seed - Optional random seed

§Returns

Data FdMatrix of size n × len(t)

§Examples

use fdars_core::simulation::{sim_fundata, EFunType, EValType};

let t: Vec<f64> = (0..20).map(|i| i as f64 / 19.0).collect();
let data = sim_fundata(5, &t, 4, EFunType::Fourier, EValType::Linear, Some(42));
assert_eq!(data.shape(), (5, 20));
assert!(data.as_slice().iter().all(|v| v.is_finite()));