Beispiel #1
0
BooleanType Matrix::isDiagonal( ) const
{
	if (isSquare() == BT_FALSE)
		return BT_FALSE;

	for (unsigned i = 0; i < getNumRows( ); ++i)
		for (unsigned j = 0; j < getNumCols( ); ++j)
			if ((i != j) && (acadoIsZero( operator()(i, j) ) == BT_FALSE))
				return BT_FALSE;

	return BT_TRUE;
}
Beispiel #2
0
returnValue PlotWindow::getAutoScaleYLimits(	const VariablesGrid& dataGridY,
												PlotFormat plotFormat,
												double& lowerLimit,
												double& upperLimit
												) const
{
	double maxValue  = dataGridY.getMax( );
	double minValue  = dataGridY.getMin( );
	double meanValue = dataGridY.getMean( );

	if ( ( acadoIsZero( maxValue ) == BT_TRUE ) && ( acadoIsZero( minValue ) == BT_TRUE ) )
		meanValue = 0.1 / 0.025;

	lowerLimit = minValue - 0.1*( maxValue-minValue ) - 0.025*meanValue - 1.0e-8;
	upperLimit = maxValue + 0.1*( maxValue-minValue ) + 0.025*meanValue + 1.0e-8;

	
	if ( ( plotFormat == PF_LOG ) || ( plotFormat == PF_LOG_LOG ) )
	{
		if ( ( acadoIsStrictlyGreater( minValue,0.0, ZERO ) == BT_TRUE ) && ( acadoIsGreater( lowerLimit,0.0, ZERO ) == BT_FALSE ) )
		{
			lowerLimit = ( minValue + acadoMin( minValue,EPS ) ) / sqrt(10.0);
			upperLimit = upperLimit * sqrt(10.0);
		}
	}
	else
	{
		if ( ( acadoIsStrictlyGreater( minValue,0.0, ZERO ) == BT_TRUE ) && ( acadoIsGreater( lowerLimit,0.0, ZERO ) == BT_FALSE ) )
			lowerLimit = 0.0;

		if ( ( acadoIsStrictlySmaller( maxValue,0.0 ) == BT_TRUE ) && ( acadoIsSmaller( upperLimit,0.0 ) == BT_FALSE ) )
			upperLimit = 0.0;
	}
	
	return SUCCESSFUL_RETURN;
}