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

Function SWAPI

IntegerProgramming/LLL.cc:97–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97void SWAPI(const short& k, const short& k_max, BigInt** b, BigInt* d,
98 BigInt** lambda)
99// the SWAPI procedure of algorithm 2.6.7
100{
101
102 // exchange b[k] and b[k-1]
103 // This can be done efficiently by swapping pointers (not entries).
104 BigInt* swap=b[k];
105 b[k]=b[k-1];
106 b[k-1]=swap;
107
108 if(k>1)
109 for(short j=0;j<=k-2;j++)
110 {
111 // exchange lambda[k][j] and lambda[k-1][j]
112 BigInt swap=lambda[k][j];
113 lambda[k][j]=lambda[k-1][j];
114 lambda[k-1][j]=swap;
115 }
116
117 BigInt _lambda=lambda[k][k-1];
118
119 BigInt B=(d[k-1]*d[k+1] + _lambda*_lambda)/d[k];
120 // It might be better to choose another evaluation order for this formula,
121 // see below.
122
123 for(short i=k+1;i<=k_max;i++)
124 {
125 BigInt t=lambda[i][k];
126 lambda[i][k]=(d[k+1]*lambda[i][k-1] - _lambda*t)/d[k];
127 lambda[i][k-1]=(B*t + _lambda*lambda[i][k])/d[k+1];
128 }
129
130 d[k]=B;
131}
132
133
134

Callers 1

integral_LLLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected