Home | History | Annotate | Download | only in tools
      1 #!/usr/bin/python
      2 
      3 def gen(x, y):
      4     type = "mat" + str(x)
      5     if x != y:
      6         type = type + "x" + str(y)
      7     print type + " outerProduct(vec" + str(y) + " u, vec" + str(x) + " v)\n{"
      8     print "    " + type + " m;"
      9 
     10     for i in range(x):
     11         print "    m[" + str(i) + "] = u * v[" + str(i) + "];"
     12     print "    return m;\n}"
     13 
     14 print "#version 120"
     15 gen(2,2)
     16 gen(2,3) # mat2x3 means 2 columns, 3 rows
     17 gen(2,4)
     18 gen(3,2)
     19 gen(3,3)
     20 gen(3,4)
     21 gen(4,2)
     22 gen(4,3)
     23 gen(4,4)
     24