コード例 #1
0
        ##  NOTE:  testing shows -z 47 will work            ##
        ######################################################
        # trunc_to_zero_bits = 52

        ######################################################

        ##  TODO: find out the space in which this test fails!!!

        ##  DBL_MANT_DIG is the number of digits in FLT_MANT  ##
        ##  why aren't we using DBL_MANT_BITS  ??????? the number of bits
        ##  used in the mantissa

        ######################################################

        verbose = 1
        pylarc.initialize_larc(matrix_exponent, op_exponent, max_level,
                               rnd_sig_bits, trunc_to_zero_bits, verbose)
        pylarc.create_report_thread(180)
        print_naive = 0
        print_nonzeros = 0
        print("Problem size is small enough to run on desktop")
        if print_naive:
            print("  will print files of naive matrices")
        else:
            print("  not printing files of naive matrices")
        if print_nonzeros:
            print("  will print files of nonzero matrices\n")
        else:
            print("  not printing files of nonzero matrices\n")
    ## LARGE STORES for cs1l,cs4l,cs9l
    else:
        ## matrix_exponent = 26
コード例 #2
0
ファイル: circulant.py プロジェクト: LARCmath/LARC
from ctypes import *

if __name__ == '__main__':
    # This version references matrices by matrixID instead of pointers

    print("This code tests some basic matrix building and reading routines\n")

    # initialize larc
    mat_store_exp = 26
    op_store_exp = 24
    max_level = 10
    rnd_sig_bits = -1  # default value
    trunc_to_zero_bits = -1  # default value
    pylarc.create_report_thread(1800)
    verbose = 1
    pylarc.initialize_larc(mat_store_exp, op_store_exp, max_level,
                           rnd_sig_bits, trunc_to_zero_bits, verbose)

    # In the Makefile you can compile with different scalarType values
    # Define string for using in formating filenames
    scalarTypeStr = pylarc.cvar.scalarTypeStr

    # Calculate number of matrices created, then print part of matrix store
    num_matrices_made = pylarc.num_matrices_created()
    print("\n%d matrices have been created" % num_matrices_made)
    end = num_matrices_made - 1

    # build array in C from Python list of scalars
    print("Using row_major_list_to_store on data entered from python\n")

    # parameters for entering the python array into the store
    level = 7
コード例 #3
0
ファイル: exampleLARC.py プロジェクト: LARCmath/LARC
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR   #
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, #
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.             #
#                                                                #
##################################################################

from __future__ import print_function

import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../../src"))
import pylarc
from ctypes import *

# initialize larc and make sure it's set up for integers
pylarc.initialize_larc(26, 24, 15, -1, -1, 1)
#if pylarc.cvar.scalarTypeDef != 'z':
#    print("ERROR: remake with type MPINTEGER")
#    sys.exit()

# manipulate some numbers in python
typeChar = pylarc.cvar.scalarTypeDef
if typeChar == 'i':
    x = 2**5
    more = [x, 2**10, 2**15, 2**20]
elif typeChar == 'z':
    x = 2**25
    more = [x, 2**100, 2**50, 2**75]
elif typeChar == 'r':
    x = 3.77 * (2**5)
    more = [x, x * 2**10, x * 2**15, x * 2**20]