OOPS
HtMatrix.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef OOPS_ASSIMILATION_HTMATRIX_H_
12 #define OOPS_ASSIMILATION_HTMATRIX_H_
13 
14 #include <boost/noncopyable.hpp>
15 
22 
23 namespace oops {
24 
25 /// The \f$ H^T \f$ matrix.
26 /*!
27  * The solvers represent matrices as objects that implement a "multiply"
28  * method. This class defines objects that apply a generalized \f$ H^T \f$
29  * matrix which includes \f$ H^T \f$ itself and the equivalent operators
30  * for the other terms of the cost function.
31  */
32 
33 template<typename MODEL, typename OBS> class HtMatrix : private boost::noncopyable {
36 
37  public:
38  explicit HtMatrix(const CostFct_ & j): j_(j) {}
39 
41  const bool idModel = false) const {
44  // Don't zero out dx here
45  for (unsigned jj = 0; jj < j_.nterms(); ++jj) {
46  cost.enrollProcessor(j_.jterm(jj).setupAD(dy.getv(jj), dx));
47  }
48  j_.runADJ(dx, cost, post, idModel);
49  }
50 
51  private:
52  CostFct_ const & j_;
53 };
54 
55 } // namespace oops
56 
57 #endif // OOPS_ASSIMILATION_HTMATRIX_H_
oops::HtMatrix::multiply
void multiply(const DualVector< MODEL, OBS > &dy, ControlIncrement< MODEL, OBS > &dx, const bool idModel=false) const
Definition: HtMatrix.h:40
oops
The namespace for the main oops code.
Definition: ErrorCovarianceL95.cc:22
oops::HtMatrix
The matrix.
Definition: HtMatrix.h:33
oops::HtMatrix::HtMatrix
HtMatrix(const CostFct_ &j)
Definition: HtMatrix.h:38
oops::CostFunction::nterms
unsigned nterms() const
Definition: CostFunction.h:94
CostFunction.h
oops::DualVector
Container of dual space vectors for all terms of the cost function.
Definition: DualVector.h:34
oops::HtMatrix::CostFct_
CostFunction< MODEL, OBS > CostFct_
Definition: HtMatrix.h:34
oops::CostFunction::jterm
const CostBase_ & jterm(const unsigned ii) const
Access terms of the cost function other than .
Definition: CostFunction.h:93
oops::ControlIncrement
Definition: ControlIncrement.h:46
oops::HtMatrix::j_
CostFct_ const & j_
Definition: HtMatrix.h:52
oops::CostTermBase::setupAD
virtual PostPtrTLAD_ setupAD(std::shared_ptr< const GeneralizedDepartures >, ControlIncrement< MODEL, OBS > &) const =0
Initialize before starting the AD run.
oops::PostProcessorTLAD::enrollProcessor
void enrollProcessor(PostBaseTLAD_ *pp)
Definition: PostProcessorTLAD.h:43
PostProcessor.h
oops::CostFunction::runADJ
virtual void runADJ(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ > post=PostProcessor< Increment_ >(), const bool idModel=false) const =0
oops::PostProcessorTLAD
Control model post processing.
Definition: PostProcessorTLAD.h:33
oops::DualVector::getv
std::shared_ptr< const GeneralizedDepartures > getv(const unsigned) const
Definition: DualVector.h:126
oops::PostProcessor
Control model post processing.
Definition: PostProcessor.h:30
ControlIncrement.h
oops::Increment
Increment Class: Difference between two states.
Definition: CostJbState.h:27
oops::HtMatrix::Increment_
Increment< MODEL > Increment_
Definition: HtMatrix.h:35
oops::CostFunction
Cost Function.
Definition: CostFunction.h:53
PostProcessorTLAD.h
DualVector.h
Increment.h