designs.rs
470 B · rust · 16 lines
1use super::models::CellNd;2use crate::core::error::Result;3use crate::core::tensor::Tensor;45/// Grows a seed pattern into a cell, deepened to its fractal past level one.6///7/// # Errors8///9/// Errors when the pattern's rank is not N, or the level is below one.10pub fn grow<const N: usize>(pattern: Tensor, level: usize) -> Result<CellNd<N>> {11 let mut cell = CellNd::<N>::new(pattern)?;12 if level > 1 {13 cell = cell.fractal(level)?;14 }15 Ok(cell)16}