00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "Forward.hh"
00028 #include "LinForward.hh"
00029
00030 namespace coool
00031 {
00032 using namespace coool;
00033
00034 static const char* myNameIs = "LinearForward";
00035
00036 const char* LinearForward::className() const{ return (myNameIs);}
00037
00038 LinearForward::LinearForward(Matrix<double>* pm)
00039 : Forward()
00040 {
00041 int m = pm->numOfRows();
00042
00043
00044 ndata = m;
00045 jacob = pm;
00046 }
00047
00048 LinearForward::LinearForward(Matrix<double>* pm, int verbose)
00049 : Forward(verbose)
00050 {
00051 int m = pm->numOfRows();
00052
00053
00054 ndata = m;
00055 jacob = pm;
00056 }
00057
00058 Vector<double> LinearForward::adjointOp(const Vector<double>& v)
00059 {
00060 return jacob->atdotx(v);
00061 }
00062
00063 Vector<double> LinearForward::adjointOp(const Vector<long>& v)
00064 {
00065 Vector<double> u(v);
00066 return jacob->atdotx(u);
00067 }
00068
00069 double LinearForward::forwardOp(int i, const Vector<double>& v)
00070 {
00071 Vector<double> a(jacob->rowVector(i));
00072 return a*v;
00073 }
00074
00075 double LinearForward::forwardOp(int i, const Vector<long>& v)
00076 {
00077 Vector<double> a(jacob->rowVector(i)), u(v);
00078 return a*u;
00079 }
00080
00081 Vector<double> LinearForward::forwardOp(const Vector<double>& v)
00082 {
00083 return jacob->adotx(v);
00084 }
00085
00086 Vector<double> LinearForward::forwardOp(const Vector<long>& v)
00087 {
00088 Vector<double> u(v);
00089 return jacob->adotx(u);
00090 }
00091
00092 List<double> LinearForward::dataList(const Model<double>& p)
00093 {
00094 Vector<double> v(forwardOp(p.modParam()));
00095 List<double> l(ToList(v));
00096 return l;
00097 }
00098
00099 List<double> LinearForward::dataList(const Model<long>& p)
00100 {
00101 Vector<double> v(forwardOp(p.modParam()));
00102 List<double> l(ToList(v));
00103 return l;
00104 }
00105
00106 }