better use of findfirst in create_product_matrix

This commit is contained in:
kalmar 2017-01-13 18:02:34 +01:00
parent 239521f159
commit 95618eb0f9
1 changed files with 5 additions and 10 deletions

View File

@ -45,18 +45,13 @@ function create_product_matrix(basis::Array{Array{Float64,2},1}, limit::Int)
for i in 1:limit
x_inv = inv(basis[i])
for j in 1:limit
w::Array{Float64,2} = x_inv*basis[j]
w = x_inv*basis[j]
function f(x::Array{Float64,2})
if x == w
return true
else
return false
end
index = findfirst(basis, w)
if 0 < index limit
product_matrix[i,j] = index
push!(constraints[index],[i,j])
end
index = findfirst(f, basis)
product_matrix[i,j] = index
push!(constraints[index],[i,j])
end
end
return product_matrix, constraints