Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Merge 6128543 into 5812a9e
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] committed Jul 5, 2018
2 parents 5812a9e + 6128543 commit d248631
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/src.jl
Expand Up @@ -15,7 +15,7 @@
Calculates the square of a float: r^2
"""
function pow_2{F<:AbstractFloat}(r::F)
function pow_2(r::F) where F<:AbstractFloat
return r ^ 2
end

Expand All @@ -39,7 +39,7 @@ end
"""
MBContainer container
"""
type MBContainer{I<:Integer, F<:AbstractFloat}
mutable struct MBContainer{I<:Integer, F<:AbstractFloat}
dim::I # Dimensions
len::I # Number of points
points::Array{F, 2} # Points in 2D array
Expand Down Expand Up @@ -81,14 +81,14 @@ MBContainer container
)
end

MBContainer{I<:Integer, F<:AbstractFloat}(dim::I, len::I, points::Array{F, 2}) = MBContainer{I, F}(dim, len, points)
MBContainer(dim::I, len::I, points::Array{F, 2}) where {I<:Integer, F<:AbstractFloat} = MBContainer{I, F}(dim, len, points)

"""
find_pivot(len, points, center, arr_squared_r, dim)
Find a pivot point, which is used for calculating the new miniball.
"""
function find_pivot{I<:Integer, F<:AbstractFloat}(len::I, points::Array{F, 2}, center::Array{F, 1}, arr_squared_r::F, dim::I)
function find_pivot(len::I, points::Array{F, 2}, center::Array{F, 1}, arr_squared_r::F, dim::I) where {I<:Integer, F<:AbstractFloat}
max_distance = 0.0
pivot = zeros(F, dim)
point = zeros(F, dim)
Expand Down Expand Up @@ -203,7 +203,7 @@ http://www.inf.ethz.ch/personal/gaertner/texts/own_work/esa99_final.pdf,
from B. Gaertner, Fast and Robust Smallest Enclosing Balls, ESA 1999,
from section 3. The Primitive Operation and after that.
"""
function new_center_and_radius!{F<:AbstractFloat}(pivot::Array{F, 1}, container::MBContainer)
function new_center_and_radius!(pivot::Array{F, 1}, container::MBContainer) where F<:AbstractFloat
dim = container.dim
return_value = true
fsize = container.fsize
Expand All @@ -230,7 +230,7 @@ function new_center_and_radius!{F<:AbstractFloat}(pivot::Array{F, 1}, container:
Check if the given point is already inside the current miniball.
"""
function inside_current_ball{I<:Integer, F<:AbstractFloat}(coords::Array{F, 1}, center::Array{F, 1}, squared_radius::F, dim::I)
function inside_current_ball(coords::Array{F, 1}, center::Array{F, 1}, squared_radius::F, dim::I) where {I<:Integer, F<:AbstractFloat}
cntr = center
pnt = coords
dist = -squared_radius
Expand All @@ -247,7 +247,7 @@ Moves the support points inside the support vector. The idea is to move the
points that are the furthest apart from each other to the front of
the vector. Closest points to gather are at the end of the vector.
"""
function support_points_move_to_front{I<:Integer, F<:AbstractFloat}(container::MBContainer, element::Array{F, 1}, id_::I)
function support_points_move_to_front(container::MBContainer, element::Array{F, 1}, id_::I) where {I<:Integer, F<:AbstractFloat}
splice!(container.support_vector, id_)
unshift!(container.support_vector, element)
end
Expand All @@ -257,7 +257,7 @@ end
Recursive function for creating a miniball using the support vector.
"""
function miniball_support_points{F<:AbstractFloat}(container::MBContainer, end_support_vector::Array{F, 1})
function miniball_support_points(container::MBContainer, end_support_vector::Array{F, 1}) where F<:AbstractFloat
dim = container.dim
fsize = container.fsize
ssize = container.ssize
Expand Down Expand Up @@ -288,7 +288,7 @@ Recursive function for creating a miniball using the support vector.
Appends a pivot point to the front of the support vector.
"""
function pivot_move_to_front{F<:AbstractFloat}(pivot::Array{F, 1}, container::MBContainer)
function pivot_move_to_front(pivot::Array{F, 1}, container::MBContainer) where F<:AbstractFloat
dim = container.dim
unshift!(container.support_vector, pivot)
if length(container.support_vector) == (dim + 2)
Expand Down

0 comments on commit d248631

Please sign in to comment.