import numpy as np
from linear_solver_float import LinearSolverFloat

# set floating point accuracy 
R = 4 

# first example
M = np.array([[1/2,3/2],
              [3/2,1/2]])

Y_1 = np.array([1,0])
Y_2 = np.array([0,1])
M_inv = np.linalg.inv(M)

M_inv.dot(Y_1), M_inv.dot(Y_2)

num_reads = 1000
lsf = LinearSolverFloat(M,Y_1,R=R,num_reads=num_reads)
sampleset = lsf.sample()
sampleset.to_pandas_dataframe()

min_occurence = num_reads / 20
solutions = lsf.getSolutions(min_occurence)
list(solutions)

lsf.setY(Y_2)
lsf.sample() # 050d68cf-b1d7-4ba5-acdb-688140e88c15
list(lsf.getSolutions(min_occurence))

