m2r (version 1.0.2)

LLL: LLL algorithm

Description

Macaulay2's implementation of the LLL algorithm. This implementation is still under development and is currently untested.

Usage

LLL(mat, control = list(), code = FALSE)

LLL.(mat, control = list(), code = FALSE)

Arguments

mat

a matrix (integer entries)

control

additional arguments to pass to LLL; see examples

code

return only the M2 code? (default: FALSE)

Value

an object of class m2_matrix

See Also

m2_matrix()

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
 requires Macaulay2

##### basic usage
########################################

# example 1
M <- matrix(c(
  1, 1, 1, 1,
  2, 0, 3, 4,
  1, 0, 0, 0,
  0, 1, 0, 0,
  0, 0, 1, 0,
  0, 0, 0, 1
), nrow = 6, byrow = TRUE)

LLL(M)




# example 2 (wikipedia)
M <- matrix(c(
  1, -1, 3,
  1,  0, 5,
  1,  2, 6
), nrow = 3, byrow = TRUE)

LLL(M)


##### control
########################################

M <- matrix(c(
  1, 1, 1, 1,
  2, 0, 3, 4,
  1, 0, 0, 0,
  0, 1, 0, 0,
  0, 0, 1, 0,
  0, 0, 0, 1
), nrow = 6, byrow = TRUE)

LLL(M, code = TRUE)
LLL(M, control = list(Strategy = "NTL"), code = TRUE)
LLL(M, control = list(Strategy = c("BKZ", "RealFP")), code = TRUE)

LLL(M)
LLL(M, control = list(Strategy = "NTL"))
LLL(M, control = list(Strategy = c("BKZ", "RealFP")))
LLL(M, control = list(Strategy = c("BKZ", "RealQP")))



# method timings with microbenchmark.  note they are roughly the same
# for this example matrix
microbenchmark::microbenchmark(
  "NTL" = LLL(M, control = list(Strategy = "NTL")),
  "BKZ_RealFP" = LLL(M, control = list(Strategy = c("BKZ", "RealFP"))),
  "BKZ_RealQP" = LLL(M, control = list(Strategy = c("BKZ", "RealQP"))),
  "BKZ_RealRR" = LLL(M, control = list(Strategy = c("BKZ", "RealRR")))
)



##### additional examples
########################################

LLL.(M)
LLL(M, code = TRUE)



# }
# NOT RUN {
# }

Run the code above in your browser using DataLab