Possible PEP - two dimensional arrays?

wxjmfauth at gmail.com wxjmfauth at gmail.com
Wed Jun 8 04:13:16 EDT 2016


Lists (list of lists) in action.

>>> sys.version
'3.2.5 (default, May 15 2013, 23:06:03) [MSC v.1500 32 bit (Intel)]'
>>>
>>> zz = vecmat.NewMat(3, 2)
>>> zz[0][0] = 1.0; zz[0][1] = 2.0
>>> zz[1][0] = 3.0; zz[1][1] = 4.0
>>> zz[2][0] = 5.0; zz[2][1] = 5.0
>>> zz
[[1.0, 2.0], [3.0, 4.0], [5.0, 5.0]]
>>> vmio.pr(zz, 'zz=')
zz=
(   1.00000e+000  2.00000e+000 )
(   3.00000e+000  4.00000e+000 )
(   5.00000e+000  5.00000e+000 )
>>> aa, b, cc = svdecomp.SVDecomp(zz)
>>> bb = vecmat.VecToDiagMat(b)
>>> cct = vecmat.TransposeMat(cc)
>>> vmio.pr(aa, 'aa=')
aa=
(   6.91451e-001 -2.42761e-001 )
(   4.73049e-001 -5.59698e-001 )
(  -5.46004e-001 -7.92342e-001 )
>>> vmio.pr(bb, 'bb=')
bb=
(   8.25102e-001  0.00000e+000 )
(   0.00000e+000  8.90613e+000 )
>>> vmio.pr(cct, 'cct=')
cct=
(  -7.50721e-001  6.60619e-001 )
(  -6.60619e-001 -7.50721e-001 )
>>> rr = vecmat.MatMulMatMulMat(aa, bb, cct)
>>> vmio.pr(rr, 'rr=')
rr=
(   1.00000e+000  2.00000e+000 )
(   3.00000e+000  4.00000e+000 )
(   5.00000e+000  5.00000e+000 )
>>>



More information about the Python-list mailing list