42 #ifndef THYRA_SILLY_MODIFIED_GRAM_SHMIDT_HPP
43 #define THYRA_SILLY_MODIFIED_GRAM_SHMIDT_HPP
45 #include "Thyra_MultiVectorBase.hpp"
46 #include "Thyra_MultiVectorStdOps.hpp"
47 #include "Thyra_VectorStdOps.hpp"
48 #include "Thyra_DetachedMultiVectorView.hpp"
62 template<
class Scalar>
63 void sillyModifiedGramSchmidt(
64 const Ptr<MultiVectorBase<Scalar> > &V,
65 const Ptr<RCP<MultiVectorBase<Scalar> > > &R_out
69 const int n = V->domain()->dim();
70 *R_out = createMembers(V->domain(), V->domain());
71 DetachedMultiVectorView<Scalar> R(*(*R_out));
72 for (
int k = 0; k < n; ++k) {
73 R(k,k) = norm(*V->col(k));
74 Vt_S(V->col(k).ptr(), ST::one()/R(k,k));
75 for (
int j = k+1; j < n; ++j) {
76 R(k,j) = scalarProd(*V->col(k), *V->col(j));
77 Vp_StV(V->col(j).ptr(), -R(k,j), *V->col(k));
84 #endif // THYRA_SILLY_MODIFIED_GRAM_SHMIDT_HPP
TypeTo as(const TypeFrom &t)