56 template<
typename dtype>
88 coefficients_.push_back(1);
97 coefficients_.resize(
inValues.size());
127 template<
typename dtypeOut>
357 integralCofficients[i + 1] =
static_cast<double>(coefficients_[i]) /
static_cast<double>(i + 1);
371 return static_cast<uint32>(coefficients_.size() - 1);
381 std::cout << *
this << std::endl;
394 std::string
repr =
"Poly1d<";
436 return std::accumulate(coefficients_.begin(),
440 { return polyValue + coefficient * utils::power(inValue, power++); });
457 [
this](
const auto xValue) { return this->operator()(xValue); });
482 if (this->coefficients_.size() <
inOtherPoly.coefficients_.size())
484 for (
size_t i = 0; i < coefficients_.size(); ++i)
488 for (
size_t i = coefficients_.size(); i <
inOtherPoly.coefficients_.size(); ++i)
490 coefficients_.push_back(
inOtherPoly.coefficients_[i]);
495 for (
size_t i = 0; i <
inOtherPoly.coefficients_.size(); ++i)
525 if (this->coefficients_.size() <
inOtherPoly.coefficients_.size())
527 for (
size_t i = 0; i < coefficients_.size(); ++i)
531 for (
size_t i = coefficients_.size(); i <
inOtherPoly.coefficients_.size(); ++i)
533 coefficients_.push_back(-
inOtherPoly.coefficients_[i]);
538 for (
size_t i = 0; i <
inOtherPoly.coefficients_.size(); ++i)
578 for (
uint32 k = 0; k <= i; ++k)
611 coefficients_.clear();
612 coefficients_.push_back(1);
644 std::vector<dtype> coefficients_{};
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds info about the dtype.
Definition DtypeInfo.hpp:41
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
self_type transpose() const
Definition NdArrayCore.hpp:4958
bool issquare() const noexcept
Definition NdArrayCore.hpp:3085
size_type numCols() const noexcept
Definition NdArrayCore.hpp:3541
const Shape & shape() const noexcept
Definition NdArrayCore.hpp:4587
Poly1d< dtype > operator-(const Poly1d< dtype > &inOtherPoly) const
Definition Poly1d.hpp:511
Poly1d< dtype > operator*(const Poly1d< dtype > &inOtherPoly) const
Definition Poly1d.hpp:554
static Poly1d< double > fit(const NdArray< dtype > &xValues, const NdArray< dtype > &yValues, const NdArray< dtype > &weights, uint8 polyOrder)
Definition Poly1d.hpp:266
Poly1d< dtype > & operator^=(uint32 inPower)
Definition Poly1d.hpp:607
Poly1d< dtype > operator+(const Poly1d< dtype > &inOtherPoly) const
Definition Poly1d.hpp:468
dtype eval(dtype xValue) const noexcept
Definition Poly1d.hpp:186
Poly1d< double > integ() const
Definition Poly1d.hpp:344
Poly1d< dtype > & operator*=(const Poly1d< dtype > &inOtherPoly)
Definition Poly1d.hpp:566
Poly1d(const NdArray< dtype > &inValues, IsRoots isRoots=IsRoots::NO)
Definition Poly1d.hpp:78
Poly1d< dtype > & operator-=(const Poly1d< dtype > &inOtherPoly)
Definition Poly1d.hpp:523
static Poly1d< double > fit(const NdArray< dtype > &xValues, const NdArray< dtype > &yValues, uint8 polyOrder)
Definition Poly1d.hpp:211
Poly1d< dtypeOut > astype() const
Definition Poly1d.hpp:128
NdArray< dtype > eval(const NdArray< dtype > &xValues) const noexcept
Definition Poly1d.hpp:198
Poly1d< dtype > & operator+=(const Poly1d< dtype > &inOtherPoly)
Definition Poly1d.hpp:480
NdArray< dtype > operator()(const NdArray< dtype > &xValues) const noexcept
Definition Poly1d.hpp:450
std::string str() const
Definition Poly1d.hpp:390
void print() const
Definition Poly1d.hpp:379
Poly1d< dtype > operator^(uint32 inPower) const
Definition Poly1d.hpp:595
uint32 order() const noexcept
Definition Poly1d.hpp:369
dtype operator()(dtype inValue) const noexcept
Definition Poly1d.hpp:433
double area(double a, double b) const
Definition Poly1d.hpp:110
friend std::ostream & operator<<(std::ostream &inOStream, const Poly1d< dtype > &inPoly)
Definition Poly1d.hpp:637
NdArray< dtype > coefficients() const
Definition Poly1d.hpp:145
Poly1d< dtype > deriv() const
Definition Poly1d.hpp:156
NdArray< double > inv(const NdArray< dtype > &inArray)
Definition inv.hpp:54
Definition chebyshev_t.hpp:39
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:775
OutputIt copy(InputIt first, InputIt last, OutputIt destination) noexcept
Definition StlAlgorithms.hpp:97
std::string num2str(dtype inNumber)
Definition num2str.hpp:44
dtype power(dtype inValue, uint8 inPower) noexcept
Definition Utils/power.hpp:46
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition essentiallyEqual.hpp:49
constexpr dtype power(dtype inValue, uint8 inExponent) noexcept
Definition Functions/power.hpp:52
IsRoots
Is Roots boolean.
Definition Enums.hpp:92
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
std::uint8_t uint8
Definition Types.hpp:42
std::uint32_t uint32
Definition Types.hpp:40