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"
31void sillyModifiedGramSchmidt(
36 typedef Teuchos::ScalarTraits<Scalar> ST;
using Teuchos::as;
37 const int n = V->domain()->dim();
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) {
45 Vp_StV(V->col(j).ptr(), -R(k,j), *V->col(k));
Create an explicit mutable (non-const) view of a MultiVectorBase object.
Interface for a collection of column vectors called a multi-vector.
void Vt_S(const Ptr< MultiVectorBase< Scalar > > &Z, const Scalar &alpha)
Z(i,j) *= alpha, i = 0...Z->range()->dim()-1, j = 0...Z->domain()->dim()-1.
void Vp_StV(const Ptr< VectorBase< Scalar > > &y, const Scalar &alpha, const VectorBase< Scalar > &x)
AXPY: y(i) = alpha * x(i) + y(i), i = 0...y->space()->dim()-1.
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y)
Scalar product result = <x,y>.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm(const VectorBase< Scalar > &v)
Natural norm: result = sqrt(<v,v>).
RCP< MultiVectorBase< Scalar > > createMembers(const RCP< const VectorSpaceBase< Scalar > > &vs, int numMembers, const std::string &label="")
Create a set of vector members (a MultiVectorBase) from the vector space.
TypeTo as(const TypeFrom &t)