4#include"Teuchos_LAPACK.hpp"
6#ifndef __INNER_PRODUCT_MATRIX__
7#define __INNER_PRODUCT_MATRIX__
14 const std::vector<Real> &
V,
15 const std::vector<Real> &w,
19 const std::vector<Real> &
V,
20 const std::vector<Real> &w,
21 const std::vector<Real> &a);
25 void update(
const std::vector<Real> &a);
29 void apply(ROL::Ptr<
const std::vector<Real> > xp,
30 ROL::Ptr<std::vector<Real> > bp);
32 void applyadd(ROL::Ptr<
const std::vector<Real> > xp,
33 ROL::Ptr<std::vector<Real> > bp);
36 ROL::Ptr<std::vector<Real> > bp, Real factor);
39 Real
inner(ROL::Ptr<
const std::vector<Real> > up,
40 ROL::Ptr<
const std::vector<Real> > vp);
43 virtual void solve(ROL::Ptr<
const std::vector<Real> > bp,
44 ROL::Ptr<std::vector<Real> > xp){};
47 virtual Real
inv_inner(ROL::Ptr<
const std::vector<Real> > up,
48 ROL::Ptr<
const std::vector<Real> > vp){
54 const std::vector<Real>
U_;
55 const std::vector<Real>
V_;
56 const std::vector<Real>
w_;
67 const std::vector<Real> &
V,
68 const std::vector<Real> &w,
72 for(
int i=0;i<
ni_;++i) {
73 for(
int j=0;j<
ni_;++j) {
74 for(
int k=0;k<
nq_;++k) {
83 const std::vector<Real> &
V,
84 const std::vector<Real> &w,
85 const std::vector<Real> &a ) :
88 for(
int i=0;i<
ni_;++i) {
89 for(
int j=0;j<
ni_;++j) {
90 for(
int k=0;k<
nq_;++k) {
103 ROL::Ptr<std::vector<Real> > bp ) {
104 for(
int i=0;i<
ni_;++i) {
106 for(
int j=0;j<
ni_;++j ) {
107 (*bp)[i] +=
M_[i+
ni_*j]*(*xp)[j];
114 ROL::Ptr<std::vector<Real> > bp ) {
115 for(
int i=0;i<
ni_;++i) {
116 for(
int j=0;j<
ni_;++j ) {
117 (*bp)[i] +=
M_[i+
ni_*j]*(*xp)[j];
124 ROL::Ptr<std::vector<Real> > bp, Real factor ) {
125 for(
int i=0;i<
ni_;++i) {
126 for(
int j=0;j<
ni_;++j ) {
127 (*bp)[i] += factor*
M_[i+
ni_*j]*(*xp)[j];
135 std::fill(
M_.begin(),
M_.end(),0);
136 for(
int i=0;i<
ni_;++i) {
137 for(
int j=0;j<
ni_;++j) {
138 for(
int k=0;k<
nq_;++k) {
152 ROL::Ptr<
const std::vector<Real> > vp ) {
154 ROL::Ptr<std::vector<Real> > Mvp = ROL::makePtr<std::vector<Real>>(
ni_,0);
156 for(
int i=0;i<
ni_;++i) {
157 J += (*up)[i]*(*Mvp)[i];
174 std::vector<Real>
M_;
184 const std::vector<Real> &U=std::vector<Real>(),
185 const std::vector<Real> &
V=std::vector<Real>(),
186 const std::vector<Real> &w=std::vector<Real>(),
190 const std::vector<Real> &U=std::vector<Real>(),
191 const std::vector<Real> &
V=std::vector<Real>(),
192 const std::vector<Real> &w=std::vector<Real>(),
193 const std::vector<Real> &a=std::vector<Real>());
195 void solve(ROL::Ptr<
const std::vector<Real> > bp,
196 ROL::Ptr<std::vector<Real> > xp);
198 Real
inv_inner(ROL::Ptr<
const std::vector<Real> > up,
199 ROL::Ptr<
const std::vector<Real> > vp);
205 const std::vector<Real> &U,
206 const std::vector<Real> &
V,
207 const std::vector<Real> &w,
225 const std::vector<Real> &U,
226 const std::vector<Real> &
V,
227 const std::vector<Real> &w,
228 const std::vector<Real> &a):
246 ROL::Ptr<std::vector<Real> > xp){
248 int nrhs = bp->size()/
ni_;
260 ROL::Ptr<
const std::vector<Real> > vp ) {
262 ROL::Ptr<std::vector<Real> > Mivp = ROL::makePtr<std::vector<Real>>(
ni_,0);
263 this->
solve(vp,Mivp);
264 for(
int i=0;i<
ni_;++i) {
266 J += (*up)[i]*(*Mivp)[i];
virtual void solve(Vector< Real > &c, Vector< Real > &u, const Vector< Real > &z) override
void solve(ROL::Ptr< const std::vector< Real > > bp, ROL::Ptr< std::vector< Real > > xp)
solve for
ROL::Ptr< Teuchos::LAPACK< int, Real > > lapack_
InnerProductMatrixSolver(ROL::Ptr< Teuchos::LAPACK< int, Real > > lapack, const std::vector< Real > &U=std::vector< Real >(), const std::vector< Real > &V=std::vector< Real >(), const std::vector< Real > &w=std::vector< Real >(), const int a=1)
Real inv_inner(ROL::Ptr< const std::vector< Real > > up, ROL::Ptr< const std::vector< Real > > vp)
Compute the inner product .
void applyaddtimes(ROL::Ptr< const std::vector< Real > > xp, ROL::Ptr< std::vector< Real > > bp, Real factor)
virtual Real inv_inner(ROL::Ptr< const std::vector< Real > > up, ROL::Ptr< const std::vector< Real > > vp)
InnerProductMatrix(InnerProductMatrix< Real > *ipm)
const std::vector< Real > U_
const std::vector< Real > w_
void apply(ROL::Ptr< const std::vector< Real > > xp, ROL::Ptr< std::vector< Real > > bp)
virtual void solve(ROL::Ptr< const std::vector< Real > > bp, ROL::Ptr< std::vector< Real > > xp)
void update(const std::vector< Real > &a)
Real inner(ROL::Ptr< const std::vector< Real > > up, ROL::Ptr< const std::vector< Real > > vp)
Compute the inner product .
InnerProductMatrix(const std::vector< Real > &U, const std::vector< Real > &V, const std::vector< Real > &w, const int a=1)
const std::vector< Real > V_
void applyadd(ROL::Ptr< const std::vector< Real > > xp, ROL::Ptr< std::vector< Real > > bp)
virtual ~InnerProductMatrix()