Mantid
Loading...
Searching...
No Matches
Framework
Algorithms
src
MaxEnt
MaxentSpaceReal.cpp
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4
// NScD Oak Ridge National Laboratory, European Spallation Source,
5
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#include "
MantidAlgorithms/MaxEnt/MaxentSpaceReal.h
"
8
#include <stdexcept>
9
10
namespace
Mantid::Algorithms
{
11
17
std::vector<double>
MaxentSpaceReal::toComplex
(
const
std::vector<double> &values) {
18
19
// The output has 2*N values
20
std::vector<double> result(values.size() * 2);
21
22
for
(
size_t
i = 0; i < values.size(); i++)
23
result[2 * i] = values[i];
24
25
return
result;
26
}
27
33
std::vector<double>
MaxentSpaceReal::fromComplex
(
const
std::vector<double> &values) {
34
35
if
(values.size() % 2) {
36
throw
std::invalid_argument(
"Cannot convert to real vector"
);
37
}
38
39
// The output has N/2 values
40
std::vector<double> result(values.size() / 2);
41
42
for
(
size_t
i = 0; i < result.size(); i++) {
43
result[i] = values[2 * i];
44
}
45
return
result;
46
}
47
48
}
// namespace Mantid::Algorithms
MaxentSpaceReal.h
Mantid::Algorithms::MaxentSpaceReal::fromComplex
std::vector< double > fromComplex(const std::vector< double > &values) override
Converts a vector of complex numbers to a vector of real numbers.
Definition
MaxentSpaceReal.cpp:33
Mantid::Algorithms::MaxentSpaceReal::toComplex
std::vector< double > toComplex(const std::vector< double > &values) override
Converts a vector of real values to a vector of complex numbers.
Definition
MaxentSpaceReal.cpp:17
Mantid::Algorithms
Definition
AbsorptionCorrection.h:28
Generated by
1.9.8