Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

matvec::BG Class Reference

#include <bg.h>

List of all members.

Public Methods

 BG ()
 BG (unsigned x_i, double b)
 BG (double a)
 BG (const BG &a)
BG & initialize (unsigned i, double b)
BG & operator= (double b)
BG power (double y) const
void NRupdate (void)
void display (void)

Static Public Methods

void set_dimen (unsigned i)

Public Attributes

double f
doubleMatrix d
doubleMatrix D

Static Public Attributes

unsigned dimen = 3
doubleMatrix x

Friends

BG operator+ (const BG &a, const BG &b)
BG operator- (const BG &a, const BG &b)
BG operator * (const BG &a, const BG &b)
BG operator/ (const BG &a, const BG &b)
BG operator- (const BG &a)
BG operator/ (double a, const BG &b)
BG operator+ (double a, const BG &b)
BG operator- (double a, const BG &b)
BG operator * (double a, const BG &b)
BG operator+ (const BG &a, double b)
BG operator- (const BG &a, double b)
BG operator * (const BG &a, double b)
BG operator/ (const BG &a, double b)
bool operator<= (const BG &a, double b)
bool operator< (const BG &a, double b)
bool operator>= (const BG &a, double b)
bool operator> (const BG &a, double b)
bool operator== (const BG &a, double b)
bool operator!= (const BG &a, double b)
bool operator<= (const BG &a, const BG &b)
bool operator< (const BG &a, const BG &b)
bool operator>= (const BG &a, const BG &b)
bool operator> (const BG &a, const BG &b)
bool operator== (const BG &a, const BG &b)
bool operator!= (const BG &a, const BG &b)
bool operator<= (double b, const BG &a)
bool operator< (double b, const BG &a)
bool operator>= (double b, const BG &a)
bool operator> (double b, const BG &a)
bool operator== (double b, const BG &a)
bool operator!= (double b, const BG &a)
BG & operator+= (BG &a, const BG &b)
BG & operator-= (BG &a, const BG &b)
BG & operator *= (BG &a, const BG &b)
BG & operator/= (BG &a, const BG &b)
BG & operator+= (BG &a, double b)
BG & operator-= (BG &a, double b)
BG & operator *= (BG &a, double b)
BG & operator/= (BG &a, double b)
BG sqrt (const BG &a)
BG log (const BG &a)
BG exp (const BG &a)
double fabs (const BG &a)
std::ostream & operator<< (std::ostream &os, const BG &a)


Constructor & Destructor Documentation

matvec::BG::BG  
 

Definition at line 32 of file bg.cpp.

References D, d, dimen, f, and matvec::Matrix< double >::resize().

00032             {
00033     if(dimen==0){
00034       std::cout <<"BG has not been initialized yet 1\n";
00035       exit (1);
00036     } 
00037     else {
00038       f = 0.0;
00039       d.resize(dimen,1,0.0);
00040       D.resize(dimen,dimen,0.0);
00041     }
00042   }

matvec::BG::BG unsigned    x_i,
double    b
 

Definition at line 44 of file bg.cpp.

References D, d, dimen, f, matvec::Matrix< double >::resize(), and x.

00044                             {
00045     if(dimen==0){
00046       std::cout <<"BG has not been initialized yet 2\n";
00047       exit (1);
00048     }
00049     else {
00050       f = x[i][0]*b;
00051       d.resize(dimen,1,0.0);
00052       d[i][0] = b;
00053       D.resize(dimen,dimen,0.0);
00054     }
00055   }

matvec::BG::BG double    a
 

Definition at line 57 of file bg.cpp.

References D, d, dimen, f, and matvec::Matrix< double >::resize().

00057                 {
00058     if(dimen==0){
00059       std::cout <<"BG has not been initialized yet 3\n";
00060       exit (1);
00061     }
00062     else {
00063       f = a;
00064       d.resize(dimen,1,0.0);
00065       D.resize(dimen,dimen,0.0);
00066     }
00067   }

matvec::BG::BG const BG &    a
 

Definition at line 69 of file bg.cpp.

References D, d, dimen, and f.

00069                    {
00070     if(dimen==0){
00071       std::cout <<"BG has not been initialized yet 4\n";
00072       exit (1);
00073     }
00074     else {
00075       f = a.f;
00076       d = a.d;
00077       D = a.D;
00078     }
00079   }


