AllowRotation and size_t

This commit is contained in:
Aik-Siong Koh
2024-01-14 21:40:33 -07:00
committed by PaddleStroke
parent fe99ad2593
commit 85557e1fa4
285 changed files with 1854 additions and 1116 deletions

View File

@@ -32,7 +32,7 @@ MbD::Polynomial::Polynomial(Symsptr var, std::shared_ptr<std::vector<Symsptr>> c
Symsptr MbD::Polynomial::expandUntil(Symsptr, std::shared_ptr<std::unordered_set<Symsptr>> set)
{
auto newCoeffs = std::make_shared<std::vector<Symsptr>>();
for (int i = 0; i < (int)coeffs->size(); i++)
for (size_t i = 0; i < coeffs->size(); i++)
{
auto coeff = coeffs->at(i);
auto newCoeff = coeff->expandUntil(coeff, set);
@@ -44,7 +44,7 @@ Symsptr MbD::Polynomial::expandUntil(Symsptr, std::shared_ptr<std::unordered_set
Symsptr MbD::Polynomial::simplifyUntil(Symsptr, std::shared_ptr<std::unordered_set<Symsptr>> set)
{
auto newCoeffs = std::make_shared<std::vector<Symsptr>>();
for (int i = 0; i < (int)coeffs->size(); i++)
for (size_t i = 0; i < coeffs->size(); i++)
{
auto coeff = coeffs->at(i);
auto newCoeff = coeff->simplifyUntil(coeff, set);
@@ -58,7 +58,7 @@ Symsptr MbD::Polynomial::differentiateWRTx()
//Differentiate powers
if (coeffs->size() == 1) return sptrConstant(0.0);
auto newCoeffs = std::make_shared<std::vector<Symsptr>>();
for (int i = 1; i < (int)coeffs->size(); i++)
for (size_t i = 1; i < coeffs->size(); i++)
{
auto newCoeff = i * coeffs->at(i)->getValue();
newCoeffs->push_back(sptrConstant(newCoeff));
@@ -80,7 +80,7 @@ Symsptr MbD::Polynomial::integrateWRT(Symsptr var)
assert(xx == var);
auto newCoeffs = std::make_shared<std::vector<Symsptr>>();
newCoeffs->push_back(sptrConstant(0.0));
for (int i = 0; i < (int)coeffs->size(); i++)
for (size_t i = 0; i < coeffs->size(); i++)
{
auto newCoeff = coeffs->at(i)->getValue() / (i + 1);
newCoeffs->push_back(sptrConstant(newCoeff));
@@ -93,7 +93,7 @@ double MbD::Polynomial::getValue()
auto xvalue = xx->getValue();
auto xpower = 1.0;
auto answer = 0.0;
for (int i = 0; i < (int)coeffs->size(); i++)
for (size_t i = 0; i < coeffs->size(); i++)
{
answer += coeffs->at(i)->getValue() * xpower;
xpower *= xvalue;
@@ -113,7 +113,7 @@ std::ostream& MbD::Polynomial::printOn(std::ostream& s) const
s << *xx << ", ";
s << "coeffs{";
s << *coeffs->at(0);
for (int i = 1; i < (int)coeffs->size(); i++)
for (size_t i = 1; i < coeffs->size(); i++)
{
s << ", " << *coeffs->at(i);
}