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

📄 constant.h

📁 高效的c++科学算法库
💻 H
字号:
/*                                           -*- c++ -*- ****************************** * Scientific Library (GNU Public Licence) * * Author: Laurent Deniau, Laurent.Deniau@cern.ch * * $Id: constant.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_CONSTANT_CONSTANT_H#define SL_MATRIX_STRUCTURES_CONSTANT_CONSTANT_H#ifndef SL_MATRIX_STRUCTURES_CONSTANT_H#error <sl/matrix/structures/constant/constant.h> must be included via <sl/matrix/structures/constant.h>#endif#ifdef HAVE_NAMESPACEnamespace sl {#endif    class TConstant : public MatrixStructure {          /** @name Explanation                         Constant matrix structure          */              public:        typedef ConstantIterator iterator_t;          /// doc         size_t size () const { return  1; }          /// doc         Index  rows () const { return my_n; }          /// doc         Index  cols () const { return my_p; }          /// doc         Index firstInRow (Index const i) const { return MinIndex; }          /// doc         Index firstInCol (Index const j) const { return MinIndex; }          /// doc         Index lastInRow  (Index const i) const { return MinIndex; }          /// doc         Index lastInCol  (Index const j) const { return MinIndex; }          /// doc         static Bool isRowMajor () { return true; }          /// map(MinIndex,MinIndex)        ptrdiff_t offset () const { return 0; }          /// doc         explicit            TConstant () : my_n (0), my_p (0) { }          /// doc         explicit            TConstant (Index const n) : my_n (n), my_p (1) { }          /// doc             TConstant (Index const n, Index const p) : my_n (n), my_p (p) { }          // WARNING: Do NOT declare the copy constructor !          /// doc         void            resize (Index const n, Index const p) {            my_n = n; my_p = p;        }          /// doc         template <typename T_value>            T_value&            get (T_value* const data, Index const i, Index const j) {            return data[0];        }          /// doc         template <typename T_value>            T_value            get (T_value const* const data, Index const i, Index const j) const {            return data[0];        }      private:          /// doc        Index my_n;          /// doc        Index my_p;    };#ifdef HAVE_NAMESPACE}#endif #endif // SL_MATRIX_STRUCTURES_CONSTANT_CONSTANT_H

⌨️ 快捷键说明

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