Commit aeca6716 authored by Henry Weller's avatar Henry Weller
Browse files

VectorSpace: Added cmptSqr

parent 5050a6cf
......@@ -302,11 +302,18 @@ inline Scalar cmptAv(const Scalar s)
}
inline Scalar cmptSqr(const Scalar s)
{
return sqr(s);
}
inline Scalar cmptMag(const Scalar s)
{
return mag(s);
}
inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
{
Scalar maga = mag(a);
......@@ -323,7 +330,7 @@ inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
}
// Stabilisation around zero for division
//- Stabilisation around zero for division
inline Scalar stabilise(const Scalar s, const Scalar small)
{
if (s >= 0)
......
......@@ -537,6 +537,18 @@ inline Cmpt cmptProduct
}
template<class Form, class Cmpt, direction Ncmpts>
inline Form cmptSqr
(
const VectorSpace<Form, Cmpt, Ncmpts>& vs
)
{
Form v;
VectorSpaceOps<Ncmpts,0>::eqOp(v, vs, eqSqrOp<Cmpt>());
return v;
}
template<class Form, class Cmpt, direction Ncmpts>
inline Form cmptMag
(
......
......@@ -72,6 +72,7 @@ EqOp(plusEq, x += y)
EqOp(minusEq, x -= y)
EqOp(multiplyEq, x *= y)
EqOp(divideEq, x /= y)
EqOp(eqSqr, x = sqr(y))
EqOp(eqMag, x = mag(y))
EqOp(plusEqMagSqr, x += magSqr(y))
EqOp(maxEq, x = max(x, y))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment