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 Yao, LinearAlgebra | |
# define tropical numbers with the following property. | |
# x ⊕ y := max(x ,y) | |
# x ⊗ y := x + y | |
struct Tropical{T} <: Number | |
n::T | |
c::T | |
end | |
Tropical(x::Real) = Tropical(x,one(x)) |
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
#here we generate a Ham and simulate the weight to see if they are negative | |
from numpy import array, bmat, zeros , dot , diag , eye, ones , sort , prod | |
from numpy.random import rand | |
from scipy.linalg import det , expm, eig , logm | |
import numpy as np | |
np.set_printoptions(suppress=True, precision=2, linewidth=100) | |
def build_Ham(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
from numpy import bmat, zeros , array , eye , dot | |
from scipy.linalg import det , expm | |
B1 = array([[2, 1, 1, 3, 2], | |
[1, 2, 1, 3, 1], | |
[2, 3, 1, 2, 2], | |
[1, 3, 1, 3, 1], | |
[2, 3, 3, 1, 3]] | |
) |