Determinant and permanent: Difference between revisions
Content added Content deleted
ReeceGoding (talk | contribs) (Added R.) |
ReeceGoding (talk | contribs) (→{{header|R}}: Simplified squareness check.) |
||
Line 2,274:
{
stopifnot(is.matrix(A))
▲ if(any(dimensions != n)) stop("Matrix is not square.")
if(n < 1) stop("Matrix has a dimension of size 0.")
sum(sapply(combinat::permn(n), function(sigma) prod(sapply(1:n, function(i) A[i, sigma[i]]))))
|