📄 colmajor.h
字号:
/* -*- c++ -*- ****************************** * Scientific Library (GNU Public Licence) * * Author: Laurent Deniau, Laurent.Deniau@cern.ch * * $Id: colmajor.h,v 1.1 1998/11/05 12:48:37 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_COLMAJOR_COLMAJOR_H#define SL_MATRIX_STRUCTURES_COLMAJOR_COLMAJOR_H#ifndef SL_MATRIX_STRUCTURES_COLMAJOR_H#error <sl/matrix/structures/colmajor/colmajor.h> must be included via <sl/matrix/structures/colmajor.h>#endif#ifdef HAVE_NAMESPACEnamespace sl {#endif /** @memo Structure: Column major storage */ class ColMajor : public MatrixStructure { public: typedef ColMajorIterator iterator_t; size_t size () const { return my_n*my_p; } Index rows () const { return my_n; } Index cols () const { return my_p; } Index firstInRow (Index const i) const { return MinIndex; } Index firstInCol (Index const j) const { return MinIndex; } Index lastInRow (Index const i) const { return my_p; } Index lastInCol (Index const j) const { return my_n; } static Bool isRowMajor () { return false; } // map(MinIndex,MinIndex) ptrdiff_t offset () const { return (my_n+1)*MinIndex; } explicit ColMajor () : my_n (0), my_p (0) { } explicit ColMajor (Index const n) : my_n (n), my_p (n) { } ColMajor (Index const n, Index const p) : my_n (n), my_p (p) { } // WARNING: Do NOT declare the copy constructor ! void resize (Index const n, Index const p) { my_n = n; my_p = p; } template <typename T_value> T_value& get (T_value* const data, Index const i, Index const j) { return data[my_n*j+i]; } template <typename T_value> T_value get (T_value const* const data, Index const i, Index const j) const { return data[my_n*j+i]; } private: Index my_n, my_p; }; typedef ColMajor Fortran;#ifdef HAVE_NAMESPACE}#endif #endif // SL_MATRIX_STRUCTURES_COLMAJOR_ITERATOR_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -