matrix dimension & variance now local