src/ztransform.c
float dm2z(float dm, 
					 float omega0,
					 float omegal0)
{
	unsigned long i, ip1;
	float sdm,z;

	if(!zrf_initialized || omega0!=zrf_omega0 || omegal0!=zrf_omegal0) 
		init_zrf(omega0, omegal0);

	k_locate(zrf_dm, ZRF_NUM, (float)dm, &i);
	if(i==ZRF_NUM || i==ZRF_NUM-1) i=ZRF_NUM-2;
	if(i==-1) i=0;
	ip1=i+1;
	sdm=dm-zrf_dm[i];
	z=(zrf_z[i]+sdm*(zrf_z[ip1]-zrf_z[i])/(zrf_dm[ip1]-zrf_dm[i]));
	return(z);
}
/* Converts redshift z into distance modulus dm */
Converts redshift z into distance modulus dm
Converts redshift z into distance modulus dm
float dm2z(float dm, 
					 float omega0,
					 float omegal0)
{
	unsigned long i, ip1;
	float sdm,z;
	if(!zrf_initialized || omega0!=zrf_omega0 || omegal0!=zrf_omegal0) 
		init_zrf(omega0, omegal0);
	k_locate(zrf_dm, ZRF_NUM, (float)dm, &i);
	if(i==ZRF_NUM || i==ZRF_NUM-1) i=ZRF_NUM-2;
	if(i==-1) i=0;
	ip1=i+1;
	sdm=dm-zrf_dm[i];
	z=(zrf_z[i]+sdm*(zrf_z[ip1]-zrf_z[i])/(zrf_dm[ip1]-zrf_dm[i]));
	return(z);
}
float dm2z ( float dm , float omega0 , float omegal0 ) { unsigned long i , ip1 ; float sdm , z ; if ( ! zrf_initialized || omega0 != zrf_omega0 || omegal0 != zrf_omegal0 ) init_zrf ( omega0 , omegal0 ) ; k_locate ( zrf_dm , ZRF_NUM , ( float ) dm , & i ) ; if ( i == ZRF_NUM || i == ZRF_NUM - 1 ) i = ZRF_NUM - 2 ; if ( i == -1 ) i = 0 ; ip1 = i + 1 ; sdm = dm - zrf_dm [ i ] ; z = ( zrf_z [ i ] + sdm * ( zrf_z [ ip1 ] - zrf_z [ i ] ) / ( zrf_dm [ ip1 ] - zrf_dm [ i ] ) ) ; return ( z ) ; }
Converts redshift z into distance modulus dm
Converts redshift z into distance modulus dm