Advertisement
Pietu1998

Any-Size Matrix Determinant Oneliner

Dec 8th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. det = lambda m:(lambda r,d:(lambda s,e:(lambda o:sum((lambda c:(lambda m,p:r(lambda f,m,p:1if len(p)<2else-f(f,m[1:],p[1:p.index(m[0])]+[p[0]]+p[p.index(m[0])+1:])if m[0]-p[0]else f(f,m[1:],p[1:]),m,p))(o,c)*r(lambda f,a:a[0]*f(f,a[1:])if a else 1,list(m[i+s*c[i]]for i in d(s))))((lambda m,i:r(lambda f,m,i:(lambda q:[m[i//q]]+f(f,m[:i//q]+m[i//q+1:],i%q))(e(len(m)-1))if m else[],m,i-1))(o,n+1))for n in d(e(s))))(list(d(s))))(int(len(m)**.5),lambda n:r(lambda f,a:a*f(f,a-1)if a else 1,n)))(lambda f,*a:f(f,*a),range)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement