This file is indexed.

/usr/include/GNUstep/Base/AdVector.h is in adun.app 0.81-6.

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
/*
   Project: Adun

   Copyright (C) 2005 Michael Johnston & Jordi Villa-Freixa

   Author: Michael Johnston

   This application 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.

   This application 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
   Library 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 USA.
*/

#ifndef VECTORS
#define VECTORS

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <stdio.h>


/**
Basic vector structure for Framework
\ingroup Types
*/

typedef struct 
{
	double length;		//!< The length of the vector
	double vector[3]; 	//!< An array of three double elements
}
Vector3D;

typedef struct 
{
	double length[2];		//!< The length of the two vector
	double vector[6]; 		//!< An array of six double elements (x1, y1, x2, y2 etc);
}
DoubleVector3D;

/**
A structure for integer arrays
\ingroup Types
*/

typedef struct 
{
	int length;		//!< The length of the vector
	int* array; 	//!< An array 
}
IntArrayStruct;

/**
\defgroup Vector Vector
\ingroup Functions
@{
*/

/**
These functions are inlined only under GCC.
This is because under ICC better performance is achieved if the
ICC compiled versions are used everywhere
*/

#ifdef __GNUC__

/**
 Sets all elements in vector to 0.
 */
extern inline void Ad3DVectorInit(Vector3D* vector)
{
	double* array;
	
	array = vector->vector;
	array[0] = array[1] = array[2] = 0;
	vector->length = 0;
}


/**
 Returns 1 if position1 and position two are separated by less than sqrt(3)*separation.
 That is if the distance between the two points is less than separation on every axis.
 (A point less than separation away on each axis is maximum sqrt(3)*separation away).
 Conversely if the distance is greater than separation on any axis this function returns 0.
 (If this is the case then the minimum it can be away is separation).
 */
extern inline int AdCartesianDistanceCheck(double* position1, double* position2, double separation)
{
	if(fabs(position1[0] - position2[0]) > separation)
		return 0;
	
	if(fabs(position1[1] - position2[1]) > separation)
		return 0;
	
	if(fabs(position1[2] - position2[2]) > separation)
		return 0;
	
	return 1;
}

/**
 Similar to AdCartesianDistanceCheck().
 However in this case checks if two points separated by the vector \e separation
 are closer than \e distance
 */
extern inline int AdCartesianDistanceVectorCheck(Vector3D* separation, double distance)
{
	double* components;
	
	components = separation->vector;
	
	if(fabs(components[0]) > distance)
		return 0;
	
	if(fabs(components[1]) > distance)
		return 0;
	
	if(fabs(components[2]) > distance)
		return 0;
	
	return 1;	
}

/**
 Multiplies \e vector by \e value
 \param vector Pointer to a Vector3D struct
 \param value A double to multiply the vector by.
 
 \note The vector length is \e NOT modified.
 **/
extern inline void Ad3DVectorScalarMultiply(Vector3D* vector, double value)
{
	double* array;
	
	array = vector->vector;
	array[0] *= value;
	array[1] *= value;
	array[2] *= value;
}

/**
 \param vector_one Pointer to a Vector3D struct
 \param vector_two Pointer to a Vector3D structs
 \return The dot product of the two vectors
 **/
extern inline double Ad3DDotProduct(Vector3D* vector_one, Vector3D* vector_two)
{
	register int i;
	double product;
	
	for(product = 0, i=3; --i>=0;)
		product += vector_one->vector[i] * vector_two->vector[i];
	
	return product;
}

/**
 Calculates the cross product of two vectors.
 \param v_one Pointer to a Vector3D struct.
 \param v_two Pointer to a Vector3D struct.
 \param result Pointer to a Vector3D struct where the result vector will be stored.
 **/
extern inline void Ad3DCrossProduct(Vector3D* v_one, Vector3D* v_two, Vector3D* result)
{
	//calculate the cross product of the two vectors v_one X v_two
	result->vector[0] = v_one->vector[1]*v_two->vector[2] - v_one->vector[2]*v_two->vector[1];
	result->vector[1] = v_one->vector[2]*v_two->vector[0] - v_one->vector[0]*v_two->vector[2]; 
	result->vector[2] = v_one->vector[0]*v_two->vector[1] - v_one->vector[1]*v_two->vector[0];
}

/**
 Calculates the length of the vector represented by Vector3D.
 struct vector and then assigns the result to vector->length.
 \param vector A pointer to a Vector3D struct.
 **/
extern inline void Ad3DVectorLength(Vector3D* vec)
{
	(vec->length) =  *(vec->vector) * *(vec->vector) + *(vec->vector + 1) * *(vec->vector + 1); 
	(vec->length) += *(vec->vector + 2) * *(vec->vector + 2);
	
	(vec->length) = sqrt(vec->length);
}

/**
 Gets squared length
 */
extern inline void Ad3DVectorLengthSquared(Vector3D* vec)
{
	(vec->length) =  *(vec->vector) * *(vec->vector) + *(vec->vector + 1) * *(vec->vector + 1); 
	(vec->length) += *(vec->vector + 2) * *(vec->vector + 2);
}

#else

//Non-inline declarations of the above functions

void Ad3DVectorInit(Vector3D* vector);
double Ad3DDotProduct(Vector3D*, Vector3D*);
void Ad3DCrossProduct(Vector3D*, Vector3D*, Vector3D*);
void Ad3DVectorLength(Vector3D* vec);
int AdCartesianDistanceCheck(double* position1, double* position2, double separation);
int AdCartesianDistanceVectorCheck(Vector3D* separation, double distance);
void Ad3DVectorScalarMultiply(Vector3D* vector, double value);
void Ad3DVectorLengthSquared(Vector3D* vec);

#endif


/**
Allocates a matrix of Vector3D structs
*/
Vector3D** AdAllocate3DVectorMatrix(unsigned int numberOfRows, unsigned int numberOfColumns);

/**
 Frees a matrix of Vector3D structs.
 It must have been allocated using AdAllocate3DVectorMatrix().
 */
void AdFree3DVectorMatrix(Vector3D** matrix);

/**
Finds the unit vector related to a given vector.
\param vector A pointer to a Vector3D struct.
\param unit_vector Pointer to the Vector3D struct where the unit vector is to be stored. 
**/
void AdGet3DUnitVector(Vector3D*, Vector3D*);

/**
In essence generates uniformly distributed points on the unit sphere using \e generator
via the trig-method.
\param vector Pointer to a Vector3D struct in which the result will be placed
\param generator Pointer to a previously allocated gsl_rng instance which will be used
to generate the necessary random numbers.
*/
void AdGetRandom3DUnitVector(Vector3D* vector, gsl_rng* generator);

/**
Return the index of the minimium element in a standard double array.
If there is more than one entry with the same value the smallest index is returned
**/
int AdDoubleArrayMin(double*, int);
/**
Return the index of the maximum element in a standard double array.
If there is more than one entry with the same value the smallest index is returned
**/
int AdDoubleArrayMax(double*, int);

void AdIntArrayIntersectionAndDifference(IntArrayStruct *prime, IntArrayStruct *query, IntArrayStruct *intersection, IntArrayStruct *complement);
void AdIntArrayIntersection(IntArrayStruct *prime, IntArrayStruct *query, IntArrayStruct *intersection);
void AdIntArrayDifference(IntArrayStruct *prime, IntArrayStruct *query, IntArrayStruct *difference);

/** \@}**/

#endif