Beispiel #1
0
func (m *mVariable) Verify(dataline string) float64 {
	refdata, err := matrix.FloatParse(dataline)
	if err != nil {
		fmt.Printf("parse error: %s", err)
		return 0.0
	}
	return blas.Nrm2Float(matrix.Minus(m.mtx, refdata))
}
Beispiel #2
0
func (m *mVariable) ShowError(dataline string) {
	refdata, err := matrix.FloatParse(dataline)
	if err != nil {
		fmt.Printf("parse error: %s", err)
		return
	}
	df := matrix.Minus(m.mtx, refdata)
	emtx, _ := matrix.FloatMatrixStacked(matrix.StackRight, m.mtx, refdata, df)
	fmt.Printf("my data | ref.data | diff \n%v\n", emtx.ToString(spformat))
}
Beispiel #3
0
func (u *epigraph) ShowError(line string) {
	lpar := strings.Index(line, "[")
	rpar := strings.LastIndex(line, "]")
	mstart := strings.Index(line, "{")
	refval, _ := matrix.FloatParse(line[mstart:rpar])
	fval, _ := strconv.ParseFloat(strings.Trim(line[lpar+1:mstart], " "), 64)
	df := matrix.Minus(u.m(), refval)
	em, _ := matrix.FloatMatrixStacked(matrix.StackRight, u.m(), refval, df)
	fmt.Printf("my data | ref.data | diff \n%v\n", em.ToString("%.4e"))
	d := u.t() - fval
	fmt.Printf("/%.4e/ | /%.4e/ | /%4e/\n", u.t(), fval, d)
}
Beispiel #4
0
// Implement Verifiable interface
func (u *epigraph) Verify(line string) float64 {
	diff := 0.0
	lpar := strings.Index(line, "[")
	rpar := strings.LastIndex(line, "]")
	mstart := strings.Index(line, "{")
	refval, _ := matrix.FloatParse(line[mstart:rpar])
	fval, _ := strconv.ParseFloat(strings.Trim(line[lpar+1:mstart], " "), 64)
	diff += blas.Nrm2Float(matrix.Minus(refval, u.m()))
	d := u.t() - fval
	diff += d * d
	return diff
}
Beispiel #5
0
func fromFile(name string, t *testing.T) *matrix.FloatMatrix {
	fd, ferr := os.Open(name)
	if ferr != nil {
		return nil
	}
	fi, _ := fd.Stat()
	buf := make([]byte, fi.Size(), fi.Size())
	n, _ := fd.Read(buf)
	t.Logf("read %d bytes ...%v\n", n, buf[0:20])
	data := string(buf)
	Ac, _ := matrix.FloatParse(data)
	return Ac
}
Beispiel #6
0
func (u *matrixVar) ShowError(dataline string) {
	refval, _ := matrix.FloatParse(dataline)
	em := matrix.Minus(u.val, refval)
	r, _ := matrix.FloatMatrixStacked(matrix.StackRight, u.val, refval, em)
	fmt.Printf("my data | ref.data | diff \n%v\n", r.ToString("%.4e"))
}
Beispiel #7
0
func (u *matrixVar) Verify(dataline string) float64 {
	diff := 0.0
	refval, _ := matrix.FloatParse(dataline)
	diff += blas.Nrm2Float(matrix.Minus(u.val, refval))
	return diff
}