silly
parent
a734102cbf
commit
bfbf015b3d
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
project(COSC-4P80-Assignment-3 VERSION 0.0.4)
|
||||
project(COSC-4P80-Assignment-3 VERSION 0.0.5)
|
||||
|
||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace assign3
|
|||
|
||||
neuron_t& update(const std::vector<Scalar>& new_data, const topology_function_t* basis_func, Scalar eta, Scalar r);
|
||||
|
||||
static Scalar distance(const neuron_t& n1, const neuron_t& n2);
|
||||
static Scalar distance(const neuron_t& n1, const neuron_t& n2, Scalar time_ratio);
|
||||
|
||||
[[nodiscard]] inline const std::vector<Scalar>& get_data() const
|
||||
{ return data; }
|
||||
|
|
|
@ -51,10 +51,10 @@ namespace assign3
|
|||
return std::sqrt(dist);
|
||||
}
|
||||
|
||||
Scalar neuron_t::distance(const neuron_t& n1, const neuron_t& n2)
|
||||
Scalar neuron_t::distance(const neuron_t& n1, const neuron_t& n2, Scalar time_ratio)
|
||||
{
|
||||
auto dx = n1.x_pos - n2.x_pos;
|
||||
auto dy = n1.y_pos - n2.y_pos;
|
||||
return std::sqrt(dx * dx + dy * dy);
|
||||
auto dist = n1.dist(n2.data);
|
||||
auto dist_sq = dist * dist;
|
||||
return std::exp(-time_ratio * dist_sq);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue