added function to matrix3