10 #ifndef ROL_STDTRIDIAGONALOPERATOR_H
11 #define ROL_STDTRIDIAGONALOPERATOR_H
36 template <
typename T>
using vector = std::vector<T>;
40 const ROL::Ptr<const vector<Real> >
a_;
41 const ROL::Ptr<const vector<Real> >
b_;
42 const ROL::Ptr<const vector<Real> >
c_;
56 for(
int i=0;i<
N_-1;++i) {
61 d_[N_-1] = (*a_)[N_-1];
62 du2_.assign(N_-2,0.0);
83 StrdTridiagonalOperator(a,b,b);
96 Hv[0] = (*a_)[0]*v[0] + (*b_)[0]*v[1];
98 for(
int i=1; i<
N_-1; ++i ) {
99 Hv[i] = (*c_)[i-1]*v[i-1] + (*a_)[i]*v[i] + (*b_)[i]*v[i+1];
102 Hv[N_-1] = (*a_)[N_-1]*v[N_-1] + (*c_)[N_-2]*v[N_-2];
107 Hv[0] = (*a_)[0]*v[0] + (*c_)[0]*v[1];
109 for(
int i=1; i<
N_-1; ++i ) {
110 Hv[i] = (*b_)[i-1]*v[i-1] + (*a_)[i]*v[i] + (*c_)[i]*v[i+1];
113 Hv[N_-1] = (*a_)[N_-1]*v[N_-1] + (*b_)[N_-2]*v[N_-2];
121 lapack_.GTTRS(
'N',
N_,1,&
dl_[0],&
d_[0],&
du_[0],&
du2_[0],&
ipiv_[0],&Hv[0],
N_,&INFO);
129 lapack_.GTTRS(
'T',
N_,1,&
dl_[0],&
d_[0],&
du_[0],&
du2_[0],&
ipiv_[0],&Hv[0],
N_,&INFO);
Provides the std::vector implementation to apply a linear operator, which is a std::vector representa...
StdTridiagonalOperator(const ROL::Ptr< const vector< Real > > &a, const ROL::Ptr< const vector< Real > > &b, const ROL::Ptr< const vector< Real > > &c)
virtual void applyAdjoint(vector< Real > &Hv, const vector< Real > &v, Real &tol) const
StdTridiagonalOperator(const ROL::Ptr< const vector< Real > > &a, const ROL::Ptr< const vector< Real > > &b)
virtual void applyInverse(vector< Real > &Hv, const vector< Real > &v, Real &tol) const
Provides the std::vector implementation to apply a linear operator, which encapsulates a tridiagonal ...
const ROL::Ptr< const vector< Real > > c_
virtual void apply(vector< Real > &Hv, const vector< Real > &v, Real &tol) const
ROL::LAPACK< int, Real > lapack_
virtual ~StdTridiagonalOperator()
virtual void applyAdjointInverse(vector< Real > &Hv, const vector< Real > &v, Real &tol) const
const ROL::Ptr< const vector< Real > > b_
const ROL::Ptr< const vector< Real > > a_