Applied PQC GitHub Home Playground Blog @AppliedPQC

Gram–Schmidt Orthogonalization and the LLL Algorithm

Every code listing from this chapter of Applied Post-Quantum Cryptography: 6 in total, 6 runnable here. Edit any cell and press Run.

The book's snippets build on each other down the chapter, but a Sage Cell kernel runs one cell and keeps no state afterwards, so each cell replays the earlier listings with apqc_book. That call is the only thing added to the book's own code.

← the playground

Listing 1: Sage experiment: dot product

Listing 2: Sage experiment: Gram–Schmidt

Listing 3: Verification

Listing 4: Experiment 1: orthogonality

Listing 5: Experiment 2: compare two vector pairs

Listing 6: Experiment 3: Gram–Schmidt in Sage