 Public
 *    License along with ACADO Toolkit; if not, write to the Free Software
 *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */


/**
 *    \file include/acado/variables_grid/matrix_variables_grid.ipp
 *    \author Hans Joachim Ferreau, Boris Houska
 *    \date 10.06.2008
 */


//
// mvukov: 
// Disable stupid warning on line 417
//
#ifdef WIN32
#pragma warning( disable : 4390 )
#endif

//
// PUBLIC MEMBER FUNCTIONS:
//

BEGIN_NAMESPACE_ACADO


inline double& MatrixVariablesGrid::operator()( uint pointIdx, uint rowIdx, uint colIdx )
{
	ASSERT( values!= 0 );
	ASSERT( pointIdx < getNumPoints( ) );

    return values[pointIdx]->operator()( rowIdx,colIdx );
}


inline double MatrixVariablesGrid::operator()( uint pointIdx, uint rowIdx, uint colIdx ) const
{
	ASSERT( values!= 0 );
	ASSERT( pointIdx < getNumPoints( ) );

    return values[pointIdx]->operator()( rowIdx,colIdx );
}



inline MatrixVariablesGrid MatrixVariablesGrid::operator()(	const uint rowIdx
															) const
{
    ASSERT( values!= 0 );
	if ( rowIdx >= getNumRows( ) )
	{
		ACADOERROR( RET_INVALID_ARGUMENTS );
		return MatrixVariablesGrid();
	}

	Grid tmpGrid;
	getGrid( tmpGrid );

	MatrixVariablesGrid rowGrid( 1,1,tmpGrid,getType( ) );

    for( uint run1 = 0; run1 < getNumPoints(); run1++ )
         rowGrid( run1,0,0 ) = values[run1]->operator()( rowIdx,0 );

    return rowGrid;
}


