MCPcopy Create free account
hub / github.com/NeuralNetworkVerification/Marabou / commitChange

Method commitChange

src/basis_factorization/CSRMatrix.cpp:545–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545void CSRMatrix::commitChange( unsigned row, unsigned column, double newValue )
546{
547 ASSERT( FloatUtils::wellFormed( newValue ) );
548
549 // First check whether the entry already exists
550 unsigned index = findArrayIndexForEntry( row, column );
551 bool found = ( index < _nnz );
552
553 if ( !found )
554 {
555 // Entry doesn't exist currently
556 if ( !FloatUtils::isZero( newValue ) )
557 {
558 CommittedChange change;
559 change._column = column;
560 change._value = newValue;
561 _committedInsertions[row].insert( change );
562 }
563 }
564 else
565 {
566 // Entry currently exists
567 if ( FloatUtils::isZero( newValue ) )
568 {
569 _committedDeletions.insert( index );
570 }
571 else if ( FloatUtils::areDisequal( newValue, _A[index] ) )
572 {
573 CommittedChange change;
574 change._column = column;
575 change._value = newValue;
576 _committedChanges[row].append( change );
577 }
578 }
579}
580
581unsigned CSRMatrix::findArrayIndexForEntry( unsigned row, unsigned column ) const
582{

Callers 4

transposeIntoOtherMethod · 0.80
test_deletionsMethod · 0.80
test_changesMethod · 0.80

Calls 2

insertMethod · 0.45
appendMethod · 0.45

Tested by 3

test_deletionsMethod · 0.64
test_changesMethod · 0.64