correctly compute sw_trace_nd

Also, remove if test in sw_trace to gain alittle bit of performance. In addition, the documentation for these sections is updated accordingly.
`det` is complex, is it clear that only the real parts are used!?