⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iterator.h

📁 高效的c++科学算法库
💻 H
字号:
/*                                                          -*- c++ -*- ****************************** * Scientific Library (GNU Public Licence) * * Author: Laurent Deniau, Laurent.Deniau@cern.ch * * $Id: iterator.h,v 1.1 1998/11/05 12:48:36 paubert Exp $ * * Suggestions: sl@mathinsa.insa-lyon.fr * Bugs:   sl-bugs@mathinsa.insa-lyon.fr * * For more information, please see the sl++ Home Page: * http://wwwinfo.cern.ch/~ldeniau/sl.html * ****************************** */#ifndef SL_MATRIX_STRUCTURES_BANDED_ITERATOR_H#define SL_MATRIX_STRUCTURES_BANDED_ITERATOR_H#ifndef SL_MATRIX_STRUCTURES_BANDED_H#error <sl/matrix/structures/banded/iterator.h> must be included via <sl/matrix/structures/banded.h>#endif#ifdef HAVE_NAMESPACEnamespace sl {#endif    template <Index LB, Index UB>        class BandedIterator : public GeneralIterator {          public:        typedef Banded<LB,UB> structure_t;        Index lbands () const { return LB; }        Index ubands () const { return UB; }        Index nbands () const { return LB+UB+1; }          public:            BandedIterator( structure_t const* structure,                            Index const i =MinIndex,                            Index const j =MinIndex)                : GeneralIterator(structure->rows(),                                  structure->cols(),                                  i, j, i*nbands()+j-i) {}        void            operator ++ () {            ++my_j;            if (my_j > my_i+UB || my_j > my_p) {                ++my_i;                my_j = my_i > LB+MinIndex ? my_i-LB : MinIndex;                if (my_i > my_j+LB || my_i > my_n) my_ok = false;                my_o = my_i*nbands()+my_j-my_i;            } else ++my_o;        }        void            incRow() {            ++my_i;            if (my_i > my_j+LB || my_i > my_n) my_ok = false;            else my_o += LB+UB;        }        void            incCol() {            ++my_j;            if (my_j > my_i+UB || my_j > my_p) my_ok = false;            else ++my_o;        }    };#ifdef HAVE_NAMESPACE}#endif #endif// SL_MATRIX_STRUCTURES_BANDED_ITERATOR_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -