Sha256: 77c55c77f0d7099ace4885e730556576ce46f5b78cb9a32d1dbaffa86e190d0e

Contents?: true

Size: 1.2 KB

Versions: 1

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)(ScsScaling *scal, ScsSolution *sol) {
  scs_int i;
  scs_float *D = scal->D;
  scs_float *E = scal->E;
  for (i = 0; i < scal->n; ++i) {
    sol->x[i] /= (E[i] / scal->dual_scale);
  }
  for (i = 0; i < scal->m; ++i) {
    sol->y[i] /= (D[i] / scal->primal_scale);
  }
  for (i = 0; i < scal->m; ++i) {
    sol->s[i] *= (D[i] * scal->dual_scale);
  }
}

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scs-0.3.2 vendor/scs/src/normalize.c