Sha256: a3435d074373f87f2f74b1d95f6e987f54e50640a31673a4041719a541352437

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

#include "normalize.h"

#include "linalg.h"
#include "scs.h"

/* needed for normalizing the warm-start */
void SCS(normalize_sol)(ScsWork *w, ScsSolution *sol) {
  scs_int i;
  scs_float *D = w->scal->D;
  scs_float *E = w->scal->E;
  for (i = 0; i < w->n; ++i) {
    sol->x[i] /= (E[i] / w->scal->dual_scale);
  }
  for (i = 0; i < w->m; ++i) {
    sol->y[i] /= (D[i] / w->scal->primal_scale);
  }
  for (i = 0; i < w->m; ++i) {
    sol->s[i] *= (D[i] * w->scal->dual_scale);
  }
}

void SCS(un_normalize_sol)(ScsWork *w, ScsSolution *sol) {
  scs_int i;
  scs_float *D = w->scal->D;
  scs_float *E = w->scal->E;
  for (i = 0; i < w->n; ++i) {
    sol->x[i] *= (E[i] / w->scal->dual_scale);
  }
  for (i = 0; i < w->m; ++i) {
    sol->y[i] *= (D[i] / w->scal->primal_scale);
  }
  for (i = 0; i < w->m; ++i) {
    sol->s[i] /= (D[i] * w->scal->dual_scale);
  }
}

void SCS(un_normalize_primal)(ScsWork *w, scs_float *r) {
  scs_int i;
  scs_float *D = w->scal->D;
  for (i = 0; i < w->m; ++i) {
    r[i] /= (D[i] * w->scal->dual_scale);
  }
}

void SCS(un_normalize_dual)(ScsWork *w, scs_float *r) {
  scs_int i;
  scs_float *E = w->scal->E;
  for (i = 0; i < w->n; ++i) {
    r[i] /= (E[i] * w->scal->primal_scale);
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scs-0.3.1 vendor/scs/src/normalize.c
scs-0.3.0 vendor/scs/src/normalize.c