func (c *Cubic) Initialize(loc *uni.Location, obj *uni.Objective, grad *uni.Gradient) (err error) { //if c.step.Init() == math.NaN() { // c.step.SetInit(1) //} // Now initialize the three to set the initial location to the current location err = c.step.Initialize() if err != nil { return errors.New("cubic: error initializing: " + err.Error()) } // Initialize the rest of the memory c.prevF = obj.Init() c.initialGradNegative = (grad.Curr() < 0) c.currStepDirectionPositive = true c.deltaCurrent = 0.0 // How far is the current point from the initial point // Add in some checking on the Step Increase and decrease sizes return nil }