Ejemplo n.º 1
0
static void
commandtime(int fd, off_t mediasize, u_int sectorsize)
{	
	double dtmega, dtsector;
	int i;

	printf("I/O command overhead:\n");
	i = mediasize;
	rdsect(fd, 0, sectorsize);
	T0();
	for (i = 0; i < 10; i++)
		rdmega(fd);
	gettimeofday(&tv2, NULL);
	dtmega = (tv2.tv_usec - tv1.tv_usec) / 1e6;
	dtmega += (tv2.tv_sec - tv1.tv_sec);

	printf("\ttime to read 10MB block    %10.6f sec\t= %8.3f msec/sector\n",
		dtmega, dtmega*100/2048);

	rdsect(fd, 0, sectorsize);
	T0();
	for (i = 0; i < 20480; i++)
		rdsect(fd, 0, sectorsize);
	gettimeofday(&tv2, NULL);
	dtsector = (tv2.tv_usec - tv1.tv_usec) / 1e6;
	dtsector += (tv2.tv_sec - tv1.tv_sec);

	printf("\ttime to read 20480 sectors %10.6f sec\t= %8.3f msec/sector\n",
		dtsector, dtsector*100/2048);
	printf("\tcalculated command overhead\t\t\t= %8.3f msec/sector\n",
		(dtsector - dtmega)*100/2048);

	printf("\n");
	return;
}
Ejemplo n.º 2
0
/*
** Hapgood defines a transformation between GSE and HEE in his 1992
** paper (section 6), but this part isn't online.  
**
** The gist of it is, we rotate 180 degrees about Z, and then translate
** along X.
**
** But we also need to add "R", a constant vector defined by
**
**      R = [ Rsun, 0, 0 ]
**
** where
**
**             r0 (1 - e^2)
**    Rsun =   ------------
**             1 + e cos(v)
**
**   r0 = 1.495985E8 km        	mean distance of the Sun from Earth.
**
**    e = 0.016709 - 0.0000418T0	eccentricity of the Sun's apparent
**					orbit around the Earth.
**
**    w = 282.94 + 1.72 T0		longitude of perigee of that orbit
**
**    v = lambda0 - w			(see lambda0 above)
**
**
** Implemented by Ed Santiago, Updated by Kristi Keller
*/
int
gse_twixt_hee(const double et, Vec v_in, Vec v_out, Direction direction)
{
  Mat mat;
  double r0,e, w,v, Rsun;
  hapgood_matrix(180, Z, mat);

  /*
  ** Note that there's no transposition here if the direction is "back";
  ** the operation works identically in both directions.
  */
  mat_times_vec(mat, v_in, v_out);

  /* Translate the X axis about the earth-sun distance */
  r0 = (double)1.495985e8;  
  e = 0.016709 - 0.0000418*T0(et);
  w = 282.94 + 1.72*T0(et);
  v = lambda0(et) - w; 
  Rsun = r0*(1-e*e)/(1.+e*cosd(v)); 
  /*  v_out[0] += (double)1.5e8;  */

  v_out[0] += Rsun;

  return 0;
}
Ejemplo n.º 3
0
/*
** lambda0
**
** The Sun's ecliptic longitude (lambdaO) can be calculated using the 
** series of formulae:
**
**     M = 357.528 + 35999.050T0 + 0.04107H degrees 
**     Lambda = 280.460 + 36000.772T0 + 0.04107H degrees 
**     lambdaO = Lambda + (1.915 - 0.0048T0) sinM + 0.020 sin2M
**
** where T0 is the time in Julian centuries from 12:00 UT on 1 January 2000
** to the midnight Universal Time (UT) preceding the time of interest and 
** H is the time in hours since that preceding UT midnight. Formulae 
** derived from the Almanac for Computers. In the intermediate formulae, 
** M is the Sun's mean anomaly and Lambda its mean longitude.
*/
double
lambda0(const double et)
{
  double M, lambda;

  M      = 357.528 + 35999.050 * T0(et);  /* + 0.04107 * H(et); */
  lambda = 280.460 + 36000.772 * T0(et);  /* + 0.04107 * H(et); */

  /*  printf("lambda0: %10.15lf\n\n", lambda + (1.915 - 0.0048 * T0(et)) * sind(M) + 0.020 * sind(2 * M));  */

  return lambda + (1.915 - 0.0048 * T0(et)) * sind(M) + 0.020 * sind(2 * M);
}
Ejemplo n.º 4
0
void DContact::ResolveCollisions(const float2& Ncoll, float t, float fCoF, float fCoR,
					  const float2& C0, const float2& P0, float2& V0, float& w0, float m0, float i0, 
					  const float2& C1, const float2& P1, float2& V1, float& w1, float m1, float i1)
{
	// pre-computations
	float tcoll = t > 0.0f ? t : 0.0f;

	float2 Q0 = P0 + V0 * tcoll;
	float2 Q1 = P1 + V1 * tcoll;
	float2 R0 = C0 - Q0;
	float2 R1 = C1 - Q1;
	float2 T0(-R0.y, R0.x);
	float2 T1(-R1.y, R1.x);
	float2 VP0 = V0 - T0 * w0;
	float2 VP1 = V1 - T1 * w1;

	// impact velocity
	float2 Vcoll = VP0 - VP1;
	float  vn	 = Vcoll.dot(Ncoll);
	float2 Vn	 = Ncoll * vn;
	float2 Vt	 = Vcoll - Vn;
	if(vn > 0.0f) { return; }
	float vt = Vt.magnitude();
	Vt = Vt.normalize();

	// compute impulse (friction and restitution)
	float2 J, Jt(0.0f, 0.0f), Jn(0.0f, 0.0f);
	float t0 = (R0 ^ Ncoll) * (R0 ^ Ncoll) * i0;
	float t1 = (R1 ^ Ncoll) * (R1 ^ Ncoll) * i1;
	float m  = m0 + m1;
	float denom = m + t0 + t1;
	float jn = vn / denom;
	Jn = Ncoll * (-(1.0f + fCoR) * jn); // restitution
	Jt = Vt.normalize() * (fCoF * jn); // friction
	J = Jn + Jt;

	// changes in momentum
	float2 dV0 = J * m0;
	float2 dV1 = -J * m1;
	float dw0 =-(R0 ^ J) * i0; 
	float dw1 = (R1 ^ J) * i1;

	if(m0 > 0.0f) { V0 += dV0; w0 += dw0; }; // apply changes in momentum
	if(m1 > 0.0f) { V1 += dV1; w1 += dw1; }; // apply changes in momentum

	// Check for static frcition
	if (vn < 0.0f && fCoF > 0.0f)
	{
		float cone = -vt / vn;
		if (cone < fCoF)
		{
			float2 Nfriction = -Vt.normalize();
			float fCoS = cmat.coStaticFriction;

			ResolveCollisions(Nfriction, 0.0f, 0.0f, fCoS,
							 C0, P0, V0, w0, m0, i0, 
							 C1, P1, V1, w1, m1, i1);
		}
	}
};
std::vector<typename TransformationLayer<Dtype>::Affine2D>
TransformationLayer<Dtype>::generate(int N, int W, int H, int Wo, int Ho) {
  std::vector<Affine2D> r;
  for (int i = 0; i < N; i++) {
    if (synchronized_ && i) {
      r.push_back(r.back());
    } else {
      Dtype rot = 0, scale = 1, sx = 0, sy = 0;
      if (rotate_) caffe_rng_uniform<Dtype>(1, -M_PI, M_PI, &rot);
      Dtype sin_rot = sin(rot);
      Dtype cos_rot = cos(rot);
      Dtype rot_w = Wo*fabs(cos_rot) + Ho*fabs(sin_rot);
      Dtype rot_h = Wo*fabs(sin_rot) + Ho*fabs(cos_rot);
      Dtype max_scale = std::min(max_scale_, std::min(H / rot_h, W / rot_w));
      Dtype min_scale = std::min(min_scale_, max_scale);
      caffe_rng_uniform<Dtype>(1, min_scale, max_scale, &scale);
      Dtype scl_w = std::min(rot_w * scale, Dtype(W));
      caffe_rng_uniform<Dtype>(1, -(W-scl_w)/2, (W-scl_w)/2, &sx);
      Dtype scl_h = std::min(rot_h * scale, Dtype(H));
      caffe_rng_uniform<Dtype>(1, -(H-scl_h)/2, (H-scl_h)/2, &sy);
      Affine2D T0(1, 0, 0, 1, -0.5*Wo, -0.5*Ho);
      Affine2D RS(scale * cos_rot, -scale * sin_rot,
                  scale * sin_rot,  scale * cos_rot, 0, 0);
      if (mirror_ && caffe_rng_rand()&1) {
        RS.a00_ = -RS.a00_;
        RS.a10_ = -RS.a10_;
      }
      Affine2D T1(1, 0, 0, 1, 0.5*W + sx, 0.5*H + sy);
      r.push_back(T1*RS*T0);
    }
  }
  return r;
}
void CatmullRomCurveEvaluator::pushPoints(std::vector<Point>& ptvEvaluatedCurvePts, std::vector<Point>& pts, const float& fAniLength) const {
	// contruct the P vectors 
	const Vec4d Px(pts[0].x, pts[1].x, pts[2].x, pts[3].x);
	const Vec4d Py(pts[0].y, pts[1].y, pts[2].y, pts[3].y);

	// pushing the points
	ptvEvaluatedCurvePts.push_back(pts[0]);
	ptvEvaluatedCurvePts.push_back(pts[3]);
	for (int j = 0; j < 50; j++) { // draw 50 points
		double t = j / 50.0;

		Vec4d T0(1, t - 0.01, (t - 0.01) * (t - 0.01), (t - 0.01) * (t - 0.01) * (t - 0.01));
		Point pt0(T0 * M * Px, T0 * M * Py);

		Vec4d T(1, t, t * t, t * t * t);
		Point ptOnCurve(T * M * Px, T * M * Py);

		Vec4d T1(1, t + 0.01, (t + 0.01) * (t + 0.01), (t + 0.01) * (t + 0.01) * (t + 0.01));
		Point pt1(T1 * M * Px, T1 * M * Py);

		if (fAniLength > 0.001f) {
			if (ptOnCurve.x > fAniLength) // point out of screen
				ptOnCurve.x = ptOnCurve.x - fAniLength;
			ptvEvaluatedCurvePts.push_back(ptOnCurve);
		}
		else {
			if (ptOnCurve.x < pts[3].x && ptOnCurve.x > pts[0].x && ((ptOnCurve.x - pt0.x) > 0.01) && ((pt1.x - ptOnCurve.x) > 0.01))
				ptvEvaluatedCurvePts.push_back(ptOnCurve);
		}
	}
}
Ejemplo n.º 7
0
void ifRightType()
{
    printType(T0());
    std::cout << ", ";
    printType(T1());
    std::cout << " -> ";
    printType(typename DB::NumberTraits::ResultOfIf<T0, T1>::Type());
    std::cout << std::endl;
}
Ejemplo n.º 8
0
SECStatus 
rijndael_encryptBlock(AESContext *cx, 
                      unsigned char *output,
                      const unsigned char *input)
{
    return SECFailure;
#ifdef rijndael_large_blocks_fixed
    unsigned int j, r, Nb;
    unsigned int c2=0, c3=0;
    PRUint32 *roundkeyw;
    PRUint8 clone[RIJNDAEL_MAX_STATE_SIZE];
    Nb = cx->Nb;
    roundkeyw = cx->expandedKey;
    /* Step 1: Add Round Key 0 to initial state */
    for (j=0; j<4*Nb; j+=4) {
	COLUMN(clone, j) = COLUMN(input, j) ^ *roundkeyw++;
    }
    /* Step 2: Loop over rounds [1..NR-1] */
    for (r=1; r<cx->Nr; ++r) {
	for (j=0; j<Nb; ++j) {
	    COLUMN(output, j) = T0(STATE_BYTE(4*  j          )) ^
	                        T1(STATE_BYTE(4*((j+ 1)%Nb)+1)) ^
	                        T2(STATE_BYTE(4*((j+c2)%Nb)+2)) ^
	                        T3(STATE_BYTE(4*((j+c3)%Nb)+3));
	}
	for (j=0; j<4*Nb; j+=4) {
	    COLUMN(clone, j) = COLUMN(output, j) ^ *roundkeyw++;
	}
    }
    /* Step 3: Do the last round */
    /* Final round does not employ MixColumn */
    for (j=0; j<Nb; ++j) {
	COLUMN(output, j) = ((BYTE0WORD(T2(STATE_BYTE(4* j         ))))  |
                             (BYTE1WORD(T3(STATE_BYTE(4*(j+ 1)%Nb)+1)))  |
                             (BYTE2WORD(T0(STATE_BYTE(4*(j+c2)%Nb)+2)))  |
                             (BYTE3WORD(T1(STATE_BYTE(4*(j+c3)%Nb)+3)))) ^
	                     *roundkeyw++;
    }
    return SECSuccess;
#endif
}
Ejemplo n.º 9
0
/*
** The GEI2000 to GEI transformation is given by the matrix 
**
**	P = <-zA,Z>*<thetaA,Y>*<-zetaA,Z>
**
** where the rotation angles zA, thetaA and zetaA are the precession 
** angles. This transformation is a precession correction as described
** by Hapgood (1995).
**
**     zA     = 0.64062 T0 + 0.00030 T0^2 degrees 
**     thetaA = 0.55675 T0 - 0.00012 T0^2 degrees 
**     zetaA  = 0.64062 T0 + 0.00008 T0^2 degrees
*/
void
mat_P(const double et, Mat mat)
{
  Mat mat_tmp;
  double t0 = T0(et);

  hapgood_matrix(-1.0*(0.64062 * t0  +  0.00030 * t0*t0), Z, mat);

  hapgood_matrix(0.55675 * t0  -  0.00012 * t0*t0, Y, mat_tmp);
  mat_times_mat(mat, mat_tmp, mat);

  hapgood_matrix(-1.0*(0.64062 * t0  +  0.00008 * t0*t0), Z, mat_tmp);
  mat_times_mat(mat, mat_tmp, mat);
}
Ejemplo n.º 10
0
void
mat_T1(const double et, Mat mat)
{
  double theta = 100.461 + 36000.770 * T0(et) + 360.0*(H(et)/24.0);  /* + 15.04107 * H(et);  */

  /*
  theta = fmod(theta, 360.0);
  if (theta < 0.0)
    theta += 360.0;
  */

  /*  printf("T0= %20.20lf, H= %15.10lf, theta= %15lf\n", T0(et), H(et), theta);  */

  hapgood_matrix(theta, Z, mat);
}
Ejemplo n.º 11
0
int main()
{	
	srand( (unsigned int)( time(NULL) ) );

	Stopwatch T0("");
	T0.Reset();		T0.Start();
	Initialize_Data();
	T0.Stop();
	printf("- Reading Data Finished (%f seconds)\n",T0.GetTime() );

	T0.Reset();		T0.Start();
	Compute_GroundTruth();
	T0.Stop();
	printf("- Computing GroundTruth Finished (%f seconds)\n",T0.GetTime());
	
	Process();
	
	return 1;
}
Ejemplo n.º 12
0
 namespace wrapper
 {
   template <class T0, class T1>
   auto logaddexp2(T0 const &t0, T1 const &t1)
       -> decltype(nt2::log2(nt2::pow(T0(2), t0) + nt2::pow(T1(2), t1)));
 }
