lemon/matrix_maps.h
changeset 2084 59769591eb60
parent 2072 224d3781b00b
child 2088 68f8d17ced51
equal deleted inserted replaced
9:bf96057988ec 10:138b051d8d29
    45     typedef _MatrixMap MatrixMap;
    45     typedef _MatrixMap MatrixMap;
    46     typedef typename MatrixMap::SecondKey Key;
    46     typedef typename MatrixMap::SecondKey Key;
    47     typedef typename MatrixMap::Value Value;
    47     typedef typename MatrixMap::Value Value;
    48 
    48 
    49 
    49 
       
    50     /// \brief Constructor of the row map
       
    51     ///
       
    52     /// Constructor of the row map.
    50     MatrixRowMap(MatrixMap& _matrix, typename MatrixMap::FirstKey _row) 
    53     MatrixRowMap(MatrixMap& _matrix, typename MatrixMap::FirstKey _row) 
    51       : matrix(_matrix), row(_row) {}
    54       : matrix(_matrix), row(_row) {}
    52 
    55 
    53     /// \brief Subscription operator
    56     /// \brief Subscription operator
    54     ///
    57     ///
    89     typedef _MatrixMap MatrixMap;
    92     typedef _MatrixMap MatrixMap;
    90     typedef typename MatrixMap::SecondKey Key;
    93     typedef typename MatrixMap::SecondKey Key;
    91     typedef typename MatrixMap::Value Value;
    94     typedef typename MatrixMap::Value Value;
    92 
    95 
    93 
    96 
       
    97     /// \brief Constructor of the row map
       
    98     ///
       
    99     /// Constructor of the row map.
    94     ConstMatrixRowMap(const MatrixMap& _matrix, 
   100     ConstMatrixRowMap(const MatrixMap& _matrix, 
    95 		      typename MatrixMap::FirstKey _row) 
   101 		      typename MatrixMap::FirstKey _row) 
    96       : matrix(_matrix), row(_row) {}
   102       : matrix(_matrix), row(_row) {}
    97 
   103 
    98     /// \brief Subscription operator
   104     /// \brief Subscription operator
   106   private:
   112   private:
   107     const MatrixMap& matrix;
   113     const MatrixMap& matrix;
   108     typename MatrixMap::FirstKey row;
   114     typename MatrixMap::FirstKey row;
   109   };
   115   };
   110 
   116 
       
   117   /// \ingroup matrices
       
   118   ///
   111   /// \brief Gives back a row view of the matrix map
   119   /// \brief Gives back a row view of the matrix map
   112   ///
   120   ///
   113   /// \ingroup matrices
       
   114   /// Gives back a row view of the matrix map.
   121   /// Gives back a row view of the matrix map.
   115   ///
   122   ///
       
   123   /// \sa MatrixRowMap
       
   124   /// \sa ConstMatrixRowMap
   116   template <typename MatrixMap>
   125   template <typename MatrixMap>
   117   MatrixRowMap<MatrixMap> matrixRowMap(MatrixMap& matrixMap,
   126   MatrixRowMap<MatrixMap> matrixRowMap(MatrixMap& matrixMap,
   118 				       typename MatrixMap::FirstKey row) {
   127 				       typename MatrixMap::FirstKey row) {
   119     return MatrixRowMap<MatrixMap>(matrixMap, row);
   128     return MatrixRowMap<MatrixMap>(matrixMap, row);
   120   }
   129   }
   135   public:
   144   public:
   136     typedef _MatrixMap MatrixMap;
   145     typedef _MatrixMap MatrixMap;
   137     typedef typename MatrixMap::FirstKey Key;
   146     typedef typename MatrixMap::FirstKey Key;
   138     typedef typename MatrixMap::Value Value;
   147     typedef typename MatrixMap::Value Value;
   139 
   148 
       
   149     /// \brief Constructor of the column map
       
   150     ///
       
   151     /// Constructor of the column map.
   140     MatrixColMap(MatrixMap& _matrix, typename MatrixMap::SecondKey _col) 
   152     MatrixColMap(MatrixMap& _matrix, typename MatrixMap::SecondKey _col) 
   141       : matrix(_matrix), col(_col) {}
   153       : matrix(_matrix), col(_col) {}
   142 
   154 
   143     /// \brief Subscription operator
   155     /// \brief Subscription operator
   144     ///
   156     ///
   178   public:
   190   public:
   179     typedef _MatrixMap MatrixMap;
   191     typedef _MatrixMap MatrixMap;
   180     typedef typename MatrixMap::FirstKey Key;
   192     typedef typename MatrixMap::FirstKey Key;
   181     typedef typename MatrixMap::Value Value;
   193     typedef typename MatrixMap::Value Value;
   182 
   194 
       
   195     /// \brief Constructor of the column map
       
   196     ///
       
   197     /// Constructor of the column map.
   183     ConstMatrixColMap(const MatrixMap& _matrix, 
   198     ConstMatrixColMap(const MatrixMap& _matrix, 
   184 		      typename MatrixMap::SecondKey _col) 
   199 		      typename MatrixMap::SecondKey _col) 
   185       : matrix(_matrix), col(_col) {}
   200       : matrix(_matrix), col(_col) {}
   186 
   201 
   187     /// \brief Subscription operator
   202     /// \brief Subscription operator
   195   private:
   210   private:
   196     const MatrixMap& matrix;
   211     const MatrixMap& matrix;
   197     typename MatrixMap::SecondKey col;
   212     typename MatrixMap::SecondKey col;
   198   };
   213   };
   199 
   214 
       
   215   /// \ingroup matrices
       
   216   ///
   200   /// \brief Gives back a column view of the matrix map
   217   /// \brief Gives back a column view of the matrix map
   201   ///
   218   ///
   202   /// \ingroup matrices
       
   203   /// Gives back a column view of the matrix map.
   219   /// Gives back a column view of the matrix map.
   204   ///
   220   ///
       
   221   /// \sa MatrixColMap
       
   222   /// \sa ConstMatrixColMap
   205   template <typename MatrixMap>
   223   template <typename MatrixMap>
   206   MatrixColMap<MatrixMap> matrixColMap(MatrixMap& matrixMap,
   224   MatrixColMap<MatrixMap> matrixColMap(MatrixMap& matrixMap,
   207 				       typename MatrixMap::SecondKey col) {
   225 				       typename MatrixMap::SecondKey col) {
   208     return MatrixColMap<MatrixMap>(matrixMap, col);
   226     return MatrixColMap<MatrixMap>(matrixMap, col);
   209   }
   227   }