3 /***********************************************************************
4 * This code is part of GLPK (GNU Linear Programming Kit).
6 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
7 * 2009, 2010 Andrew Makhorin, Department for Applied Informatics,
8 * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
9 * E-mail: <mao@gnu.org>.
11 * GLPK is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * GLPK is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 * License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
23 ***********************************************************************/
25 typedef struct BFX BFX;
26 #define GLPBFX_DEFINED
36 BFX *bfx_create_binv(void)
37 { /* create factorization of the basis matrix */
39 bfx = xmalloc(sizeof(BFX));
45 int bfx_factorize(BFX *binv, int m, int (*col)(void *info, int j,
46 int ind[], mpq_t val[]), void *info)
47 { /* compute factorization of the basis matrix */
50 if (binv->lux != NULL && binv->lux->n != m)
51 { lux_delete(binv->lux);
54 if (binv->lux == NULL)
55 binv->lux = lux_create(m);
56 ret = lux_decomp(binv->lux, col, info);
57 binv->valid = (ret == 0);
61 void bfx_ftran(BFX *binv, mpq_t x[], int save)
62 { /* perform forward transformation (FTRAN) */
64 lux_solve(binv->lux, 0, x);
65 xassert(save == save);
69 void bfx_btran(BFX *binv, mpq_t x[])
70 { /* perform backward transformation (BTRAN) */
72 lux_solve(binv->lux, 1, x);
76 int bfx_update(BFX *binv, int j)
77 { /* update factorization of the basis matrix */
79 xassert(1 <= j && j <= binv->lux->n);
83 void bfx_delete_binv(BFX *binv)
84 { /* delete factorization of the basis matrix */
85 if (binv->lux != NULL)
86 lux_delete(binv->lux);