Ejemplo n.º 13
0
static SECStatus 
rijndael_encryptBlock128(AESContext *cx, 
                         unsigned char *output,
                         const unsigned char *input)
{
    unsigned int r;
    PRUint32 *roundkeyw;
    rijndael_state state;
    PRUint32 C0, C1, C2, C3;
#if defined(NSS_X86_OR_X64)
#define pIn input
#define pOut output
#else
    unsigned char *pIn, *pOut;
    PRUint32 inBuf[4], outBuf[4];

    if ((ptrdiff_t)input & 0x3) {
	memcpy(inBuf, input, sizeof inBuf);
	pIn = (unsigned char *)inBuf;
    } else {
	pIn = (unsigned char *)input;
    }
    if ((ptrdiff_t)output & 0x3) {
	pOut = (unsigned char *)outBuf;
    } else {
	pOut = (unsigned char *)output;
    }
#endif
    roundkeyw = cx->expandedKey;
    /* Step 1: Add Round Key 0 to initial state */
    COLUMN_0(state) = *((PRUint32 *)(pIn     )) ^ *roundkeyw++;
    COLUMN_1(state) = *((PRUint32 *)(pIn + 4 )) ^ *roundkeyw++;
    COLUMN_2(state) = *((PRUint32 *)(pIn + 8 )) ^ *roundkeyw++;
    COLUMN_3(state) = *((PRUint32 *)(pIn + 12)) ^ *roundkeyw++;
    /* Step 2: Loop over rounds [1..NR-1] */
    for (r=1; r<cx->Nr; ++r) {
        /* Do ShiftRow, ByteSub, and MixColumn all at once */
	C0 = T0(STATE_BYTE(0))  ^
	     T1(STATE_BYTE(5))  ^
	     T2(STATE_BYTE(10)) ^
	     T3(STATE_BYTE(15));
	C1 = T0(STATE_BYTE(4))  ^
	     T1(STATE_BYTE(9))  ^
	     T2(STATE_BYTE(14)) ^
	     T3(STATE_BYTE(3));
	C2 = T0(STATE_BYTE(8))  ^
	     T1(STATE_BYTE(13)) ^
	     T2(STATE_BYTE(2))  ^
	     T3(STATE_BYTE(7));
	C3 = T0(STATE_BYTE(12)) ^
	     T1(STATE_BYTE(1))  ^
	     T2(STATE_BYTE(6))  ^
	     T3(STATE_BYTE(11));
	/* Round key addition */
	COLUMN_0(state) = C0 ^ *roundkeyw++;
	COLUMN_1(state) = C1 ^ *roundkeyw++;
	COLUMN_2(state) = C2 ^ *roundkeyw++;
	COLUMN_3(state) = C3 ^ *roundkeyw++;
    }
    /* Step 3: Do the last round */
    /* Final round does not employ MixColumn */
    C0 = ((BYTE0WORD(T2(STATE_BYTE(0))))   |
          (BYTE1WORD(T3(STATE_BYTE(5))))   |
          (BYTE2WORD(T0(STATE_BYTE(10))))  |
          (BYTE3WORD(T1(STATE_BYTE(15)))))  ^
          *roundkeyw++;
    C1 = ((BYTE0WORD(T2(STATE_BYTE(4))))   |
          (BYTE1WORD(T3(STATE_BYTE(9))))   |
          (BYTE2WORD(T0(STATE_BYTE(14))))  |
          (BYTE3WORD(T1(STATE_BYTE(3)))))   ^
          *roundkeyw++;
    C2 = ((BYTE0WORD(T2(STATE_BYTE(8))))   |
          (BYTE1WORD(T3(STATE_BYTE(13))))  |
          (BYTE2WORD(T0(STATE_BYTE(2))))   |
          (BYTE3WORD(T1(STATE_BYTE(7)))))   ^
          *roundkeyw++;
    C3 = ((BYTE0WORD(T2(STATE_BYTE(12))))  |
          (BYTE1WORD(T3(STATE_BYTE(1))))   |
          (BYTE2WORD(T0(STATE_BYTE(6))))   |
          (BYTE3WORD(T1(STATE_BYTE(11)))))  ^
          *roundkeyw++;
    *((PRUint32 *) pOut     )  = C0;
    *((PRUint32 *)(pOut + 4))  = C1;
    *((PRUint32 *)(pOut + 8))  = C2;
    *((PRUint32 *)(pOut + 12)) = C3;
#if defined(NSS_X86_OR_X64)
#undef pIn
#undef pOut
#else
    if ((ptrdiff_t)output & 0x3) {
	memcpy(output, outBuf, sizeof outBuf);
    }
#endif
    return SECSuccess;
}
Ejemplo n.º 14
0
 tuple_data2()
     : m0(T0())
     , m1(T1())
 {}
