Exemplo n.º 1
0
def rand(L, M, N, orient=sp.array.frontal):
    a = np.random.randint(2, size=(L, M, N))
    a = orient(a)
    st = sp.tensor.fromarray(a, orient)
    return sp.coo_tensor(st)
Exemplo n.º 2
0
import spartenpy as sp

L = 3
M = 4
N = 5

__test1 = np.array([[(0,  1, 0,  2),
                     [3,  0, 4,  0],
                     [0,  5, 6,  0]],
                    [[ 7, 0, 8,  0],
                     [ 0, 9, 10, 0],
                     [11, 0, 0,  12]]])

a = sp.array.frontal(__test1)
sta = sp.tensor.fromarray(a)
st = sp.coo_tensor(sta)

#st = sp.rand(L, M, N)
#st = sp.testten()

#print st.tensor.subs

#print st.tensor.subs[0]
#print st.tensor.subs[1]
#print st.tensor.subs[2]
#print st.tensor.vals

#print st

crsst = st.tocrs()