#!/usr/bin/python3 import os,sys,math import numpy as np cudadec = "__host__ __device__" def typechar(dtype): sshort = "" #return short typechar given typestring match(dtype): case "double": sshort = "" case "float": sshort = "f" case "int": sshort = "i" return sshort def vtypename(dim,dtype): name = "cuvec{}{}".format(dim,typechar(dtype)) return name def mtypename(dim,dtype): name = "cumat{}{}".format(dim,typechar(dtype)) return name def vdc(dim): dcomp = "x" match(dim): case 0: dcomp = "x" case 1: dcomp = "y" case 2: dcomp = "z" case 3: dcomp = "w" return dcomp def genvecheaderv1(dim,dtype): lns = "" name = vtypename(dim,dtype) lns += "class {}\n".format(name) lns += "{\n\tpublic:\n" for I in range(0,dim): lns += "\t{} {};\n".format(dtype,vdc(I)) lns += "\n" lns += "\t{} {}();\n".format(cudadec,name) lns += "\t{} ~{}();\n".format(cudadec,name) lns += "\t{} {}(".format(cudadec,name) for I in range(0,dim): lns += "const {} &_{}".format(dtype,vdc(I)) if(I