def measure2(dtype0): tmp = numpy.repeat(numpy.datetime64(datetime.now(), dtype0), int(1e7)) start_time = datetime.now() result = qip.execute(hdl, '{0N!x}', tmp) time_elapsed = datetime.now() - start_time isSame = abs((result - tmp).astype(int)) < 1000 print('Time elapsed for {} : {} : {} '.format(str(tmp.dtype.name), time_elapsed, isSame.any()))
def measure1(dtype0): tmp = numpy.linspace(1, int(1e7), int(1e7), dtype=dtype0) start_time = datetime.now() result = qip.execute(hdl, '{0N!x}', tmp) time_elapsed = datetime.now() - start_time isSame = result == tmp print('Time elapsed for {} : {} : {}'.format(str(dtype0), time_elapsed, isSame.any()))
def measure4(): tmp = [ str(num) for num in numpy.linspace(1., 100., int(1e1), dtype=numpy.float) ] tmp = numpy.array(tmp) start_time = datetime.now() result = qip.execute(hdl, '{0N!x}', tmp) time_elapsed = datetime.now() - start_time isSame = result == tmp print('Time elapsed for {} : {} : {} '.format("str_", time_elapsed, isSame.any()))
import os from shutil import copyfile os.getcwd() copyfile('..\\x64\\Release\\qip.dll', 'qip.pyd') import numpy, pandas, uuid import qip hdl = qip.open_connection(8888) atoms = qip.execute(hdl, 'atoms') fatoms = qip.execute(hdl, 'flip atoms') t = atoms[['name', 'data']] t['from_kdb'] = [ qip.execute(hdl, '{x}', row['data']) for _, row in t.iterrows() ] t['isSame'] = t['data'] == t['from_kdb'] print("Number of error: {}".format(len(t[~t['isSame']]))) t = atoms[['name', 'ldata']] t