To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit bbf745ef authored by Victor's avatar Victor
Browse files

small change

parent 98cb4690
"""
abstract type AbstractSpace{Dim,T,F} end
`Dim` is the dimension of the space, `T` is the element type, `ife` is a bool which is `true`
when space is finite
"""
abstract type IsFinite{T} end abstract type IsFinite{T} end
#ife stands for is finite #ife stands for is finite
"""
$(TYPEDEF)
`Dim` is the dimension of the space, `T` is the element type,
`I` to indicate finiteness
"""
abstract type AbstractSpace{Dim,T,I} end abstract type AbstractSpace{Dim,T,I} end
AbstractSpacesTuple = Tuple{Vararg{AbstractSpace}} AbstractSpacesTuple = Tuple{Vararg{AbstractSpace}}
import Base:ndims,isfinite,eltype import Base:ndims,isfinite,eltype
...@@ -50,13 +51,11 @@ A real pace with dimension N and type T ...@@ -50,13 +51,11 @@ A real pace with dimension N and type T
""" """
struct RealSpace{N,T} <: AbstractSpace{N,T,IsFinite{false}} end struct RealSpace{N,T} <: AbstractSpace{N,T,IsFinite{false}} end
# TODO: # TODO: find a way to put a type on D in get_inc
""" """
$(SIGNATURES) $(SIGNATURES)
Returns increment Returns increment
""" """
# TODO: find a way to put a type on D in get_inc
function get_inc(D,s::AbstractSpace{Dim,T,I}) where {Dim,T<:AbstractFloat,I<:IsFinite{false}} function get_inc(D,s::AbstractSpace{Dim,T,I}) where {Dim,T<:AbstractFloat,I<:IsFinite{false}}
if Dim > 1 if Dim > 1
return Tuple(D .* randn(T,Dim)) return Tuple(D .* randn(T,Dim))
...@@ -87,8 +86,8 @@ function get_inc(x,D,s::GraphSpace{T}) where {T} ...@@ -87,8 +86,8 @@ function get_inc(x,D,s::GraphSpace{T}) where {T}
end end
""" """
function get_inc_reflected(x::Number,inc::Number,s=-1,e=1) $(SIGNATURES)
Here we increment the trajectory of trait 1 such that it follows a reflected brownian motion (1D) Here we increment the trajectory of trait 1 such that it follows a reflected brownian motion (1D)
""" """
function _reflect1D(x::Number,inc::Number,s::AbstractSegment) function _reflect1D(x::Number,inc::Number,s::AbstractSegment)
if x + inc < s.s if x + inc < s.s
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment