00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00029 #ifndef _LA_VECTOR_DOUBLE_H_
00030 #define _LA_VECTOR_DOUBLE_H_
00031
00032 #include "lafnames.h"
00033 #include LA_GEN_MAT_DOUBLE_H
00034
00035
00052 class DLLIMPORT LaVectorDouble: public LaGenMatDouble
00053 {
00054 public:
00055
00059 LaVectorDouble();
00060
00062 LaVectorDouble(int n);
00063
00066 LaVectorDouble(int m, int n);
00067
00070 LaVectorDouble(double* v, int n);
00071
00075
00076
00080 LaVectorDouble(const LaGenMatDouble& s);
00081
00090 void resize(int n);
00091
00097 void resize(int m, int n);
00098
00100
00104 inline int size() const;
00105
00111 inline int inc() const;
00112
00117 inline int start() const;
00118
00123 inline int end() const;
00124
00129 inline LaIndex index() const;
00131
00147 inline double& operator()(int i);
00148
00162 inline const double& operator()(int i) const ;
00163
00175 inline LaVectorDouble operator()(const LaIndex& i);
00176
00188 inline LaVectorDouble operator()(const LaIndex& i) const;
00190
00197 LaVectorDouble& operator=(double s);
00198
00206 LaVectorDouble& operator=(const LaGenMatDouble&s);
00207
00216 LaVectorDouble& inject(const LaGenMatDouble &s);
00217
00222 LaVectorDouble& copy(const LaGenMatDouble &s);
00223
00231 LaVectorDouble& ref(const LaGenMatDouble &);
00233 };
00234
00235
00236
00237
00238 inline LaVectorDouble::LaVectorDouble() : LaGenMatDouble(0,1) {}
00239 inline LaVectorDouble::LaVectorDouble(int i) : LaGenMatDouble(i,1) {}
00240
00241
00242
00243
00244
00245 inline LaVectorDouble::LaVectorDouble(int m, int n) : LaGenMatDouble(m,n)
00246 {
00247 assert(n==1 || m==1);
00248 }
00249
00250 inline LaVectorDouble::LaVectorDouble(double *d, int m) :
00251 LaGenMatDouble(d,m,1) {}
00252
00253 #if 0
00254 inline LaVectorDouble::LaVectorDouble(double *d, int m, int n) :
00255 LaGenMatDouble(d,m,n) {}
00256 #endif
00257
00258 inline LaVectorDouble::LaVectorDouble(const LaGenMatDouble& G) :
00259 LaGenMatDouble(G)
00260 {
00261 assert(G.size(0)==1 || G.size(1)==1);
00262 }
00263
00264 inline void LaVectorDouble::resize(int i)
00265 {
00266
00267
00268
00269 LaGenMatDouble::resize(i, 1);
00270 }
00271
00272 inline void LaVectorDouble::resize(int m, int n)
00273 {
00274 assert(n==1 || m==1);
00275 LaGenMatDouble::resize(m, n);
00276 }
00277
00278
00279
00280
00281
00282
00283 inline int LaVectorDouble::size() const
00284 {
00285 return LaGenMatDouble::size(0)*LaGenMatDouble::size(1);
00286 }
00287
00288 inline double& LaVectorDouble::operator()(int i)
00289 {
00290 if (LaGenMatDouble::size(0)==1 )
00291 return LaGenMatDouble::operator()(0,i);
00292 else
00293 return LaGenMatDouble::operator()(i,0);
00294 }
00295
00296 inline const double& LaVectorDouble::operator()(int i) const
00297 {
00298 if (LaGenMatDouble::size(0)==1 )
00299 return LaGenMatDouble::operator()(0,i);
00300 else
00301 return LaGenMatDouble::operator()(i,0);
00302 }
00303
00304 inline LaVectorDouble LaVectorDouble::operator()(const LaIndex& I)
00305 {
00306 if (LaGenMatDouble::size(0)==1)
00307 return LaGenMatDouble::operator()(LaIndex(0,0),I).shallow_assign();
00308 else
00309 return LaGenMatDouble::operator()(I,LaIndex(0,0)).shallow_assign();
00310 }
00311
00312 inline LaVectorDouble LaVectorDouble::operator()(const LaIndex& I) const
00313 {
00314 if (LaGenMatDouble::size(0)==1)
00315 return LaGenMatDouble::operator()(LaIndex(0,0),I).shallow_assign();
00316 else
00317 return LaGenMatDouble::operator()(I,LaIndex(0,0)).shallow_assign();
00318 }
00319
00320
00321 inline LaVectorDouble& LaVectorDouble::copy(const LaGenMatDouble &A)
00322 {
00323 assert(A.size(0) == 1 || A.size(1) == 1);
00324
00325 LaGenMatDouble::copy(A);
00326 return *this;
00327 }
00328
00329 inline LaVectorDouble& LaVectorDouble::operator=(const LaGenMatDouble &A)
00330 {
00331 return copy(A);
00332 }
00333
00334 inline LaVectorDouble& LaVectorDouble::ref(const LaGenMatDouble &A)
00335 {
00336 assert(A.size(0) == 1 || A.size(1) == 1);
00337 LaGenMatDouble::ref(A);
00338 return *this;
00339 }
00340
00341 inline LaVectorDouble& LaVectorDouble::operator=(double d)
00342 {
00343 LaGenMatDouble::operator=(d);
00344 return *this;
00345 }
00346
00347 inline LaVectorDouble& LaVectorDouble::inject(const LaGenMatDouble &A)
00348 {
00349 assert(A.size(0) == 1 || A.size(1) == 1);
00350 LaGenMatDouble::inject(A);
00351 return *this;
00352 }
00353
00354 inline int LaVectorDouble::inc() const
00355 {
00356 if (LaGenMatDouble::size(1)==1 )
00357 return LaGenMatDouble::inc(0);
00358 else
00359 return LaGenMatDouble::inc(1)*LaGenMatDouble::gdim(0);
00360
00361
00362 }
00363
00364 inline LaIndex LaVectorDouble::index() const
00365 {
00366 if (LaGenMatDouble::size(1)==1 )
00367 return LaGenMatDouble::index(0);
00368 else
00369 return LaGenMatDouble::index(1);
00370 }
00371
00372 inline int LaVectorDouble::start() const
00373 {
00374 if (LaGenMatDouble::size(1)==1 )
00375 return LaGenMatDouble::start(0);
00376 else
00377 return LaGenMatDouble::start(1);
00378 }
00379
00380 inline int LaVectorDouble::end() const
00381 {
00382 if (LaGenMatDouble::size(1)==1 )
00383 return LaGenMatDouble::end(0);
00384 else
00385 return LaGenMatDouble::end(1);
00386 }
00387
00388 #endif
00389