Member Function Documentation

void matvec::BG::display void   
 

Definition at line 269 of file bg.cpp.

References D, d, and f.

00269                       {
00270     std::cout <<"Function value is: " << f << std::endl << std::endl;
00271     std::cout <<"First Derivatives are: " << std::endl;
00272     std::cout << d << std::endl;
00273     std::cout <<"Second Derivatives are: " << std::endl;
00274     std::cout << D << std::endl;
00275   }

BG & matvec::BG::initialize unsigned    i,
double    b
 

Definition at line 260 of file bg.cpp.

References D, d, f, matvec::Matrix< double >::resize(), and x.

00260                                         {
00261     f = b*x[i][0];
00262     d.resize(BG::dimen,1,0.0);
00263     d[i][0] = b;
00264     D.resize(BG::dimen,BG::dimen,0.0);
00265     return (*this);
00266   }

void matvec::BG::NRupdate void   
 

Definition at line 276 of file bg.cpp.

References d, D, matvec::doubleMatrix::ginv0(), and x.

00276                        {
00277     x -= D.ginv0()*d;
00278   }

BG & matvec::BG::operator= double    b
 

Definition at line 239 of file bg.cpp.

References D, d, f, and matvec::Matrix< double >::resize().

00239                            {
00240     f = b;
00241     d.resize(BG::dimen,1,0.0);
00242     D.resize(BG::dimen,BG::dimen,0.0);
00243     return (*this);
00244   }

BG matvec::BG::power double    y const [inline]
 

Definition at line 105 of file bg.h.

References exp, and log.

00105 {BG r = exp(y*log(*this)); return r;}

void matvec::BG::set_dimen unsigned    i [inline, static]
 

Definition at line 45 of file bg.h.

References dimen, and matvec::Matrix< double >::resize().

00045                                      {
00046       dimen = i;
00047       x.resize(dimen,1,0.0);
00048     }


Friends And Related Function Documentation

BG exp const BG &    a [friend]
 

Definition at line 144 of file bg.cpp.

Referenced by power().

00144                      {
00145     BG r; 
00146     r.f = std::exp(a.f);
00147     r.d = r.f*a.d;
00148     r.D = r.f*a.D + r.d*a.d.transpose();
00149     return r;
00150   }

double fabs const BG &    a [friend]
 

Definition at line 107 of file bg.h.

00107 {return std::fabs(a.f);};

BG log const BG &    a [friend]
 

Definition at line 136 of file bg.cpp.

Referenced by power().

00136                      {
00137     BG r; 
00138     r.f = std::log(a.f);
00139     r.d = 1.0/a.f*a.d;
00140     r.D = 1.0/a.f*a.D - 1.0/(a.f*a.f) * a.d*a.d.transpose();
00141     return r;
00142   }

BG operator * const BG &    a,
double    b
[friend]
 

Definition at line 189 of file bg.cpp.

00189                                      {
00190     BG r = b * a;
00191     return r;
00192   }

BG operator * double    a,
const BG &    b
[friend]
 

Definition at line 168 of file bg.cpp.

00168                                      {
00169     BG r;
00170     r.f = a*b.f;
00171     r.d = a*b.d;
00172     r.D = a*b.D;
00173     return r;
00174   }

BG operator * const BG &    a,
const BG &    b
[friend]
 

Definition at line 99 of file bg.cpp.

00099                                         {
00100     BG r;
00101     r.f = a.f * b.f;
00102     r.d = a.f*b.d + a.d*b.f;
00103     r.D = a.f*b.D + a.d*b.d.transpose() + b.d*a.d.transpose() + a.D*b.f;
00104     return r;
00105   }

BG& operator *= BG &    a,
double    b
[friend]
 

Definition at line 229 of file bg.cpp.

00229                                  {
00230     a = a * b;
00231     return a;
00232   }

BG& operator *= BG &    a,
const BG &    b
[friend]
 

Definition at line 209 of file bg.cpp.

00209                                     {
00210     a = a*b;
00211     return a;
00212   }

bool operator!= double    b,
const BG &    a
[friend]
 

Definition at line 85 of file bg.h.

