Esempio n. 1
0
    /**
     * Copy the contents of the matrix to another addressable matrix. The matrices must have the same dimensions, else an
     * assertion failure is generated.
     */
    template <typename U> void copyTo(AddressableMatrix<U> & dst) const
    {
      long nr = this->numRows(), nc = this->numColumns();
      alwaysAssertM(nr == dst.numRows() && nc == dst.numColumns(),
                    "AddressableMatrix: Copy destination has different dimensions");

      for (long r = 0; r < nr; ++r)
        for (long c = 0; c < nc; ++c)
          dst.set(r, c, get(r, c));
    }
Esempio n. 2
0
 /** Constructor. */
 ConstIterator(AddressableMatrix const & m_, long r = 0, long c = 0)
 : m(m_), nrows(m_.numRows()), ncols(m_.numColumns()), entry(IndexPair(r, c), 0)
 {}