mersenneforum.org > Math trying to implement block lanczos on GF2...
 Register FAQ Search Today's Posts Mark Forums Read

 2020-10-04, 17:33 #1 paul0   Sep 2011 3·19 Posts trying to implement block lanczos on GF2... Hi, I'm currently trying to implement Block Lanczos, but I'm having some trouble understanding the notation on calculating Si and Winv. I'm reading Montgomery's paper and Yang et. al.'s pseudocode (attached). On line 13 of the attached file, the algorithm seems to create a set S of row & col where a 1 is found. Eventually I need to compute Si*SiT based on S. I think to form Si*SiT I just need to set M[x,x] = 1 for each x ∈ S. M is a square matrix with side size of machine word (as defined by the paper) rows and cols. Is this correct? Also, Si-1 is an input to this function, but I don't see it was used there. What am I missing? Attached Thumbnails   Last fiddled with by paul0 on 2020-10-04 at 17:56
 2020-10-04, 19:12 #2 paul0   Sep 2011 3×19 Posts I tried implementing M[x,x] = 1 as I mentioned above. It worked! ViT*A*Vi becomes zero. However, it seems that not all X - Y are nullspaces of B. I got 10 out of 32 valid nullspace, then 6 out of 32 on a matrix with more dependencies. The paper says I need to combine these vectors. How do I do that? gaussian elimination? I'd like to mention that I'm avoiding optimizations for now, like the ANDing of Si*SiT. Last fiddled with by paul0 on 2020-10-04 at 19:53
 2020-10-05, 02:07 #3 paul0   Sep 2011 718 Posts It seems that I missed an entire paragraph about the last step with gaussian elmination. will try to implement that first. also, RIP Peter Montgomery.
 2020-10-05, 15:06 #4 jasonp Tribal Bullet     Oct 2004 67168 Posts You figured it out, but yes the block Lanczos algorithm finds the nullspace of A^T*A and not of A, since the algorithm only works for symmetric matrices.To get the answers you need, Gauss elimination of the nullspace vectors you have is necessary. I remember how great it felt when I managed to get the code running on a real problem, BL is hard to figure out from papers, or even from other people's code.
 2020-10-06, 05:20 #5 henryzz Just call me Henry     "David" Sep 2007 Cambridge (GMT/BST) 11×17×31 Posts It looks like Yang's paper is an improvement to clarity. I have tried and failed with other references in the past. Time for another go at some point. Congratulations on getting this working.
2020-10-06, 05:52   #6
paul0

Sep 2011

3·19 Posts

Quote:
 Originally Posted by jasonp You figured it out, but yes the block Lanczos algorithm finds the nullspace of A^T*A and not of A, since the algorithm only works for symmetric matrices.To get the answers you need, Gauss elimination of the nullspace vectors you have is necessary. I remember how great it felt when I managed to get the code running on a real problem, BL is hard to figure out from papers, or even from other people's code.
Quote:
 Originally Posted by henryzz It looks like Yang's paper is an improvement to clarity. I have tried and failed with other references in the past. Time for another go at some point. Congratulations on getting this working.
I agree with you both. I kept trying sporadically since 2015. Aside from Yang's paper, this recent C++ implementation also helped me (https://github.com/SebWouters/blanczos). It is well commented and seemed to written as teaching tool, though there are a few optimizations which may confuse beginners.

Here are the rest of the pseudocode from Yang's paper (full paper behind paywall): https://www.sparrho.com/item/an-impr...zation/9c93ad/

I got the last step working and got it to work with my toy NFS implementation. The terms Montgomery used for the last step (page 114) were unfamiliar to me, so I'm a bit suspicious that by running gaussian elimination, I may have bypassed the entire Block Lanczos process. Also, I don't know yet how to not compute U explicitly.

I have 2 questions:
1. Is it normal for the first dependency to be always trivial?
2. The very last output is "a basis for ZU". This just means the nullspaces of B are the columns of ZU?

EDIT: it seems that i'm in the wrong subforum, feel free to move this thread mods.

Last fiddled with by paul0 on 2020-10-06 at 06:23

 2020-10-06, 07:10 #7 paul0   Sep 2011 5710 Posts I'd like to add a third question: 3. In Montgomery's paper p. 115, he writes: "Afterwards I check whether all nonzero columns of Vi+1 were chosen in Si and/or Si-1". This assertion is implemented in the c++ implementation I linked above. What would happen if I do not implement this assertion? Will my implementation silently fail for some inputs?
 2020-10-06, 08:12 #8 Chris Card     Aug 2004 2×5×13 Posts For what it's worth, here's my C++ implementation of block lanczos that I wrote a few years ago, based on Montgomery's paper: https://github.com/ChrisCGH/factor-b...ockLanczos.cpp
2020-10-08, 04:09   #9
paul0

Sep 2011

718 Posts

Quote:
 Originally Posted by Chris Card For what it's worth, here's my C++ implementation of block lanczos that I wrote a few years ago, based on Montgomery's paper: https://github.com/ChrisCGH/factor-b...ockLanczos.cpp

appreciate it, thanks

 Similar Threads Thread Thread Starter Forum Replies Last Post jasonp Msieve 104 2013-06-17 11:28 ravlyuchenko Msieve 5 2011-05-09 13:16 Christenson Factoring 39 2011-04-08 09:44 jasonp Msieve 18 2010-02-07 08:33 Andi47 Msieve 7 2009-01-11 19:33

All times are UTC. The time now is 01:20.

Thu Jan 28 01:20:14 UTC 2021 up 55 days, 21:31, 0 users, load averages: 2.50, 2.62, 2.64