// Simple test to verify the NMF algorithm works correctly use rtx_nmf::{Device, NMFConfig, NMFDecomposer, Tensor}; fn main() -> Result<(), Box> { println!("๐Ÿงช Simple NMF Algorithm Test"); println!("============================"); // Test with CPU device and basic configuration let device = Device::cpu(); println!("๐Ÿ“ฑ Using device: {:?}", device); // Create simple test matrix (4x3) let test_data = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 2.0, 4.0, 6.0]; let matrix = Tensor::from_data(test_data, [4, 3], &device)?; println!("โœ… Created test matrix: 4x3"); // Create NMF decomposer with minimal components let config = NMFConfig::new() .with_components(2) .with_max_iterations(5) .with_tolerance(1e-4); let mut decomposer = NMFDecomposer::new(config); println!("โœ… NMF decomposer created successfully"); // Run decomposition println!("\nโšก Running NMF decomposition..."); let result = decomposer.fit_transform_detailed(&matrix)?; println!("โœ… NMF decomposition completed!"); println!(" Components: 2"); println!(" Iterations: {}", result.iterations); println!(" Error: {:.6}", result.reconstruction_error); println!(" Time: {:.3}s", result.computation_time); println!(" Converged: {}", result.converged); println!("\n๐ŸŽ‰ Simple test passed! Core NMF algorithm is working."); Ok(()) }