def makeMap(self): self.map = pti.new("ptiIndex **") self.map = pti.cast("ptiIndex **", PTI.malloc(2 * pti.sizeof(self.map))) self.map[0] = pti.cast( "ptiIndex *", PTI.malloc(self.address.nrows * pti.sizeof(pti.new("ptiIndex *")))) for i in range(self.address.nrows): self.map[0][i] = i self.map[1] = pti.cast( "ptiIndex *", PTI.malloc(self.address.ncols * pti.sizeof(pti.new("ptiIndex *")))) for i in range(self.address.ncols): self.map[1][i] = i
def __init__(self, ncols, nrows): self.nthreads = (int)(os.popen('grep -c cores /proc/cpuinfo').read()) print(self.nthreads) self.address = pti.cast( "ptiMatrix *", PTI.malloc(self.nthreads * pti.sizeof(pti.new("ptiMatrix *")))) PTI.ptiMakeMatrixBuff(self.address, ncols, nrows)
def __init__(self, size): self.nthreads = (int)(os.popen('grep -c cores /proc/cpuinfo').read()) print(self.nthreads) self.address = pti.cast( "ptiValueVector *", PTI.malloc(self.nthreads * pti.sizeof(pti.new("ptiValueVector *")))) PTI.ptiMakeVectorBuff(self.address, size)
def convert(self, type="", blockbits=7, superblockbits=7): if (type == "hicoo"): result = HiCOOMatrix() nnz = pti.new("uint64_t *", self.nnz()) PTI.ptiSparseMatrixToHiCOO(result.address, nnz, self.address, blockbits, superblockbits) elif (type == "csr"): result = CSRMatrix() PTI.ptiSparseMatrixToCSR(result.address, self.address) elif (type == "dense"): result = DenseMatrix(self.address.nrows, self.address.ncols) for i in range(self.address.nnz): m = self.address.rowind.data[i] n = self.address.colind.data[i] data = self.address.values.data[i] result.setValue(m, n, data) else: print("[ERROR] Wrong sparse matrix type.") return result
def __init__(self): self.address = pti.new("ptiSparseTensor *") self.dimentions = 0 self.nthreads = (int)(os.popen('grep -c cores /proc/cpuinfo').read())
def __init__(self): self.address = pti.new("ptiSemiSparseTensorGeneral *")
def __init__(self): self.address = pti.new("ptiSparseTensorHiCOO *")
def __init__(self, length): self.address = pti.new("ptiValueVector *") PTI.ptiNewValueVector(self.address, length, length)
def __init__(self, length): self.address = pti.new("ptiNnzIndexVector *") PTI.ptiNewNnzIndexVector(self.address, length, length)
def __init__(self): self.address = pti.new("ptiSparseMatrix *") self.nthreads = (int)(os.popen('grep -c cores /proc/cpuinfo').read()) self.map = None
def __init__(self, nrows, ncols): self.address = pti.new("ptiMatrix *") PTI.ptiNewMatrix(self.address, nrows, ncols) PTI.ptiConstantMatrix(self.address, 0)
def __init__(self): self.address = pti.new("ptiSparseMatrixCSR *")