Example #1
0
def load_pre_calculated_g_bn_mat():
    global g_bn_mat

    # load pre-calculated g_bn_mat
    file_name = 'outputs_dirich\\bn_upto_1024.txt'
    g_bn_mat_2d_list = read_2d_data_list_from_file(file_name )
    g_bn_mat = np.asarray(g_bn_mat_2d_list)
Example #2
0
def pre_calculate_bn_upto_max_num_and_save_to_file(max_num):

    # pre_calcuate bn up to 2^l_range
    l_range = int(round(np.log2(max_num)))
    g_bn_mat = pre_calculate_bn_upto(l_range)
    print g_bn_mat

    file_name = 'outputs_dirich\\bn_upto_%d.txt'%(max_num)
    write_2d_data_list_to_file(file_name, g_bn_mat)
    g_bn_mat_again = read_2d_data_list_from_file(file_name )
    print 'g_bn_mat_again: ', g_bn_mat_again
    verify_two_2d_mat_same(g_bn_mat, g_bn_mat_again)
Example #3
0
def pre_calculate_indice_upto_max_num_and_save_to_file(g_max_num):

    # pre_calculate_all_indice_upto max_num,
    # internally, it will find smallest prim_root 1st
    g_indice_g_n_mat = get_all_indice_upto(g_max_num)
    print g_indice_g_n_mat
    file_name = 'outputs_dirich\\indice_gn_upto_%d.txt'%(g_max_num)
    write_2d_data_list_to_file(file_name, g_indice_g_n_mat)

    # read the data back, verify they are correct
    g_indice_g_n_mat_again = read_2d_data_list_from_file(file_name )
    print 'g_indice_g_n_mat_again: ', g_indice_g_n_mat_again
    verify_two_2d_mat_same(g_indice_g_n_mat, g_indice_g_n_mat_again)