]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Join with Klaus' comments
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 9 Mar 1998 17:29:07 +0000 (17:29 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 9 Mar 1998 17:29:07 +0000 (17:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@48 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/dfmatrix.h
deal.II/lac/include/lac/dvector.h
deal.II/lac/include/lac/ivector.h
deal.II/lac/include/lac/vectorbase.h

index 9556d07dcf5317b594e52f9bd75111e3ed5f9b0c..861083594f6c4abaf4e1205a1b7d7a318dca246e 100644 (file)
  *  Memory for Components is supplied explicitly <p>
  *  ( ! Amount of memory needs not to comply with actual dimension due to reinitializations ! ) <p>
  *  - all necessary methods for matrices are supplied <p>
- *  - operators available are `=` and `( )` <p>
- *  CONVENTIONS for used `equations` : <p>
- *  - THIS matrix is always named `A` <p>
+ *  - operators available are '=' and '( )' <p>
+ *  CONVENTIONS for used 'equations' : <p>
+ *  - THIS matrix is always named 'A' <p>
  *  - matrices are always uppercase , vectors and scalars are lowercase <p>
  *  - Transp(A) used for transpose of matrix A
  *
  */
 class dFMatrix
 {
-                                    /// Component-array.
-double* val;
-                                    /// Dimension. Actual number of Columns
-int dim_range;
-                                    /// Dimension. Actual number of Rows
-int dim_image;
-                                    /// Dimension. Determines amount of reserved memory
-int val_size;
+                                    /**
+                                     * Component-array.
+                                     */
+    double* val;
+                                    /** 
+                                     * Dimension. Actual number of Columns
+                                     */
+    int dim_range;
+                                    /**
+                                     * Dimension. Actual number of Rows
+                                     */
+    int dim_image;
+                                    /**
+                                     * Dimension. Determines amount of reserved memory
+                                     */
+    int val_size;
 
- /**
- * Initialization   . initialize memory for Matrix <p>
- * ( m rows , n columns )
- */
                                   /**
                                    * Initialization   . initialize memory for Matrix <p>
                                    * ( m rows , n columns )
                                    */
     void init(int m, int n);
-
+    
                                     /**
- *   Access Elements. returns A(i,j)
- */
                                    *   Access Elements. returns A(i,j)
                                    */
     double& el(int i, int j)  { return val[i*dim_range+j]; }
-
+    
                                     /**
- *   Access Elements. returns A(i,j)
- */
                                    *   Access Elements. returns A(i,j)
                                    */
     double el(int i, int j) const { return val[i*dim_range+j]; }
-
-
+    
+    
   public:
-                                    /// copy constructor. Be very careful with this constructor, since
-                                    // it may take a hige amount of computing time for large matrices!!
-
- /**@name 1: Basic Object-handling */
-//@{
- /**
- *       Constructor. Dimension = (n,n) <p>
- *       ->   quadratic matrix (n rows , n columns)
- */
+                                    /**@name 1: Basic Object-handling */
+                                    //@{
+                                    /**
+                                     *       Constructor. Dimension = (n,n) <p>
+                                     *       ->   quadratic matrix (n rows , n columns)
+                                     */
     dFMatrix(int n = 1) { init(n,n); }
-
+    
                                     /**
- *       Constructor. Dimension = (m,n) <p>
- *       -> rectangular matrix (m rows , n columns)
- */
                                    *       Constructor. Dimension = (m,n) <p>
                                    *       -> rectangular matrix (m rows , n columns)
                                    */
     dFMatrix(int m,int n) { init(m,n); }
-
-                                    /**
- * Copy constructor. Be very careful with this constructor, since
- * it may take a high amount of computing time for large matrices!!
- */
+    
+                                    /** 
+                                     * Copy constructor. Be very careful with
+                                     * this constructor, since it may take a
+                                     * huge amount of computing time for large
+                                     * matrices!!
+                                     */
     dFMatrix(const dFMatrix&);
 
                                     /**
- *        Destructor. Clears memory
- */
                                    *        Destructor. Clears memory
                                    */
     ~dFMatrix();
+    
+                                     /**
+                                     * Comparison operator. Be careful with
+                                     * this thing, it may eat up huge amounts
+                                     * of computing time!
+                                     */
+    bool operator == (const dFMatrix &) const;
 
                                     /**
- *  A = B           . Copy all elements
- */
                                    *  A = B           . Copy all elements
                                    */
     dFMatrix& operator = (const dFMatrix& B);
     
-
-                                /**
- *  U(0-m,0-n) = s  . Fill all elements
- */
-void fill(const dFMatrix& src, int i = 0, int j = 0);
-
+    
                                     /**
- * Change  Dimension.
- * Set dimension to (m,n) <p>
- * ( reinit rectangular matrix )
- */
+                                     *  U(0-m,0-n) = s  . Fill all elements
+                                     */
+    void fill(const dFMatrix& src, int i = 0, int j = 0);
+    
+                                    /**
+                                     * Change  Dimension.
+                                     * Set dimension to (m,n) <p>
+                                     * ( reinit rectangular matrix )
+                                     */
     void reinit(int m, int n);
-
+    
                                     /**
- * Change  Dimension.
- * Set dimension to (n,n) <p>
- * ( reinit quadratic matrix )
- */
                                    * Change  Dimension.
                                    * Set dimension to (n,n) <p>
                                    * ( reinit quadratic matrix )
                                    */
     void reinit(int n) { reinit(n,n); }
-
+    
                                     /**
- * Adjust  Dimension.
- * Set dimension to ( m(B),n(B) ) <p>
- * ( adjust to dimensions of another matrix B )
- */
                                    * Adjust  Dimension.
                                    * Set dimension to ( m(B),n(B) ) <p>
                                    * ( adjust to dimensions of another matrix B )
                                    */
     void reinit(const dFMatrix& B) { reinit(B.m(), B.n()); }
-
+    
                                     /**
- *  Inquire Dimension (Row) . returns Number of Rows
- */
                                    *  Inquire Dimension (Row) . returns Number of Rows
                                    */
     int m() const { return dim_image; }
-
+    
                                     /**
- *  Inquire Dimension (Col) . returns Number of Columns
- */
                                    *  Inquire Dimension (Col) . returns Number of Columns
                                    */
     int n() const { return dim_range; }
-//@}
-
-
- /**@name 2: Data-Access
- */
-//@{
- /**
- *   Access Elements. returns element at relative 'address' i <p>
- *   ( -> access to A(i/n , i mod n) )
- */
+                                    //@}
+    
+    
                                   /**@name 2: Data-Access
                                    */
+                                    //@{
                                   /**
                                    *   Access Elements. returns element at relative 'address' i <p>
                                    *   ( -> access to A(i/n , i mod n) )
                                    */
     double el(int i) const { return val[i]; }
-
+    
                                     /**
- *   Access Elements. returns A(i,j)
- */
                                    *   Access Elements. returns A(i,j)
                                    */
     double operator() (int i, int j) const
       {
-       //THROW2((i<0) || (i>=dim_image), IntError(IntError::Range,i));
-       //THROW2((j<0) || (j>=dim_range), IntError(IntError::Range,i));
+                                        //THROW2((i<0) || (i>=dim_image), IntError(IntError::Range,i));
+                                        //THROW2((j<0) || (j>=dim_range), IntError(IntError::Range,i));
        return el(i,j);
       }
 
                                     /**
- *   Access Elements. returns A(i,j)
- */
                                    *   Access Elements. returns A(i,j)
                                    */
     double& operator() (int i, int j)
       {
-       //THROW2((i<0) || (i>=dim_image), IntError(IntError::Range,i));
-       //THROW2((j<0) || (j>=dim_range), IntError(IntError::Range,i));
+                                        //THROW2((i<0) || (i>=dim_image), IntError(IntError::Range,i));
+                                        //THROW2((j<0) || (j>=dim_range), IntError(IntError::Range,i));
        return el(i,j);
       }
-//@}
-
 
- /**@name 3: Basic applications on matrices
- */
-//@{
- /**
- *  A+=B            . Simple addition
- */
+                                    /**
+                                     * Set all entries in the matrix to
+                                     * zero.
+                                     */
+    void clear ();
+                                    //@}
+    
+    
+                                    /**@name 3: Basic applications on matrices
+                                     */
+                                    //@{
+                                    /**
+                                     *  A+=B            . Simple addition
+                                     */
     void add(double s, const dFMatrix& B);
 
                                     /**
- *  A+=Transp(B)    . Simple addition of the transpose of B to this
- */
+                                     * A+=Transp(B).
+                                     * Simple addition of the transpose of B to this
+                                     */
     void Tadd(double s, const dFMatrix& B);
-
+    
                                     /**
-                                     *  C=A*B           . Matrix-matrix-multiplication 
+                                     * C=A*B.
+                                     * Matrix-matrix-multiplication 
                                      */
     void mmult(dFMatrix& C, const dFMatrix& B) const;
-
+    
                                     /**
-                                     *  C=Transp(A)*B   . Matrix-matrix-multiplication using transpose of this
+                                     * C=Transp(A)*B.
+                                     * Matrix-matrix-multiplication using
+                                     * transpose of this
                                      */
     void Tmmult(dFMatrix& C, const dFMatrix& B) const;
-
+    
                                     /**
-                                     *  w (+)= A*v      . Matrix-vector-multiplication ; <p>
+                                     *  w (+)= A*v.
+                                     *  Matrix-vector-multiplication ; <p>
                                      *  ( application of this to a vector v )
                                      *  flag adding=true : w=+A*v
                                      */
     void vmult(dVector& w, const dVector& v,const int adding = 0) const;
 
                                     /**
-                                     *  w (+)= Transp(A)*v  . Matrix-vector-multiplication ; <p>
-                                     *  ( application of transpose of this to a vector v )
+                                     *  w (+)= Transp(A)*v.
+                                     *  Matrix-vector-multiplication ; <p>
+                                     *  (application of transpose of this to a vector v)
                                      *  flag adding=true : w=+A*v
                                      */
     void Tvmult(dVector& w,const dVector& v,const int adding=0) const;
 
                                     /**
-                                     *  A=Inverse(A). Inversion of this by Gauss-Jordan-algorithm
+                                     * A=Inverse(A). Inversion of this by
+                                     * Gauss-Jordan-algorithm
                                      */
     void gauss_jordan();
+
+                                    /**
+                                      * Computes the determinant of a matrix.
+                                      * This is only implemented for one two and
+                                      * three dimensions, since for higher
+                                      * dimensions the numerical work explodes.
+                                      * Obviously, the matrix needs to be square
+                                      * for this function.
+                                      */
+    double determinant () const;
+
+                                    /**
+                                     * Assign the inverse of the given
+                                     * matrix to #*this#. This function is
+                                     * only implemented (hardcoded) for
+                                     * square matrices of dimension one,
+                                     * two and three.
+                                     */
+    void invert (const dFMatrix &M);
                                     //@}
 
 
@@ -211,54 +257,63 @@ void fill(const dFMatrix& src, int i = 0, int j = 0);
     void add_row(int i, double s, int j);
 
                                     /**
-                                     *  A(i,1-n)+=s*A(j,1-n)+t*A(k,1-n)   . Multiple addition of rows of this
+                                     *  A(i,1-n)+=s*A(j,1-n)+t*A(k,1-n).
+                                     *  Multiple addition of rows of this
                                      */
     void add_row(int i, double s, int j, double t, int k);
 
                                     /**
-                                     *  A(1-n,i)+=s*A(1-n,j)              . Simple addition of columns of this
+                                     *  A(1-n,i)+=s*A(1-n,j).
+                                     *  Simple addition of columns of this
                                      */
     void add_col(int i, double s, int j);
 
                                     /**
-                                     *  A(1-n,i)+=s*A(1-n,j)+t*A(1-n,k)   . Multiple addition of columns of this
+                                     *  A(1-n,i)+=s*A(1-n,j)+t*A(1-n,k).
+                                     *  Multiple addition of columns of this
                                      */
     void add_col(int i, double s, int j, double t, int k);
 
                                     /**
- *  Swap  A(i,1-n) <-> A(j,1-n)       . Swap rows i and j of this
- */
+                                     * Swap  A(i,1-n) <-> A(j,1-n).
+                                     * Swap rows i and j of this
+                                     */
     void swap_row(int i, int j);
 
                                     /**
- *  Swap  A(1-n,i) <-> A(1-n,j)       . Swap columns i and j of this
- */
+                                     *  Swap  A(1-n,i) <-> A(1-n,j).
+                                     *  Swap columns i and j of this
+                                     */
     void swap_col(int i, int j);
-//@}
+                                    //@}
 
 
-                                    /**@name 5: Mixed stuff . Including more applications on matrices
+                                    /**@name 5: Mixed stuff. Including more
+                                     *  applications on matrices
                                      */
                                     //@{
                                     /**
-                                     *  w=b-A*v         . Residual calculation , returns |w|
+                                     *  w=b-A*v.
+                                     *  Residual calculation , returns |w|
                                      */
     double residual(dVector& w, const dVector& v, const dVector& b) const;
 
                                     /**
- *  Inversion of lower triangle .
- */
                                    *  Inversion of lower triangle .
                                    */
     void forward(dVector& dst, const dVector& src) const;
 
                                     /**
- *  Inversion of upper triangle .
- */
                                    *  Inversion of upper triangle .
                                    */
     void backward(dVector& dst, const dVector& src) const;
 
                                     /**
                                      * QR - factorization of a matrix.
-                                     * The orthogonal transformation Q is applied to the vector y and this matrix. <p>
-                                     * After execution of householder, the upper triangle contains the resulting matrix R, <p>
+                                     * The orthogonal transformation Q is
+                                     * applied to the vector y and this matrix. <p>
+                                     * After execution of householder, the upper
+                                     *  triangle contains the resulting matrix R, <p>
                                      * the lower the incomplete factorization matrices.
                                      */
     void householder(dVector& y);
@@ -269,7 +324,8 @@ void fill(const dFMatrix& src, int i = 0, int j = 0);
     double least_squares(dVector& dst, dVector& src);
 
                                     /**
-                                     *  A(i,i)+=B(i,1-n). Addition of complete rows of B to diagonal-elements of this ; <p>
+                                     *  A(i,i)+=B(i,1-n). Addition of complete
+                                     *  rows of B to diagonal-elements of this ; <p>
                                      *  ( i = 1 ... m )
                                      */
     void add_diag(double s, const dFMatrix& B);
@@ -281,8 +337,9 @@ void fill(const dFMatrix& src, int i = 0, int j = 0);
     void diagadd(const double& src);
 
                                     /**
-                                     *  w+=part(A)*v    . Conditional partial Matrix-vector-multiplication <p>
-                                     *  ( used elements of v determined by x ) 
+                                     *  w+=part(A)*v. Conditional partial
+                                     *  Matrix-vector-multiplication <p>
+                                     *  (used elements of v determined by x)
                                      */
     void gsmult(dVector& w, const dVector& v,const iVector& x) const;
 
@@ -291,38 +348,6 @@ void fill(const dFMatrix& src, int i = 0, int j = 0);
                                      * Output of the matrix in user-defined format.
                                      */
     void print(FILE* fp, const char* format = 0) const;
-//@}
-
-                                     /**
-                                     * Comparison operator. Be careful with
-                                     * this thing, it may eat up huge amounts
-                                     * of computing time!
-                                     */
-    bool operator == (const dFMatrix &) const;
-
-                                    /**
-                                      * Computes the determinant of a matrix.
-                                      * This is only implemented for one two and
-                                      * three dimensions, since for higher
-                                      * dimensions the numerical work explodes.
-                                      * Obviously, the matrix needs to be square
-                                      * for this function.
-                                      */
-    double determinant () const;
-
-                                    /**
-                                     * Assign the inverse of the given
-                                     * matrix to #*this#. This function is
-                                     * only implemented (hardcoded) for
-                                     * square matrices of dimension one,
-                                     * two and three.
-                                     */
-    void invert (const dFMatrix &M);
-    
-                                    /**
-                                     * Set all entries in the matrix to
-                                     * zero.
-                                     */
-    void clear ();
+                                    //@}
 };
 #endif
index c2456db695736e44c37de2e7625af5e4449b6ec5..f1d1f36b98d8148b52126b54673aa40210bf68ec 100644 (file)
 #include <lac/vectorbase.h>
 #endif
 
-/*
-CLASS
-   dVector
-   */
+
+/**
+ *  Double precision Vector.
+ *  Memory for Components is supplied explicitly <p>
+ *  ( ! Amount of memory needs not to comply with actual dimension due to reinitializations ! ) <p>
+ *  - all necessary methods for Vectors are supplied <p>
+ *  - operators available are `=` , `*` and `( )` <p>
+ *  CONVENTIONS for used `equations` : <p>
+ *  - THIS vector is always named `U` <p>
+ *  - vectors are always uppercase , scalars are lowercase
+ */
 class dVector : public VectorBase
 {
   friend class dFMatrix;
-protected:
-  int dim, maxdim;
-  double *val;
-public:
-  dVector();
-  dVector(const dVector& v);
-  dVector(int n);
-  ~dVector();
-  void reinit(int n, int fast = 0);
-  void reinit(const dVector&, int fast = 0);
-
-  int n() const; // Abfrage der Dimension
-
-  double operator()(int i) const; // read-only Zugriff
-  double& operator()(int i); //Zugriff auf die Komponenten
-
-  double operator*(const dVector& v) const; //Skalarprodukt
-
-  dVector& operator=(double s);
-  dVector& operator=(const dVector& v);
-
-  // GROUP: Addition
-
-  void add(const double);
-  void add(const dVector&);
-  void add(double, const dVector&);
-  void add(double, const dVector&, double, const dVector&);
-
-  void sadd(double, const dVector&);
-  void sadd(double, double, const dVector&);
-  void sadd(double, double, const dVector&, double, const dVector&);
-  void sadd(double, double, const dVector&, double, const dVector&, 
-           double, const dVector&);
-
-  void equ(double);
-  void equ(double, const dVector&);
-  void equ(double, const dVector&, double, const dVector&);
-
-  void czero(int);
-  void cequ(int, const VectorBase&, double, int);
-  void cequ(int, const VectorBase&, double, int, double, int);
-  void cequ(int, const VectorBase&, double, int, double, int, double, int, double, int);
-
-  void cadd(int, const VectorBase&, double, int);
-  void cadd(int, const VectorBase&, double, int, double, int);
-  void cadd(int, const VectorBase&, double, int, double, int, double, int, double, int);
-
-  virtual const char* name() const;
-  //
-  // Output of the vector in user-defined format.
-  //
-  void print(FILE* fp, const char* format = 0) const;
-  void print(const char* format = 0) const;
+
+  protected:
+
+                                    /// Dimension. Actual number of components
+    int dim;
+
+                                    /// Dimension. Determines amount of reserved memory , evtl. >DIM !
+    int maxdim;
+
+                                    /// Component-array. 
+    double *val;
+
+  public:
+
+                                    /**
+                                     * @name 1: Basic Object-handling 
+                                     */
+                                    //@{
+                                    /**
+                                     *  Dummy-Constructor. Dimension=0
+                                     */
+    dVector();
+    
+                                    /**
+                                     *   Copy-Constructor. Dimension set to that of V , <p>
+                                     *                     all components are copied from V
+                                     */
+    dVector(const dVector& V);
+    
+                                    /**
+                                     *        Constructor. Dimension = N (>0)
+                                     */
+    dVector(int N);
+    
+                                    /**
+                                     *         Destructor. Clears memory
+                                     */
+    ~dVector();
+    
+                                    /**
+                                     *  U(0-N) = s       . Fill all components
+                                     */
+    dVector& operator=(double s);
+    
+                                    /**
+                                     *  U = V            . Copy all components
+                                     */
+    dVector& operator=(const dVector& V);
+    
+                                    /**
+                                     *  U = U * V        . Scalar Produkt
+                                     */
+    double operator*(const dVector& V) const;
+    
+                                    /**
+                                     * Change  Dimension. <p>
+                                     * Set dimension to N <p>
+                                     * ! reserved memory for This remains unchanged ! <p>
+                                     * on fast=0 vector is filled by 0.
+                                     */ 
+    void reinit(int N, int fast = 0);
+    
+                                    /**
+                                     * Adjust  Dimension. <p>
+                                     * Set dimension to n(V) <p>
+                                     * ! reserved memory for This remains unchanged ! <p>
+                                     * ! components of V are not copied in any case ! <p>
+                                     * on fast=0 vector is filled by 0.
+                                     */
+    void reinit(const dVector& V, int fast = 0);
+    
+                                    /**
+                                     *  Inquire Dimension. returns Dimension , 
+                                     *             INLINE
+                                     */
+    int n() const;
+                                    //@}
+    
+    
+                                    /**
+                                     * @name 2: Data-Access
+                                     */
+                                    //@{
+                                    /**
+                                     *  Access Components. returns U(i) , 
+                                     *             INLINE
+                                     */
+    double operator()(int i) const;
+    
+                                    /**
+                                     *  Access Components. returns U(i) , 
+                                     *             INLINE
+                                     */
+    double& operator()(int i);
+                                    //@}
+    
+    
+                                    /**
+                                     * @name 3: Modification of vectors
+                                     */
+                                    //@{
+                                    /**
+                                     *  U(0-DIM)+=s      . Addition of S to all components
+                                     */
+    void add(const double s);
+    
+                                    /**
+                                     *  U+=V             . Simple addition
+                                     */
+    void add(const dVector& V);
+    
+                                    /**
+                                     *  U+=a*V           . Simple addition
+                                     */
+    void add(double a, const dVector& V);
+    
+                                    /**
+                                     *  U+=a*V+b*W       . Multiple addition
+                                     */
+    void add(double a, const dVector& V, double b, const dVector& W);
+    
+                                    /**
+                                     *  U=s*U+V          . Scaling + simple addition
+                                     */
+    void sadd(double s, const dVector& V);
+    
+                                    /**
+                                     *  U=s*U+a*V        . Scaling + simple addition
+                                     */
+    void sadd(double s, double a, const dVector& V);
+    
+                                    /**
+                                     *  U=s*U+a*V+b*W    . Scaling + multiple addition
+                                     */
+    void sadd(double s, double a, const dVector& V, double b, const dVector& W);
+    
+                                    /**
+                                     *  U=s*U+a*V+b*W+c*X. Scaling + multiple addition
+                                     */
+    void sadd(double s, double a, const dVector& V, double b, const dVector& W, 
+             double c, const dVector& X);
+    
+                                    /**
+                                     *  U=s*U            . Scaling
+                                     */
+    void equ(double s);
+    
+                                    /**
+                                     *  U=a*V            . Replacing
+                                     */
+    void equ(double a, const dVector& V);
+    
+                                    /**
+                                     *  U=a*V+b*W        . Replacing by sum
+                                     */
+    void equ(double a, const dVector& V, double b, const dVector& W);
+                                    //@}
+    
+    
+                                    /**
+                                     * @name 4: Modification of components
+                                     */
+                                    //@{
+                                    /**
+                                     *  U(i)=0             . ONE Component only
+                                     */
+    void czero(int i);
+    
+                                    /**
+                                     *  U(i)=a*V(j)        . Replacing
+                                     */
+    void cequ(int i, const VectorBase& V, double a, int j);
+    
+                                    /**
+                                     *  U(i)=a*V(j)+b*V(k) . Replacing by sum
+                                     */
+    void cequ(int i, const VectorBase& V, double a, int j, double b, int k);
+    
+                                    /**
+                                     *  U(i)=a*V(j)+b*V(k)+c*V(l)+d*V(m) . Replacing by sum
+                                     */
+    void cequ(int i, const VectorBase& V, double a, int j, double b,
+             int k, double c, int l, double d, int m);
+    
+                                    /**
+                                     *  U(i)+=a*V(j)       . Simple addition
+                                     */
+    void cadd(int i, const VectorBase& V, double a, int j);
+    
+                                    /**
+                                     *  U(i)+=a*V(j)+b*V(k). Multiple addition
+                                     */ 
+    void cadd(int i, const VectorBase& V, double a, int j, double b, int k);
+    
+                                    /**
+                                     *  U(i)+=a*V(j)+b*V(k)+c*V(l)+d*V(m) . Multiple addition
+                                     */
+    void cadd(int i, const VectorBase& V, double a, int j, double b,
+             int k, double c, int l, double d, int m);
+                                    //@}
+    
+    
+                                    /**
+                                     * @name 5: Mixed stuff
+                                     */
+                                    //@{
+                                    ///
+    virtual const char* name() const;
+    
+                                    /**
+                                     *  Output of vector in user-defined format.
+                                     */
+    void print(FILE* fp, const char* format = 0) const;
+    
+                                    /**
+                                     *  Output of vector in user-defined format.
+                                     */
+    void print(const char* format = 0) const;
+                                    //@}
 };
 
+
+
+
+
 inline int dVector::n() const
 {
   return dim;
@@ -87,13 +264,13 @@ inline int dVector::n() const
 
 inline double dVector::operator() (int i) const
 {
-                                  //THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
+                                   //THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
   return val[i];
 }
 
 inline double& dVector::operator() (int i)
 {
-                                  //THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
+                                   //THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
   return val[i];
 }
 
index 43170c6baa55fcf1c503965deefff055ef79da84..e9b3a1c43e55a9b9d26fbf05d64ce1dc0217f86d 100644 (file)
 #ifndef __base_types_h
 #include <base/types.h>
 #endif
-//#ifndef __base_errors_h
-//#include <deal/errors.h>
-//#endif
-
-/*
-CLASS
-   iVector
-   */
+
+
+
+/**
+ *  Integer Vector.
+ *  Memory for Components is supplied explicitly <p>
+ *  ( ! Amount of memory needs not to comply with actual dimension due to reinitializations ! ) <p>
+ *  - all defined methods for iVectors are supplied <p>
+ *  - operators available are `=` and `( )` <p>
+ *  CONVENTIONS for used `equations` : <p>
+ *  - THIS vector is always named `U` <p>
+ *  - vectors are always uppercase , scalars are lowercase
+ */
 class iVector
 {
   friend class dFMatrix;
+
 protected:
-  //////////
-  int dim, maxdim;
-  //////////
-  int *val;
-public:
-  //////////
-  iVector();
-  //////////
-  iVector(const iVector& v);
-  //////////
-  iVector(int n);
-  //////////
-  ~iVector();
-  //////////
-  void reinit(int n, int fast = 0);
-  //////////
-  void reinit(const iVector&, int fast = 0);
-
-  //////////
-  int n() const; // Abfrage der Dimension
-
-  //////////
-  int operator()(int i) const; //read-only Zugriff
-  //////////
-  int& operator()(int i); //Zugriff auf die Komponenten
-
-  //////////
-  iVector& operator=(int i);
-  //////////
-  iVector& operator=(const iVector& v);
-
-  //////////
-  void add(const iVector&);
-  //////////
-  void add(int, const iVector&);
-
-  // Zuweisung
-
-  //////////
-  void equ(int, const iVector&);
+
+                                    /// Dimension. Actual number of components
+    int dim;
+
+                                    /// Dimension. Determines amount of reserved memory , evtl. >DIM !
+    int maxdim;
+    
+                                    /// Component-array.
+    int *val;
+    
+  public:
+    
+                                    /**@name 1: Basic Object-handling */
+                                    //@{
+                                    /**
+                                     *  Dummy-Constructor. Dimension=1
+                                     */
+    iVector();
+    
+                                    /**
+                                     *   Copy-Constructor. Dimension set to that of V , <p>
+                                     *                     all components are copied from V
+                                     */
+    iVector(const iVector& V);
+    
+                                    /**
+                                     *        Constructor. Dimension = N (>0)
+                                     */
+    iVector(int N);
+    
+                                    /**
+                                     *         Destructor. Clears memory
+                                     */
+    ~iVector();
+    
+                                    /**
+                                     *  U(0-N) = s       . Fill all components
+                                     */
+    iVector& operator=(int s);
+    
+                                    /**
+                                     *  U = V            . Copy all components
+                                     */
+    iVector& operator=(const iVector& V);
+    
+                                    /**
+                                     * Change  Dimension. <p>
+                                     * Set dimension to N <p>
+                                     * ! reserved memory for This remains unchanged ! <p>
+                                     * on fast=0 vector is filled by 0.
+                                     */
+    void reinit(int N, int fast = 0);
+    
+                                    /**
+                                     * Adjust  Dimension. <p>
+                                     * Set dimension to n(V) <p>
+                                     * ! reserved memory for This remains unchanged ! <p>
+                                     * ! components of V are not copied in any case ! <p>
+                                     * on fast=0 vector is filled by 0.
+                                     */
+    void reinit(const iVector& V, int fast = 0);
+    
+                                    /**
+                                     *  Inquire Dimension. returns Dimension ,
+                                     *             INLINE
+                                     */
+    int n() const;
+                                    //@}
+    
+    
+                                    /**@name 2: Data-Access
+                                     */
+                                    //@{
+                                    /**
+                                     *  Access Components. returns U(i) ,
+                                     *             INLINE
+                                     */
+    int operator()(int i) const;
+    
+                                    /**
+                                     *  Access Components. returns U(i) ,
+                                     *             INLINE
+                                     */
+    int& operator()(int i);
+                                    //@}
+    
+    
+                                    /**@name 3: Modification of vectors
+                                     */
+                                    //@{
+                                    /**
+                                     *  U+=V             . Simple addition
+                                     */
+    void add(const iVector& V);
+    
+                                    /**
+                                     *  U+=a*V           . Simple addition
+                                     */
+    void add(int a, const iVector& V);
+    
+                                    /**
+                                     *  U=a*V            . Replacing
+                                     */
+    void equ(int a, const iVector& V);
+                                    //@}
 };
 
+
+
+
+
+
+
+
+
+
 inline int iVector::n() const
 {
   return dim;
index a619fd133d0136ee93f0de18a386aeade2159535..8d3372516588837ff63439026f444eba77280131 100644 (file)
@@ -8,30 +8,76 @@
 #ifndef __lac_vectorbase_h
 #define __lac_vectorbase_h
 
-/*
-CLASS
-   VectorBase
-   */
+
+
+/**
+ * Vector Baseclass (abstract).
+ *  CONVENTIONS for used `equations` : <p>
+ *  - THIS vector is always named `U` <p>
+ *  - vectors are always uppercase , scalars are lowercase
+ */
 class VectorBase
 {
-  
   public:
-  virtual ~VectorBase() {}
-
-  // Komponentenweises Eintragen
-
-  virtual void czero(int) = 0;
-  virtual void cequ(int, const VectorBase&, double, int) = 0;
-  virtual void cequ(int, const VectorBase&, double, int, double, int) = 0;
-  virtual void cequ(int, const VectorBase&, double, int, double, int, double, int, double, int) = 0;
-
-  // Komponentenweise Addition
-
-  virtual void cadd(int, const VectorBase&, double, int) = 0;
-  virtual void cadd(int, const VectorBase&, double, int, double, int) = 0;
-  virtual void cadd(int, const VectorBase&, double, int, double, int, double, int, double, int) = 0;
-
-  virtual const char* name() const = 0;
+    
+                                    /**@name 1: Basic Object-handling
+                                     */
+                                    //@{
+                                    /**
+                                     *           Destructor. Should clear memory
+                                     */
+    virtual ~VectorBase() {}
+                                    //@}
+    
+    
+                                    /**@name 2: Modification of components
+                                     */
+                                    //@{
+                                    /**
+                                     *  U(i)=0             . ONE Component only
+                                     */
+    virtual void czero(int i) = 0;
+    
+                                    /**
+                                     *  U(i)=a*V(j)        . Replacing
+                                     */
+    virtual void cequ(int i, const VectorBase& V, double a, int j) = 0;
+    
+                                    /**
+                                     *  U(i)=a*V(j)+b*V(k) . Replacing by sum
+                                     */
+    virtual void cequ(int i, const VectorBase& V, double a, int j, double b, int k) = 0;
+    
+                                    /**
+                                     *  U(i)=a*V(j)+b*V(k)+c*V(l)+d*V(m) . Replacing by sum
+                                     */
+    virtual void cequ(int i, const VectorBase& V, double a, int j, double b,
+                     int k, double c, int l, double d, int m) = 0;
+    
+                                    /**
+                                     *  U(i)+=a*V(j)       . Simple addition
+                                     */
+    virtual void cadd(int i, const VectorBase& V, double a, int j) = 0;
+    
+                                    /**
+                                     *  U(i)+=a*V(j)+b*V(k). Multiple addition
+                                     */
+    virtual void cadd(int i, const VectorBase& V, double a, int j, double b, int k) = 0;
+    
+                                    /**
+                                     *  U(i)+=a*V(j)+b*V(k)+c*V(l)+d*V(m) . Multiple addition
+                                     */
+    virtual void cadd(int i, const VectorBase& V, double a, int j, double b,
+                     int k, double c, int l, double d, int m) = 0;
+                                    //@}
+    
+    
+                                    /**@name 3: Mixed stuff
+                                     */
+                                    //@{
+                                    ///
+    virtual const char* name() const = 0;
+                                    //@}
 };
 
 #endif

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.