added for_each, count_if and compound matrix multiplier