📄 affine_func.h
字号:
/* HYSDEL Copyright (C) 1999-2002 Fabio D. Torrisi This file is part of HYSDEL. HYSDEL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. HYSDEL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA CONTACT INFORMATION =================== Fabio D. Torrisi ETH Zentrum Physikstrasse. 3 ETL, CH-8032 Zurich Switzerland mailto:torrisi@aut.ee.ethz.ch (preferred)*/#ifndef D_AFFINE_FUNC#define D_AFFINE_FUNC#ifndef STD_NS#define STD_NSusing namespace std;#endif#include <list>#include <string>class Expr;class Var_symbol;class Affine_addend;class Globals;/** representation of an Expression as an affine function. */class Affine_func {public: /** create an empty (i.e. =0) affine function */ Affine_func(const Globals * glob); /** create an affine function with just the constant part c */ Affine_func(Expr * c, const Globals * glob); /** create an affine function with a single variable var and set * its coefficient to one */ Affine_func(const Var_symbol * var, const Globals * glob); ~Affine_func(); Affine_func *clone() const; const list < Affine_addend * > * get_addends() const { return & addends; } /** addition of two affine functions */ void add(Affine_func * add); /** subtraction of two affine functions */ void sub(Affine_func * sub); /* multiply the affine function with a constant */ void mult_const(Expr * c); /* divide the affine function by a constant */ void div_const(Expr * c); /* negate the affine function */ void neg(); /* simplify each coefficient as far as possible */ void simplify(); /* output in human readable form, for debug only */ string to_string() const; /** find the Affine_addend in addends whose variable is var * return NULL if no such addend exists */ const Affine_addend * find_addend(const Var_symbol * var) const; /** remove the constant part and return it. Return NULL if the * function is linear. */ Affine_addend * remove_const(); /** convert back to Expr */ Expr * to_expr() const;private: Affine_addend * find_addend_nonconst(const Var_symbol * var); const Globals * globals; /** contains all addends, also the constant part. A variable * must not appear more than once in this list. */ list < Affine_addend * > addends; typedef list < Affine_addend * >::iterator addends_iter; typedef list < Affine_addend * >::const_iterator const_addends_iter;};#endif //D_AFFINE_FUNC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -