matrix tools using lazy evaluations