/usr/include/polymake/PolynomialVarNames.h is in libpolymake-dev-common 3.2r2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | /* Copyright (c) 1997-2018
Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
http://www.polymake.org
This program 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, or (at your option) any
later version: http://www.gnu.org/licenses/gpl.txt.
This program 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.
--------------------------------------------------------------------------------
*/
#ifndef POLYMAKE_POLYNOMIALVARNAMES_H
#define POLYMAKE_POLYNOMIALVARNAMES_H
#include "polymake/Array.h"
#include "polymake/vector"
#include <string>
namespace pm {
class PolynomialVarNames
{
public:
/// the default naming scheme depending on the coefficient nesting level:
/// x, y, z, u, v, w for nesting levels 0..6 and t for anything above
static constexpr char default_varname(int nesting_level)
{
return nesting_level < 3 ? 'x'+nesting_level : nesting_level < 6 ? 'v'+nesting_level-3 : 't';
}
/// set the default naming scheme
explicit PolynomialVarNames(int nesting_level);
/// set the desired names
/// the last name in the sequence works as a pattern for all excess variables:
/// it is concatenated with "_NN" where NN is the variable index less the number of fixed names
explicit PolynomialVarNames(const Array<std::string>& names)
: explicit_names(names) {}
/// get the current list of explicit names
const Array<std::string>& get_names() const { return explicit_names; }
/// get the name of the variable with the given index
/// @param index variable index
/// @param n_vars number of variables in the polynomial class
/// if the index exceeds the number of the explicit names, the variable name will be generated
/// according to the pattern "{LastExplicitName}_{IndexExcess}"
/// if the index refers to the last explicit name and \a n_vars exceeds the number of explicit names,
/// the variable name is "{LastExplicitName}_0"
const std::string& operator() (int index, int n_vars) const;
/// set the explicit variable names
void set_names(const Array<std::string>& names);
void swap(PolynomialVarNames& other);
private:
/// explicit variable names set by the application
Array<std::string> explicit_names;
/// the cache for automatically generated names of variables with indexes beyond the explicit list
mutable std::vector<std::string> generated_names;
};
}
namespace polymake {
using pm::PolynomialVarNames;
}
#endif // POLYMAKE_POLYNOMIALVARNAMES_H
|