S-linear algebra in thermodynamical and mechanical theories