September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,24 +1,19 @@
|
|||
function multarrays($a, $b) {
|
||||
$c = @()
|
||||
if($a -and $b) {
|
||||
$n = $a.count - 1
|
||||
$m = $b[0].count - 1
|
||||
$c = @(0)*($n+1)
|
||||
foreach ($i in 0..$n) {
|
||||
$c[$i] = foreach ($j in 0..$m) {
|
||||
$sum = 0
|
||||
foreach ($k in 0..$n){$sum += $a[$i][$k]*$b[$k][$j]}
|
||||
$sum
|
||||
}
|
||||
$n,$m,$p = ($a.Count - 1), ($b.Count - 1), ($b[0].Count - 1)
|
||||
if ($a[0].Count -ne $b.Count) {throw "Multiplication impossible"}
|
||||
$c = @(0)*($a[0].Count)
|
||||
foreach ($i in 0..$n) {
|
||||
$c[$i] = foreach ($j in 0..$p) {
|
||||
$sum = 0
|
||||
foreach ($k in 0..$m){$sum += $a[$i][$k]*$b[$k][$j]}
|
||||
$sum
|
||||
}
|
||||
}
|
||||
$c
|
||||
}
|
||||
function show($a) {
|
||||
if($a) {
|
||||
0..($a.count - 1) | foreach{ if($a[$_]){"$($a[$_])"}else{""} }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show($a) { $a | foreach{"$_"}}
|
||||
|
||||
$a = @(@(1,2),@(3,4))
|
||||
$b = @(@(5,6),@(7,8))
|
||||
$c = @(5,6)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue