SearcharxivSearch

arXiv subjects

Hao Teng

Publications and source records attributed to Hao Teng.

3 recordsLinked to original sources

C2RustXW: Program-Structure-Aware C-to-Rust Translation via Program Analysis and LLM

The growing adoption of Rust for its memory safety and performance has increased the demand for effective migration of legacy C codebases. However, existing rule-based translators (e.g., \ctorust) often generate verbose, non-idiomatic code that preserves unsafe C semantics, limiting readability, maintainability, and practical adoption. Moreover, manual post-processing of such outputs is labor-intensive and rarely yields high-quality Rust code, posing a significant barrier to large-scale migration. To address these limitations, we present \tool, a program-structure-aware C-to-Rust translation approach that integrates program analysis with Large Language Models (LLMs). \tool extracts the multi-level program structure, including global symbols, function dependencies, and control- and data-flow information, and encodes these as structured textual representations injected into LLM prompts to guide translation and repair. Based on this design, \tool performs dependency-aware translation and adopts a multi-stage repair pipeline that combines rule-based and structure-guided LLM-based techniques to ensure syntactic correctness. For semantic correctness, \tool further integrates execution-based validation with structure-guided reasoning to localize and repair behavioral inconsistencies. Experimental results show that \tool achieves 100\% syntactic correctness on CodeNet and 97.78\% on GitHub, while significantly reducing code size (up to 43.70\%) and unsafe usage (to 5.75\%). At the project level, \tool achieves perfect syntactic correctness and an average semantic correctness of 78.87\%, demonstrating its effectiveness for practical and scalable C-to-Rust migration.

cs.SE

Turbulence generation and data assimilation in wall-bounded flows with a latent diffusion model

Wall-bounded turbulent flows are chaotic and multiscale, rendering fast prediction at high Reynolds numbers computationally prohibitive in applications such as wind farms. Classical data assimilation is based on repeated solutions of the governing equations and thus inherits this cost. Generative models learn the probability distribution of flow states, enabling scalable probabilistic reconstruction. Our generative framework couples a variational autoencoder with a diffusion transformer to generate four-dimensional spatiotemporal samples. Bayesian conditioning enables data assimilation without retraining and allows statistical constraints to be imposed through sampling. The framework is applied to a subdomain of turbulent plane Couette flow, where the corresponding DNS in this generation region requires $O(10^6)$ spatial degrees of freedom. Using $O(10)$ latent spatial degrees of freedom, the model achieves a compression ratio of $O(10^5)$, which is one to two orders of magnitude above prior reports. It reproduces single-point statistics up to fourth order and the energy spectra, as well as the intermittency and phase-sensitive structure captured by velocity-increment and $Q$--$R$ statistics. Two assimilation scenarios demonstrate that, when observations are statistically consistent with the prior, conditional diffusion models with the proposed sampling strategy preserve complex turbulent statistics in the posterior. However, enforcing these constraints while preserving physical fidelity and sample diversity introduces an inherent trade-off. Excessive conditioning can distort the learned prior, paralleling limitations of classical ensemble-based data assimilation, where this can likewise degrade the prior covariance. These results highlight both the promise of diffusion models as probabilistic surrogates and the challenges of conditioning them.

physics.flu-dyn

Resolved frustrated tunneling ionization in asymmetrical fast oscillation of above-threshold ionization spectrum

Tunneling ionization is one of the fundamental electron dynamics, which has wide applications in ultrafast physics. When frustrated tunneling ionization (FTI) is considered, the tunneling rate is not equivalent to ionization rate. However, it is hard to resolve the effects of FTI and direct tunneling ionization (DTI) in ionization spectrum experimentally. Here we report the first observation of the asymmetrical fast oscillation in above-threshold ionization (ATI) spectrum of Argon as function of carrier-envelope phase (CEP), to the best of our knowledge. Simulation results identify that in the experimental ATI spectrum, the π/5 oscillation originates from the quantum interference of electrons in FTI, while DTI is responsible for the asymmetry. Our results provide clear evidence to resolve the effects of direct tunneling and FTI in a new physical regime.

physics.optics