func (a *epiMatrixA) Af(u, v MatrixVariable, alpha, beta float64, trans la.Option) (err error) { err = nil if trans.Equal(la.OptNoTrans) { ue, u_ok := u.(*epigraph) ve := v.Matrix() if !u_ok { return errors.New("'u' not a epigraph") } err = a.A.Af(ue.m(), ve, alpha, beta, trans) } else { ve, v_ok := v.(*epigraph) ue := u.Matrix() if !v_ok { return errors.New("'v' not a epigraph") } err = a.A.Af(ue, ve.m(), alpha, beta, trans) ve.set(ve.t() * beta) } return }
func (g *epMatrixG) Gf(u, v MatrixVariable, alpha, beta float64, trans la.Option) (err error) { err = nil if trans.Equal(la.OptNoTrans) { ue, u_ok := u.(*epigraph) ve := v.Matrix() if !u_ok { fmt.Printf("Df: not a epigraph\n") return errors.New("'u' not a epigraph") } err = sgemv(g.G, ue.m(), ve, alpha, beta, g.dims, trans) } else { ve, v_ok := v.(*epigraph) ue := u.Matrix() if !v_ok { return errors.New("'v' not a epigraph") } err = sgemv(g.G, ue, ve.m(), alpha, beta, g.dims, trans) ve.set(beta * ve.t()) } return }
func (d *epigraphDf) Df(u, v MatrixVariable, alpha, beta float64, trans la.Option) (err error) { err = nil if trans.Equal(la.OptNoTrans) { u_e, u_ok := u.(*epigraph) v_e := v.Matrix() if !u_ok { fmt.Printf("Df: not a epigraph\n") return errors.New("'u' not a epigraph") } err = blas.GemvFloat(d.df, u_e.m(), v_e, alpha, beta, la.OptNoTrans) v_e.Add(-alpha*u_e.t(), 0) } else { v_e, v_ok := v.(*epigraph) u_e := u.Matrix() if !v_ok { fmt.Printf("Df: not a epigraph\n") return errors.New("'v' not a epigraph") } err = blas.GemvFloat(d.df, u_e, v_e.m(), alpha, beta, la.OptTrans) v_e.set(-alpha*u_e.GetIndex(0) + beta*v_e.t()) } return }