Ejemplo n.º 15
0
static void
speeddisk(int fd, off_t mediasize, u_int sectorsize)
{
	int bulk, i;
	off_t b0, b1, sectorcount, step;

	sectorcount = mediasize / sectorsize;
	step = 1ULL << (flsll(sectorcount / (4 * 200)) - 1);
	if (step > 16384)
		step = 16384;
	bulk = mediasize / (1024 * 1024);
	if (bulk > 100)
		bulk = 100;

	printf("Seek times:\n");
	printf("\tFull stroke:\t");
	b0 = 0;
	b1 = sectorcount - step;
	T0();
	for (i = 0; i < 125; i++) {
		rdsect(fd, b0, sectorsize);
		b0 += step;
		rdsect(fd, b1, sectorsize);
		b1 -= step;
	}
	TN(250);

	printf("\tHalf stroke:\t");
	b0 = sectorcount / 4;
	b1 = b0 + sectorcount / 2;
	T0();
	for (i = 0; i < 125; i++) {
		rdsect(fd, b0, sectorsize);
		b0 += step;
		rdsect(fd, b1, sectorsize);
		b1 += step;
	}
	TN(250);
	printf("\tQuarter stroke:\t");
	b0 = sectorcount / 4;
	b1 = b0 + sectorcount / 4;
	T0();
	for (i = 0; i < 250; i++) {
		rdsect(fd, b0, sectorsize);
		b0 += step;
		rdsect(fd, b1, sectorsize);
		b1 += step;
	}
	TN(500);

	printf("\tShort forward:\t");
	b0 = sectorcount / 2;
	T0();
	for (i = 0; i < 400; i++) {
		rdsect(fd, b0, sectorsize);
		b0 += step;
	}
	TN(400);

	printf("\tShort backward:\t");
	b0 = sectorcount / 2;
	T0();
	for (i = 0; i < 400; i++) {
		rdsect(fd, b0, sectorsize);
		b0 -= step;
	}
	TN(400);

	printf("\tSeq outer:\t");
	b0 = 0;
	T0();
	for (i = 0; i < 2048; i++) {
		rdsect(fd, b0, sectorsize);
		b0++;
	}
	TN(2048);

	printf("\tSeq inner:\t");
	b0 = sectorcount - 2048;
	T0();
	for (i = 0; i < 2048; i++) {
		rdsect(fd, b0, sectorsize);
		b0++;
	}
	TN(2048);

	printf("Transfer rates:\n");
	printf("\toutside:     ");
	rdsect(fd, 0, sectorsize);
	T0();
	for (i = 0; i < bulk; i++) {
		rdmega(fd);
	}
	TR(bulk * 1024);

	printf("\tmiddle:      ");
	b0 = sectorcount / 2 - bulk * (1024*1024 / sectorsize) / 2 - 1;
	rdsect(fd, b0, sectorsize);
	T0();
	for (i = 0; i < bulk; i++) {
		rdmega(fd);
	}
	TR(bulk * 1024);

	printf("\tinside:      ");
	b0 = sectorcount - bulk * (1024*1024 / sectorsize) - 1;
	rdsect(fd, b0, sectorsize);
	T0();
	for (i = 0; i < bulk; i++) {
		rdmega(fd);
	}
	TR(bulk * 1024);

	printf("\n");
	return;
}
Ejemplo n.º 16
0
void Process()
{
	Stopwatch T0("");

	lsh.Initialize( dps.dim );
	sh.Initialize( &dps );

	T0.Reset();		T0.Start();
	sh.Set_Spheres();
	T0.Stop();
	printf("- Learning Spherical Hashing Finished (%f seconds)\n",T0.GetTime());

	bitset<BCODE_LEN> *bCodeData_LSH = new bitset<BCODE_LEN> [ nP ];
	bitset<BCODE_LEN> *bCodeQuery_LSH = new bitset<BCODE_LEN> [ nQ ];
	bitset<BCODE_LEN> *bCodeData_SH = new bitset<BCODE_LEN> [ nP ];
	bitset<BCODE_LEN> *bCodeQuery_SH = new bitset<BCODE_LEN> [ nQ ];

	Result_Element<int> *resLSH = new Result_Element<int> [ nP ];
	Result_Element<int> *resSH_HD = new Result_Element<int> [ nP ];
	Result_Element<double> *resSH_SHD = new Result_Element<double> [ nP ];
	
	Do_ZeroCentering();

	T0.Reset();		T0.Start();
	// compute binary codes of LSH
#ifdef USE_PARALLELIZATION
	#pragma omp parallel for
#endif
	for(int i=0;i<nP;i++)
	{
		lsh.Compute_BCode( dps.d[i] , bCodeData_LSH[i] );
		
	}
#ifdef USE_PARALLELIZATION
	#pragma omp parallel for
#endif
	for(int i=0;i<nQ;i++)
	{
		lsh.Compute_BCode( qps.d[i] , bCodeQuery_LSH[i] );
		
	}
	T0.Stop();
	printf("- LSH: Computing Binary Codes Finished (%f seconds)\n",T0.GetTime() );

	Undo_ZeroCentering();


	T0.Reset();		T0.Start();
	// compute binary codes of Spherical Hashing
#ifdef USE_PARALLELIZATION
	#pragma omp parallel for
#endif
	for(int i=0;i<nP;i++)
	{
		sh.Compute_BCode( dps.d[i] , bCodeData_SH[i] );
	}

#ifdef USE_PARALLELIZATION
	#pragma omp parallel for
#endif
	for(int i=0;i<nQ;i++)
	{
		sh.Compute_BCode( qps.d[i] , bCodeQuery_SH[i] );
	}
	T0.Stop();
	printf("- Spherical Hashing: Computing Binary Codes Finished (%f seconds)\n",T0.GetTime() );

	double mAP_LSH, mAP_SH_HD, mAP_SH_SHD;
	mAP_LSH = 0.0;		mAP_SH_HD = 0.0;		mAP_SH_SHD = 0.0;
	// process queries
	for(int qIndex=0;qIndex<nQ;qIndex++)
	{
#ifdef USE_PARALLELIZATION		
		#pragma omp parallel for
#endif
		for(int i=0;i<nP;i++)
		{
			resLSH[i].index    = i;		resLSH[i].dist    = Compute_HD(  bCodeQuery_LSH[qIndex] , bCodeData_LSH[i] );
			resSH_HD[i].index  = i;		resSH_HD[i].dist  = Compute_HD(  bCodeQuery_SH[qIndex]  , bCodeData_SH[i]  );
			resSH_SHD[i].index = i;		resSH_SHD[i].dist = Compute_SHD( bCodeQuery_SH[qIndex]  , bCodeData_SH[i]  );
		}
		mAP_LSH += Compute_AP<int>( gt[qIndex] , resLSH , nP );
		mAP_SH_HD += Compute_AP<int>( gt[qIndex] , resSH_HD , nP );
		mAP_SH_SHD += Compute_AP<double>( gt[qIndex] , resSH_SHD , nP );
	}
	mAP_LSH    /= (double)(nQ);
	mAP_SH_HD  /= (double)(nQ);
	mAP_SH_SHD /= (double)(nQ);

	printf("\n");
	printf("-- mAP\n");
	printf("\tLocality Sensitive Hashing : %f\n",mAP_LSH   );
	printf("\t    Spherical Hashing (HD) : %f\n",mAP_SH_HD );
	printf("\t    Spherical Hashing (SHD): %f\n",mAP_SH_SHD);
}
Ejemplo n.º 17
0
 tuple_data3()
     : m0(T0())
     , m1(T1())
     , m2(T2())
 {}
