| 257 | |
| 258 | |
| 259 | int matrix::LLL_kernel_basis() |
| 260 | { |
| 261 | |
| 262 | // copy the column vectors of the actual matrix |
| 263 | // (They are modified by the LLL-algorithm!) |
| 264 | BigInt** b=new BigIntP[columns]; |
| 265 | for(int n=0;n<columns;n++) |
| 266 | b[n]=new BigInt[rows]; |
| 267 | for(int n=0;n<columns;n++) |
| 268 | for(int m=0;m<rows;m++) |
| 269 | b[n][m]=coefficients[m][n]; |
| 270 | |
| 271 | // compute a LLL-reduced basis of the relations of b[0],...,b[columns-1] |
| 272 | _kernel_dimension=relations(b,columns,rows,H); |
| 273 | |
| 274 | // The kernel lattice basis is now stored in the member H (vectors |
| 275 | // H[0],...,H[_kernel_dimension-1]). |
| 276 | |
| 277 | // delete auxiliary vectors |
| 278 | for(int n=0;n<columns;n++) |
| 279 | delete[] b[n]; |
| 280 | delete[] b; |
| 281 | |
| 282 | return _kernel_dimension; |
| 283 | } |
| 284 | |
| 285 | |
| 286 | |