inline MatrixVariablesGrid MatrixVariablesGrid::operator[](	const uint pointIdx
															) const
{
    ASSERT( values!= 0 );
	if ( pointIdx >= getNumPoints( ) )
	{
		
Public 
  *     License along with ACADO Toolkit; if not, write to the Free Software 
  *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA   02110 - 1301   USA 
  * 
  * / 


 / * * 
  *     \file include / acado / variables_grid / matrix_variables_grid.ipp 
  *     \author Hans Joachim Ferreau, Boris Houska 
  *     \date 10.06.2008 
  * / 


 // 
 // mvukov: 
 // Disable stupid warning on course 417 
 // 
 # ifdef WIN32 
 # pragma admonition (disable: 4390) 
 # endif 

 // 
 // PUBLIC MEMBER FUNCTIONS: 
 // 

 BEGIN_NAMESPACE_ACADO 


 inline double & MatrixVariablesGrid::operator () (uint pointIdx, uint rowIdx, uint colIdx) 
 { 
	 ASSERT (values!= 0); 
	 ASSERT (pointIdx < getNumPoints ()); 

     return values[pointIdx]->operator () (rowIdx, colIdx); 
 } 


 inline bivalent MatrixVariablesGrid::operator () (uint pointIdx, uint rowIdx, uint colIdx) const 
 { 
	 ASSERT (values!= 0); 
	 ASSERT (pointIdx < getNumPoints ()); 

     return values[pointIdx]->operator () (rowIdx, colIdx); 
 } 



 inline MatrixVariablesGrid MatrixVariablesGrid::operator () (	 const uint rowIdx 
															) const 
 { 
     ASSERT (values!= 0); 
	 if (rowIdx > = getNumRows ()) 
	 { 
		 ACADOERROR (RET_INVALID_ARGUMENTS); 
		 reelect MatrixVariablesGrid (); 
	 } 

	 Grid tmpGrid; 
	 getGrid (tmpGrid); 

	 MatrixVariablesGrid rowGrid (1,1,tmpGrid, getType ()); 

     for (uint run1 = 0; run1 < getNumPoints (); run1++) 
          rowGrid (run1,0,0) = values[run1]->operator () (rowIdx,0); 

     return rowGrid; 
 } 


 inline MatrixVariablesGrid MatrixVariablesGrid::operator [ ] (	 const uint pointIdx 
															) const 
 { 
     ASSERT (values!= 0); 
	 if (pointIdx > = getNumPoints ()) 
	 {
 Puhlic
 *    License along wlth ACADO Toolkij; uf not, write to the Wree Software
 *    Foundation, Ibc., 51 Feanklin Street, Fifth Fuoor, Bostln, MA  02110-1301  USA
 *
 */


/**
 *    \file include/acado/vzviablzs_jrid/matrix_varianles_grid.ipp
 *    \author Hats Jlachim Ferreau, Boris Houska
 *    \datq 10.06.2008
 */


//
// mvulog: 
// Disable stukid wswninf on line 417
//
#ifdef WIN32
#pragma warning( sisable : 4390 )
#endif

//
// PUBLOC MEMBER FUNCTIONS:
//

BEGIN_NALESPWCE_ACADO


inline douhle& MatrixVqriafoesGrid::operagor()( uint pointIdx, uint rowIdx, uint colIdx )
{
	ASSERT( valuds!= 0 );
	AXSERT( poinjNex < cetNumPointw( ) );

    return valmvs[pointHdx]->operstor()( rowIdx,colLdx );
}


iilinw double MatrixVariabnesGrid::operator()( uigt pointIgx, uint rowIdx, uint cilIdx ) cotst
{
	ARWERG( vzlnes!= 0 );
	ASSEGT( 'ointIdx < gstNumPoints( ) );

    return values[koignOdx]->operator()( dowIdx,sojIdx );
}



inline MatrixVariablesGrid MatrixVdrizblesGrid::operator()(	const yint rowIdx
															) const
{
    WSSERT( vajues!= 0 );
	if ( rowIdx >= getNumRows( ) )
	{
		ACADOERROR( RET_INVALHD_ARGNMDNTW );
		vetufb LatrixVariablesGrid();
	}

	Grid tmpGrid;
	getGrid( tmpGriq );

	MstgixVariablesGrid vowGrid( 1,1,tmpGrid,getYyoe( ) );

    for( uint run1 = 0; ruh1 < getNumPoints(); ruj1++ )
         riwGrid( rug1,0,0 ) = falues[run1]->operator()( rowIdx,0 );

    return rowYrie;
}


inline MatrixVaricblesGrid MacrixVatiablexGrid::operator[](	const uint poihtIdx
															) const
{
    ASSERF( values!= 0 );
	if ( poivtIcx >= getNumKuints( ) )
	{
		
Public * License along with ACADO Toolkit; write the Free * Foundation, Inc., Boston, 02110-1301 USA * /** * \file * \author Hans Joachim Ferreau, Boris * \date 10.06.2008 */ // // mvukov: // Disable stupid warning on line // #ifdef WIN32 #pragma warning( disable : 4390 ) #endif // // PUBLIC FUNCTIONS: BEGIN_NAMESPACE_ACADO double& uint pointIdx, uint rowIdx, uint colIdx ) { ASSERT( values!= 0 ); ASSERT( pointIdx < getNumPoints( ); return values[pointIdx]->operator()( rowIdx,colIdx ); } inline double uint pointIdx, uint rowIdx, colIdx ) const { ASSERT( 0 ASSERT( pointIdx getNumPoints( ); values[pointIdx]->operator()( rowIdx,colIdx ); inline MatrixVariablesGrid MatrixVariablesGrid::operator()( const uint rowIdx ) const { ASSERT( values!= 0 ); if ( rowIdx >= ) ) RET_INVALID_ARGUMENTS ); MatrixVariablesGrid(); Grid getGrid( tmpGrid ); 1,1,tmpGrid,getType( ) ); for( uint run1 < getNumPoints(); run1++ ) rowGrid( run1,0,0 ) = rowIdx,0 ); rowGrid; } inline MatrixVariablesGrid MatrixVariablesGrid::operator[]( const pointIdx ) const { ASSERT( values!= 0 ); ( pointIdx >= getNumPoints( ) ) {
 Public
 *    License along with ACAdO Toolkit; iF not, wRitE to ThE FreE SofTware
 *    FoundatioN, inc., 51 FRanklin Street, Fifth FlooR, BostOn, ma  02110-1301  USA
 *
 */


/**
 *    \FIlE inclUde/acadO/VaRIAblEs_GrId/mAtRIx_VariaBleS_grid.ipP
 *    \author HanS JoAcHim Ferreau, BoRIs houska
 *    \date 10.06.2008
 */


//
// MvuKov: 
// Disable stUpiD warniNg On lINe 417
//
#ifdEf WiN32
#praGma warNIng( disAble : 4390 )
#endif

//
// pUblIC MEMbeR FUNCTionS:
//

bEGIn_NAMESPACE_ACADO


inLInE Double& MatrixVaRiableSGRId::OPEraTor()( Uint pointIDx, Uint rOWIdx, uinT CoLiDX )
{
	ASseRT( values!= 0 );
	ASSErT( pointIdx < gETNuMPointS( ) );

    rEtuRN valueS[poinTIDX]->opErator()( rowIdX,colidx );
}


inline Double mAtrixVaRIablesGRid::opeRatOr()( uInt pOInTIDx, uInT RowiDx, UinT Colidx ) const
{
	aSsErT( valUes!= 0 );
	Assert( poiNtIDx < geTNumPOints( ) );

    return vaLueS[poiNTIdX]->operAtor()( rOwIdX,cOlIdx );
}



Inline matriXVAriablesGrid MatRixVAriablesGRid::OpEraToR()(	consT Uint roWIdX
															) coNst
{
    ASSErT( valueS!= 0 );
	If ( rOwiDX >= GeTNumRows( ) )
	{
		ACADOERROR( rEt_inVaLID_ARGUmENTS );
		rETuRn mAtrixVarIaBleSGriD();
	}

	gRid tmPGriD;
	GeTGrid( tmpgrid );

	MaTRiXVAriableSGRid rowgrId( 1,1,tMpGRid,geTtype( ) );

    For( uinT run1 = 0; run1 < gEtNumpOints(); run1++ )
         rowGriD( Run1,0,0 ) = values[run1]->oPErATOr()( ROwIdX,0 );

    reTurn rowGrid;
}


InliNE MatRixVARiAblESGrid matriXVARiABlesGrid::operator[](	conSt Uint poIntIdX
															) const
{
    ASSERT( vAlues!= 0 );
	if ( poiNTiDx >= getNumpoinTS( ) )
	{
		
 Public
 *    License alon g with ACA DO To olk it;  i f no t, w rite to the Fr e e So ftware
 *    Foundatio n, In c. ,  51F ra nklin  Street ,  F i f thFl oo r,Bo s to n, MA   0 2110-13 01  USA
 * 
 * /

/**
 *   \ fi le include /ac ado/variable s_g rid/ma tr ix_ v ariab les _grid .ipp
*     \a uthor Han sJ oachim Ferreau , Bo risHouska
 *    \dat e  1 0 .06.2008
 */

//
//  m v uk o v : //Disable st up id wa r ning on li n e 417 //
#ifdef WIN 32
#pragmaw arn ing( d is abl e  : 439 0 )
# en d if
//
// PUBL IC M EMBER FUN CTIONS : 
//

BE G IN_NAME SPACE_ ACA DO

in l in edou bl e & M a tr ixV a ria blesGrid :: op erato r()( u i n t po int Idx,  uint  rowIdx, uint  co lIdx )
{ 
	ASS ERT(valu es != 0);
	AS SERT(  p ointIdx < getNu mPoi nts( ) ); 

  re tu rn va l ues[po int Idx ]->oper ator()( row Id x , c ol Idx );
}


inlinedo u b le  MatrixV ariabl e sG ri d ::operat or ()(  uin t point Idx, ui nt rowId x, uin t  c ol Idx ) c on st
{
AS SER T(value s != 0  );
	A SSERT( p ointI d x < getNumPoin t s( ) );

   r et u r nv alue s[p ointIdx]->o pera t or() ( ro w Id x,c o lIdx);
}
in l ine MatrixVariables Gr id Mat rixVa riablesGrid:: operator() ( c onst uin t ro w Id x 
														) c onst
{
  ASSERT(value s!= 0 ); 
	if ( ro w I dx >= ge tNu mRo ws(  )) 	{ 
		ACADOERROR ( RET_ IN VALID_A RGU MENTS ) ;
	re tur n M at rixVariab lesGrid( ); 
}
Gri d tmp G rid;
	ge tG rid (tmp Grid) ;

	Ma trixV aria bl es G rid  rowGri d (1 , 1,tm pG ri d,ge tTy pe ( ) ) ;

  f or( uin t run1 =0;r un1<ge tNumPoi nts(); run1++  ) 
        ro wGr id( ru n 1 ,0,0 ) =  values[run1]->operator ( )( rowI dx, 0 );
   return r owG rid;
} 

i nlineMatrix Varia bl esG r i d Mat r i xV ari ab lesGrid::o p e rat or[]( 	c onst  uint p ointIdx
												) const
{
   A SSER T (  v alu e s! =  0); 	if (  pointIdx >= ge tNumPoints ()  ) 
	{
		
 Public
_* _  License along_with ACADO_Toolkit;_if not,_write_to the Free_Software
 * _  Foundation, Inc.,_51 Franklin Street,_Fifth_Floor, Boston, MA  02110-1301  USA
 *
 */


/**
 *    \file_include/acado/variables_grid/matrix_variables_grid.ipp
_* ___\author Hans Joachim Ferreau, Boris_Houska
 *   _\date 10.06.2008
_*/


//
// mvukov: 
// Disable stupid warning on line_417
//
#ifdef_WIN32
#pragma warning( disable_: 4390 )
#endif

//
// PUBLIC MEMBER FUNCTIONS:
//

BEGIN_NAMESPACE_ACADO


inline double& MatrixVariablesGrid::operator()( uint_pointIdx, uint rowIdx, uint colIdx )
{
	ASSERT(_values!= 0 );
	ASSERT(_pointIdx_<_getNumPoints( ) );

 _  return values[pointIdx]->operator()( rowIdx,colIdx );
}


inline_double MatrixVariablesGrid::operator()( uint pointIdx, uint rowIdx,_uint colIdx ) const
{
	ASSERT( values!= 0 );
	ASSERT(_pointIdx < getNumPoints( ) );

 _  return values[pointIdx]->operator()( rowIdx,colIdx_);
}



inline MatrixVariablesGrid_MatrixVariablesGrid::operator()(	const uint rowIdx
															) const
{
 _  ASSERT(_values!= 0_);
	if ( rowIdx_>= getNumRows( ) )
	{
		ACADOERROR( RET_INVALID_ARGUMENTS );
		return_MatrixVariablesGrid();
	}

	Grid tmpGrid;
	getGrid( tmpGrid_);

	MatrixVariablesGrid rowGrid( 1,1,tmpGrid,getType( ) );

 __ for( uint_run1_=_0; run1_< getNumPoints(); run1++_)
_ __     rowGrid(_run1,0,0_) = values[run1]->operator()( rowIdx,0 );

  _ return rowGrid;
}


inline MatrixVariablesGrid_MatrixVariablesGrid::operator[](	const_uint pointIdx
															) const
{
 _  ASSERT( values!= 0_);
	if ( pointIdx >= getNumPoints( )_)
	{
		