Ejemplo n.º 18
0
 vector3()
 :v0(T0()), v1(T1()),v2(T2()){}
Ejemplo n.º 19
0
 tuple1()
     : m0(T0())
 {}
/*
 * In principle, plot over the last "time_plot" hours (0 to N).
 * If time_plot < 0, do 3 plots: all data, 12 hours and 24 hours. For CPU efficiency in the Raspberry Pi
 */
void PlotFibreMonSwitch(int do_time_plot = 0, int width = 1400, int height = 900) { // Plot over the last "time_plot" hours
  int time_plot_array[3] = {0, 24, 12};
  float fontsize = 0.045;
  const char filename[200] = "MergedLog.txt";
  const char file_fibremap[200] = "fibremap.txt";
  int nfibres = FIBRES;
  float **fibres_values_temp;  // Ptx, Prx, Attenuation, Attenuator, Temperatures
  char **fibres_names_temp;
  int time_plot = 0;    // Avoid breaking things
  if (do_time_plot > 0) {
    time_plot = do_time_plot;
  }
  
  char title[FIBRES][20];
  
  TTree *data;
  TTree *fibremap;
  TTree *fibres_values = new TTree("Fibres values", "Fibres values");

  fibres_values_temp = (float**)calloc(nfibres, sizeof(float*));
  fibres_names_temp = (char**)calloc(nfibres, sizeof(char*));
  for (int j = 0; j < nfibres; j++) {
    fibres_values_temp[j] = (float*)calloc(5, sizeof(float));
    fibres_names_temp[j] = (char*)calloc(100, sizeof(char));
  }

  // Data from the fibremap file
  char fromSw[100], toSw[100], fibrename[100], fibrename_val[100];
  int fibre, fromPort, toPort, fibre_idx;
  float attenuator;
  
  fibremap = new TTree("Fibre mapping", "Fibre mapping");
  fibremap->ReadFile(file_fibremap, "fibre/I:fromSw/C:fromPort/I:toSw/C:toPort/I:fibrename/C:attenuator/F");
  fibremap->SetBranchAddress("fibre", &fibre);
  fibremap->SetBranchAddress("fromSw", fromSw);
  fibremap->SetBranchAddress("fromPort", &fromPort);
  fibremap->SetBranchAddress("toSw", toSw);
  fibremap->SetBranchAddress("toPort", &toPort);
  fibremap->SetBranchAddress("fibrename", fibrename);
  fibremap->SetBranchAddress("attenuator", &attenuator);
  
  nfibres = fibremap->GetEntries();
  

  // Data for the destination TTree containing each fibre attenuation (and the rest)
  float x, att, Ptx, Prx ,Ptx_fibreval, Prx_fibreval, temperature_val;
  char titletemp[50];
  TBranch *branch_fibre = fibres_values->Branch("fibre_idx", &fibre_idx, "fibre_idx/I");
  TBranch *branch_fibrename = fibres_values->Branch("fibrename_val", fibrename_val, "fibrename_val/C");
  TBranch *branch_time = fibres_values->Branch("x", &x, "x/F");
  TBranch *branch_att = fibres_values->Branch("Ptx_fibreval", &Ptx_fibreval, "Ptx_fibreval/F");
  TBranch *branch_temperature = fibres_values->Branch("temperature_val", &temperature_val, "temperature_val/F");
  TBranch *branch_Ptx = fibres_values->Branch("Prx_fibreval", &Prx_fibreval, "Prx_fibreval/F");
  TBranch *branch_Prx = fibres_values->Branch("Attenuation", &att, "Att/F");
  
  cout << "Got " << nfibres << " fibres mapped" << endl;
  
  // Load logging data
  data = new TTree("Fibre data", "Fibre data");
  char date[200], month[20], day[20], time[20], hostname[100], t2[20];
  float temp, voltage, current, Ptx, Prx;
  data->ReadFile(filename, "month/C:day:time:hostname:date:t2:temp/F:voltage:current:Ptx:Prx");
  data->SetBranchAddress("date", date);
  data->SetBranchAddress("month", month);
  data->SetBranchAddress("day", day);
  data->SetBranchAddress("time", time);
  data->SetBranchAddress("hostname", hostname);
  data->SetBranchAddress("t2", t2);
  data->SetBranchAddress("temp", &temp);
  data->SetBranchAddress("voltage", &voltage);
  data->SetBranchAddress("current", &current);
  data->SetBranchAddress("Ptx", &Ptx);
  data->SetBranchAddress("Prx", &Prx);
  
  int datalen = data->GetEntries();
  int time_entries = datalen/nfibres;
  
  // Get timestamps for beginning and end of log
  data->GetEntry(0);
  int time0 = getTimestamp(date, time);
  data->GetEntry(datalen-1);
  int timeN = getTimestamp(date, time);
  
  time_entries = (timeN - time0)/60/INTERVAL + 1;
  
  // Process data and do mapping
  int pos = 0;
  int line_time = 0;
  int thisfibre = 0;
  for (int pos = 0; pos < datalen; pos++) {
    data->GetEntry(pos);
    if (line_time != (getTimestamp(date, time) - time0)/60/INTERVAL) {
      thisfibre = 0;
      for (int k = 0; k < nfibres; k++) {
        fibres_values_temp[k][2] = fibres_values_temp[k][0] - fibres_values_temp[k][1] - fibres_values_temp[k][3];
        
        x = (float)line_time*INTERVAL*60; // *INTERVAL*60;
        
        strcpy(fibrename_val, fibres_names_temp[k]);
        Ptx_fibreval = fibres_values_temp[k][0];
        Prx_fibreval = fibres_values_temp[k][1];
        temperature_val = fibres_values_temp[k][4];
        att = fibres_values_temp[k][2];
        fibre_idx = k;
        // Save TTree element
        fibres_values->Fill();
      }
      line_time = (getTimestamp(date, time) - time0)/60/INTERVAL;
    }
    char hostname_switch[100];
    int port_switch = -1;
    char *tok;
    
    tok = strtok(hostname, ":");
    if (tok != NULL) {
      strcpy(hostname_switch, tok);
      tok = strtok(NULL, ":");
      if (tok != NULL) {
        port_switch = atoi(tok);
      }
    }
    
    // Find hostname and port in the fibre maps 
    int idx_tx = -1;
    int idx_rx = -1;
    for (int k = 0; k < nfibres; k++) {
      fibremap->GetEntry(k);
      if ((strstr(hostname, fromSw) != NULL) && ((port_switch == -1) || (port_switch == fromPort))) {
        idx_tx = k;
        strcpy(fibres_names_temp[k], fibrename);
        fibres_values_temp[idx_tx][3] = attenuator;
      }
      if ((strstr(hostname, toSw) != NULL) && ((port_switch == -1) || (port_switch == toPort))) {
        idx_rx = k;
      }
    }
    fibres_values_temp[idx_tx][0] = Ptx;
    fibres_values_temp[idx_tx][4] = temp;
    fibres_values_temp[idx_rx][1] = Prx;
    
    thisfibre++;
  }

  // Plot
  TGraph **Attenuation;
  TGraph **TxPower, **RxPower, **Temperature;
  TLegend *att_legend = new TLegend(0.85, 0.85, 0.99, 0.99);
  TLegend *temperature_legend = new TLegend(0.85, 0.85, 0.99, 0.99);
  TLegend *txpower_legend = new TLegend(0.85, 0.85, 0.99, 0.99);
  TLegend *rxpower_legend = new TLegend(0.85, 0.85, 0.99, 0.99);
  float **y_val, **x_val, **txpower_val, **rxpower_val, max_att, min_att, max_txpower, min_txpower, max_rxpower, min_rxpower, **temp_val, max_temp, min_temp;
  char **fibrenames;
  
  min_att = 1e9;
  max_att = -1;
  min_rxpower = 1e9;
  max_rxpower = -1e9;
  min_txpower = 1e9;
  max_txpower = -1e9;
  min_temp = 1e9;
  max_temp = -1e9;

  y_val = (float**)calloc(nfibres, sizeof(float*));
  x_val = (float**)calloc(nfibres, sizeof(float*));
  temp_val = (float**)calloc(nfibres, sizeof(float*));
  txpower_val = (float**)calloc(nfibres, sizeof(float*));
  rxpower_val = (float**)calloc(nfibres, sizeof(float*));
  fibrenames = (char**)calloc(nfibres, sizeof(char*));
  for (int i = 0; i < nfibres; i++) {
    y_val[i] = (float*)calloc(time_entries, sizeof(float));
    x_val[i] = (float*)calloc(time_entries, sizeof(float));
    for (int j = 0; j < time_entries; j++) {
      x_val[i][j] = -1;
    }
    temp_val[i] = (float*)calloc(time_entries, sizeof(float));
    txpower_val[i] = (float*)calloc(time_entries, sizeof(float));
    rxpower_val[i] = (float*)calloc(time_entries, sizeof(float));
    fibrenames[i] = (char*)calloc(time_entries, sizeof(char));
  }

  Attenuation = (TGraph**)calloc(nfibres, sizeof(TGraph*));
  Temperature = (TGraph**)calloc(nfibres, sizeof(TGraph*));
  TxPower = (TGraph**)calloc(nfibres, sizeof(TGraph*));
  RxPower = (TGraph**)calloc(nfibres, sizeof(TGraph*));
  int nentries = fibres_values->GetEntries();
  // Get data from TTree into the arrays
  for (int k = 0; k < nentries; k++) {
    fibres_values->GetEntry(k);
    x_val[(int)fibre_idx][(int)x/INTERVAL/60] = x + INTERVAL*60;
    y_val[(int)fibre_idx][(int)x/INTERVAL/60] = att;
    temp_val[(int)fibre_idx][(int)x/INTERVAL/60] = temperature_val;
    txpower_val[(int)fibre_idx][(int)x/INTERVAL/60] = Ptx_fibreval;
    rxpower_val[(int)fibre_idx][(int)x/INTERVAL/60] = Prx_fibreval;
    strcpy(fibrenames[fibre_idx], fibrename_val);
  }
  /* 
   * Create all TGraphs and TLegends
   */
  for (int i = 0; i < nfibres; i++) {
    // Fix null values
    for (int j = 0; j < time_entries; j++) {
      if (x_val[i][j] < 0) {
        x_val[i][j] = x_val[i][j - 1] + INTERVAL*60;
        y_val[i][j] = y_val[i][j - 1];
        temp_val[i][j] = temp_val[i][j - 1];
        txpower_val[i][j] = txpower_val[i][j - 1];
        rxpower_val[i][j] = rxpower_val[i][j - 1];
      }
      // If using time_plot, zoom in only in the interesting interval
      if ((time_plot == 0) || (j + time_plot*60/INTERVAL > time_entries)) {
        if (max_att < y_val[i][j])
          max_att = y_val[i][j];
        if (min_att > y_val[i][j])
          min_att = y_val[i][j];
        if (max_txpower < txpower_val[i][j])
          max_txpower = txpower_val[i][j];
        if (min_txpower > txpower_val[i][j])
          min_txpower = txpower_val[i][j];
        if (max_rxpower < rxpower_val[i][j])
          max_rxpower = rxpower_val[i][j];
        if (min_rxpower > rxpower_val[i][j])
          min_rxpower = rxpower_val[i][j];
        if (max_temp < temp_val[i][j])
          max_temp = temp_val[i][j];
        if (min_temp > temp_val[i][j])
          min_temp = temp_val[i][j];
      }
    }
    Attenuation[i] = new TGraph(time_entries, x_val[i], y_val[i]);
    Temperature[i] = new TGraph(time_entries, x_val[i], temp_val[i]);
    TxPower[i] = new TGraph(time_entries, x_val[i], txpower_val[i]);
    RxPower[i] = new TGraph(time_entries, x_val[i], rxpower_val[i]);
    att_legend->AddEntry(Attenuation[i], fibrenames[i], "LP");
    temperature_legend->AddEntry(Attenuation[i], fibrenames[i], "LP");
    txpower_legend->AddEntry(Attenuation[i], fibrenames[i], "LP");
    rxpower_legend->AddEntry(Attenuation[i], fibrenames[i], "LP");
  }

  // X axis reference for zooming in the last N hours intervals
  int rangeinit = (time_entries*INTERVAL - time_plot*60)*60;
  int rangeend = INTERVAL*60*(time_entries + 5*time_plot/12);   // Variable spacing depending on the number of hours, to make room for the legend

  // Time reference for the plots X axis
  data->GetEntry(0);
  char date1[20], date2[20];
  char time1[20], time2[20];
  sprintf(date1, date);
  sprintf(time1, time);
  data->GetEntry(datalen - 1);
  sprintf(date2, date);
  sprintf(time2, time);
  TDatime T0(getYear(date1), getMonth(date1), getDay(date1), getHour(time1), getMinute(time1) - INTERVAL, 00);
  int X0 = T0.Convert();
  gStyle->SetTimeOffset(X0);
  TDatime T1(getYear(date1), getMonth(date1), getDay(date1), getHour(time1), getMinute(time1), 00);
  int X1 = T1.Convert()-X0;
  TDatime T2(getYear(date2), getMonth(date2), getDay(date2), getHour(time2), getMinute(time2), 00);
  int X2 = T2.Convert()-X0 + INTERVAL*60;       // Move the lines to the left to leave some space for the legend
  
  /*
   * Attenuation plot
   */
  TCanvas *att_can = new TCanvas("C_att", "Attenuation", width, height);

  for (int i = 0; i < nfibres; i++) {
    Attenuation[i]->Draw(i==0?"AL":"L,same");
    Attenuation[i]->SetLineColor(i + 1);
    Attenuation[i]->SetLineWidth(2);
  }
  Attenuation[0]->GetYaxis()->SetRangeUser(floor(min_att*.95), ceil(max_att*1.05));
  if (time_plot > 0) {
    Attenuation[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
  }
  Attenuation[0]->GetYaxis()->SetTitle("Attenuation [dB]");
  Attenuation[0]->GetXaxis()->SetTitle("");
  Attenuation[0]->SetTitle("Fibres attenuation");
  Attenuation[0]->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");
  Attenuation[0]->GetXaxis()->SetTimeDisplay(1);
  Attenuation[0]->GetXaxis()->SetLabelOffset(0.03);
  
  att_legend->Draw();
  
  // Output to file
  char filename[200];
  if (time_plot > 0) {
    sprintf(filename, "attenuation_%d_hours.png", time_plot);
  }
  else {
    sprintf(filename, "attenuation.png");
  }
  att_can->Print(filename);
  
  if (do_time_plot < 0) {
    for (int i = 1; i < 3; i++) {
      sprintf(filename, "attenuation_%d_hours.png", time_plot_array[i]);
      
      int rangeinit = (time_entries*INTERVAL - time_plot_array[i]*60)*60;
      int rangeend = INTERVAL*60*(time_entries + 5*time_plot_array[i]/12);
      Attenuation[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
      float thisattmax = -1.;
      float thisattmin = 1000.;
      for (int j = 0; j < time_entries; j++) {
        for (int k = 0; k < nfibres; k++) {
          if (j + time_plot_array[i]*60/INTERVAL > time_entries) {
            if (y_val[k][j] > thisattmax)
              thisattmax = y_val[k][j];
            if (y_val[k][j] < thisattmin)
              thisattmin = y_val[k][j];
          }
        }
      }
      Attenuation[0]->GetYaxis()->SetRangeUser(floor(thisattmin*.95), ceil(thisattmax*1.05));
      
      att_can->Print(filename);
    }
  }
  
  /*
   * Transmitted power plot
   */
  TCanvas *txpower_can = new TCanvas("TxPower", "TxPower", width, height);
  
  for (int i = 0; i < nfibres; i++) {
    TxPower[i]->Draw(i==0?"AL":"L,same");
    TxPower[i]->SetLineColor(i + 1);
    TxPower[i]->SetLineWidth(2);
  }
  TxPower[0]->GetYaxis()->SetRangeUser((ceil(min_txpower) - 1), (floor(max_txpower) + 1));
  if (time_plot > 0) {
    TxPower[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend); 
  }
  TxPower[0]->GetYaxis()->SetTitle("TxPower [dBm]");
  TxPower[0]->GetXaxis()->SetTitle("");
  TxPower[0]->SetTitle("SFP Transmitted Power");
  TxPower[0]->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");
  TxPower[0]->GetXaxis()->SetTimeDisplay(1);
  TxPower[0]->GetXaxis()->SetLabelOffset(0.03);
  txpower_legend->Draw();
  
  if (time_plot > 0) {
    sprintf(filename, "txpower_%d_hours.png", time_plot);
  }
  else {
    sprintf(filename, "txpower.png");
  }
  txpower_can->Print(filename);
  if (do_time_plot < 0) {
    for (int i = 1; i < 3; i++) {
      sprintf(filename, "txpower_%d_hours.png", time_plot_array[i]);
      
      int rangeinit = (time_entries*INTERVAL - time_plot_array[i]*60)*60;
      int rangeend = INTERVAL*60*(time_entries + 5*time_plot_array[i]/12);
      TxPower[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
      float thistxpmax = -1000.;
      float thistxpmin = 1000.;
      for (int j = 0; j < time_entries; j++) {
        for (int k = 0; k < nfibres; k++) {
          if (j + time_plot_array[i]*60/INTERVAL > time_entries) {
            if (txpower_val[k][j] > thistxpmax)
              thistxpmax = txpower_val[k][j];
            if (txpower_val[k][j] < thistxpmin)
              thistxpmin = txpower_val[k][j];
          }
        }
      }
      TxPower[0]->GetYaxis()->SetRangeUser((ceil(thistxpmin) - 1), (floor(thistxpmax) + 1));
      
      txpower_can->Print(filename);
    }
  }
  
  
  
  /*
   * Received power plot
   */
  TCanvas *rxpower_can = new TCanvas("RxPower", "RxPower", width, height);
  
  for (int i = 0; i < nfibres; i++) {
    RxPower[i]->Draw(i==0?"AL":"L,same");
    RxPower[i]->SetLineColor(i + 1);
    RxPower[i]->SetLineWidth(2);
  }
  RxPower[0]->GetYaxis()->SetRangeUser((ceil(min_rxpower) - 1), (floor(max_rxpower) + 1));
  if (time_plot > 0) {
    RxPower[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
  }
  RxPower[0]->GetYaxis()->SetTitle("RxPower [dBm]");
  RxPower[0]->GetXaxis()->SetTitle("");
  RxPower[0]->SetTitle("SFP Received Power");
  RxPower[0]->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");
  RxPower[0]->GetXaxis()->SetTimeDisplay(1);
  RxPower[0]->GetXaxis()->SetLabelOffset(0.03);
  rxpower_legend->Draw();
  
  if (time_plot > 0) {
    sprintf(filename, "rxpower_%d_hours.png", time_plot);
  }
  else {
    sprintf(filename, "rxpower.png");
  }
  rxpower_can->Print(filename);
  if (do_time_plot < 0) {
    for (int i = 1; i < 3; i++) {
      sprintf(filename, "rxpower_%d_hours.png", time_plot_array[i]);
      
      int rangeinit = (time_entries*INTERVAL - time_plot_array[i]*60)*60;
      int rangeend = INTERVAL*60*(time_entries + 5*time_plot_array[i]/12);
      RxPower[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
      float thisrxpmax = -1000.;
      float thisrxpmin = 1000.;
      for (int j = 0; j < time_entries; j++) {
        for (int k = 0; k < nfibres; k++) {
          if (j + time_plot_array[i]*60/INTERVAL > time_entries) {
            if (rxpower_val[k][j] > thisrxpmax)
              thisrxpmax = rxpower_val[k][j];
            if (rxpower_val[k][j] < thisrxpmin)
              thisrxpmin = rxpower_val[k][j];
          }
        }
      }
      
      RxPower[0]->GetYaxis()->SetRangeUser((ceil(thisrxpmin) - 1), (floor(thisrxpmax) + 1));
      
      rxpower_can->Print(filename);
    }
  }
  
   
  /*
   * Temperature plot
   */
  TCanvas *temperature_can = new TCanvas("Temperature", "Temperature", width, height);
  
  for (int i = 0; i < nfibres; i++) {
    Temperature[i]->Draw(i==0?"AL":"L,same");
    Temperature[i]->SetLineColor(i + 1);
    Temperature[i]->SetLineWidth(2);
  }
  Temperature[0]->GetYaxis()->SetRangeUser((ceil(min_temp) - 1), (floor(max_temp) + 1));
  if (time_plot > 0) {
    Temperature[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
  }
  Temperature[0]->GetYaxis()->SetTitle("Temperature [^{o}C]");
  Temperature[0]->GetXaxis()->SetTitle("");
  Temperature[0]->SetTitle("SFP Temperature");
  Temperature[0]->GetXaxis()->SetTimeFormat("#splitline{%d/%m}{%H:%M}");
  Temperature[0]->GetXaxis()->SetTimeDisplay(1);
  Temperature[0]->GetXaxis()->SetLabelOffset(0.03);
  temperature_legend->Draw();
  
  if (time_plot > 0) {
    sprintf(filename, "temperature_%d_hours.png", time_plot);
  }
  else {
    sprintf(filename, "temperature.png");
  }
  temperature_can->Print(filename);
  if (do_time_plot < 0) {
    for (int i = 1; i < 3; i++) {
      sprintf(filename, "temperature_%d_hours.png", time_plot_array[i]);
      
      int rangeinit = (time_entries*INTERVAL - time_plot_array[i]*60)*60;
      int rangeend = INTERVAL*60*(time_entries + 5*time_plot_array[i]/12);
      Temperature[0]->GetXaxis()->SetRangeUser(rangeinit, rangeend);
      float thistempmax = -1.;
      float thistempmin = 1000.;
      for (int j = 0; j < time_entries; j++) {
        for (int k = 0; k < nfibres; k++) {
          if (j + time_plot_array[i]*60/INTERVAL > time_entries) {
            if (temp_val[k][j] > thistempmax)
              thistempmax = temp_val[k][j];
            if (temp_val[k][j] < thistempmin)
              thistempmin = temp_val[k][j];
          }
        }
      }
      
      Temperature[0]->GetYaxis()->SetRangeUser((ceil(thistempmin) - 1), (floor(thistempmax) + 1));
      
      temperature_can->Print(filename);
    }
  }
  

  // Free Willy
  free(fibres_values_temp);
  free(fibres_names_temp);
  
}
Ejemplo n.º 21
0
 std::complex<double> complex(T0 const& v0=T0(0), T1 const& v1 = T1(0)) {
     return std::complex<double>(v0,v1);
 }
Ejemplo n.º 22
0
/*
** The obliquity of the ecliptic (epsilon) can be calculated using the formula:
**
**	epsilon = 23.439 - 0.013T0 degrees
**
** where T0 is the time in Julian centuries from 12:00 UT on 1 January 2000
** to the midnight (UT) preceding the time of interest. Formula derived from
** the Almanac for Computers.
*/
double
epsilon(const double et)
{
  return 23.439 - 0.013 * T0(et);
}