400Ping opened a new issue, #663: URL: https://github.com/apache/mahout/issues/663
### Goal: Add a host-side preprocessing pipeline so amplitude encoding receives validated, normalized, and padded data before GPU transfer. ### Scope: Implement a preprocessing module that: validates input (non-empty, no NaN/Inf), computes/validates qubits (ceil(log2(len)) or validate user input, cap at 30), L2-normalizes on CPU (use rayon), zero-pads to 2^n, and returns a struct with buffer, qubits, original_len, norm. Integrate AmplitudeEncoder to consume this output instead of recomputing norm on the fly; align the contract with the CUDA kernel (host-prepared buffer vs. kernel-side normalize—choose and document one). Add tests for edge cases (empty, zero norm, NaN/Inf, length > 2^n, padding correctness, L2≈1) and happy path. ### Steps: - Add preprocessing module in qdp-core (e.g., preprocess.rs): implement validation, qubit calc, L2 normalize (rayon), zero-pad, return struct. - Update AmplitudeEncoder to use the preprocessed buffer/metadata and keep error types/messages consistent. - Document the host/GPU contract (who owns normalization/padding) and update in-code comments. - Add unit/integration tests in qdp-core covering edge cases and happy path; run cargo test -p qdp-core. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
