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

SubSMat.h

Go to the documentation of this file.
00001 /*
00002     File:           SubSMat.h
00003 
00004     Function:       Defines a scatter-gather sparse matrix, i.e., a submatrix of another sparse 
00005                     matrix.
00006                     
00007     Author(s):      Andrew Willmott
00008 
00009     Copyright:      (c) 1995-2000, Andrew Willmott
00010  */
00011 
00012 
00013 #ifndef __SubSMat__
00014 #define __SubSMat__
00015 
00016 #include "vl/VL.h"
00017 #include "vl/Mat.h"
00018 
00019 
00020 // --- SubSMat Class ----------------------------------------------------------
00021 
00022 
00023 class TSubSVec;
00024 class TSparseVec;
00025 class TSparseMat;
00026 
00027 class TSubSMat
00028 {
00029 public:
00030     
00031     // Constructors
00032     
00033     TSubSMat(Int m, Int n, Int start, TMSparseVec *target);
00034     TSubSMat(const TSubSMat &m);            
00035     
00036     // Accessor functions
00037     
00038     inline Int              Rows() const { return rows; };
00039     inline Int              Cols() const { return cols; };
00040 
00041     inline TMSubSVec        operator [] (Int i) const;        
00042 
00043     // Assignment operators
00044     
00045     TSubSMat                &operator = (const TSubSMat &m);
00046     TSubSMat                &operator = (const TSparseMat &m);  
00047     TSubSMat                &operator = (const TMat &m);    
00048 
00049 protected:
00050 
00051     Int                     rows;
00052     Int                     cols;
00053     Int                     start;
00054     TMSparseVec             *target; 
00055 };
00056 
00057 TMSubSVec   col(const TSparseMat &m, Int i);
00058 TMSubSVec   diag(const TSparseMat &m, Int diagNum);
00059                     //  -i = diag. starting on row i, +i = diag. starting on col i
00060 TSubSMat    sub(const TSparseMat &m, Int top, Int left, Int nrows, Int ncols);
00061 TSubSMat    sub(const TSparseMat &m, Int nrows, Int ncols);
00062 
00063 
00064 // --- SubSMat Inlines --------------------------------------------------------
00065 
00066 #include "vl/SubSVec.h"
00067 #include "vl/SparseVec.h"
00068 
00069 inline TMSubSVec TSubSMat::operator [] (Int i) const
00070 {
00071     Assert(i >= 0 && i < Rows(), "(SubSMat::[]) index out of range");
00072     return(sub(target[i], start, Cols()));
00073 }
00074 
00075 #endif
00076 

Generated at Sat Aug 5 00:16:48 2000 for Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000