This file is indexed.

/usr/include/CGAL/polynomial_utils.h is in libcgal-dev 4.7-4.

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
 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// 
//
// Author(s)     : Michael Hemmer <hemmer@mpi-inf.mpg.de> 
//              
// ============================================================================

#include <CGAL/basic.h>
#include <CGAL/Polynomial_traits_d.h>

#ifndef CGAL_POLYNOMIAL_UTILS_H
#define CGAL_POLYNOMIAL_UTILS_H

#define CGAL_UNARY_POLY_FUNCTION(functor,function)                      \
  template <typename Polynomial_d>  inline                              \
  typename Polynomial_traits_d<Polynomial_d>::functor::result_type      \
  function(const Polynomial_d& p){                                      \
    typedef Polynomial_traits_d<Polynomial_d> PT;                       \
    return typename PT::functor()(p);                                   \
  }   

#define CGAL_UNARY_POLY_FUNCTION_INDEX(functor,function)                \
  CGAL_UNARY_POLY_FUNCTION(functor,function)                            \
  template <typename Polynomial_d>  inline                              \
  typename Polynomial_traits_d<Polynomial_d>::functor::result_type      \
  function(const Polynomial_d& p, int index ){                          \
    typedef Polynomial_traits_d<Polynomial_d> PT;                       \
    typename PT::functor fo;                                            \
    return fo(p,index);                                                 \
  }      

#define CGAL_BINARY_POLY_FUNCTION(functor,function)                     \
  template <typename Polynomial_d>  inline                              \
  typename Polynomial_traits_d<Polynomial_d>::functor::result_type      \
  function(const Polynomial_d& p,                                       \
      const typename Polynomial_traits_d<Polynomial_d>::                \
      functor::second_argument_type& second                             \
  ){                                                                    \
    typedef Polynomial_traits_d<Polynomial_d> PT;                       \
    return typename PT::functor()(p,second);                            \
  }  

#define CGAL_BINARY_POLY_FUNCTION_INDEX(functor,function)               \
  CGAL_BINARY_POLY_FUNCTION(functor,function)                           \
  template <typename Polynomial_d>  inline                              \
  typename Polynomial_traits_d<Polynomial_d>::functor::result_type      \
  function(const Polynomial_d& p,                                       \
      const typename Polynomial_traits_d<Polynomial_d>::                \
      functor::second_argument_type& second,                            \
      int index                                                         \
  ){                                                                    \
    typedef Polynomial_traits_d<Polynomial_d> PT;                       \
    return typename PT::functor()(p,second,index);                      \
  }  

