44 #ifndef ROL_STDTRIDIAGONALOPERATOR_H
45 #define ROL_STDTRIDIAGONALOPERATOR_H
70 template <
typename T>
using vector = std::vector<T>;
74 const ROL::Ptr<const vector<Real> >
a_;
75 const ROL::Ptr<const vector<Real> >
b_;
76 const ROL::Ptr<const vector<Real> >
c_;
90 for(
int i=0;i<
N_-1;++i) {
95 d_[N_-1] = (*a_)[N_-1];
96 du2_.assign(N_-2,0.0);
117 StrdTridiagonalOperator(a,b,b);
130 Hv[0] = (*a_)[0]*v[0] + (*b_)[0]*v[1];
132 for(
int i=1; i<
N_-1; ++i ) {
133 Hv[i] = (*c_)[i-1]*v[i-1] + (*a_)[i]*v[i] + (*b_)[i]*v[i+1];
136 Hv[N_-1] = (*a_)[N_-1]*v[N_-1] + (*c_)[N_-2]*v[N_-2];
141 Hv[0] = (*a_)[0]*v[0] + (*c_)[0]*v[1];
143 for(
int i=1; i<
N_-1; ++i ) {
144 Hv[i] = (*b_)[i-1]*v[i-1] + (*a_)[i]*v[i] + (*c_)[i]*v[i+1];
147 Hv[N_-1] = (*a_)[N_-1]*v[N_-1] + (*b_)[N_-2]*v[N_-2];
155 lapack_.GTTRS(
'N',
N_,1,&
dl_[0],&
d_[0],&
du_[0],&
du2_[0],&
ipiv_[0],&Hv[0],
N_,&INFO);
163 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_