add inv()and write some code for KL
finish the kl but not check!