
#THIS CODE IS AUTO-GENERATED by timeloop_tempate, DO NOT DIRECTLY EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!

from numba import njit, void, prange
import numpy as np
import math
from numpy import float64, int32, int64

@njit(nogil=True, cache=True)
def PREM_FRAC_PP(PREM_FREQ,T,REN_POL_TERM_Y,REN_T,PREM_PAYBL_Y):
	if PREM_FREQ==0:
		if T==1:
			return 1
		else:
			return 0
	else:
		if T>(REN_POL_TERM_Y*12 + 1):
			return 0
		else:
			if (REN_T==((PREM_PAYBL_Y*12)//(12/PREM_FREQ))*(12/PREM_FREQ)+1) or (T==(REN_POL_TERM_Y*12)+1):
				return max(PREM_PAYBL_Y*12-((REN_T-1)//((12/PREM_FREQ))+1)*12/PREM_FREQ,0)/12
			else:
				if (REN_T<=(PREM_PAYBL_Y*12)) and ((((T+11)*PREM_FREQ)%12)==0):
					return 1/PREM_FREQ
				else:
					return 0


@njit(nogil=True, parallel=True, cache=True)
def wrapped_PREM_FRAC_PP(PREM_FREQ,T,REN_POL_TERM_Y,REN_T,PREM_PAYBL_Y):
	arr_PREM_FRAC_PP=np.zeros(T.shape,dtype=float64)
	for y in prange(T.shape[0]):
		for t in range(T.shape[1]):
			arr_PREM_FRAC_PP[y,t]=PREM_FRAC_PP(PREM_FREQ[y,0],T[y,t],REN_POL_TERM_Y[y,0],REN_T[y,t],PREM_PAYBL_Y[y,0])
	return arr_PREM_FRAC_PP

d3832c11001f2aad1b0e293cd331713240bea694
<mask token>

<mask token>


@njit(nogil=True, cache=True)
def PREM_FRAC_PP(PREM_FREQ, T, REN_POL_TERM_Y, REN_T, PREM_PAYBL_Y):
    if PREM_FREQ == 0:
        if T == 1:
            return 1
        else:
            return 0
    elif T > REN_POL_TERM_Y * 12 + 1:
        return 0
    elif REN_T == PREM_PAYBL_Y * 12 // (12 / PREM_FREQ) * (12 / PREM_FREQ
        ) + 1 or T == REN_POL_TERM_Y * 12 + 1:
        return max(PREM_PAYBL_Y * 12 - ((REN_T - 1) // (12 / PREM_FREQ) + 1
            ) * 12 / PREM_FREQ, 0) / 12
    elif REN_T <= PREM_PAYBL_Y * 12 and (T + 11) * PREM_FREQ % 12 == 0:
        return 1 / PREM_FREQ
    else:
        return 0


<mask token>

<mask token>


@njit(nogil=True, cache=True)
def PREM_FRAC_PP(PREM_FREQ, T, REN_POL_TERM_Y, REN_T, PREM_PAYBL_Y):
    if PREM_FREQ == 0:
        if T == 1:
            return 1
        else:
            return 0
    elif T > REN_POL_TERM_Y * 12 + 1:
        return 0
    elif REN_T == PREM_PAYBL_Y * 12 // (12 / PREM_FREQ) * (12 / PREM_FREQ
        ) + 1 or T == REN_POL_TERM_Y * 12 + 1:
        return max(PREM_PAYBL_Y * 12 - ((REN_T - 1) // (12 / PREM_FREQ) + 1
            ) * 12 / PREM_FREQ, 0) / 12
    elif REN_T <= PREM_PAYBL_Y * 12 and (T + 11) * PREM_FREQ % 12 == 0:
        return 1 / PREM_FREQ
    else:
        return 0


@njit(nogil=True, parallel=True, cache=True)
def wrapped_PREM_FRAC_PP(PREM_FREQ, T, REN_POL_TERM_Y, REN_T, PREM_PAYBL_Y):
    arr_PREM_FRAC_PP = np.zeros(T.shape, dtype=float64)
    for y in prange(T.shape[0]):
        for t in range(T.shape[1]):
            arr_PREM_FRAC_PP[y, t] = PREM_FRAC_PP(PREM_FREQ[y, 0], T[y, t],
                REN_POL_TERM_Y[y, 0], REN_T[y, t], PREM_PAYBL_Y[y, 0])
    return arr_PREM_FRAC_PP

from numba import njit, void, prange
import numpy as np
import math
from numpy import float64, int32, int64


@njit(nogil=True, cache=True)
def PREM_FRAC_PP(PREM_FREQ, T, REN_POL_TERM_Y, REN_T, PREM_PAYBL_Y):
    if PREM_FREQ == 0:
        if T == 1:
            return 1
        else:
            return 0
    elif T > REN_POL_TERM_Y * 12 + 1:
        return 0
    elif REN_T == PREM_PAYBL_Y * 12 // (12 / PREM_FREQ) * (12 / PREM_FREQ
        ) + 1 or T == REN_POL_TERM_Y * 12 + 1:
        return max(PREM_PAYBL_Y * 12 - ((REN_T - 1) // (12 / PREM_FREQ) + 1
            ) * 12 / PREM_FREQ, 0) / 12
    elif REN_T <= PREM_PAYBL_Y * 12 and (T + 11) * PREM_FREQ % 12 == 0:
        return 1 / PREM_FREQ
    else:
        return 0


@njit(nogil=True, parallel=True, cache=True)
def wrapped_PREM_FRAC_PP(PREM_FREQ, T, REN_POL_TERM_Y, REN_T, PREM_PAYBL_Y):
    arr_PREM_FRAC_PP = np.zeros(T.shape, dtype=float64)
    for y in prange(T.shape[0]):
        for t in range(T.shape[1]):
            arr_PREM_FRAC_PP[y, t] = PREM_FRAC_PP(PREM_FREQ[y, 0], T[y, t],
                REN_POL_TERM_Y[y, 0], REN_T[y, t], PREM_PAYBL_Y[y, 0])
    return arr_PREM_FRAC_PP


#THIS CODE IS AUTO-GENERATED by timeloop_tempate, DO NOT DIRECTLY EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!

from numba import njit, void, prange
import numpy as np
import math
from numpy import float64, int32, int64

@njit(nogil=True, cache=True)
def PREM_FRAC_PP(PREM_FREQ,T,REN_POL_TERM_Y,REN_T,PREM_PAYBL_Y):
	if PREM_FREQ==0:
		if T==1:
			return 1
		else:
			return 0
	else:
		if T>(REN_POL_TERM_Y*12 + 1):
			return 0
		else:
			if (REN_T==((PREM_PAYBL_Y*12)//(12/PREM_FREQ))*(12/PREM_FREQ)+1) or (T==(REN_POL_TERM_Y*12)+1):
				return max(PREM_PAYBL_Y*12-((REN_T-1)//((12/PREM_FREQ))+1)*12/PREM_FREQ,0)/12
			else:
				if (REN_T<=(PREM_PAYBL_Y*12)) and ((((T+11)*PREM_FREQ)%12)==0):
					return 1/PREM_FREQ
				else:
					return 0


@njit(nogil=True, parallel=True, cache=True)
def wrapped_PREM_FRAC_PP(PREM_FREQ,T,REN_POL_TERM_Y,REN_T,PREM_PAYBL_Y):
	arr_PREM_FRAC_PP=np.zeros(T.shape,dtype=float64)
	for y in prange(T.shape[0]):
		for t in range(T.shape[1]):
			arr_PREM_FRAC_PP[y,t]=PREM_FRAC_PP(PREM_FREQ[y,0],T[y,t],REN_POL_TERM_Y[y,0],REN_T[y,t],PREM_PAYBL_Y[y,0])
	return arr_PREM_FRAC_PP
