§
    `ƒiè
  ã                   óè   — d dl mZ dZ ej        ddded¬¦  «        Z ej        dd	d
ed¬¦  «        Z ej        dd	ded¬¦  «        Z ej        dd	ded¬¦  «        Z ej        dd	ded¬¦  «        ZdS )é    )Ú_corea1  
#include <cupy/math_constants.h>

double __device__ entr(double x) {
    if (isnan(x)) {
        return CUDART_NAN;
    } else if (x > 0){
        return -x * log(x);
    } else if (x == 0){
        return 0;
    } else {
        return -CUDART_INF;
    }
}

double __device__ kl_div(double x, double y) {
    if (isnan(x) || isnan(y)) {
        return CUDART_NAN;
    } else if (x > 0 && y > 0) {
        return x * log(x / y) - x + y;
    } else if (x == 0 && y >= 0) {
        return y;
    } else {
        return CUDART_INF;
    }
}

double __device__ rel_entr(double x, double y) {
    if (isnan(x) || isnan(y)) {
        return CUDART_NAN;
    } else if (x > 0 && y > 0) {
        return x * log(x / y);
    } else if (x == 0 && y >= 0) {
        return 0;
    } else {
        return CUDART_INF;
    }
}

double __device__ huber(double delta, double r) {
    if (delta < 0) {
        return CUDART_INF;
    } else if (abs(r) <= delta) {
        return 0.5 * r * r;
    } else {
        return delta * (abs(r) - 0.5 * delta);
    }
}

double __device__ pseudo_huber(double delta, double r) {
    if (delta < 0) {
        return CUDART_INF;
    } else if (delta == 0 || r == 0) {
        return 0;
    } else {
        double u = delta;
        double v = r / delta;
        return u * u * (sqrt(1 + v * v) - 1);
    }
}

Úcupyx_scipy_special_entr)zf->fzd->dzout0 = out0_type(entr(in0));z^Elementwise function for computing entropy.

    .. seealso:: :meth:`scipy.special.entr`

    )ÚpreambleÚdocÚcupyx_scipy_special_kl_div)zff->fzdd->dz#out0 = out0_type(kl_div(in0, in1));ztElementwise function for computing Kullback-Leibler divergence.

    .. seealso:: :meth:`scipy.special.kl_div`

    Úcupyx_scipy_special_rel_entrz%out0 = out0_type(rel_entr(in0, in1));zkElementwise function for computing relative entropy.

    .. seealso:: :meth:`scipy.special.rel_entr`

    Úcupyx_scipy_special_huberz"out0 = out0_type(huber(in0, in1));zfElementwise function for computing the Huber loss.

    .. seealso:: :meth:`scipy.special.huber`

    Ú cupyx_scipy_special_pseudo_huberz)out0 = out0_type(pseudo_huber(in0, in1));ztElementwise function for computing the Pseudo-Huber loss.

    .. seealso:: :meth:`scipy.special.pseudo_huber`

    N)	Úcupyr   Ú_float_preambleÚcreate_ufuncÚentrÚkl_divÚrel_entrÚhuberÚpseudo_huber© ó    úx/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupyx/scipy/special/_convex_analysis.pyú<module>r      sÿ   ðØ Ð Ð Ð Ð Ð ð=€ð@ €uÔØÐ 0Ø"Øð	ð		ñ 	ô 	€ð 
ˆÔ	Ø Ð"4Ø)Øð	ð	
	ñ 
	ô 
	€ð ˆ5ÔØ"Ð$6Ø+Øð	ð		ñ 	ô 	€ð 	ˆÔØÐ!3Ø(Øð	ð			ñ 		ô 		€ð "ˆuÔ!Ø&Ð(:Ø/Øð	ð		ñ 	ô 	€€€r   