This file is indexed.

/usr/include/CLHEP/GenericFunctions/SphericalHarmonicCoefficientSet.icc is in libclhep-dev 2.1.4.1+dfsg-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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include <vector>
#include "CLHEP/GenericFunctions/ClebschGordanCoefficientSet.hh"
#include <stdexcept>
namespace Genfun {

  class SphericalHarmonicCoefficientSet::Clockwork {
    
  public:
    
    std::vector<std::vector<std::complex<double> > > data;
    
  };
  
  inline
  SphericalHarmonicCoefficientSet::SphericalHarmonicCoefficientSet(unsigned int LMAX):c(new Clockwork()){
    for (unsigned int l=0;l<=LMAX;l++) {
      std::vector<std::complex<double> > theMs;
      for (int m=-l; m<=int(l);m++) {
	theMs.push_back(std::complex<double> (0.0));
      }
      c->data.push_back(theMs);
    }
  }
  
  inline
  SphericalHarmonicCoefficientSet::~SphericalHarmonicCoefficientSet(){
    delete c;
  }
  
  inline
  SphericalHarmonicCoefficientSet::SphericalHarmonicCoefficientSet(const SphericalHarmonicCoefficientSet & right):
    c(new Clockwork(*right.c))
  {
  }
  
  inline
  unsigned int SphericalHarmonicCoefficientSet::getLMax() const {
    return c->data.size()-1;
  }
  
  inline
  const std::complex<double> &SphericalHarmonicCoefficientSet:: operator () (unsigned int l, int m) const {
    return c->data[l][m+l];
  }
  
  inline
  std::complex<double> & SphericalHarmonicCoefficientSet::operator () (unsigned int l, int m) {
    return c->data[l][m+l];
  }
  
  inline
  std::ostream & operator << ( std::ostream & o, const SphericalHarmonicCoefficientSet & c)
  {
    for (unsigned int l=0;l<=c.getLMax();l++) {
      for (int m=-l;m<=int(l);m++) {
	o << "l=" << l << " m=" ;
	if (m==0) o << " ";
	if (m>0 ) o << "+";
	o << m << " mag: " << c(l,m) << std::endl;
      }
      o << std::endl;
    }
    return o;
  }

  inline
  SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator= (const SphericalHarmonicCoefficientSet & source ){
    if (this!=&source) {
      delete c;
      c = new Clockwork(*source.c);
    }
    return *this;
  }




  inline
  SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator*= (const std::complex<double> & s ){
    unsigned int LMAX=getLMax();
    for (unsigned int l=0;l<=LMAX;l++) {
      for (int m=-l;m<=int(l);m++) {
	operator()(l,m)*=s;
      }
    }
    return *this;
  }


  inline
  SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator+= (const SphericalHarmonicCoefficientSet & source ){
    unsigned int LMAX=getLMax();
    for (unsigned int l=0;l<=LMAX;l++) {
      for (int m=-l;m<=int(l);m++) {
	operator()(l,m)+=source(l,m);
      }
    }
    return *this;
  }


  inline
  SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator-= (const SphericalHarmonicCoefficientSet & source ){
    unsigned int LMAX=getLMax();
    for (unsigned int l=0;l<=LMAX;l++) {
      for (int m=-l;m<=int(l);m++) {
	operator()(l,m)-=source(l,m);
      }
    }
    return *this;
  }



  inline
  std::complex<double> dot(const SphericalHarmonicCoefficientSet &a, 
			   const SphericalHarmonicCoefficientSet &b) {

    std::complex<double> result=0.0;
    if (a.getLMax()!=b.getLMax()) throw std::runtime_error ("function dot:  SphericalHarmonicCoefficientSets of different dimension");
    
    for (unsigned int l=0;l<=a.getLMax();l++) {
      for (int m=-l;m<=int(l);m++) {
	result += a(l,m)*conj(b(l,m));
      }
    }
    return result;
  }
  
  inline SphericalHarmonicCoefficientSet squareExpansionCoefficients(const SphericalHarmonicCoefficientSet & coefficientsA) {
    unsigned int LMAX=coefficientsA.getLMax();
    SphericalHarmonicCoefficientSet coefficientsASq(2*LMAX);
    static ClebschGordanCoefficientSet clebschGordan;
    for (unsigned int L=0;L<=2*LMAX;L++) {
      for (int M=-L; M<=int(L); M++) {
	coefficientsASq(L,M)=0.0;
	for (unsigned int l1=0;l1<=LMAX;l1++) {
	  for (unsigned int l2=0;l2<=LMAX;l2++) {
	    for (int m1=-l1;m1<=int(l1);m1++) {
	      for (int m2=-l2;m2<=int(l2);m2++) {
		if (m1-m2==M) {
		  if (((l1+l2) >= L) && abs(l1-l2) <= int(L))  {
		    coefficientsASq(L,M) += (coefficientsA(l1,m1)*
					     conj(coefficientsA(l2,m2))*
					     (m2%2 ? -1.0:1.0) * 
					     sqrt((2*l1+1)*(2*l2+1)/(4*M_PI*(2*L+1)))*
					     clebschGordan(l1,l2,0,0,L,0)*clebschGordan(l1,l2,m1,-m2,L,M));
		  }
		}
	      }
	    }
	  }
	}
      }
    }
    return coefficientsASq;
  } 

}