/* * This file is part of qpOASES. * * qpOASES -- An Implementation of the Online Active Set Strategy. * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. * * qpOASES is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * qpOASES 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with qpOASES; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \file SRC/Indexlist.cpp * \author Hans Joachim Ferreau * \version 1.3embedded * \date 2007-2008 * * Implementation of the Indexlist class designed to manage index lists of * constraints and bounds within a QProblem_SubjectTo. */ #include /***************************************************************************** * P U B L I C * *****************************************************************************/ /* * I n d e x l i s t */ Indexlist::Indexlist( ) : length( 0 ), first( -1 ), last( -1 ), lastusedindex( -1 ), physicallength( INDEXLISTFACTOR*(NVMAX+NCMAX) ) { int i; for( i=0; i= 0 ) && ( number[n] >= 0 ) ) numberarray[i] = number[n]; else return THROWERROR( RET_INDEXLIST_CORRUPTED ); n = next[n]; } return SUCCESSFUL_RETURN; } /* * g e t I n d e x */ int Indexlist::getIndex( int givennumber ) const { int i; int n = first; int index = -1; /* return -1 by default */ /* Run trough indexlist until number is found, if so return it index. */ for ( i=0; i