generalized toLLVM to allow specification of num elements for known mats