Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Cramers-rule/Go/cramers-rule-1.go
Normal file
29
Task/Cramers-rule/Go/cramers-rule-1.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gonum.org/v1/gonum/mat"
|
||||
)
|
||||
|
||||
var m = mat.NewDense(4, 4, []float64{
|
||||
2, -1, 5, 1,
|
||||
3, 2, 2, -6,
|
||||
1, 3, 3, -1,
|
||||
5, -2, -3, 3,
|
||||
})
|
||||
|
||||
var v = []float64{-3, -32, -47, 49}
|
||||
|
||||
func main() {
|
||||
x := make([]float64, len(v))
|
||||
b := make([]float64, len(v))
|
||||
d := mat.Det(m)
|
||||
for c := range v {
|
||||
mat.Col(b, c, m)
|
||||
m.SetCol(c, v)
|
||||
x[c] = mat.Det(m) / d
|
||||
m.SetCol(c, b)
|
||||
}
|
||||
fmt.Println(x)
|
||||
}
|
||||
29
Task/Cramers-rule/Go/cramers-rule-2.go
Normal file
29
Task/Cramers-rule/Go/cramers-rule-2.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/skelterjohn/go.matrix"
|
||||
)
|
||||
|
||||
var m = matrix.MakeDenseMatrixStacked([][]float64{
|
||||
{2, -1, 5, 1},
|
||||
{3, 2, 2, -6},
|
||||
{1, 3, 3, -1},
|
||||
{5, -2, -3, 3},
|
||||
})
|
||||
|
||||
var v = []float64{-3, -32, -47, 49}
|
||||
|
||||
func main() {
|
||||
x := make([]float64, len(v))
|
||||
b := make([]float64, len(v))
|
||||
d := m.Det()
|
||||
for c := range v {
|
||||
m.BufferCol(c, b)
|
||||
m.FillCol(c, v)
|
||||
x[c] = m.Det() / d
|
||||
m.FillCol(c, b)
|
||||
}
|
||||
fmt.Println(x)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue