Skip to content

Commit 1f33c9f

Browse files
authored
Merge pull request #18 from maxreiss123/develop
Develop
2 parents db1e8d6 + dfe53f3 commit 1f33c9f

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Sbp.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ end
399399
try
400400
operation = get_physical_operation(entry.tokenLib, item)
401401
physical_dimension = convert(Vector{Float16}, operation(entry.physical_dimension))
402-
if !isempty(physical_dimension)
402+
if !isempty(physical_dimension) && !has_inf16(physical_dimension)
403403
push!(entry.elements, item)
404404
entry.physical_dimension = physical_dimension
405405
entry.homogene = true
@@ -418,7 +418,7 @@ end
418418
operation = get_physical_operation(entry.tokenLib, item)
419419
last_dim = get_physical_dimension(entry.tokenLib, entry.elements[end])
420420
temp_dim = convert(Vector{Float16}, operation(last_dim, entry.physical_dimension))
421-
if !isempty(temp_dim)
421+
if !isempty(temp_dim) && !has_inf16(temp_dim)
422422
entry.arity_potential = 1
423423
push!(entry.elements, item)
424424
entry.physical_dimension = temp_dim
@@ -760,7 +760,7 @@ function calculate_vector_dimension!(tree::TempComputeTree)
760760

761761

762762
#needs to be revised
763-
if length(dims) == 2 && isempty(tree.vector_dimension)
763+
if length(dims) == 2 && has_inf16(tree.vector_dimension)
764764
tree.symbol = rand(point_operations)
765765
function_op = tokenLib.physical_operation_dict[][tree.symbol]
766766
tree.vector_dimension = function_op(dims...)
@@ -888,9 +888,6 @@ function retrieve_exchange_from_lib(tree::TempComputeTree,
888888
end
889889

890890
function calculate_distance(k1::Vector{Float16}, k2::Vector{Float16})
891-
if isempty(k2) || isempty(k1)
892-
return Inf16
893-
end
894891
return sqrt(sum((k1 .- k2) .^ 2))
895892
end
896893

@@ -1013,7 +1010,7 @@ function propagate_necessary_changes!(
10131010
return false
10141011
end
10151012

1016-
if !isempty(tree.vector_dimension) && isapprox(tree.vector_dimension, expected_dim, atol=eps(Float16))
1013+
if !has_inf16(tree.vector_dimension) && isapprox(tree.vector_dimension, expected_dim, atol=eps(Float16))
10171014
return true
10181015
end
10191016

test/Spb_core_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ end
225225
# Test 5: Tree with operation resulting in empty dimension (should choose random point operation)
226226
tree5 = TempComputeTree(Int8(6), Int8[7], Float16[], token_dto) # sin(x1) should result in [] dimension
227227
dim5 = calculate_vector_dimension!(tree5)
228-
@test dim5 == []
228+
@test dim5 == Float16[Inf, Inf, Inf, Inf, Inf, Inf, Inf]
229229

230230

231231
# Test 6: Recalculation of existing dimension

0 commit comments

Comments
 (0)