MPS-Basic
Loading...
Searching...
No Matches
weight.cpp
Go to the documentation of this file.
1#include "weight.hpp"
2
3#include <cassert>
4#include <iostream>
5
7 this->weightType = weightType;
8}
9
10double Weight::weightFn(double dis, double re) {
11 assert(dis > 0.0);
12
13 if (dis >= re) {
14 return 0.0;
15 } else {
17 return (re / dis) - 1.0;
18 } else if (weightType == WeightType::Explicit) {
19 return (re / dis) + (dis / re) - 2.0;
21 return (re / dis) - (dis / re);
22 }
23 std::cerr << "ERROR: Unknown weight type." << std::endl;
24 std::exit(-1);
25 }
26}
WeightType weightType
Definition weight.hpp:17
double weightFn(double dis, double re)
Weight function for MPS method.
Definition weight.cpp:10
Weight()=default
WeightType
Definition weight.hpp:5