Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
package require math::linearalgebra
|
||||
package require struct::list
|
||||
|
||||
proc permanent {matrix} {
|
||||
for {set plist {};set i 0} {$i<[llength $matrix]} {incr i} {
|
||||
lappend plist $i
|
||||
}
|
||||
foreach p [::struct::list permutations $plist] {
|
||||
foreach i $plist j $p {
|
||||
lappend prod [lindex $matrix $i $j]
|
||||
}
|
||||
lappend sum [::tcl::mathop::* {*}$prod[set prod {}]]
|
||||
}
|
||||
return [::tcl::mathop::+ {*}$sum]
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
set mat {
|
||||
{1 2 3 4}
|
||||
{4 5 6 7}
|
||||
{7 8 9 10}
|
||||
{10 11 12 13}
|
||||
}
|
||||
puts [::math::linearalgebra::det $mat]
|
||||
puts [permanent $mat]
|
||||
Loading…
Add table
Add a link
Reference in a new issue