A new efficient algorithm to compute the exact reflection and transmission factors for plane waves in layered absorbing media (liquids and solids)