From feb8ebaeb76fa1c94de2dd7c4e5a0999b313f8c6 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Thu, 6 Jun 2019 20:09:32 +0200 Subject: GLPK 4.65 --- test/monniaux/glpk-4.65/src/intopt/spv.h | 83 ++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 test/monniaux/glpk-4.65/src/intopt/spv.h (limited to 'test/monniaux/glpk-4.65/src/intopt/spv.h') diff --git a/test/monniaux/glpk-4.65/src/intopt/spv.h b/test/monniaux/glpk-4.65/src/intopt/spv.h new file mode 100644 index 00000000..d7d4699f --- /dev/null +++ b/test/monniaux/glpk-4.65/src/intopt/spv.h @@ -0,0 +1,83 @@ +/* spv.h (operations on sparse vectors) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2007-2017 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef SPV_H +#define SPV_H + +typedef struct SPV SPV; + +struct SPV +{ /* sparse vector v = (v[j]) */ + int n; + /* dimension, n >= 0 */ + int nnz; + /* number of non-zero components, 0 <= nnz <= n */ + int *pos; /* int pos[1+n]; */ + /* pos[j] = k, 1 <= j <= n, is position of (non-zero) v[j] in the + * arrays ind and val, where 1 <= k <= nnz; pos[j] = 0 means that + * v[j] is structural zero */ + int *ind; /* int ind[1+n]; */ + /* ind[k] = j, 1 <= k <= nnz, is index of v[j] */ + double *val; /* double val[1+n]; */ + /* val[k], 1 <= k <= nnz, is a numeric value of v[j] */ +}; + +#define spv_create_vec _glp_spv_create_vec +SPV *spv_create_vec(int n); +/* create sparse vector */ + +#define spv_check_vec _glp_spv_check_vec +void spv_check_vec(SPV *v); +/* check that sparse vector has correct representation */ + +#define spv_get_vj _glp_spv_get_vj +double spv_get_vj(SPV *v, int j); +/* retrieve component of sparse vector */ + +#define spv_set_vj _glp_spv_set_vj +void spv_set_vj(SPV *v, int j, double val); +/* set/change component of sparse vector */ + +#define spv_clear_vec _glp_spv_clear_vec +void spv_clear_vec(SPV *v); +/* set all components of sparse vector to zero */ + +#define spv_clean_vec _glp_spv_clean_vec +void spv_clean_vec(SPV *v, double eps); +/* remove zero or small components from sparse vector */ + +#define spv_copy_vec _glp_spv_copy_vec +void spv_copy_vec(SPV *x, SPV *y); +/* copy sparse vector (x := y) */ + +#define spv_linear_comb _glp_spv_linear_comb +void spv_linear_comb(SPV *x, double a, SPV *y); +/* compute linear combination (x := x + a * y) */ + +#define spv_delete_vec _glp_spv_delete_vec +void spv_delete_vec(SPV *v); +/* delete sparse vector */ + +#endif + +/* eof */ -- cgit