This file is indexed.

/usr/include/eclib/p2points.h is in libec-dev 20160101-1.

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
// p2points.h:  declarations of P2Point class for points in P^2(Q)
//////////////////////////////////////////////////////////////////////////
//
// Copyright 1990-2012 John Cremona
// 
// This file is part of the eclib package.
// 
// eclib 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.
// 
// eclib 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 eclib; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
// 
//////////////////////////////////////////////////////////////////////////
 
// allow for multiple includes
#ifndef _P2POINT_
#define _P2POINT_

#include "bigrat.h"

//
// class for  points in P^2(Q), used as base for points on elliptic curves etc.
//
class P2Point;
P2Point scale(const P2Point& P, const bigint& u, int back=0); 
P2Point scale(const P2Point& P, long u=1, int back=0); 
P2Point shift(const P2Point& P,
      const bigint& r, const bigint& s, const bigint& t, 
      int back=0); 
P2Point transform(const P2Point& P,
			   const bigint& u, 
			   const bigint& r, const bigint& s, const bigint& t, 
			   int back=0); 

class P2Point{ 
  friend class Point;
  bigint X ; // homogeneous coordinates
  bigint Y ;
  bigint Z ;
  void reduce(); //divide out coordinate gcd
public:
  // constructors 
  P2Point(void)       // not a real point
    { X=0; Y=0; Z=0;} 
  P2Point(const bigint& x, const bigint& y, const bigint& z)
    : X(x), Y(y), Z(z)
    { reduce(); }
  P2Point(const bigint& x, const bigint& y, long z)
    : X(x), Y(y), Z(BIGINT(z))
    { reduce(); }
  P2Point(const bigint& x, long y, long z)
    : X(x), Y(BIGINT(y)), Z(BIGINT(z))
    { reduce(); }
  P2Point(long x, long y, long z)
    : X(BIGINT(x)), Y(BIGINT(y)), Z(BIGINT(z))
    { reduce(); }
  P2Point(const bigint& x, const bigint& y)
    : X(x), Y(y), Z(BIGINT(1))
    { ; } // no need to reduce 
  /* The following creates ambiguities owing to the bigint->bigrational coercion
  P2Point(const bigrational& x, const bigrational& y)
    : X(num(x)*den(y)), Y(num(y)*den(x)), Z(den(x)*den(y))
    { reduce(); }
  */
  P2Point(const P2Point& Q)
    :X(Q.X), Y(Q.Y), Z(Q.Z)
    { ; }
  ~P2Point(void) {;}
                
  // input and output
  friend inline ostream& operator<<(ostream & os, const P2Point& P)
    {return os << "[" << P.X << ":" << P.Y << ":" << P.Z << "]" ;}

  friend inline void output_pari(ostream&os, const P2Point& P)
    {
      bigint xp=P.X, yp=P.Y, zp=P.Z;
      if(is_zero(zp)) {os<<"[0]"; return;}
      if(is_one(zp)) {os<<"["<<xp<<","<<yp<<"]"; return;}
      bigint z=gcd(xp,zp);
      os<<"["<<(xp/z)<<"/"<<(zp/z)<<","<<yp<<"/"<<zp<<"]";
    }

// P2Point input: 3 formats allowed are 
// [x:y:z], [x,y], [x/z,y/z] with any stype of brackets
  friend istream& operator>>(istream & is, P2Point& P);

  // test of equality of points        
  int operator==(const P2Point& Q) const
  {
    return eq(*this,Q);
  }
  int operator!=(const P2Point& Q) const { return !(*this == Q); }
  friend int eq(const P2Point&P, const P2Point&Q);

  // assignment (p.init(.) is quicker than p=P2Point(.) for existing p)
  void init(const bigint& x, const bigint& y, const bigint& z)
  {X=x; Y=y; Z=z; reduce(); }
  void init(const bigint& x, const bigint& y)
  {X=x; Y=y; Z = BIGINT(1); }
  void operator=(const P2Point& Q) // P1 = P2
    { X=Q.X ; Y=Q.Y; Z=Q.Z;  }

  // Coordinate transforms useful for elliptic curve points 
  friend P2Point scale(const P2Point& P, const bigint& u, int back); 
  friend P2Point scale(const P2Point& P, long u, int back); 
  friend P2Point shift(const P2Point& P,
		       const bigint& r, const bigint& s, const bigint& t, 
		       int back); 
  friend P2Point transform(const P2Point& P,
			   const bigint& u, 
			   const bigint& r, const bigint& s, const bigint& t, 
			   int back); 

  void getcoordinates(bigint& x, bigint& y, bigint& z) const
    {x=X; y=Y; z=Z; }
  void getaffinecoordinates(bigrational& x, bigrational& y) const
  {x=bigrational(X,Z); y=bigrational(Y,Z); }
  void getrealcoordinates(bigfloat&x, bigfloat& y) const;
  friend inline bigint getX(const P2Point& p) {return p.X; }
  friend inline bigint getY(const P2Point& p) {return p.Y; }
  friend inline bigint getZ(const P2Point& p) {return p.Z; }
  int isintegral() const { return Z==BIGINT(1); }
  int isinfinite() const { return Z==BIGINT(0); }

}; // end of p2point class

// the real x and y coords of the point
inline void realify_point(const P2Point& P, bigfloat&x, bigfloat& y)
{
  P.getrealcoordinates(x,y);
}

// end of file: p2points.h

#endif