refactor det calculating, now det is calculated by decomposed matrix