mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 07:23:26 +00:00
improved naming
This commit is contained in:
@@ -175,9 +175,7 @@ namespace omath
|
|||||||
|
|
||||||
constexpr Mat& operator*=(const Type& f) noexcept
|
constexpr Mat& operator*=(const Type& f) noexcept
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < Rows; ++i)
|
std::ranges::for_each(m_data,[&f](auto& val) {val *= f;});
|
||||||
for (size_t j = 0; j < Columns; ++j)
|
|
||||||
At(i, j) *= f;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,45 +187,39 @@ namespace omath
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Mat operator*(const Type& f) const noexcept
|
constexpr Mat operator*(const Type& value) const noexcept
|
||||||
{
|
{
|
||||||
Mat result(*this);
|
Mat result(*this);
|
||||||
result *= f;
|
result *= value;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Mat& operator/=(const Type& f) noexcept
|
constexpr Mat& operator/=(const Type& value) noexcept
|
||||||
{
|
{
|
||||||
std::ranges::for_each(m_data,[&f](auto& val) {val /= f;});
|
std::ranges::for_each(m_data,[&value](auto& val) {val /= value;});
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Mat operator/(const Type& f) const noexcept
|
constexpr Mat operator/(const Type& value) const noexcept
|
||||||
{
|
{
|
||||||
Mat result(*this);
|
Mat result(*this);
|
||||||
result /= f;
|
result /= value;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Mat& operator=(const Mat& other) noexcept
|
constexpr Mat& operator=(const Mat& other) noexcept
|
||||||
{
|
{
|
||||||
if (this == &other)
|
if (this != &other)
|
||||||
return *this;
|
m_data = other.m_data;
|
||||||
for (size_t i = 0; i < Rows; ++i)
|
|
||||||
for (size_t j = 0; j < Columns; ++j)
|
|
||||||
At(i, j) = other.At(i, j);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Mat& operator=(Mat&& other) noexcept
|
constexpr Mat& operator=(Mat&& other) noexcept
|
||||||
{
|
{
|
||||||
if (this == &other)
|
if (this != &other)
|
||||||
return *this;
|
m_data = std::move(other.m_data);
|
||||||
|
|
||||||
for (size_t i = 0; i < Rows; ++i)
|
|
||||||
for (size_t j = 0; j < Columns; ++j)
|
|
||||||
At(i, j) = other.At(i, j);
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user