//! Physics-Informed Denoising Diffusion Models (PIDDM) //! //! This crate implements Physics-Informed Diffusion Models for solving PDEs, //! based on the approach from ICLR 2025 research on combining diffusion models //! with physics constraints. //! //! # Overview //! //! Traditional diffusion models learn to denoise by predicting noise added to data. //! Physics-Informed Diffusion Models add a physics residual loss during training //! to ensure the generated samples satisfy physical constraints (e.g., PDE residuals). //! //! # Architecture //! //! ```text //! Input noise z ~ N(0,1) → Diffusion UNet → Denoised field u //! ↑ //! Physics loss: ||L[u] - f||² //! ``` //! //! # Example //! //! ```rust,ignore //! use rtx_piddm::{PIDDM, DDPMScheduler, PhysicsLoss}; //! //! // Create PIDDM model //! let scheduler = DDPMScheduler::new(1000, 1e-4, 0.02); //! let model = PIDDM::new(scheduler, unet, 0.1); // 0.1 = physics weight //! //! // Training step with physics loss //! let loss = model.training_step(&x0, |u| physics_residual(u)); //! ``` //! //! # References //! //! - Ho et al., "Denoising Diffusion Probabilistic Models" (NeurIPS 2020) //! - Physics-Informed Neural Networks literature (Raissi et al., 2019) #![forbid(unsafe_code)] #![warn(missing_docs)] mod piddm; mod scheduler; mod unet; pub use piddm::{PIDDM, PIDDMConfig, PIDDMError}; pub use scheduler::{BetaSchedule, DDIMScheduler, DDPMScheduler, NoiseScheduler, SchedulerConfig}; pub use unet::{DiffusionUNet, TimeEmbedding, UNetConfig};