Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LinForward.cpp

Go to the documentation of this file.
00001 //============================================================
00002 // COOOL           version 1.1           ---     Nov,  1995
00003 //   Center for Wave Phenomena, Colorado School of Mines
00004 //============================================================
00005 //
00006 //   This code is part of a preliminary release of COOOL (CWP
00007 // Object-Oriented Optimization Library) and associated class 
00008 // libraries. 
00009 //
00010 // The COOOL library is a free software. You can do anything you want
00011 // with it including make a fortune.  However, neither the authors,
00012 // the Center for Wave Phenomena, nor anyone else you can think of
00013 // makes any guarantees about anything in this package or any aspect
00014 // of its functionality.
00015 //
00016 // Since you've got the source code you can also modify the
00017 // library to suit your own purposes. We would appreciate it 
00018 // if the headers that identify the authors are kept in the 
00019 // source code.
00020 //
00021 //=============================================================
00022 // Author: H. Lydia Deng
00023 // Implementation of a objective function class
00024 // Implementation of linear operators as objective function for optimization
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 //      int n = pm->numOfCols();
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 //      int n = pm->numOfCols();
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 }

Generated on Wed Dec 15 21:20:29 2004 for vuVolume by  doxygen 1.3.9.1