From b00e6523945e234fa19c07ff76630b6518da6d6b Mon Sep 17 00:00:00 2001 From: Yingjie Wang Date: Sun, 7 Dec 2025 11:18:20 -0500 Subject: [PATCH] fix: add fabs on the Jacobian --- src/render.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/render.c b/src/render.c index de0d798..663798d 100644 --- a/src/render.c +++ b/src/render.c @@ -26,7 +26,7 @@ double integrand_r(double *xy, size_t dim, void *integrand_params_void) { double rgb[3] = {0}; double theta_phi[2] = {theta, phi}; integrand_params->system->angle_to_pixel(theta_phi, rgb); - return rgb[0]*gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc); + return rgb[0]*fabs(gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc)); } double integrand_g(double *xy, size_t dim, void *integrand_params_void) { @@ -38,7 +38,7 @@ double integrand_g(double *xy, size_t dim, void *integrand_params_void) { double rgb[3] = {0}; double theta_phi[2] = {theta, phi}; integrand_params->system->angle_to_pixel(theta_phi, rgb); - return rgb[1]*gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc); + return rgb[1]*fabs(gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc)); } double integrand_b(double *xy, size_t dim, void *integrand_params_void) { @@ -50,7 +50,7 @@ double integrand_b(double *xy, size_t dim, void *integrand_params_void) { double rgb[3] = {0}; double theta_phi[2] = {theta, phi}; integrand_params->system->angle_to_pixel(theta_phi, rgb); - return rgb[2]*gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc); + return rgb[2]*fabs(gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc)); } int MC_pixel_render(const System *system, int i, int j, const Spline_data spline_data, double *rgb, int pixel_render_max, double pixel_render_err, gsl_rng *r){