def test_append2(self):
     ddesc = HDF5_DDesc(path=self.file, datapath='/earray', mode='a')
     a = blaze.empty('0 * 2 * float64', ddesc=ddesc)
     self.assertTrue(isinstance(a, blaze.Array))
     lvals = [[i,i*2] for i in range(10)]
     append(a, lvals)
     self.assertEqual([list(i) for i in a], lvals)
Пример #2
0
 def test_append2(self):
     persist = blaze.Storage(self.rooturi, format="blz")
     a = blaze.empty('0 * 2 * float64', storage=persist)
     self.assertTrue(isinstance(a, blaze.Array))
     lvals = [[i,i*2] for i in range(10)]
     append(a,lvals)
     self.assertEqual(dd_as_py(a._data), lvals)
 def test_append2(self):
     ddesc = BLZ_DDesc(path=self.rootdir, mode='w')
     a = blaze.empty('0 * 2 * float64', ddesc=ddesc)
     self.assertTrue(isinstance(a, blaze.Array))
     lvals = [[i,i*2] for i in range(10)]
     append(a, lvals)
     self.assertEqual([list(i) for i in a], lvals)
Пример #4
0
 def test_append2(self):
     persist = blaze.Persist(self.rooturi)
     a = blaze.empty('0, 2, float64', persist=persist)
     self.assert_(isinstance(a, blaze.Array))
     lvals = [[i,i*2] for i in range(10)]
     a.append(lvals)
     self.assertEqual(dd_as_py(a._data), lvals)
 def test_append2(self):
     ddesc = HDF5_DDesc(path=self.file, datapath='/earray', mode='a')
     a = blaze.empty('0 * 2 * float64', ddesc=ddesc)
     self.assertTrue(isinstance(a, blaze.Array))
     lvals = [[i, i * 2] for i in range(10)]
     append(a, lvals)
     self.assertEqual([list(i) for i in a], lvals)
 def test_append2(self):
     ddesc = BLZ_DDesc(path=self.rootdir, mode='w')
     a = blaze.empty('0 * 2 * float64', ddesc=ddesc)
     self.assertTrue(isinstance(a, blaze.Array))
     lvals = [[i, i * 2] for i in range(10)]
     append(a, lvals)
     self.assertEqual([list(i) for i in a], lvals)
 def op_alloc(self, op):
     dshape = op.type
     ddesc = op.metadata.get('ddesc') # TODO: ddesc!
     self.values[op] = blaze.empty(dshape, ddesc=ddesc)
Пример #8
0
 def op_alloc(self, op):
     dshape = op.type
     storage = op.metadata.get('storage') # TODO: storage!
     self.values[op] = blaze.empty(dshape, storage=storage)
Пример #9
0
    simple_execute_write(arr._data, res._data,
                         iter_dims=iter_dims, chunk=chunk)
    logging.info("took %f secs.\n", time.time()-t);
    if dump_result:
        logging.debug(res)

    return res


if __name__ == '__main__':
    root = logging.getLogger()
    root.setLevel(logging.DEBUG)
 
    operand_datashape = blaze.dshape('10, 10, 10, float64')

    op0 = blaze.empty(operand_datashape)
    op1 = blaze.empty(operand_datashape)

    shape = (a.val for a in operand_datashape.shape)

    from operator import add
    t = time.time()
    for el in it_product(*[xrange(i) for i in shape]):
        val = random.uniform(-math.pi, math.pi)
        factor = math.sqrt(reduce(add, [j * 10**i for i, j in enumerate(reversed(el))]))

        op0[el] = math.sin(val) * factor
        op1[el] = math.cos(val) * factor

    logging.info("initialization took %f seconds", (time.time()-t))
Пример #10
0
 def op_alloc(self, op):
     dshape = op.type
     storage = op.metadata.get('storage')  # TODO: storage!
     self.values[op] = blaze.empty(dshape, storage=storage)