Commit ff473b98 authored by graham's avatar graham
Browse files

ENH: cmptProduct function, i.e. cmptProduct(vector(a, b, c)) = a*b*c.

parent d9931658
...@@ -27,7 +27,11 @@ int main() ...@@ -27,7 +27,11 @@ int main()
Info<< magSqr(d) << endl; Info<< magSqr(d) << endl;
vector d2(0.5, 0.51, -0.5); vector d2(0.5, 0.51, -0.5);
Info<< cmptMax(d2) << " " << cmptSum(d2) << " " << cmptMag(d2) << endl; Info<< cmptMax(d2) << " "
<< cmptSum(d2) << " "
<< cmptProduct(d2) << " "
<< cmptMag(d2)
<< endl;
Info<< min(d, d2) << endl; Info<< min(d, d2) << endl;
return 0; return 0;
} }
...@@ -406,6 +406,17 @@ inline Cmpt cmptAv ...@@ -406,6 +406,17 @@ inline Cmpt cmptAv
return cmptSum(vs)/nCmpt; return cmptSum(vs)/nCmpt;
} }
template<class Form, class Cmpt, int nCmpt>
inline Cmpt cmptProduct
(
const VectorSpace<Form, Cmpt, nCmpt>& vs
)
{
Cmpt product = vs.v_[0];
VectorSpaceOps<nCmpt,1>::SeqOp(product, vs, multiplyEqOp<Cmpt>());
return product;
}
template<class Form, class Cmpt, int nCmpt> template<class Form, class Cmpt, int nCmpt>
inline Form cmptMag inline Form cmptMag
......
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