@@ -1171,13 +1171,17 @@ def __init__(self, cst: Any):
1171
1171
Var .__init__ (self , np .array (cst , dtype = np .int64 ), op = "Identity" )
1172
1172
elif isinstance (cst , float ):
1173
1173
Var .__init__ (self , np .array (cst , dtype = np .float64 ), op = "Identity" )
1174
+ elif isinstance (cst , complex ):
1175
+ Var .__init__ (self , np .array (cst , dtype = np .complex128 ), op = "Identity" )
1174
1176
elif isinstance (cst , list ):
1175
1177
if all (isinstance (t , bool ) for t in cst ):
1176
1178
Var .__init__ (self , np .array (cst , dtype = np .bool_ ), op = "Identity" )
1177
1179
elif all (isinstance (t , (int , bool )) for t in cst ):
1178
1180
Var .__init__ (self , np .array (cst , dtype = np .int64 ), op = "Identity" )
1179
1181
elif all (isinstance (t , (float , int , bool )) for t in cst ):
1180
1182
Var .__init__ (self , np .array (cst , dtype = np .float64 ), op = "Identity" )
1183
+ elif all (isinstance (t , (float , int , bool , complex )) for t in cst ):
1184
+ Var .__init__ (self , np .array (cst , dtype = np .complex128 ), op = "Identity" )
1181
1185
else :
1182
1186
raise ValueError (
1183
1187
f"Unable to convert cst (type={ type (cst )} ), value={ cst } ."
0 commit comments