ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 30 Jan 2022 18:16:37 +0100orthogonalization and orthonormalization of vectors under integer modhttps://ask.sagemath.org/question/60878/orthogonalization-and-orthonormalization-of-vectors-under-integer-mod/ how can I get first orthogonal(Gram–Schmidt process) and then orthonormal of basis vector list under integer mod.
l=[(1,2,3),(1,5,6)]
basis=[vector(GF(29),i) for i in l]
print(basis)
#[(1,2,3),(1,5,6)]Sun, 30 Jan 2022 13:44:45 +0100https://ask.sagemath.org/question/60878/orthogonalization-and-orthonormalization-of-vectors-under-integer-mod/Answer by tmonteil for <p>how can I get first orthogonal(Gram–Schmidt process) and then orthonormal of basis vector list under integer mod.</p>
<pre><code>l=[(1,2,3),(1,5,6)]
basis=[vector(GF(29),i) for i in l]
print(basis)
#[(1,2,3),(1,5,6)]
</code></pre>
https://ask.sagemath.org/question/60878/orthogonalization-and-orthonormalization-of-vectors-under-integer-mod/?answer=60881#post-id-60881Here is a partial answer : instead of putting your "basis" in a list, you should put it in a matrix, so that you could benefit from the methods available there.
sage: M = matrix(basis)
sage: M
[1 2 3]
[1 5 6]
sage: M.parent()
Full MatrixSpace of 2 by 3 dense matrices over Finite Field of size 29
sage: M.gram_schmidt()
AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object has no attribute 'conjugate'
Unfortunately, to compute the Gram-Schmidt orthogonalization of `M`, Sage needs to find the conjugate of elements `GF(29)`, which seems not defined (if you replace `GF(29)` with `ZZ`, everythin seems fine).Sun, 30 Jan 2022 15:48:35 +0100https://ask.sagemath.org/question/60878/orthogonalization-and-orthonormalization-of-vectors-under-integer-mod/?answer=60881#post-id-60881Answer by Max Alekseyev for <p>how can I get first orthogonal(Gram–Schmidt process) and then orthonormal of basis vector list under integer mod.</p>
<pre><code>l=[(1,2,3),(1,5,6)]
basis=[vector(GF(29),i) for i in l]
print(basis)
#[(1,2,3),(1,5,6)]
</code></pre>
https://ask.sagemath.org/question/60878/orthogonalization-and-orthonormalization-of-vectors-under-integer-mod/?answer=60882#post-id-60882You can perform Gram–Schmidt over `QQ` and then change ring to `GF(29)`:
M = Matrix( QQ, [(1,2,3),(1,5,6)] )
[ t.change_ring(GF(29)) for t in M.gram_schmidt() ]Sun, 30 Jan 2022 18:16:37 +0100https://ask.sagemath.org/question/60878/orthogonalization-and-orthonormalization-of-vectors-under-integer-mod/?answer=60882#post-id-60882