namespace CGAL {

// GetCoefficient
template <typename Polynomial_d> inline  
typename Polynomial_traits_d<Polynomial_d>::Get_coefficient::result_type
get_coefficient(const Polynomial_d& p, int i){
  typename Polynomial_traits_d<Polynomial_d>::Get_coefficient get_coefficient;
  return get_coefficient(p,i);
}
// GetInnermostCoefficient
template <typename Polynomial_d> inline  
typename Polynomial_traits_d<Polynomial_d>
::Get_innermost_coefficient::result_type
get_innermost_coefficient(const Polynomial_d& p, Exponent_vector ev){
  typename Polynomial_traits_d<Polynomial_d>::Get_innermost_coefficient gic;
  return gic(p,ev);
}
// ConstructCoefficientConstIteratorRange
// ConstructInnermostCoefficientConstIteratorRange
// Swap
template <typename Polynomial_d> inline  
typename Polynomial_traits_d<Polynomial_d>::Swap::result_type
swap(const Polynomial_d& p, int i, int j){
  typename Polynomial_traits_d<Polynomial_d>::Swap swap;
  return swap(p,i,j);
}
// Move
template <typename Polynomial_d> inline  
typename Polynomial_traits_d<Polynomial_d>::Move::result_type
move(const Polynomial_d& p, int i, int j){
  typename Polynomial_traits_d<Polynomial_d>::Move move;
  return move(p,i,j);
}
// Permute
template <typename Polynomial_d, typename Input_iterator> inline  
typename Polynomial_traits_d<Polynomial_d>::Permute::result_type
permute(const Polynomial_d& p, Input_iterator begin, Input_iterator end){
  typename Polynomial_traits_d<Polynomial_d>::Permute permute;
  return permute(p,begin,end);
}

// Degree
CGAL_UNARY_POLY_FUNCTION_INDEX(Degree,degree)
// TotalDegree
CGAL_UNARY_POLY_FUNCTION(Total_degree,total_degree)
// DegreeVector
CGAL_UNARY_POLY_FUNCTION(Degree_vector,degree_vector)
// LeadingCoefficient
CGAL_UNARY_POLY_FUNCTION(Leading_coefficient,leading_coefficient)
// InnermostLeadingCoefficient
CGAL_UNARY_POLY_FUNCTION(
    Innermost_leading_coefficient,
    innermost_leading_coefficient)

// Canonicalize
CGAL_UNARY_POLY_FUNCTION(Canonicalize, canonicalize)
// Differentiate
CGAL_UNARY_POLY_FUNCTION_INDEX(Differentiate, differentiate)

// Evaluate
CGAL_BINARY_POLY_FUNCTION(Evaluate,evaluate)
// EvaluateHomogeneous
template <typename Polynomial_d, typename T>  inline                                 
typename Polynomial_traits_d<Polynomial_d>::Evaluate_homogeneous::result_type
evaluate_homogeneous(const Polynomial_d& p,const T& num, const T& den){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Evaluate_homogeneous()(p,num,den);                      
}  

// Substitute
template <typename Polynomial_d, typename Input_iterator>  inline     
typename CGAL::Coercion_traits<
    typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type,
    typename std::iterator_traits<Input_iterator>::value_type>              
  ::Type  
substitute(const Polynomial_d& p,Input_iterator begin, Input_iterator end){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Substitute()(p,begin, end);                      
}  
// IsZeroAt
template <typename Polynomial_d, typename Input_iterator>  inline     
typename Polynomial_traits_d<Polynomial_d>::Is_zero_at::result_type
is_zero_at(const Polynomial_d& p, Input_iterator begin, Input_iterator end){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Is_zero_at()(p,begin, end);                      
}  
// SignAt
template <typename Polynomial_d, typename Input_iterator>  inline     
typename Polynomial_traits_d<Polynomial_d>::Sign_at::result_type
sign_at(const Polynomial_d& p, Input_iterator begin, Input_iterator end){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Sign_at()(p,begin, end);                      
}  

// SubstituteHomogeneous
template <typename Polynomial_d, typename Input_iterator>  inline     
typename CGAL::Coercion_traits<
    typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type,
    typename std::iterator_traits<Input_iterator>::value_type>              
  ::Type  
substitute_homogeneous(
    const Polynomial_d& p,Input_iterator begin, Input_iterator end){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Substitute_homogeneous()(p,begin, end);
}  
// IsZeroAtHomogeneous
template <typename Polynomial_d, typename Input_iterator>  inline     
typename Polynomial_traits_d<Polynomial_d>::Is_zero_at_homogeneous::result_type
is_zero_at_homogeneous(
    const Polynomial_d& p, Input_iterator begin, Input_iterator end){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Is_zero_at_homogeneous()(p,begin, end);
}  
// SignAtHomogeneous
template <typename Polynomial_d, typename Input_iterator>  inline     
typename Polynomial_traits_d<Polynomial_d>::Sign_at_homogeneous::result_type
sign_at_homogeneous(
    const Polynomial_d& p, Input_iterator begin, Input_iterator end){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Sign_at_homogeneous()(p,begin, end);                      
}  

// Compare // provided by number_type utils 
// CGAL_BINARY_POLY_FUNCTION(Compare,compare);

// UnivariateContent
CGAL_UNARY_POLY_FUNCTION(Univariate_content, univariate_content)
// MultivariateContent
CGAL_UNARY_POLY_FUNCTION(Multivariate_content, multivariate_content)

// SquareFreeFactorize
template <typename Polynomial_d, typename OutputIterator>  inline     
OutputIterator
square_free_factorize(const Polynomial_d& p, OutputIterator oi){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Square_free_factorize()(p,oi);                      
}  
// MakeSquareFree
CGAL_UNARY_POLY_FUNCTION(Make_square_free, make_square_free)
// IsSquareFree
CGAL_UNARY_POLY_FUNCTION(Is_square_free, is_square_free)

// PseudoDivision
// PseudoDivisionQuotient
// PseudoDivisionRemainder
template <typename Polynomial_d>  inline     
void 
pseudo_division(
    const Polynomial_d& f, const Polynomial_d& g, 
    Polynomial_d& q, Polynomial_d& r, 
    typename Polynomial_traits_d<Polynomial_d>::Coefficient_type& D){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  typename PT::Pseudo_division()(f,g,q,r,D);                      
  return;
}  
template <typename Polynomial_d>  inline     
typename Polynomial_traits_d<Polynomial_d>::Pseudo_division_quotient::result_type
pseudo_division_quotient(const Polynomial_d& f, const Polynomial_d& g){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Pseudo_division_quotient()(f,g);                      
}  
template <typename Polynomial_d>  inline     
typename Polynomial_traits_d<Polynomial_d>::Pseudo_division_remainder::result_type
pseudo_division_remainder(const Polynomial_d& f, const Polynomial_d& g){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Pseudo_division_remainder()(f,g);                      
}  

// GcdUpToConstantFactor
CGAL_BINARY_POLY_FUNCTION(
    Gcd_up_to_constant_factor, 
    gcd_up_to_constant_factor)
// IntegralDivisionUpToConstantFactor
CGAL_BINARY_POLY_FUNCTION(
    Integral_division_up_to_constant_factor, 
    integral_division_up_to_constant_factor)
// UnivariateContentUpToConstantFactor
CGAL_UNARY_POLY_FUNCTION(
    Univariate_content_up_to_constant_factor, 
    univariate_content_up_to_constant_factor)
// SquareFreeFactorizeUpToConstantFactor
template <typename Polynomial_d, typename OutputIterator>  inline     
OutputIterator
square_free_factorize_up_to_constant_factor(
    const Polynomial_d& p, OutputIterator oi){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Square_free_factorize_up_to_constant_factor()(p,oi);
}  

// Shift
CGAL_BINARY_POLY_FUNCTION_INDEX(Shift,shift)
// Negate
CGAL_UNARY_POLY_FUNCTION_INDEX(Negate,negate)
// Invert
CGAL_UNARY_POLY_FUNCTION_INDEX(Invert,invert)
// Translate
CGAL_BINARY_POLY_FUNCTION_INDEX(Translate,translate)
// TranslateHomogeneous
template <typename Polynomial_d>  inline     
typename Polynomial_traits_d<Polynomial_d>::Translate_homogeneous::result_type
translate_homogeneous(const Polynomial_d& f,
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num, 
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den){
      
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Translate_homogeneous()(f,num,den);                      
}  
template <typename Polynomial_d>  inline     
typename Polynomial_traits_d<Polynomial_d>::Translate_homogeneous::result_type
translate_homogeneous(const Polynomial_d& f,
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num, 
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den,
    int index ){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Translate_homogeneous()(f,num,den,index);
}      
// Scale
CGAL_BINARY_POLY_FUNCTION_INDEX(Scale,scale)
// ScaleHomogeneous
template <typename Polynomial_d>  inline     
typename Polynomial_traits_d<Polynomial_d>::Scale_homogeneous::result_type
scale_homogeneous(const Polynomial_d& f,
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num, 
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den){
      
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Scale_homogeneous()(f,num,den);                      
}  
template <typename Polynomial_d>  inline     
typename Polynomial_traits_d<Polynomial_d>::Scale_homogeneous::result_type
scale_homogeneous(const Polynomial_d& f,
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& num, 
    const typename Polynomial_traits_d<Polynomial_d>::Innermost_coefficient_type& den,
    int index ){
  typedef Polynomial_traits_d<Polynomial_d> PT;                       
  return typename PT::Scale_homogeneous()(f,num,den,index);
}  
// Resultant
CGAL_BINARY_POLY_FUNCTION(Resultant,resultant)

template <typename Polynomial_d,typename OutputIterator> inline
OutputIterator polynomial_subresultants
(Polynomial_d p, Polynomial_d q, OutputIterator out) {
    typedef Polynomial_traits_d<Polynomial_d> PT;
    return typename PT::Polynomial_subresultants() (p, q, out);
}   

template <typename Polynomial_d,typename OutputIterator> inline
OutputIterator principal_subresultants
(Polynomial_d p, Polynomial_d q, OutputIterator out) {
    typedef Polynomial_traits_d<Polynomial_d> PT;
    return typename PT::Principal_subresultants() (p, q, out);
}   

template<typename Polynomial_d,
    typename OutputIterator1, 
    typename OutputIterator2,
    typename OutputIterator3> inline
OutputIterator1 polynomial_subresultants_with_cofactors
(Polynomial_d p,
 Polynomial_d q,
 OutputIterator1 sres_out,
 OutputIterator2 coP_out,
 OutputIterator3 coQ_out) {
    typedef Polynomial_traits_d<Polynomial_d> PT;
    return typename PT::Polynomial_subresultants_with_cofactors() 
        (p, q, sres_out, coP_out, coQ_out);
}


template <typename Polynomial_d,typename OutputIterator> inline
OutputIterator
principal_sturm_habicht_sequence
(Polynomial_d f, OutputIterator out){
    typedef Polynomial_traits_d<Polynomial_d> PT;
    return typename PT::Principal_sturm_habicht_sequence() (f, out);
}
  
template<typename Polynomial_d,typename OutputIterator> OutputIterator
sturm_habicht_sequence(Polynomial_d f,OutputIterator out) {
    typedef Polynomial_traits_d<Polynomial_d> PT;
    return typename PT::Sturm_habicht_sequence() (f, out);
}

template<typename Polynomial_d,
    typename OutputIterator1,
    typename OutputIterator2,
    typename OutputIterator3> 
OutputIterator1
sturm_habicht_sequence_with_cofactors
(Polynomial_d f,
 OutputIterator1 stha_out,
 OutputIterator2 cof_out,
 OutputIterator3 cofx_out) {
    typedef Polynomial_traits_d<Polynomial_d> PT;
    return typename PT::Sturm_habicht_sequence_with_cofactors() 
        (f, stha_out, cof_out, cofx_out);
}


// TODO: REMOVE function below ?

template<typename NT> inline
Polynomial<NT> scale_up(const Polynomial<NT>& p, const NT& a)
{ Polynomial<NT> q(p); q.scale_up(a); return q; }

template<typename NT> inline
Polynomial<NT> scale_down(const Polynomial<NT>& p, const NT& b)
{ Polynomial<NT> q(p); q.scale_down(b); return q; }


template<typename NT> inline
Polynomial<NT> translate_by_one(const Polynomial<NT>& p)
{ Polynomial<NT> q(p); q.translate_by_one(); return q; }


template<typename NT> inline
Polynomial<NT> reversal(const Polynomial<NT>& p)
{ Polynomial<NT> q(p); q.reversal(); return q; }


} //namespace CGAL

#undef CGAL_UNARY_POLY_FUNCTION
#undef CGAL_UNARY_POLY_FUNCTION_INDEX
#undef CGAL_BINARY_POLY_FUNCTION
#undef CGAL_BINARY_POLY_FUNCTION_INDEX

#endif // CGAL_POLYNOMIAL_UTILS_H