Determinant and permanent: Difference between revisions
Content added Content deleted
(+Stata) |
|||
Line 2,128: | Line 2,128: | ||
Two auxiliary functions: '''range1(n,i)''' returns the column vector with numbers 1 to n except i is removed. |
Two auxiliary functions: '''range1(n,i)''' returns the column vector with numbers 1 to n except i is removed. |
||
And '''submat(a,i,j)''' returns matrix a with row i and column j removed. |
And '''submat(a,i,j)''' returns matrix a with row i and column j removed. |
||
For x=-1, the main function '''sumrec(a,x)''' computes the determinant of a by |
For x=-1, the main function '''sumrec(a,x)''' computes the determinant of a by developing the determinant along the first column. For x=1, one gets the permanent. |
||
<lang>real vector range1(real scalar n, real scalar i) { |
<lang>real vector range1(real scalar n, real scalar i) { |