Ejemplo n.º 1
0
static int _real_cpx_objs_ok( QSP_ARG_DECL  Data_Obj *real_dp,Data_Obj *cpx_dp, const char *funcname )
{
	if( ! IS_COMPLEX(cpx_dp) ){
		sprintf(ERROR_STRING,
			"%s:  %s must be complex",funcname,OBJ_NAME(cpx_dp));
		WARN(ERROR_STRING);
		return FALSE;
	}
	if( ! IS_REAL(real_dp) ){
		sprintf(ERROR_STRING,
			"%s:  %s must be real",funcname,OBJ_NAME(real_dp));
		WARN(ERROR_STRING);
		return FALSE;
	}
	if( ! FLOATING_OBJ( cpx_dp ) ){
		sprintf(ERROR_STRING,
			"%s:  precision must be float or double",funcname);
		WARN(ERROR_STRING);
		return FALSE;
	}

	if( !dp_same_mach_prec(cpx_dp,real_dp,funcname) ){
		sprintf(ERROR_STRING,
	"%s:  complex object (%s,%s) and target (%s,%s) must have same precision",
			funcname,OBJ_NAME(cpx_dp),OBJ_MACH_PREC_NAME(cpx_dp),
			OBJ_NAME(real_dp),OBJ_MACH_PREC_NAME(real_dp));
		WARN(ERROR_STRING);
		return FALSE;
	}
	return TRUE;
}
Ejemplo n.º 2
0
static int is_good_for_inner(Data_Obj *dp,const char *func_name)
{
	int retval=1;

//#ifdef CAUTIOUS
//	if( dp == NO_OBJ ){
//		NWARN("CAUTIOUS:  is_good_for_inner passed null object pointer!?");
//		return(0);
//	}
//#endif /* CAUTIOUS */
	assert( dp != NO_OBJ );

	if( OBJ_COMPS(dp) > 1 ){
		sprintf(DEFAULT_ERROR_STRING,"%s:  object %s has %d components (should be 1)",
			func_name,OBJ_NAME(dp),OBJ_COMPS(dp));
		NWARN(DEFAULT_ERROR_STRING);
		retval=0;
	}
	if( OBJ_MACH_PREC(dp) != PREC_SP && OBJ_MACH_PREC(dp) != PREC_DP ){
		sprintf(DEFAULT_ERROR_STRING,"%s:  object %s has machine prec %s (should be float or double)",
			func_name,OBJ_NAME(dp),OBJ_MACH_PREC_NAME(dp) );
		NWARN(DEFAULT_ERROR_STRING);
		retval=0;
	}
	return(retval);
}
Ejemplo n.º 3
0
static int bad_plot_vec(QSP_ARG_DECL Data_Obj *dp,dimension_t n_comps_expected,const char *funcname)
{
    if( dp==NO_OBJ ) return 1;

    if( OBJ_PREC(dp) != PREC_SP ) {
        sprintf(ERROR_STRING,
                "%s:  data vector %s (%s) should have float precision",
                funcname,
                OBJ_NAME(dp),OBJ_MACH_PREC_NAME(dp));
        WARN(ERROR_STRING);
        return 1;
    }
    if( OBJ_COMPS(dp) != n_comps_expected ) {
        sprintf(ERROR_STRING,"%s:  data vector %s (%d) should have %d components",
                funcname,OBJ_NAME(dp),OBJ_COMPS(dp),n_comps_expected);
        WARN(ERROR_STRING);
        return 1;
    }
    return 0;
}