Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
foolnotion committed May 27, 2024
1 parent d23cfa8 commit 57279f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/operon/operators/evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ struct OPERON_EXPORT ErrorMetric {

explicit ErrorMetric(ErrorType type) : type_(type) { }

auto operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y) const noexcept -> double;
auto operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y, Operon::Span<Operon::Scalar const> w) const noexcept -> double;
auto operator()(Iterator beg1, Iterator end1, Iterator beg2) const noexcept -> double;
auto operator()(Iterator beg1, Iterator end1, Iterator beg2, Iterator beg3) const noexcept -> double;
auto operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y) const -> double;
auto operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y, Operon::Span<Operon::Scalar const> w) const -> double;
auto operator()(Iterator beg1, Iterator end1, Iterator beg2) const -> double;
auto operator()(Iterator beg1, Iterator end1, Iterator beg2, Iterator beg3) const -> double;

private:
ErrorType type_;
Expand Down
12 changes: 8 additions & 4 deletions source/operators/evaluator_error_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "operon/error_metrics/error_metrics.hpp"

namespace Operon {
auto ErrorMetric::operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y) const noexcept -> double {
auto ErrorMetric::operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y) const -> double {
switch (type_) {
case ErrorType::SSE: return SumOfSquaredErrors(x, y);
case ErrorType::MSE: return MeanSquaredError(x, y);
Expand All @@ -11,10 +11,11 @@ namespace Operon {
case ErrorType::MAE: return MeanAbsoluteError(x, y);
case ErrorType::R2: return -R2Score(x, y);
case ErrorType::C2: return -SquaredCorrelation(x, y);
default: { throw std::runtime_error("unknown error type"); }
}
}

auto ErrorMetric::operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y, Operon::Span<Operon::Scalar const> w) const noexcept -> double {
auto ErrorMetric::operator()(Operon::Span<Operon::Scalar const> x, Operon::Span<Operon::Scalar const> y, Operon::Span<Operon::Scalar const> w) const -> double {
switch (type_) {
case ErrorType::SSE: return SumOfSquaredErrors(x, y, w);
case ErrorType::MSE: return MeanSquaredError(x, y, w);
Expand All @@ -23,10 +24,11 @@ namespace Operon {
case ErrorType::MAE: return MeanAbsoluteError(x, y, w);
case ErrorType::R2: return -R2Score(x, y, w);
case ErrorType::C2: return -SquaredCorrelation(x, y, w);
default: { throw std::runtime_error("unknown error type"); }
}
}

auto ErrorMetric::operator()(Iterator beg1, Iterator end1, Iterator beg2) const noexcept -> double {
auto ErrorMetric::operator()(Iterator beg1, Iterator end1, Iterator beg2) const -> double {
switch (type_) {
case ErrorType::SSE: return SumOfSquaredErrors(beg1, end1, beg2);
case ErrorType::MSE: return MeanSquaredError(beg1, end1, beg2);
Expand All @@ -35,10 +37,11 @@ namespace Operon {
case ErrorType::MAE: return MeanAbsoluteError(beg1, end1, beg2);
case ErrorType::R2: return -R2Score(beg1, end1, beg2);
case ErrorType::C2: return -SquaredCorrelation(beg1, end1, beg2);
default: { throw std::runtime_error("unknown error type"); }
}
}

auto ErrorMetric::operator()(Iterator beg1, Iterator end1, Iterator beg2, Iterator beg3) const noexcept -> double {
auto ErrorMetric::operator()(Iterator beg1, Iterator end1, Iterator beg2, Iterator beg3) const -> double {
switch (type_) {
case ErrorType::SSE: return SumOfSquaredErrors(beg1, end1, beg2, beg3);
case ErrorType::MSE: return MeanSquaredError(beg1, end1, beg2, beg3);
Expand All @@ -47,6 +50,7 @@ namespace Operon {
case ErrorType::MAE: return MeanAbsoluteError(beg1, end1, beg2, beg3);
case ErrorType::R2: return -R2Score(beg1, end1, beg2, beg3);
case ErrorType::C2: return -SquaredCorrelation(beg1, end1, beg2, beg3);
default: { throw std::runtime_error("unknown error type"); }
}
}
} // namespace Operon

0 comments on commit 57279f3

Please sign in to comment.