示例#1
0
def rand_dp_nc_matrix(*args, **kwargs):
    dp_mat, nc_mat = None, None
    if len(kwargs) == 0:
        dp_mat, nc_mat = dp.Matrix(*args), nc.Matrix(*args)
    else:
        dp_mat, nc_mat = dp.Matrix(*args, **kwargs), nc.Matrix(*args, **kwargs)
    return dp_mat, nc_mat
示例#2
0
def rand_dp_nc_matrix(rows, cols, low=0, high=1, seed=0):
    return dp.Matrix(rows, cols, low=low, high=high, rand=True,
                     seed=seed), nc.Matrix(rows,
                                           cols,
                                           low=low,
                                           high=high,
                                           rand=True,
                                           seed=seed)
示例#3
0
def dp_nc_matrix(*args, **kwargs):
    if len(kwargs) > 0:
        return dp.Matrix(*args, **kwargs), nc.Matrix(*args, **kwargs)
    else:
        return dp.Matrix(*args), nc.Matrix(*args)
示例#4
0
import numc as nc
import dumbpy as dp
import pdb
import random
import utils
a = nc.Matrix(17, 5, 3.3)
da = dp.Matrix(17, 5, 3.3)
b = nc.Matrix(5, 17, 9)
db = dp.Matrix(5, 17, 9)

c = nc.Matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, -9.9])
dc = dp.Matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, -9.9])
e = nc.Matrix(1, 2, [1, 2])
f = nc.Matrix(1, 1, [3])
g = nc.Matrix(2, 2, [1, 2, 3, -4])
a.get(0, 0)
# pdb.set_trace()
# b[0]
# a[1]
# #a[0:0]
# #a[0,0]
# db[-1:]
# a[0:1] = [1,1]
# c[0:2,1]

# print("mul check")
# print("b*c == db * dc", b*c == db*dc)

#set sanity
z = nc.Matrix(2, 2, [1.1, 2.2, 3.3, -4.4])
x = dp.Matrix(2, 2, [1.1, 2.2, 3.3, -4.4])
示例#5
0
print("Lists Made")

fast_mat_large = numc.Matrix(lst1)
fast_vec_large = numc.Matrix(lst2)

fast_mat_med = numc.Matrix(lst3)
fast_vec_med = numc.Matrix(lst4)

fast_mat_weird = numc.Matrix(lst5)
fast_vec_weird = numc.Matrix(lst6)

fast_mat_small = numc.Matrix(lst7)
fast_vec_small = numc.Matrix(lst8)

slow_mat_large = dumbpy.Matrix(lst1)
slow_vec_large = dumbpy.Matrix(lst2)

slow_mat_med = dumbpy.Matrix(lst3)
slow_vec_med = dumbpy.Matrix(lst4)

slow_mat_weird = dumbpy.Matrix(lst5)
slow_vec_weird = dumbpy.Matrix(lst6)

slow_mat_small = dumbpy.Matrix(lst7)
slow_vec_small = dumbpy.Matrix(lst8)

print("Matrices Made")

# Scale
# Add
示例#6
0
try:
    a[4] = [5,4,6]
except IndexError:
    print("dumbpy index error seen")

try:
    b[4] = [5,4,6]
except IndexError:
    print("numc index error seen")
except:
    print("numc index error mismatch")
'''

#***********
#SLICE SLICE ERROR
a = dp.Matrix(3,3,2)
b = nc.Matrix(3,3,2)

try:
    a[0:1, 0:2] = [5]
except ValueError:
    print("dumbpy value error seen")
try:
    b[0:1, 0:2] = [5]
except ValueError:
    print("TRUE VAL ERROR")
except:
    print("FALSE VAL ERROR")

#~~~~~
try:
示例#7
0
def rand_dp_nc_matrix(rows, cols, seed=0):
    return dp.Matrix(rows, cols, rand=True, seed=seed), nc.Matrix(rows,
                                                                  cols,
                                                                  rand=True,
                                                                  seed=seed)