This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Hecke | |
| # code for solving the closest vector problem. We use Hecke's implementation of enumeration | |
| # I stopped because Hecke's enumeration did not seem to find the closest vector. Another drawback is they only support coordinate vectors input/output | |
| function closest_vec_enumeration(qs::QuadSpace{Hecke.Nemo.QQField, Hecke.Nemo.QQMatrix}, coords::Vector{Float64}, initial_dist_bnd::Float64) | |
| # this is just a quick choice for the tolerance. May need to find a better value later | |
| coords_tol = minimum([[abs(x) for x in coords]; 1/100.0]) | |
| coords_qq = QQ.(rationalize.(BigInt, coords, tol = coords_tol)) | |
| initial_dist_bnd_qq = QQ.(rationalize.(BigInt, initial_dist_bnd, tol = 0.000000001)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # construct a 100x100 random matrix to test multiply. Store result in a matrix. | |
| # Observations: allocates, v*A allocates a different amount than A*v | |
| @benchmark LinearAlgebra.mul!(B, v, A) setup = (A = rand(0x00:0x01, 100, 100); v = ones(UInt8, 1, 100); B = zeros(UInt8, 1, 100);) | |
| # construct a 100x100 random matrix to test multiply. Store result in a vector. | |
| # Observation: does not allocate | |
| @benchmark LinearAlgebra.mul!(B, A, v) setup = (A = rand(0x00:0x01, 100, 100); v = ones(UInt8, 100); B = zeros(UInt8, 100);) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <NTL/tools.h> | |
| #include <chrono> | |
| using namespace std; | |
| // First way: NTL has a clock for computing CPU time | |
| double ntl_time = NTL::GetTime(); | |
| // Second way: chrono lets you compute wall-time | |
| auto start = chrono::system_clock::now(); | |
| TIME_ME(); | |
| ntl_time = NTL::GetTime() - ntl_time; | |
| auto end = chrono::system_clock::now(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # All SSH libraries for Python are junk (2011-10-13). | |
| # Too low-level (libssh2), too buggy (paramiko), too complicated | |
| # (both), too poor in features (no use of the agent, for instance) | |
| # Here is the right solution today: | |
| import subprocess | |
| import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Used for creating a small border around most markdown images | |
| <kbd> | |
| <img src="myimg.png"> | |
| </kbd> |