LAPACKReplacement.cpp
Go to the documentation of this file.
00001 /*
00002  *      This file is part of qpOASES.
00003  *
00004  *      qpOASES -- An Implementation of the Online Active Set Strategy.
00005  *      Copyright (C) 2007-2011 by Hans Joachim Ferreau, Andreas Potschka,
00006  *      Christian Kirches et al. All rights reserved.
00007  *
00008  *      qpOASES is free software; you can redistribute it and/or
00009  *      modify it under the terms of the GNU Lesser General Public
00010  *      License as published by the Free Software Foundation; either
00011  *      version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *      qpOASES is distributed in the hope that it will be useful,
00014  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  *      See the GNU Lesser General Public License for more details.
00017  *
00018  *      You should have received a copy of the GNU Lesser General Public
00019  *      License along with qpOASES; if not, write to the Free Software
00020  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  *
00022  */
00023 
00024 
00035 #include <math.h>
00036 
00037 
00038 extern "C" void dpotrf_ (const char *uplo, const unsigned long *_n, double *a,
00039                                                  const unsigned long *_lda, long *info)
00040 {
00041         unsigned long n = *_n, lda = *_lda;
00042         double sum;
00043         unsigned long i, j;
00044         int k;
00045 
00046         for( i=0; i<n; ++i )
00047         {
00048                 /* j == i */
00049                 sum = a[i + lda*i];
00050 
00051                 for( k=(i-1); k>=0; --k )
00052                         sum -= a[k+lda*i] * a[k+lda*i];
00053 
00054                 if ( sum > 0.0 )
00055                         a[i+lda*i] = sqrt( sum );
00056                 else
00057                 {
00058                         if (info != 0)
00059                                 *info = i+1;
00060                         return;
00061                 }
00062 
00063                 for( j=(i+1); j<n; ++j )
00064                 {
00065                         sum = a[j*lda + i];
00066 
00067                         for( k=(i-1); k>=0; --k )
00068                                 sum -= a[k+lda*i] * a[k+lda*j];
00069 
00070                         a[i+lda*j] = sum / a[i+lda*i];
00071                 }
00072         }
00073         if (info != 0)
00074                 *info = 0;
00075 }
00076 
00077 
00078 /*extern "C" void spotrf_ (const char *uplo, const unsigned long *n, double *a,
00079                                                  const unsigned long *lda, long *info)
00080 {
00081 
00082 }*/


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:58