Thanks, David, I think that the problem is with the operation "+" I have using Profiler and when the matrix has dimensios, 12 x 19 these are the times
9.932s -- line 15: v = (particular_soln + homogeneous_soln) 0.004s -- line 17: print len(v.nonzero_positions()) Maybe there is some way to sum particular_soln + homogeneous_soln in a fast way? 2018-02-25 19:23 GMT-03:00 David Joyner <wdjoy...@gmail.com>: > On Sun, Feb 25, 2018 at 4:11 PM, Juan Grados <juan...@gmail.com> wrote: > > How can I improve the time for the next code?. Basically, I want to > solve a > > large undetermined binary linear system and then I need to calculate its > > hamming weight. > > > > A = random_matrix(GF(2), 10, 12, density=0.55) > > b = random_vector(GF(2), 10) > > particular_soln = A.solve_right(b, check=False) > > A_right_kernel = A.right_kernel() > > for homogeneous_soln in A_right_kernel: > > v = (particular_soln + homogeneous_soln) > > print len(v.nonzero_positions()) > > > > You are computing the min wt of a coset of a binary linear code. > I don't know of a fast stand alone function that does this. > > Printing slows you down a lot. Just make the list of wts using list > comprehension and find its minimum later. > > For real speed, you make want to modify the C code in > GAP's AClosestVectorCombinationsMatFFEVecFFE. > > > > > > > -- > > --------------------------------------------------------------------- > > MSc. Juan del Carmen Grados Vásquez > > Laboratório Nacional de Computação Científica > > Tel: +55 21 97633 3228 > > (http://www.lncc.br/) > > http://juaninf.blogspot.com > > --------------------------------------------------------------------- > > > > -- > > You received this message because you are subscribed to the Google Groups > > "sage-algebra" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to sage-algebra+unsubscr...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sage-algebra" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-algebra+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- --------------------------------------------------------------------- MSc. Juan del Carmen Grados Vásquez Laboratório Nacional de Computação Científica Tel: +55 21 97633 3228 (http://www.lncc.br/) http://juaninf.blogspot.com --------------------------------------------------------------------- -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.