]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/full-storage.hh
release: 0.1.59
[lilypond.git] / flower / include / full-storage.hh
index 0d17df412ff1cfba180b81cd37b35ea551e5b2a8..8fec189c735925c1ecbcd5dde21bb1cb61c4ad27 100644 (file)
 #define FULL_STORAGE_HH
 
 #include "varray.hh"
-#include "matrix-storage.hh"
 #include "real.hh"
 
 /// simplest matrix storage. refer to its baseclass for the doco.
-class Full_storage : public Matrix_storage
+class Full_storage 
 {
-    /// height, width
-    int height_i_,width_i_;
-    /// maxima.
-    int max_height_i_, max_width_i_;
+  /// height, width
+  int height_i_;
+  int width_i_;
+  /// maxima.
+  int max_height_i_;
+  int max_width_i_;
     
-    /// the storage
-    Real** els_p_p_;
+  /// the storage
+  Real** els_p_p_;
 
-    void
-    init() ;
+  void init() ;
      
-    bool valid (int i, int j) const ; 
+  bool valid (int i, int j) const ; 
 
-    void resize_rows (int);
-    void resize_cols (int);
+  void resize_rows (int);
+  void resize_cols (int);
 
 public:
-    virtual int rows() const;
-    virtual int cols() const ;
+  int band_i_;                 // ugh
+
+  /// check invariants
+  void OK() const;
+    
+    /// height of matrix
+  int rows() const;
+
+  /// width of matrix
+  int cols() const;
+
+  /// size if square
+  int dim() const;
+      
+  /**  set the size. contents lost.       
+      PRE
+      i >=0, j>=0
+    */
+  void set_size (int rows, int cols) ;
+
+  /**set the size to square dimen. contents lost
+      PRE
+      i>=0
+    */
+  void set_size (int i) ;
+  /**set the size to i.
+
+      keep contents. If enlarged contents unspecified
+        
+      PRE
+      i>=0, j>=0
+    
+    */
+  void resize (int rows, int cols);
+  /**    
+    set the size to square dimen. contents kept
+    Keep contents. If enlarged contents are unspecified
+    
+    PRE
+    i>=0  
+    */
+  void resize (int i);
+  
+    
+  /**
+    access an element.
+
+    Generate an errormessage, if this happens
+    in the 0-part of a sparse matrix.
+    */
+
+  Real& elem (int i,int j);
+
+  /// access a element, no modify
+  Real elem (int i, int j) const;
+
+  Array<Real> row (int i) const ;
+  Array<Real> column (int j) const;
+
+    
+  /**
+    add a row to the matrix before  row k. Contents
+    of added row are unspecified
+
+      0 <= k <= rows()
+    */
+  void insert_row (int k);
+
+    
+  /**
+      delete a row from this matrix.
+
+      PRE
+      0 <= k < rows();
+    */
+  void delete_row (int k);
+  void delete_column (int k);
+
+
+    
+    /**
+      at end of matrix?. when doing loop
+
+      for (i=0; i<h; i++)
+        for (j=0; j<w; j++)
+          ..
+
+    */
+  bool mult_ok (int i, int j) const;
+
+  /**
+      walk through matrix (regular multiply).
+      get next j for row i, or get next row i and reset j.
+      this will make sparse matrix implementation easy.
     
+      PRE
+      mult_ok (i,j)
+     */
+  void mult_next (int &i, int &j) const;
+
+  /**
+      valid matrix entry. return false if at end of row
+    */
+  bool trans_ok (int i, int j) const;
+
+  /**
+      walk through matrix (transposed multiply).
+      Get next i (for column j)
     
-    virtual void resize (int i, int j);
-    virtual void resize (int i);
-    virtual Real& elem (int i,int j);
-    virtual Real elem (int i, int j)const ;
-    int dim()const;
-    Full_storage (Matrix_storage*);
-    Full_storage();
-    Full_storage (int i, int j);
-    Full_storage (Full_storage const&);
-    Full_storage (int i);
-    void OK() const;
-    void operator=(Full_storage const &);
+      PRE
+      ver_ok (i,j)
+     */
+
+  void trans_next (int &i, int &j) const;
+
+  Full_storage();
+  Full_storage (int i, int j);
+  Full_storage (Full_storage const&);
+  Full_storage (int i);
+  void operator=(Full_storage const &);
     
-    virtual void insert_row (int k);
-    virtual void delete_row (int k);
-    virtual void delete_column (int k);
     
-    ~Full_storage();
-    virtual bool mult_ok (int i, int j)const;
-    virtual void mult_next (int &i, int &j) const ;
-    virtual bool trans_ok (int i, int j) const;
-    virtual void trans_next (int &i, int &j) const;
-    DECLARE_VIRTUAL_COPY_CONS(Full_storage,Matrix_storage);
-    DECLARE_MY_RUNTIME_TYPEINFO;
-    virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *)const;
+  ~Full_storage();
 };
 
+#ifndef INLINE
+#define INLINE inline
+#endif
+
+#include "full-storage.icc"
+
+
 #endif // FULL_STORAGE_HH