int CLinearSystem::Reduce() { int operations = 0; for(int n = 0; n < m_n; n++) { NormalizeLine(n); for(int m = 0; m < m_m-1; m++) { if(Get(n,m) == 1) { for(int n2 = 0; n2 < m_n; n2++) { if(n == n2) continue; if(Get(n2,m) != 0) { SubstractLine(n,n2,Get(n2,m)); } } } } } return operations; }
/* ------------------------------------------------------------------------------- Class: CStifSectionParser Method: ParseStartAndEndPos Description: Start and end position parser. Parameters: TPtrC aSection: in: Parsed section const TDesC& aStartTag: in: Start tag of parsing TTagToReturnValue aTagIndicator: in: Will aStartTag included to the returned values TInt& aStartPos: inout: Start point of parsing TInt& aEndPos: inout: End point of parsing TInt& aLength: inout: Length of parsed section Return Values: TInt: Error code Errors/Exceptions: None Status: Proposal ------------------------------------------------------------------------------- */ TInt CStifSectionParser::ParseStartAndEndPos( TPtrC aSection, const TDesC& aStartTag, TTagToReturnValue aTagIndicator, TInt& aStartPos, TInt& aEndPos, TInt& aLength ) { TLex lex( aSection ); lex.SkipAndMark( iSkipAndMarkPos ); // Check is aStartTag given if ( aStartTag.Length() == 0 ) { // Skip line break, tabs, spaces etc. lex.SkipSpace(); aStartPos = lex.Offset(); } else { // While end of section and aStartTag is given while ( !lex.Eos() ) { lex.SkipSpace(); TPtrC line = SubstractLine( lex.Remainder() ); TInt tagStartPos = 0; TInt tagEndPos = 0; if ( FindTag( line, aStartTag, tagStartPos, tagEndPos ) == KErrNone ) { if ( aTagIndicator == ETag ) { aStartPos = lex.Offset(); } else { aStartPos = lex.Offset() + tagEndPos; if ( line.Length() - tagEndPos == 0 ) { return KErrNotFound; } } break; } GotoEndOfLine( lex ); } } // End tag parsing starts and if we are end of the section if( lex.Eos() ) { return KErrNotFound; } // "Delete" white spaces(includes line break) aEndPos = GotoEndOfLine( lex ); // Position where start next parsing.(End position, includes white spaces) iSkipAndMarkPos = lex.Offset(); // The length includes spaces and end of lines aLength = ( aEndPos - aStartPos ); return KErrNone; }