File: lattice.rules

package info (click to toggle)
polymake 3.0r2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 19,752 kB
  • ctags: 30,928
  • sloc: cpp: 151,785; perl: 32,510; ansic: 3,597; java: 2,654; python: 278; makefile: 181; xml: 103; sh: 79
file content (140 lines) | stat: -rw-r--r-- 4,762 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#  Copyright (c) 1997-2015
#  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.
#-------------------------------------------------------------------------------

# @topic category functions/Lattice Tools
# Functions for lattice related computations.

# @category Lattice Tools
# Checks whether all coordinates of a rational vector are integral.
# @param Vector v
# @return Bool
# @example This rational vector has only integral entries:
# > $v = new Vector<Rational>(1,2,3,4);
# polytope > print is_integral($v);
# | 1
# But if we append 1/2, it hasn't anymore:
# > print is_integral($v|1/2);
# | 

user_function is_integral(Vector<Rational>) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Checks whether all coordinates of a  rational matrix are integral.
# @param Matrix m
# @return Bool
# @example This rational matrix has only integral entries:
# > $m = new Matrix<Rational>([1,2],[3,4]);
# > print is_integral($m);
# | 1
# But if we multiply it with 1/2, that is not the case anymore.
# > print is_integral(1/2 * $m);
# | 

user_function is_integral(Matrix<Rational>) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scale a vector with the least common multiple of the denominators of its coordinates.
# @param Vector v
# @return Vector<Integer>
# @example > $v = new Vector(1/2,1/3,1/4,1/5);
# > $ve = eliminate_denominators($v);
# > print $ve;
# | 30 20 15 12

user_function eliminate_denominators(Vector<Rational>) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scale a matrix row-wise with the least common multiple of the denominators of its coordinates.
# @param Matrix M
# @return Matrix<Integer>
# @example > $M = new Matrix([1/2,1/3],[1/5,7],[1/4,4/3]);
# > $Me = eliminate_denominators_in_rows($M);
# > print $Me;
# | 3 2
# | 1 35
# | 3 16

user_function eliminate_denominators_in_rows(Matrix<Rational>) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scales entire matrix with the least common multiple of the denominators of its coordinates.
# @param Matrix v
# @return Matrix<Integer>
# @example > $M = new Matrix([1/2,1/3],[1/5,7],[1/4,4/3]);
# > $Me = eliminate_denominators_entire($M);
# > print $Me;
# | 30 20
# | 12 420
# | 15 80

user_function eliminate_denominators_entire(Matrix<Rational>) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scales entire matrix with the least common multiple of the denominators of its coordinates (ignore first column).
# @param Matrix v
# @return Matrix<Integer>
# @example > $M = new Matrix([1,1/2,1/3],[1,1/5,7],[1,1/4,4/3]);
# > $Me = eliminate_denominators_entire_affine($M);
# > print $Me;
# 1 30 20
# 1 12 420
# 1 15 80

user_function eliminate_denominators_entire_affine(Matrix<Rational>) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scales the vector to a primitive integral vector.
# @param Vector v
# @return Vector<Integer>
# @example > print primitive(new Vector(3,3/2,3,3));
# | 2 1 2 2

user_function primitive(Vector) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scales each row of the matrix to a primitive integral vector.
# @param Matrix M
# @return Matrix<Integer>
# @example > print primitive(new Matrix([1,3/2],[3,1]));
# | 2 3
# | 3 1

user_function primitive(Matrix) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scales the affine part of a vector to a primitive integral vector.
# @param Vector v
# @return Vector<Integer>
# @example > print primitive_affine(new Vector(1,3/2,1,1));
# | 1 3 2 2

user_function primitive_affine(Vector) : c++ (include => "polymake/common/lattice_tools.h");

# @category Lattice Tools
# Scales the affine part of each row of the matrix to a primitive integral vector.
# @param Matrix M
# @return Matrix<Integer>
# @example  > print primitive_affine(new Matrix([1,1,3/2],[1,3,1]));
# | 1 2 3
# | 1 3 1

user_function primitive_affine(Matrix) : c++ (include => "polymake/common/lattice_tools.h");


# Local Variables:
# mode: perl
# cperl-indent-level:3
# indent-tabs-mode:nil
# End: