MCPcopy Create free account
hub / github.com/Singular/Singular / integral_LLL

Function integral_LLL

IntegerProgramming/LLL.cc:438–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436
437
438short integral_LLL(BigInt** b, const short& number_of_vectors,
439 const short& vector_dimension)
440{
441
442// first check arguments
443
444 if(number_of_vectors<0)
445 {
446 cerr<<"\nWARNING: short integral_LL(BigInt**, const short&, const short&):"
447 "\nargument number_of_vectors out of range"<<endl;
448 return -1;
449 }
450
451 if(vector_dimension<=0)
452 {
453 cerr<<"\nWARNING: short integral_LLL(BigInt**, const short&, const "
454 "short&):\nargument vector_dimension out of range"<<endl;
455 return -1;
456 }
457
458
459// consider special case
460
461 if(number_of_vectors<=1)
462 // 0 or 1 input vector, nothing to be done
463 return 0;
464
465
466// memory allocation
467
468// The names are chosen (as far as possible) according to Cohen's book.
469// However, for technical reasons, the indices do not run from 1 to
470// (e.g.) number_of_vectors, but from 0 to number_of_vectors-1.
471// Therefore all indices are shifted by -1 in comparison with this book,
472// except from the indices of the array d which has size
473// number_of_vectors+1.
474
475 BigInt* d=new BigInt[number_of_vectors+1];
476
477 BigInt** lambda=new BigIntP[number_of_vectors];
478 for(short s=1;s<number_of_vectors;s++)
479 lambda[s]=new BigInt[s];
480 // We only need lambda[n][k] for n>k.
481
482
483
484// Step 1: Initialization
485
486 short k=1;
487 short k_max=0;
488 // for iteration
489 d[0]=1;
490
491 d[1]=0;
492 for(short n=0;n<vector_dimension;n++)
493 d[1]+=b[0][n]*b[0][n];
494 // Now, d[1] is the scalar product of b[0] with itself.
495

Callers 1

relationsFunction · 0.85

Calls 3

BigIntClass · 0.85
REDI_ILFunction · 0.85
SWAPIFunction · 0.85

Tested by

no test coverage detected