From e92e805efc6c1acc6921e46b18769670c75f9a90 Mon Sep 17 00:00:00 2001 From: Cory Date: Fri, 29 Dec 2023 22:55:28 +0100 Subject: [PATCH] Change deviation to absolute value --- lib/WaveSimulation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WaveSimulation.cpp b/lib/WaveSimulation.cpp index 1ccde39..a78fd52 100644 --- a/lib/WaveSimulation.cpp +++ b/lib/WaveSimulation.cpp @@ -308,7 +308,7 @@ void WaveSimulation::probability_deviation(std::string outfile, if (write_each_step) { for (size_t i = 0; i < iterations; i++) { sum = arma::accu(this->U % arma::conj(this->U)).real(); - ofile << i*this->dt << '\t' << 1. - sum << '\n'; + ofile << i*this->dt << '\t' << std::abs(1. - sum) << '\n'; this->step(); } } @@ -318,7 +318,7 @@ void WaveSimulation::probability_deviation(std::string outfile, } } sum = arma::accu(this->U % arma::conj(this->U)).real(); - ofile << this->T << '\t' << 1. - sum << '\n'; + ofile << this->T << '\t' << std::abs(1. - sum) << '\n'; ofile.close(); } -- 2.20.1