OpenMS
NNLS.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <OpenMS/config.h>
38 
39 namespace OpenMS
40 {
41 
42  namespace NNLS
43  {
44  typedef int integer;
45 
46  /* SUBROUTINE NNLS (A,MDA,M,N,B,X,RNORM,W,ZZ,INDEX,MODE) */
47 
48  /* Algorithm NNLS: NONNEGATIVE LEAST SQUARES */
49 
50  /* The original version of this code was developed by */
51  /* Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory */
52  /* 1973 JUN 15, and published in the book */
53  /* "SOLVING LEAST SQUARES PROBLEMS", Prentice-Hall, 1974. */
54  /* Revised FEB 1995 to accompany reprinting of the book by SIAM. */
55 
56  /* GIVEN AN M BY N MATRIX, A, AND AN M-VECTOR, B, COMPUTE AN */
57  /* N-VECTOR, X, THAT SOLVES THE LEAST SQUARES PROBLEM */
58 
59  /* A * X = B SUBJECT TO X .GE. 0 */
60  /* ------------------------------------------------------------------ */
61  /* Subroutine Arguments */
62 
63  /* A(),MDA,M,N MDA IS THE FIRST DIMENSIONING PARAMETER FOR THE */
64  /* ARRAY, A(). ON ENTRY A() CONTAINS THE M BY N */
65  /* MATRIX, A. ON EXIT A() CONTAINS */
66  /* THE PRODUCT MATRIX, Q*A , WHERE Q IS AN */
67  /* M BY M ORTHOGONAL MATRIX GENERATED IMPLICITLY BY */
68  /* THIS SUBROUTINE. */
69  /* B() ON ENTRY B() CONTAINS THE M-VECTOR, B. ON EXIT B() CON- */
70  /* TAINS Q*B. */
71  /* X() ON ENTRY X() NEED NOT BE INITIALIZED. ON EXIT X() WILL */
72  /* CONTAIN THE SOLUTION VECTOR. */
73  /* RNORM ON EXIT RNORM CONTAINS THE EUCLIDEAN NORM OF THE */
74  /* RESIDUAL VECTOR. */
75  /* W() AN N-ARRAY OF WORKING SPACE. ON EXIT W() WILL CONTAIN */
76  /* THE DUAL SOLUTION VECTOR. W WILL SATISFY W(I) = 0. */
77  /* FOR ALL I IN SET P AND W(I) .LE. 0. FOR ALL I IN SET Z */
78  /* ZZ() AN M-ARRAY OF WORKING SPACE. */
79  /* INDEX() AN INTEGER WORKING ARRAY OF LENGTH AT LEAST N. */
80  /* ON EXIT THE CONTENTS OF THIS ARRAY DEFINE THE SETS */
81  /* P AND Z AS FOLLOWS.. */
82 
83  /* INDEX(1) THRU INDEX(NSETP) = SET P. */
84  /* INDEX(IZ1) THRU INDEX(IZ2) = SET Z. */
85  /* IZ1 = NSETP + 1 = NPP1 */
86  /* IZ2 = N */
87  /* MODE THIS IS A SUCCESS-FAILURE FLAG WITH THE FOLLOWING */
88  /* MEANINGS. */
89  /* 1 THE SOLUTION HAS BEEN COMPUTED SUCCESSFULLY. */
90  /* 2 THE DIMENSIONS OF THE PROBLEM ARE BAD. */
91  /* EITHER M .LE. 0 OR N .LE. 0. */
92  /* 3 ITERATION COUNT EXCEEDED. MORE THAN 3*N ITERATIONS. */
93  int OPENMS_DLLAPI nnls_(double * a, integer * mda, integer * m, integer *
94  n, double * b, double * x, double * rnorm, double * w,
95  double * zz, integer * index, integer * mode);
96 
97  /* Subroutine */
98  int OPENMS_DLLAPI g1_(double *, double *, double *, double *, double *);
99 
100  /* Subroutine */
101  int OPENMS_DLLAPI h12_(integer *, integer *, integer *, integer *, double *, integer *, double *, double *, integer *, integer *, integer *);
102 
103  /* Subroutine */
104  double OPENMS_DLLAPI diff_(double *, double *);
105 
106  /* Subroutine */
107  double OPENMS_DLLAPI d_sign_(double & a, double & b);
108  }
109 
110 }
111 
int h12_(integer *, integer *, integer *, integer *, double *, integer *, double *, double *, integer *, integer *, integer *)
int integer
Definition: NNLS.h:44
double diff_(double *, double *)
int nnls_(double *a, integer *mda, integer *m, integer *n, double *b, double *x, double *rnorm, double *w, double *zz, integer *index, integer *mode)
int g1_(double *, double *, double *, double *, double *)
double d_sign_(double &a, double &b)
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48