This file is indexed.

/usr/include/casacore/scimath/Functionals/Gaussian3DParam.tcc is in casacore-dev 2.2.0-2.

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
//# Gaussian3DParam.cc: A three-dimensional Gaussian class
//# Copyright (C) 2001,2002
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library 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 Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//#        Internet email: aips2-request@nrao.edu.
//#        Postal address: AIPS++ Project Office
//#                        National Radio Astronomy Observatory
//#                        520 Edgemont Road
//#                        Charlottesville, VA 22903-2475 USA
//#
//# $Id$

#ifndef SCIMATH_GAUSSIAN3DPARAM_TCC
#define SCIMATH_GAUSSIAN3DPARAM_TCC

#include <casacore/scimath/Functionals/Gaussian3DParam.h>
#include <casacore/casa/Arrays/ArrayMath.h>
#include <casacore/casa/Arrays/Vector.h>
#include <casacore/casa/Exceptions/Error.h>
#include <casacore/casa/BasicSL/Constants.h>
#include <casacore/casa/BasicMath/Math.h>
#include <casacore/scimath/Functionals/Function.h>

namespace casacore { //# NAMESPACE CASACORE - BEGIN

template<class Type> 
Gaussian3DParam<Type>::Gaussian3DParam() 
  : Function<Type>(NPAR)
{
  param_p[H] = Type(1.0);
  param_p[CX] = Type(0.0);
  param_p[CY] = Type(0.0);
  param_p[CZ] = Type(0.0);
  param_p[AX] = Type(1.0);
  param_p[AY] = Type(1.0);
  param_p[AZ] = Type(1.0);
  param_p[THETA] = Type(0.0);
  param_p[PHI] = Type(0.0);
  fwhm2int = Type(1.0)/sqrt(log(Type(16.0)));
  settrigvals();
}


template<class Type> 
Gaussian3DParam<Type>::Gaussian3DParam(Type &height, 
                             Type &xCenter, Type &yCenter, Type &zCenter, 
                             Type &xWidth, Type &yWidth, Type &zWidth, 
                             Type &theta, Type &phi) 
  : Function<Type>(NPAR)
{
  param_p[H] = height;
  param_p[CX] = xCenter;
  param_p[CY] = yCenter;
  param_p[CZ] = zCenter;
  param_p[AX] = xWidth;
  param_p[AY] = yWidth;
  param_p[AZ] = zWidth;
  param_p[THETA] = theta;
  param_p[PHI] = phi;
  fwhm2int = Type(1.0)/sqrt(log(Type(16.0)));

  settrigvals();  
}


template<class Type> 
Gaussian3DParam<Type>::Gaussian3DParam(Type /*height*/, 
                                       const Vector<Type>& center, 
                                       const Vector<Type>& width, 
                                       Type T, Type P)
  : Function<Type>(NPAR)
{
  fwhm2int = Type(1.0)/sqrt(log(Type(16.0)));
  setCenter(center);
  setWidth(width);
  settheta(T); setphi(P);
  settrigvals();
}

template<class Type> 
Gaussian3DParam<Type>::Gaussian3DParam(const Gaussian3DParam<Type>& other)
  : Function<Type, Type>(other)
{  
   fwhm2int = Type(1.0)/sqrt(log(Type(16.0)));
   settrigvals();   //IMPR: could set vals explicitly to speed things up
}

template<class Type>
Gaussian3DParam<Type>::~Gaussian3DParam()
{}


template<class Type> 
Gaussian3DParam<Type>& Gaussian3DParam<Type>::operator=(const Gaussian3DParam<Type>& other)
{
  if (this != &other)
  {
    Function<Type>::operator=(other);
    settrigvals();  //IMPR: explicit
    fwhm2int = other.fwhm2int;
  }
  return *this;
}



template<class Type> 
Type Gaussian3DParam<Type>::height() const
{
  return param_p[H];
}

template<class Type> 
void Gaussian3DParam<Type>::setHeight(const Type& height) 
{
  param_p[H] = height;
}


template <class Type>
Type Gaussian3DParam<Type>::flux() const
{
  return param_p[H]*param_p[AX]*param_p[AY]*param_p[AZ]*
         fwhm2int*fwhm2int*fwhm2int*Type(C::pi*sqrt(C::pi));
}

template <class Type>
void Gaussian3DParam<Type>::setFlux(const Type& flux)
{
  param_p[H]= flux / (param_p[AX]*param_p[AY]*param_p[AZ]*
         fwhm2int*fwhm2int*fwhm2int*Type(C::pi*sqrt(C::pi)));
}


template<class Type> 
Vector<Type> Gaussian3DParam<Type>::center() const 
{
  Vector<Type> center(3);
  center(0) = param_p[CX];
  center(1) = param_p[CY];
  center(2) = param_p[CZ];
  return center;
}

template<class Type> 
void Gaussian3DParam<Type>::setCenter(const Vector<Type>& center) 
{
  if (center.nelements() != 3) 
    throw(AipsError("Gaussian3D<Type>::setCenter(const Vector<Type>& center)"
		    " - center must be of length 3"));
  param_p[CX] = center(0);
  param_p[CY] = center(1);
  param_p[CZ] = center(2);
}

template<class Type> 
Type Gaussian3DParam<Type>::xCenter() const 
{
  return param_p[CX];
}

template<class Type> 
Type Gaussian3DParam<Type>::yCenter() const 
{
  return param_p[CY];
}

template <class Type>
Type Gaussian3DParam<Type>::zCenter() const
{
  return param_p[CZ];
}

template<class Type> 
void Gaussian3DParam<Type>::setXcenter(const Type& xcenter) 
{
  param_p[CX] = xcenter;
}

template<class Type> 
void Gaussian3DParam<Type>::setYcenter(const Type& ycenter) 
{
  param_p[CY] = ycenter;
}

template<class Type>
void Gaussian3DParam<Type>::setZcenter(const Type& zcenter)
{
  param_p[CZ] = zcenter;
}

template<class Type> 
Vector<Type> Gaussian3DParam<Type>::width() const 
{
  Vector<Type> width(3);
  width(0) = param_p[AX];
  width(1) = param_p[AY];
  width(2) = param_p[AZ];
  return width;
}

template<class Type> 
void Gaussian3DParam<Type>::setWidth(const Vector<Type>& width) 
{
  if (width.nelements() != 3)
    throw(AipsError("Gaussian3DParam<Type>::setWidth"
                    "(const Vector<Type>& width)"
                    " - width must be of length 3"));
  param_p[AX] = width(0);
  param_p[AY] = width(1);
  param_p[AZ] = width(2);
}

template<class Type>
void Gaussian3DParam<Type>::setXwidth(const Type & xwidth)
{
  if (xwidth <= Type(0)) 
    throw(AipsError("Gaussian3DParam<Type>::setXwidth(const Type& xwidth)"
                    " - width must be positive"));
  param_p[AX] = xwidth;
}

template<class Type>
void Gaussian3DParam<Type>::setYwidth(const Type & ywidth)
{
  if (ywidth <= Type(0)) 
    throw(AipsError("Gaussian3DParam<Type>::setYwidth(const Type& ywidth)"
                    " - width must be positive"));
  param_p[AY] = ywidth; 
}

template<class Type>
void Gaussian3DParam<Type>::setZwidth(const Type & zwidth)
{
  if (zwidth <= Type(0)) 
    throw(AipsError("Gaussian3DParam<Type>::setZwidth(const Type& zwidth)"
                    " - width must be positive"));
  param_p[AZ] = zwidth;
}

template<class Type>
Type Gaussian3DParam<Type>::xWidth() const
{
  return param_p[AX];
}

template<class Type>
Type Gaussian3DParam<Type>::yWidth() const
{
  return param_p[AY];
}

template<class Type>
Type Gaussian3DParam<Type>::zWidth() const
{
  return param_p[AZ];
}

template<class Type> 
Type Gaussian3DParam<Type>::theta() const 
{
  //IMPR: force to be in stated range by using a correctParameters fn
  //      (see FitGaussian)
  return param_p[THETA];
}

template <class Type>
Type Gaussian3DParam<Type>::phi() const
{
  //IMPR: force to be in stated range
  return param_p[PHI];
}

template<class Type> 
void Gaussian3DParam<Type>::settheta(const Type& theta) 
{
  if (abs(theta) > Type(C::pi_4))   
    throw(AipsError("Gaussian3DParam<Type>::settheta(const Type& theta)"
		    " - theta must be in radians and between -pi/4 and pi/4"));
  
  param_p[THETA] = theta;
  settrigvals();
}

template<class Type> 
void Gaussian3DParam<Type>::setphi(const Type& phi) 
{
  if (abs(phi) > Type(C::pi_4)) 
    throw(AipsError("Gaussian3D<Type>::setphi(const Type& phi)"
		    " - phi must be in radians and between -pi/4 and pi/4"));
  
  param_p[PHI] = phi;
  settrigvals();
}




template <class Type>
void Gaussian3DParam<Type>::settrigvals() const
{
  stoT_p = param_p[THETA];
  stoP_p = param_p[PHI];
  sinT_p = sin(param_p[THETA]);
  cosT_p = cos(param_p[THETA]);
  sinP_p = sin(param_p[PHI]);
  cosP_p = cos(param_p[PHI]);
  cosTcosP_p = cosT_p * cosP_p;
  cosTsinP_p = cosT_p * sinP_p;
  sinTcosP_p = sinT_p * cosP_p;
  sinTsinP_p = sinT_p * sinP_p;
}


} //# NAMESPACE CASACORE - END


#endif