Exemplo n.º 1
0
def copyQueryFile(options):
    queryFileName   = utils.getCDSQueryFileName(options)
    print queryFileName

    if not os.path.exists(queryFileName):
        print 'copyQueryFile error:%s is not exists'%queryFileName
        exit(-1)
    command = 'cp %s kd_tree/query.txt'%queryFileName
    utils.executeCommand(command)
    print 'copyQueryFile complete'
Exemplo n.º 2
0
def copyQueryFile(options):
    queryFileName = utils.getCDSQueryFileName(options)
    print queryFileName

    if not os.path.exists(queryFileName):
        print 'copyQueryFile error:%s is not exists' % queryFileName
        exit(-1)
    command = 'cp %s kd_tree/query.txt' % queryFileName
    utils.executeCommand(command)
    print 'copyQueryFile complete'
Exemplo n.º 3
0
def convertNDDSToCDS(options):
    size = options['numberOfData']
    dim = options['numberOfDimension']
    distribution = options['distribution']
    cardinality = options['numberOfAlphabet']
    numberOfVP = options['numberOfVP']
    typeOfVP = options['typeOfVP']

    dataFileName = 'data/data_%d_%d_%s_%d.txt' % (size, dim, distribution,
                                                  cardinality)
    queryFileName = 'query/query_%d_%d_%s_%d.txt' % (size, dim, distribution,
                                                     cardinality)
    vpFileName = 'vp/vp_%d_%d_%d_%s.txt' % (dim, numberOfVP, cardinality,
                                            typeOfVP)
    cdsDataFileName = utils.getCDSDataFileName(options)
    cdsQueryFileName = utils.getCDSQueryFileName(options)
    #    cdsDataFileName     = 'cds_data/data_%d_%d_%s_%d_%s.txt'%(size,numberOfVP,distribution,cardinality,typeOfVP)
    #    cdsQueryFileName    = 'cds_query/query_%d_%d_%s_%d_%s.txt'%(size,numberOfVP,distribution,cardinality,typeOfVP)

    datas = utils.getDataInFile(dataFileName)
    querys = utils.readDataFromFile(queryFileName)
    vps = utils.readDataFromFile(vpFileName)
    print len(datas), len(querys), len(vps)

    cdsDatas = []
    for i in xrange(len(datas)):
        t = []
        for j in xrange(len(vps)):
            t.append(utils.hammingDistance(datas[i], vps[j]))
        cdsDatas.append(t)
    utils.writeDataToFile(cdsDataFileName, cdsDatas)

    cdsQuerys = []
    for i in xrange(len(querys)):
        t = []
        for j in xrange(len(vps)):
            t.append(utils.hammingDistance(querys[i], vps[j]))
        cdsQuerys.append(t)
    utils.writeDataToFile(cdsQueryFileName, cdsQuerys)
    print cdsDataFileName, cdsQueryFileName
Exemplo n.º 4
0
def convertNDDSToCDS(options):
    size            = options['numberOfData']
    dim             = options['numberOfDimension']
    distribution    = options['distribution']
    cardinality     = options['numberOfAlphabet']
    numberOfVP      = options['numberOfVP']
    typeOfVP        = options['typeOfVP']

    dataFileName    = 'data/data_%d_%d_%s_%d.txt'%(size,dim,distribution,cardinality)
    queryFileName   = 'query/query_%d_%d_%s_%d.txt'%(size,dim,distribution,cardinality)
    vpFileName      = 'vp/vp_%d_%d_%d_%s.txt'%(dim,numberOfVP,cardinality,typeOfVP)
    cdsDataFileName = utils.getCDSDataFileName(options)
    cdsQueryFileName= utils.getCDSQueryFileName(options)
#    cdsDataFileName     = 'cds_data/data_%d_%d_%s_%d_%s.txt'%(size,numberOfVP,distribution,cardinality,typeOfVP)
#    cdsQueryFileName    = 'cds_query/query_%d_%d_%s_%d_%s.txt'%(size,numberOfVP,distribution,cardinality,typeOfVP)

    datas   = utils.getDataInFile(dataFileName)
    querys  = utils.readDataFromFile(queryFileName)
    vps     = utils.readDataFromFile(vpFileName)
    print len(datas),len(querys),len(vps)

    cdsDatas = []
    for i in xrange(len(datas)):
        t = []
        for j in xrange(len(vps)):
            t.append(utils.hammingDistance(datas[i],vps[j]))
        cdsDatas.append(t)
    utils.writeDataToFile(cdsDataFileName,cdsDatas)

    cdsQuerys = []
    for i in xrange(len(querys)):
        t = []
        for j in xrange(len(vps)):
            t.append(utils.hammingDistance(querys[i],vps[j]))
        cdsQuerys.append(t)
    utils.writeDataToFile(cdsQueryFileName,cdsQuerys)
    print cdsDataFileName, cdsQueryFileName