Beispiel #1
0
void EXP_LVL5 CS_iisrs1 (	Const struct cs_Cmplx_ *xy,Const struct cs_Cmplx_ *AB,int nn,struct cs_Cmplx_ *new_xy)
{
	extern double cs_Two;

	int jj;

	double rr;
	double ss;

	struct cs_Cmplx_ last_cc;
	struct cs_Cmplx_ last_dd;
	struct cs_Cmplx_ new_cc;
	struct cs_Cmplx_ new_dd;
	struct cs_Cmplx_ tmp_dd;

	rr = cs_Two * xy->real;
	ss = xy->real * xy->real + xy->img * xy->img;

	new_cc.real = (double)nn * AB [nn].real;
	new_cc.img  = (double)nn * AB [nn].img;
	new_dd.real = (double)(nn - 1) * AB [nn - 1].real;
	new_dd.img  = (double)(nn - 1) * AB [nn - 1].img;

	for (jj = 2;jj <= (nn - 1);jj++)
	{
		last_cc.real = new_cc.real;
		last_cc.img  = new_cc.img ;
		last_dd.real = new_dd.real;
		last_dd.img  = new_dd.img ;

		CS_iikmul (&last_cc,rr,&new_cc);
		CS_iiadd  (&last_dd,&new_cc,&new_cc);

		CS_iikmul (&last_cc,ss,&new_dd);
		CS_iikmul (&AB [nn - jj],(double)(nn - jj),&tmp_dd);
		CS_iisub  (&tmp_dd,&new_dd,&new_dd);
	}

	CS_iimul (xy,&new_cc,new_xy);
	CS_iiadd (&new_dd,new_xy,new_xy);
	return;
}
Beispiel #2
0
void EXP_LVL5 CS_iisrs (Const struct cs_Cmplx_ *xy,Const struct cs_Cmplx_ *AB,int nn,struct cs_Cmplx_ *new_xy)
{
	extern double cs_Two;

	int jj;

	double rr;
	double ss;

	struct cs_Cmplx_ last_aa;
	struct cs_Cmplx_ last_bb;
	struct cs_Cmplx_ new_aa;
	struct cs_Cmplx_ new_bb;

	rr = cs_Two * xy->real;
	ss = xy->real * xy->real + xy->img * xy->img;

	new_aa.real = AB [nn].real;
	new_aa.img  = AB [nn].img;
	new_bb.real = AB [nn - 1].real;
	new_bb.img  = AB [nn - 1].img;

	for (jj = 2;jj <= nn;jj++)
	{
		last_aa.real = new_aa.real;
		last_aa.img  = new_aa.img ;
		last_bb.real = new_bb.real;
		last_bb.img  = new_bb.img ;

		CS_iikmul (&last_aa,rr,&new_aa);
		CS_iiadd  (&last_bb,&new_aa,&new_aa);

		CS_iikmul (&last_aa,ss,&new_bb);
		CS_iisub  (&AB [nn - jj],&new_bb,&new_bb);
	}

	CS_iimul (xy,&new_aa,new_xy);
	CS_iiadd (&new_bb,new_xy,new_xy);
	return;
}
Beispiel #3
0
void EXP_LVL5 CS_iisrs0 (Const struct cs_Cmplx_ *xy,Const struct cs_Cmplx_ *AB,int nn,struct cs_Cmplx_ *new_xy)
{
	extern double cs_Zero;

	int jj;

	struct cs_Cmplx_ sum;
	struct cs_Cmplx_ tmp;
	struct cs_Cmplx_ xy_pwr;

	sum.real = cs_Zero;
	sum.img  = cs_Zero;
	CS_iimul (xy,xy,&xy_pwr);
	for (jj = 2;jj <= nn;jj++)
	{
		CS_iikmul (&AB [jj],(double)(jj - 1),&tmp);
		CS_iimul  (&tmp,&xy_pwr,&tmp);
		CS_iiadd  (&sum,&tmp,&sum);
		CS_iimul (&xy_pwr,xy,&xy_pwr);
	}
	new_xy->real = sum.real;
	new_xy->img  = sum.img;
	return;
}
Beispiel #4
0
int EXP_LVL9 CSnzlndI (Const struct cs_Nzlnd_ *nzlnd,double ll [2],Const double xy [2])
{
	extern double cs_Radian;			/*  57.29577..... */
	extern double cs_Zero;				/* 0.0 */
	extern double cs_One;				/* 1.0 */
	extern double cs_K90;				/* 90.0 */
	
	int ii;
	int rtn_val;

	double xx;
	double yy;
	double rho;
	double lat;
	double del_psi,del_lat;

	struct cs_Cmplx_ zz;
	struct cs_Cmplx_ theta;
	struct cs_Cmplx_ theta1;
	struct cs_Cmplx_ theta2;

	rtn_val = cs_CNVRT_NRML;

	if (nzlnd->quad == 0)
	{
		xx = xy [XX] - nzlnd->x_off;
		yy = xy [YY] - nzlnd->y_off;
	}
	else
	{
		CS_quadI (&xx,&yy,xy,nzlnd->x_off,nzlnd->y_off,nzlnd->quad);
	}
	xx /= nzlnd->ka;
	yy /= nzlnd->ka;

	if (fabs (xx) > cs_One || fabs (yy) > cs_One)
	{
		rtn_val = cs_CNVRT_RNG;
		rho = sqrt (xx * xx + yy * yy);

		xx /= rho;
		yy /= rho;
	}

	zz.real = yy;
	zz.img  = xx;
	CS_iisrs (&zz,nzlnd->C_ary,6,&theta);

	for (ii = 0;ii < 2;ii++)
	{
		CS_iisrs1 (&theta,nzlnd->B_ary,6,&theta1);
		CS_iisrs0 (&theta,nzlnd->B_ary,6,&theta2);
		CS_iiadd  (&zz,&theta2,&theta2);
		CS_iidiv  (&theta2,&theta1,&theta);
	}

	del_psi = theta.real;
	del_lat = cs_Zero;
	for (ii = 8;ii >= 0;ii--)
	{
		del_lat = (del_lat + nzlnd->D_ary [ii]) * del_psi;
	}

	ll [LNG] = CS_adj180 (theta.img * cs_Radian) + nzlnd->org_lng;
	lat = CS_adj90  (del_lat / nzlnd->lat_kk) + nzlnd->org_lat;
	if (fabs (lat) > cs_K90)
	{
		rtn_val = cs_CNVRT_RNG;
		lat = CS_adj90 (lat);
	}
	ll [LAT] = lat;
	return (rtn_val);
}