(l int, Q QMatrix, p_ []float64, y_ []int8, alpha_ []float64, Cp, Cn, eps float64, si *SolutionInfo, shrinking int)
| 420 | } |
| 421 | |
| 422 | func (this *Solver) Solve(l int, Q QMatrix, p_ []float64, y_ []int8, alpha_ []float64, Cp, Cn, eps float64, si *SolutionInfo, shrinking int) { |
| 423 | this.l = l |
| 424 | this.Q = Q |
| 425 | this.QD = Q.get_QD() |
| 426 | this.p = make([]float64, len(p_)) |
| 427 | copy(this.p, p_) |
| 428 | this.y = make([]int8, len(y_)) |
| 429 | copy(this.y, y_) |
| 430 | this.alpha = make([]float64, len(alpha_)) |
| 431 | copy(this.alpha, alpha_) |
| 432 | this.Cp = Cp |
| 433 | this.Cn = Cn |
| 434 | this.eps = eps |
| 435 | this.unshrink = false |
| 436 | |
| 437 | // initialize alpha_status |
| 438 | { |
| 439 | this.alpha_status = make([]int8, l) |
| 440 | for i := 0; i < l; i++ { |
| 441 | this.update_alpha_status(i) |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | // initialize active set (for shrinking) |
| 446 | { |
| 447 | this.active_set = make([]int, l) |
| 448 | for i := 0; i < l; i++ { |
| 449 | this.active_set[i] = i |
| 450 | } |
| 451 | this.active_size = l |
| 452 | } |
| 453 | |
| 454 | // initialize gradient |
| 455 | { |
| 456 | this.G = make([]float64, l) |
| 457 | this.G_bar = make([]float64, l) |
| 458 | var i int |
| 459 | for i = 0; i < l; i++ { |
| 460 | this.G[i] = this.p[i] |
| 461 | this.G_bar[i] = 0 |
| 462 | } |
| 463 | for i = 0; i < l; i++ { |
| 464 | if !this.is_lower_bound(i) { |
| 465 | Q_i := this.Q.get_Q(i, l) |
| 466 | alpha_i := this.alpha[i] |
| 467 | var j int |
| 468 | for j = 0; j < l; j++ { |
| 469 | this.G[j] += alpha_i * float64(Q_i[j]) |
| 470 | } |
| 471 | if this.is_upper_bound(i) { |
| 472 | for j = 0; j < l; j++ { |
| 473 | this.G_bar[j] += this.get_C(i) * float64(Q_i[j]) |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 |
no test coverage detected