def trialMakePolyList(v): # [i think this is experimental code by Huaicai, never called, perhaps never tested. -- bruce 051117]
    pMat = []
    for i in range(size(v)):
        pMat += [polyMat[i] * v[i]]
    
    segs = []
    for corner, edges, planes in polyTab:
      pts = size(planes)
      for i in range(pts):
          segs += [pMat[corner], pMat[planes[i]]]
          segs += [pMat[planes[i]], pMat[planes[(i+1)%pts]]]
    
    return segs
def trialMakePolyList(
    v
):  # [i think this is experimental code by Huaicai, never called, perhaps never tested. -- bruce 051117]
    pMat = []
    for i in range(size(v)):
        pMat += [polyMat[i] * v[i]]

    segs = []
    for corner, edges, planes in polyTab:
        pts = size(planes)
        for i in range(pts):
            segs += [pMat[corner], pMat[planes[i]]]
            segs += [pMat[planes[i]], pMat[planes[(i + 1) % pts]]]

    return segs
Beispiel #3
0
def povStrVec(va):  # review: refile in povheader or so? [bruce 071215 comment]
    # used in other modules too
    rstr = '<'
    for ii in range(size(va)):
        rstr += str(va[ii]) + ', '

    return rstr
Beispiel #4
0
def povStrVec(va): # review: refile in povheader or so? [bruce 071215 comment]
    # used in other modules too
    rstr = '<'
    for ii in range(size(va)):
        rstr += str(va[ii]) + ', '
    
    return rstr
Beispiel #5
0
        res = array((rand(*shape) - 0.5) * 100).astype(typecode)
    return res
shapes = [(), (), (7,), (7,), (7, 1), (1, 1), (1, 9), (9, 9), (9, 100),
          (200,100,3), (2, 3, 5), (200, 3, 5, 2)]

for type in TYPECODES:
    for a1, a2 in [(makeArray(s1, type),
                    makeArray(s2, type))
                   for s1, s2 in zip(shapes[:-1], shapes[1:])]:
        assert eq(numdot(a1, a2), dot(a1,a2)), "bad dot"
	# test vdot, but only for vectors
## 	for a in a1, a2:
## 	    if not (len(a.shape) == 1 or len(a.shape) == 2 and max(a.shape) == 1):
## 		break
## 	else:
        if size(a1) == size(a2):
	    assert eq(numvdot(a1, a2), vdot(a1,a2)),\
	    "bad vdot dot"
        if len(a2.shape) > 1:
            sh = list(a2.shape)
            sh[-2], sh[-1] =  sh[-1], sh[-2]
            #IPTHON BUG if this line is wrong, ipython's execption handling
            #breaks
            a2.shape = tuple(sh)
        assert eq(numinnerproduct(a1, a2), innerproduct(a1,a2)), \
               "bad innerproduct"
try: dot(lambda :3, lambda :4)
except TypeError: pass
else: assert 0, "illegal input not handled correctly"
try: dot([3,4], lambda :4)
except TypeError: pass