00085 {return b!=a.f;};

bool operator!= const BG &    a,
const BG &    b
[friend]
 

Definition at line 78 of file bg.h.

00078 {return a.f!=b.f;};

bool operator!= const BG &    a,
double    b
[friend]
 

Definition at line 71 of file bg.h.

00071 {return a.f!=b;};

BG operator+ const BG &    a,
double    b
[friend]
 

Definition at line 176 of file bg.cpp.

00176                                      {
00177     BG r = b + a;
00178     return r;
00179   }

BG operator+ double    a,
const BG &    b
[friend]
 

Definition at line 152 of file bg.cpp.

00152                                      {
00153     BG r;
00154     r.f = a + b.f;
00155     r.d = b.d;
00156     r.D = b.D;
00157     return r;
00158   }

BG operator+ const BG &    a,
const BG &    b
[friend]
 

Definition at line 83 of file bg.cpp.

00083                                         {
00084     BG r;
00085     r.f = a.f + b.f;
00086     r.d = a.d + b.d;
00087     r.D = a.D + b.D;
00088     return r;
00089   }

BG& operator+= BG &    a,
double    b
[friend]
 

Definition at line 219 of file bg.cpp.

00219                                  {
00220     a = a + b;
00221     return a;
00222   }

BG& operator+= BG &    a,
const BG &    b
[friend]
 

Definition at line 199 of file bg.cpp.

00199                                     {
00200     a = a + b;
00201     return a;
00202   }

BG operator- const BG &    a,
double    b
[friend]
 

Definition at line 181 of file bg.cpp.

00181                                      {
00182     BG r;
00183     r.f = a.f - b;
00184     r.d = a.d;
00185     r.D = a.D;
00186     return r;
00187   }

BG operator- double    a,
const BG &    b
[friend]
 

Definition at line 160 of file bg.cpp.

00160                                      {
00161     BG r;
00162     r.f = a - b.f;
00163     r.d = -b.d;
00164     r.D = -b.D;
00165     return r;
00166   }

BG operator- const BG &    a [friend]
 

Definition at line 115 of file bg.cpp.

00115                            {
00116     BG r;
00117     r.f = -a.f;
00118     r.d = -a.d;
00119     r.D = -a.D;
00120     return r;
00121   }

BG operator- const BG &    a,
const BG &    b
[friend]
 

Definition at line 91 of file bg.cpp.

00091                                         {
00092     BG r;
00093     r.f = a.f - b.f;
00094     r.d = a.d - b.d;
00095     r.D = a.D - b.D;
00096     return r;
00097   }

BG& operator-= BG &    a,
double    b
[friend]
 

Definition at line 224 of file bg.cpp.

00224                                  {
00225     a = a - b;
00226     return a;
00227   }

BG& operator-= BG &    a,
const BG &    b
[friend]
 

Definition at line 204 of file bg.cpp.

00204                                     {
00205     a = a - b;
00206     return a;
00207   }

BG operator/ const BG &    a,
double    b
[friend]
 

Definition at line 194 of file bg.cpp.

00194                                      {
00195     BG r = a * (1.0/b);
00196     return r;
00197   }  

BG operator/ double    a,
const BG &    b
[friend]
 

Definition at line 107 of file bg.cpp.

00107                                      {
00108     BG r;
00109     r.f = a/b.f;
00110     r.d = -a/(b.f*b.f) * b.d;
00111     r.D = -a*( 1.0/(b.f*b.f) * b.D - 2.0/(b.f*b.f*b.f)*b.d*b.d.transpose() );
00112     return r;
00113   }

BG operator/ const BG &    a,
const BG &    b
[friend]
 

Definition at line 123 of file bg.cpp.

00123                                         {
00124     BG r = a * (1.0/b);
00125     return r;
00126   }

BG& operator/= BG &    a,
double    b
[friend]
 

Definition at line 234 of file bg.cpp.

00234                                  {
00235     a = a / b;
00236     return a;
00237   }

BG& operator/= BG &    a,
const BG &    b
[friend]
 

Definition at line 214 of file bg.cpp.

00214                                     {
00215     a = a/b;
00216     return a;
00217   }

bool operator< double    b,
const BG &    a
[friend]
 

Definition at line 81 of file bg.h.

