Macaulay2 Engine
Loading...
Searching...
No Matches

◆ generalReduceF4Row()

template<typename LockType>
void NCF4::generalReduceF4Row ( int index,
int first,
int firstcol,
NCF4Stats & ncF4Stats,
ElementArray & dense,
bool updateColumnIndex,
LockType & lock )
private

Definition at line 906 of file NCF4.cpp.

913{
914 int sz = mRows[index].columnIndices.size();
915 //assert(sz > 0); this may be zero when autoreducing the new gb elements
916 if (sz == 0) return;
917 if (sz == 1 && firstcol != -1) return;
918
919 int last = mRows[index].columnIndices[sz-1];
920
921 mVectorArithmetic->fillDenseArray(dense,
922 mRows[index].coeffVector,
923 mRows[index].columnIndices);
924
925 do {
926 int pivotrow = mColumns[first].pivotRow;
927 if (pivotrow >= 0)
928 {
929 ncF4Stats.numCancellations++;
930 mVectorArithmetic->denseCancelFromSparse(dense,
931 mRows[pivotrow].coeffVector,
932 mRows[pivotrow].columnIndices);
933 // last component in the row corresponding to pivotrow
934 int last1 = mRows[pivotrow].columnIndices.cend()[-1];
935 last = (last1 > last ? last1 : last);
936 }
937 else if (firstcol == -1)
938 {
939 firstcol = first;
940 }
941 first = mVectorArithmetic->denseNextNonzero(dense, first+1, last);
942 } while (first <= last);
943
944 // we have to free mRows[index] information because we are about to overwrite it
945 // how can I free mRows[index].columnIndices? it wasn't the last block allocated on mMonomialSpace...
946 mVectorArithmetic->safeDenseToSparse(dense,
947 mRows[index].coeffVector,
948 mRows[index].columnIndices,
949 firstcol,
950 last,
952 lock);
953 if (mVectorArithmetic->size(mRows[index].coeffVector) > 0)
954 {
955 mVectorArithmetic->makeMonic(mRows[index].coeffVector);
956 // don't do this in the parallel version
957 if (updateColumnIndex) mColumns[firstcol].pivotRow = index;
958 }
959}
RowsVector mRows
Definition NCF4.hpp:243
MemoryBlock mMonomialSpace
Definition NCF4.hpp:228
const VectorArithmetic * mVectorArithmetic
Definition NCF4.hpp:250
ColumnsVector mColumns
Definition NCF4.hpp:240

References mColumns, mMonomialSpace, mRows, mVectorArithmetic, and NCF4::NCF4Stats::numCancellations.

Referenced by parallelReduceF4Row(), and reduceF4Row().