aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/glpk-4.65/src/bflib/ifu.h
blob: 1c67a80154f495191b02466f854f016c23711f9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* ifu.h (dense updatable IFU-factorization) */

/***********************************************************************
*  This code is part of GLPK (GNU Linear Programming Kit).
*
*  Copyright (C) 2012-2013 Andrew Makhorin, Department for Applied
*  Informatics, Moscow Aviation Institute, Moscow, Russia. All rights
*  reserved. E-mail: <mao@gnu.org>.
*
*  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 <http://www.gnu.org/licenses/>.
***********************************************************************/

#ifndef IFU_H
#define IFU_H

/***********************************************************************
*  The structure IFU describes dense updatable IFU-factorization.
*
*  The IFU-factorization has the following format:
*
*     A = inv(F) * U,                                                (1)
*
*  where A is a given (unsymmetric) nxn square matrix, F is a square
*  matrix, U is an upper triangular matrix. Obviously, the equality (1)
*  is equivalent to the following equality:
*
*     F * A = U.                                                     (2)
*
*  It is assumed that matrix A is small and dense, so matrices F and U
*  are stored by rows in dense format as follows:
*
*        1         n       n_max      1         n       n_max
*      1 * * * * * * x x x x        1 * * * * * * x x x x
*        * * * * * * x x x x          ? * * * * * x x x x
*        * * * * * * x x x x          ? ? * * * * x x x x
*        * * * * * * x x x x          ? ? ? * * * x x x x
*        * * * * * * x x x x          ? ? ? ? * * x x x x
*      n * * * * * * x x x x        n ? ? ? ? ? * x x x x
*        x x x x x x x x x x          x x x x x x x x x x
*        x x x x x x x x x x          x x x x x x x x x x
*        x x x x x x x x x x          x x x x x x x x x x
*  n_max x x x x x x x x x x    n_max x x x x x x x x x x
*
*             matrix F                     matrix U
*
*  where '*' are matrix elements, '?' are unused locations, 'x' are
*  reserved locations. */

typedef struct IFU IFU;

struct IFU
{     /* IFU-factorization */
      int n_max;
      /* maximal order of matrices A, F, U; n_max >= 1 */
      int n;
      /* current order of matrices A, F, U; 0 <= n <= n_max */
      double *f; /* double f[n_max*n_max]; */
      /* matrix F stored by rows */
      double *u; /* double u[n_max*n_max]; */
      /* matrix U stored by rows */
};

#define ifu_expand _glp_ifu_expand
void ifu_expand(IFU *ifu, double c[/*1+n*/], double r[/*1+n*/],
      double d);
/* expand IFU-factorization */

#define ifu_bg_update _glp_ifu_bg_update
int ifu_bg_update(IFU *ifu, double c[/*1+n*/], double r[/*1+n*/],
      double d);
/* update IFU-factorization (Bartels-Golub) */

#define ifu_gr_update _glp_ifu_gr_update
int ifu_gr_update(IFU *ifu, double c[/*1+n*/], double r[/*1+n*/],
      double d);
/* update IFU-factorization (Givens rotations) */

#define ifu_a_solve _glp_ifu_a_solve
void ifu_a_solve(IFU *ifu, double x[/*1+n*/], double w[/*1+n*/]);
/* solve system A * x = b */

#define ifu_at_solve _glp_ifu_at_solve
void ifu_at_solve(IFU *ifu, double x[/*1+n*/], double w[/*1+n*/]);
/* solve system A'* x = b */

#endif

/* eof */