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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00044 #ifndef NOX_LAPACK_VECTOR_H
00045 #define NOX_LAPACK_VECTOR_H
00046
00047 #include "NOX_Abstract_Vector.H"
00048 #include "NOX_Common.H"
00049
00050 namespace NOX {
00051
00053 namespace LAPACK {
00054
00056 const double d_one = 1.0;
00058 const double d_mone = -1.0;
00060 const double d_zero = 0.0;
00062 const int i_one = 1;
00064 const int i_zero = 0;
00065
00067 class Vector : public NOX::Abstract::Vector {
00068
00069 public:
00070
00072 Vector();
00073
00075 Vector(int n);
00076
00078 Vector(int n, double *v);
00079
00081 Vector(const NOX::LAPACK::Vector& source,
00082 NOX::CopyType type = NOX::DeepCopy);
00083
00085 ~Vector();
00086
00088
00089 NOX::Abstract::Vector& init(double value);
00090
00092 virtual NOX::Abstract::Vector& random(bool useSeed = false, int seed = 1);
00093
00095 NOX::Abstract::Vector& operator=(const vector<double>& y);
00096
00097
00098 NOX::Abstract::Vector& operator=(const NOX::LAPACK::Vector& y);
00099 NOX::Abstract::Vector& operator=(const NOX::Abstract::Vector& y);
00100
00101
00102 NOX::Abstract::Vector& abs(const NOX::LAPACK::Vector& y);
00103 NOX::Abstract::Vector& abs(const NOX::Abstract::Vector& y);
00104
00105
00106 NOX::Abstract::Vector& reciprocal(const NOX::LAPACK::Vector& y);
00107 NOX::Abstract::Vector& reciprocal(const NOX::Abstract::Vector& y);
00108
00110
00112
00113
00114 NOX::Abstract::Vector& scale(double gamma);
00115
00116
00117 NOX::Abstract::Vector& scale(const NOX::LAPACK::Vector& a);
00118 NOX::Abstract::Vector& scale(const NOX::Abstract::Vector& a);
00119
00120
00121 NOX::Abstract::Vector& update(double alpha, const NOX::LAPACK::Vector& a, double gamma = 0.0);
00122 NOX::Abstract::Vector& update(double alpha, const NOX::Abstract::Vector& a, double gamma = 0.0);
00123
00124
00125 NOX::Abstract::Vector& update(double alpha, const NOX::LAPACK::Vector& a,
00126 double beta, const NOX::LAPACK::Vector& b,
00127 double gamma = 0.0);
00128 NOX::Abstract::Vector& update(double alpha, const NOX::Abstract::Vector& a,
00129 double beta, const NOX::Abstract::Vector& b,
00130 double gamma = 0.0);
00131
00133
00135
00136
00137 Teuchos::RCP<NOX::Abstract::Vector>
00138 clone(NOX::CopyType type = NOX::DeepCopy) const;
00139
00141
00143
00144
00145 double norm(NOX::Abstract::Vector::NormType type = NOX::Abstract::Vector::TwoNorm) const;
00146
00147
00148 double norm(const NOX::LAPACK::Vector& weights) const;
00149 double norm(const NOX::Abstract::Vector& weights) const;
00150
00152
00154
00155
00156 double innerProduct(const NOX::LAPACK::Vector& y) const;
00157 double innerProduct(const NOX::Abstract::Vector& y) const;
00158
00160
00161
00162 int length() const;
00163
00165 double& operator() (int i);
00166
00168 const double& operator() (int i) const;
00169
00171
00176 ostream& leftshift(ostream& stream) const;
00177
00178
00179 void print(std::ostream& stream) const;
00180
00181 private:
00182
00184 double& operator[] (int i);
00185
00187 const double& operator[] (int i) const;
00188
00190 int n;
00191
00193 vector<double> x;
00194 };
00195
00196 }
00197 }
00198
00200 ostream& operator<<(ostream& stream, const NOX::LAPACK::Vector& v);
00201
00202
00203
00204 #endif