qpOASES-3.0beta/src/LAPACKReplacement.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  * Copyright (C) 2007-2011 by Hans Joachim Ferreau, Andreas Potschka,
6  * Christian Kirches et al. All rights reserved.
7  *
8  * qpOASES is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * qpOASES is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with qpOASES; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 
35 #include <math.h>
36 
37 
38 extern "C" void dpotrf_ (const char *uplo, const unsigned long *_n, double *a,
39  const unsigned long *_lda, long *info)
40 {
41  unsigned long n = *_n, lda = *_lda;
42  double sum;
43  unsigned long i, j;
44  int k;
45 
46  for( i=0; i<n; ++i )
47  {
48  /* j == i */
49  sum = a[i + lda*i];
50 
51  for( k=(i-1); k>=0; --k )
52  sum -= a[k+lda*i] * a[k+lda*i];
53 
54  if ( sum > 0.0 )
55  a[i+lda*i] = sqrt( sum );
56  else
57  {
58  if (info != 0)
59  *info = i+1;
60  return;
61  }
62 
63  for( j=(i+1); j<n; ++j )
64  {
65  sum = a[j*lda + i];
66 
67  for( k=(i-1); k>=0; --k )
68  sum -= a[k+lda*i] * a[k+lda*j];
69 
70  a[i+lda*j] = sum / a[i+lda*i];
71  }
72  }
73  if (info != 0)
74  *info = 0;
75 }
76 
77 
78 /*extern "C" void spotrf_ (const char *uplo, const unsigned long *n, double *a,
79  const unsigned long *lda, long *info)
80 {
81 
82 }*/
IntermediateState sqrt(const Expression &arg)
void dpotrf_(const char *uplo, const unsigned long *_n, double *a, const unsigned long *_lda, long *info)


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:47