function similarity_transform(H, t_mat_opt) result(trans_H)
HElement_t(dp), intent(in) :: H(:, :)
HElement_t(dp), intent(in), optional :: t_mat_opt(:, :)
real(dp) :: trans_H(size(H, 1), size(H, 2))
HElement_t(dp) :: t_mat(size(H, 1), size(H, 2))
if (present(t_mat_opt)) then
t_mat = t_mat_opt
else
! otherwise assume the on-site correlation factor is used
t_mat = get_tranformation_matrix(H, nOccAlpha * nOccBeta)
end if
trans_H = blas_matmul(blas_matmul(matrix_exponential(-t_mat), H), matrix_exponential(t_mat))
end function similarity_transform