00081 {return b< a.f;};

bool operator< const BG &    a,
const BG &    b
[friend]
 

Definition at line 74 of file bg.h.

00074 {return a.f< b.f;};

bool operator< const BG &    a,
double    b
[friend]
 

Definition at line 67 of file bg.h.

00067 {return a.f< b;};

std::ostream& operator<< std::ostream &    os,
const BG &    a
[friend]
 

Definition at line 113 of file bg.h.

00113                                                               {
00114       os << a.f ; 
00115       return os;
00116     }

bool operator<= double    b,
const BG &    a
[friend]
 

Definition at line 80 of file bg.h.

00080 {return b<=a.f;};

bool operator<= const BG &    a,
const BG &    b
[friend]
 

Definition at line 73 of file bg.h.

00073 {return a.f<=b.f;};

bool operator<= const BG &    a,
double    b
[friend]
 

Definition at line 66 of file bg.h.

00066 {return a.f<=b;};

bool operator== double    b,
const BG &    a
[friend]
 

Definition at line 84 of file bg.h.

00084 {return b==a.f;};

bool operator== const BG &    a,
const BG &    b
[friend]
 

Definition at line 77 of file bg.h.

00077 {return a.f==b.f;};

bool operator== const BG &    a,
double    b
[friend]
 

Definition at line 70 of file bg.h.

00070 {return a.f==b;};

bool operator> double    b,
const BG &    a
[friend]
 

Definition at line 83 of file bg.h.

00083 {return b> a.f;};

bool operator> const BG &    a,
const BG &    b
[friend]
 

Definition at line 76 of file bg.h.

00076 {return a.f> b.f;};

bool operator> const BG &    a,
double    b
[friend]
 

Definition at line 69 of file bg.h.

00069 {return a.f> b;};

bool operator>= double    b,
const BG &    a
[friend]
 

Definition at line 82 of file bg.h.

00082 {return b>=a.f;};

bool operator>= const BG &    a,
const BG &    b
[friend]
 

Definition at line 75 of file bg.h.

00075 {return a.f>=b.f;};

bool operator>= const BG &    a,
double    b
[friend]
 

Definition at line 68 of file bg.h.

00068 {return a.f>=b;};

BG sqrt const BG &    a [friend]
 

Definition at line 128 of file bg.cpp.

00128                       {
00129     BG r;
00130     r.f = std::sqrt(a.f);
00131     r.d = 0.5/std::sqrt(a.f)*a.d;
00132     r.D = 0.5*( 1.0/std::sqrt(a.f)*a.D - 0.5/std::sqrt(a.f*a.f*a.f) * a.d*a.d.transpose() );
00133     return r;
00134   }


Member Data Documentation

doubleMatrix matvec::BG::D
 

Definition at line 38 of file bg.h.

Referenced by BG(), display(), matvec::exp(), initialize(), matvec::log(), NRupdate(), matvec::operator *(), matvec::operator+(), matvec::operator-(), matvec::operator/(), operator=(), and matvec::sqrt().

doubleMatrix matvec::BG::d
 

Definition at line 37 of file bg.h.

Referenced by BG(), display(), matvec::exp(), initialize(), matvec::log(), NRupdate(), matvec::operator *(), matvec::operator+(), matvec::operator-(), matvec::operator/(), operator=(), and matvec::sqrt().

unsigned matvec::BG::dimen = 3 [static]
 

Definition at line 29 of file bg.cpp.

Referenced by BG(), and set_dimen().

double matvec::BG::f
 

Definition at line 36 of file bg.h.

Referenced by BG(), matvec::SparseBGMatrix::dense(), display(), matvec::exp(), matvec::gs_ioc(), matvec::BGMatrix::gs_solve(), initialize(), matvec::log(), matvec::operator *(), matvec::operator+(), matvec::operator-(), matvec::operator/(), operator=(), matvec::SparseBGMatrix::save(), and matvec::sqrt().

matvec::doubleMatrix matvec::BG::x [static]
 

Definition at line 30 of file bg.cpp.

Referenced by BG(), initialize(), and NRupdate().


The documentation for this class was generated from the following files:
Generated on Thu Jun 16 17:14:17 2005 for Matvec by doxygen1.2.16