// Trace a tiny 8-element slice through one NTT butterfly level
use crypto::ntt
use crypto::fieldq

fn main() {
    // Put values only at positions 0-7, rest zero
    let mut poly = t_zeros(256)
    poly = t_index_set(poly, 0, 10.0)
    poly = t_index_set(poly, 1, 20.0)
    poly = t_index_set(poly, 2, 30.0)
    poly = t_index_set(poly, 3, 40.0)

    println("=== Before NTT (first 8) ===")
    let mut i = 0
    while i < 8 {
        println("  [" + int_to_str(i) + "] = " + float_to_str(t_index_get(poly, i)))
        i = i + 1
    }

    let ntt_poly = ntt_forward(poly)
    println("")
    println("=== After forward NTT (first 8) ===")
    let mut j = 0
    while j < 8 {
        println("  [" + int_to_str(j) + "] = " + float_to_str(t_index_get(ntt_poly, j)))
        j = j + 1
    }

    let recovered = ntt_inverse(ntt_poly)
    println("")
    println("=== After inverse NTT (first 8) ===")
    let mut k = 0
    while k < 8 {
        let raw = t_index_get(recovered, k)
        let fm = fq_from_mont(raw)
        println("  [" + int_to_str(k) + "] raw=" + float_to_str(raw) + " from_mont=" + int_to_str(fm))
        k = k + 1
    }
}
