10 #ifndef THYRA_SILLY_MODIFIED_GRAM_SHMIDT_HPP
11 #define THYRA_SILLY_MODIFIED_GRAM_SHMIDT_HPP
13 #include "Thyra_MultiVectorBase.hpp"
14 #include "Thyra_MultiVectorStdOps.hpp"
15 #include "Thyra_VectorStdOps.hpp"
16 #include "Thyra_DetachedMultiVectorView.hpp"
30 template<
class Scalar>
31 void sillyModifiedGramSchmidt(
32 const Ptr<MultiVectorBase<Scalar> > &V,
33 const Ptr<RCP<MultiVectorBase<Scalar> > > &R_out
37 const int n = V->domain()->dim();
38 *R_out = createMembers(V->domain(), V->domain());
39 DetachedMultiVectorView<Scalar> R(*(*R_out));
40 for (
int k = 0; k < n; ++k) {
41 R(k,k) = norm(*V->col(k));
42 Vt_S(V->col(k).ptr(), ST::one()/R(k,k));
43 for (
int j = k+1; j < n; ++j) {
44 R(k,j) = scalarProd(*V->col(k), *V->col(j));
45 Vp_StV(V->col(j).ptr(), -R(k,j), *V->col(k));
52 #endif // THYRA_SILLY_MODIFIED_GRAM_SHMIDT_HPP
TypeTo as(const TypeFrom &t)