This file contains 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 LinearAlgebra | |
using OSQP | |
using QPSReader | |
using SparseArrays | |
# Example problem from Maros-Meszaros | |
problem = readqps("AUG3D.QPS", mpsformat=:fixed) | |
m, n = problem.ncon, problem.nvar | |
# QPS format only stores the lower triangular part of the matrix. | |
P = sparse(problem.qrows, problem.qcols, problem.qvals, n, n) |
This file contains 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/env bash | |
function usage() { | |
cat << 'EOF' | |
Usage: | |
linearize_pdf.sh --file <input_file> --output <output_file>. | |
Arguments: | |
-f, --file: Input .pdf file to be processed. | |
-o, --output: Name of output .pdf file. |
This file contains 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
(* | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. |
This file contains 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
__author__ = 'VHarisop' | |
''' Pythagorean triplets are integers (a, b, c) for which the property | |
a^2 + b^2 = c^2 holds. ''' | |
from math import sqrt | |
print filter(lambda x: round(sqrt(x[2]))**2 == x[2], [(i, j, i**2 + j**2) for i in range(1, 501) for j in range(i+1, 501)]) | |
This file contains 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
__author__ = 'VHarisop' | |
''' original idea from mpetyx <github.com/mpetyx> | |
Generates Hardy-Ramanujan Numbers up to 250000 in under 1 sec. | |
''' | |
import sys | |
rng = int(sys.argv[1]) | |
hrs = [0] * (2 * rng ** 3 + 1) | |
for x in range(1, rng): |