From b9bf5317aad7ec9fed8b7d96f4fb34969eaa5a59 Mon Sep 17 00:00:00 2001 From: Wai-Shing Luk Date: Sat, 14 Dec 2024 14:57:54 +0800 Subject: [PATCH] fix for android termux + xmake --- source/lowpass_oracle.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/lowpass_oracle.cpp b/source/lowpass_oracle.cpp index b0e0c18..fcc1082 100644 --- a/source/lowpass_oracle.cpp +++ b/source/lowpass_oracle.cpp @@ -93,15 +93,15 @@ auto LowpassOracle::assess_feas(const Vec &x, const double &Spsq) -> ParallelCut if (this->idx1 == this->nwpass) { this->idx1 = 0; // round robin } - double v = matrix_vector(this->idx1); + double v = matrix_vector(size_t(this->idx1)); if (v > this->Upsq) { cut.second = Vec{v - this->Upsq, v - this->Lpsq}; - cut.first = this->A[this->idx1]; + cut.first = this->A[size_t(this->idx1)]; return &cut; } if (v < this->Lpsq) { cut.second = Vec{-v + this->Lpsq, -v + this->Upsq}; - cut.first = -this->A[this->idx1]; + cut.first = -this->A[size_t(this->idx1)]; return &cut; } } @@ -116,15 +116,15 @@ auto LowpassOracle::assess_feas(const Vec &x, const double &Spsq) -> ParallelCut if (this->idx3 == N) { this->idx3 = this->nwstop; // round robin } - double v = matrix_vector(this->idx3); + double v = matrix_vector(size_t(this->idx3)); if (v > Spsq) { cut.second = Vec{v - Spsq, v}; - cut.first = this->A[this->idx3]; + cut.first = this->A[size_t(this->idx3)]; return &cut; } if (v < 0.0) { cut.second = Vec{-v, -v + Spsq}; - cut.first = -this->A[this->idx3]; + cut.first = -this->A[size_t(this->idx3)]; return &cut; } if (v > this->_fmax) { @@ -140,10 +140,10 @@ auto LowpassOracle::assess_feas(const Vec &x, const double &Spsq) -> ParallelCut if (this->idx2 == this->nwstop) { this->idx2 = this->nwpass; // round robin } - double v = matrix_vector(this->idx2); + double v = matrix_vector(size_t(this->idx2)); if (v < 0.0) { cut.second = Vec{-v}; - cut.first = -this->A[this->idx2]; + cut.first = -this->A[size_t(this->idx2)]; return &cut; } } @@ -182,5 +182,5 @@ auto LowpassOracle::assess_optim(const Vec &x, double &Spsq) -> std::tuple_fmax; // output - return {{this->A[this->_kmax], Vec{0.0, this->_fmax}}, true}; + return {{this->A[size_t(this->_kmax)], Vec{0.0, this->_fmax}}, true}; }