Giter VIP home page Giter VIP logo

lllreduce-rs's Introduction

Lenstra-Lenstra-Lovász (LLL) reduction

Transforms a lattice's basis into a form in which the first vector of the basis is not "much" longer than the shortest (non-zero) vector of the lattice:

||first basis vector|| <= 2^((n-1)/2) ||shortest vector||

where n is the dimension of lattice (assuming LOVASZ_FACTOR = 4.0/3.0).

LLL Reduction at Wikipedia

Usage

use lllreduce::{
		Basetype, 
        gram_schmidt_with_coeffs, 
        lll_reduce};

fn main() {
	let original_mtx : std::vec::Vec<std::vec::Vec::<Basetype>> = vec![
		vec![0.0,3.0,4.0,7.0,8.0],
		vec![1.0,0.0,1.0,8.0,7.0],
		vec![1.0,1.0,3.0,5.0,6.0],
		vec![0.0,3.0,4.0,7.0,6.0],
		vec![0.0,3.0,4.0,8.0,9.0]
	];
    let mut mtxtuple = lllreduce::gram_schmidt_with_coeffs(original_mtx);
	lll_reduce(&mut mtxtuple);
    println!("\tLLL-reduced basis");
    for a in &mtxtuple.2 {
        println!("\t\t{:?}", a);
    }    
    println!("\tumtx");
    for a in &mtxtuple.0 {
        println!("\t\t{:?}", a);
    }
    println!("\tqmtx");
    for a in &mtxtuple.1 {
        println!("\t\t{:?}", a);
    }
}

Note

This is the very first, very drafty version, anything can change in it in the future.

lllreduce-rs's People

Contributors

baranyikt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.