The tr M denotes the trace of a matrix M; it is the sum of the elements along the diagonal. The trace of a matrix is normally used as a measure of the "size" of a matrix. The determinant is known as the product of the elements along its diagonal.
The determinant is majorly used in the system of linear equations; it indicates if the columns are linearly related, and it also helps to find the inverse of a matrix. For large matrices, the determinant is calculated using laplace expansion.
val detm: Matrix = Matrices.dense(3, 3, Array(1.0, 3.0, 5.0, 2.0, 4.0, 6.0, 2.0, 4.0, 5.0)) print(det(detm))