1 | /* Header file for functions defined in lsqnonneg.c */ |
---|

2 | |
---|

3 | /********************************************************************** |
---|

4 | Function GCI_lsqnonneg |
---|

5 | |
---|

6 | This function solves the non-negative least squares problem: |
---|

7 | minimise |Ax-b| subject to x >= 0 (where |v| is the 2-norm of the |
---|

8 | vector v). |
---|

9 | |
---|

10 | Arguments: A, an m x n matrix, in the form double A[n][m], so |
---|

11 | the columns of A are A[0], A[1], ..., A[n-1] |
---|

12 | b, the m-vector |
---|

13 | |
---|

14 | !!! NB: A and B will both be modified unless preserve is |
---|

15 | !!! non-zero (see below). |
---|

16 | |
---|

17 | x, the solution will be placed here |
---|

18 | m ) the dimensions of A |
---|

19 | n ) |
---|

20 | preserve, copy A and b before solving the problem |
---|

21 | rnorm, (double *) the value of |Ax-b| with the |
---|

22 | determined x if the function was successful or if the |
---|

23 | iteration count was exceeded. This can be NULL. |
---|

24 | lambda, an n-vector which will contain the dual vector |
---|

25 | on completion (that is, the Lagrange multipliers). |
---|

26 | This can be NULL. |
---|

27 | |
---|

28 | On exit: |
---|

29 | The return value will be 0 on success, and negative if |
---|

30 | a problem occurred: |
---|

31 | -1: m > MAX_EQNS or m <= 0 |
---|

32 | -2: n > MAX_VARS or n <= 0 |
---|

33 | -3: iteration count exceeded: more than 3*n iterations |
---|

34 | performed |
---|

35 | -4: memory allocation problems |
---|

36 | |
---|

37 | **********************************************************************/ |
---|

38 | |
---|

39 | int GCI_lsqnonneg(double **A, double *b, double *x, int m, int n, |
---|

40 | int preserve, double *rnorm, double *lambda); |
---|