Adds a quaterary clause to the given SAT solver.
@param s the sat solver
@param a the first literal
@param b the second literal
@param c the third literal
@param d the fourth literal
488927
void addQuaternaryClause(final MiniSatStyleSolver s, int a, int b, int c, int d) {
    this.addQuaternaryClause(s, a, b, c, d, LIT_UNDEF);
  }
563073
public void solve(DenseMatrix B) {
        if (B.nrows() != qr.nrows()) {
            throw new IllegalArgumentException(String.format("Row dimensions do not agree: A is %d x %d, but B is %d x %d", qr.nrows(), qr.nrows(), B.nrows(), B.ncols()));
        }

        if (singular) {
            throw new RuntimeException("Matrix is rank deficient.");
        }

        int m = qr.nrows();
        int n = qr.ncols();
        int nrhs = B.ncols();

        // Compute Y = Q' * B
        for (int k = 0; k < n; k++) {
            for (int j = 0; j < nrhs; j++) {
                double s = 0.0;
                for (int i = k; i < m; i++) {
                    s += qr.get(i, k) * B.get(i, j);
                }
                s = -s / qr.get(k, k);
                for (int i = k; i < m; i++) {
                    B.add(i, j, s * qr.get(i, k));
                }
            }
        }

        // Solve R*X = Y;
        for (int k = n - 1; k >= 0; k--) {
            for (int j = 0; j < nrhs; j++) {
                B.set(k, j, B.get(k, j) / tau[k]);
            }
            
            for (int i = 0; i < k; i++) {
                for (int j = 0; j < nrhs; j++) {
                    B.sub(i, j, B.get(k, j) * qr.get(i, k));
                }
            }
        }
    }
7841
void addBinaryClause(final MiniSatStyleSolver s, int a, int b) {
    this.addBinaryClause(s, a, b, LIT_UNDEF);
  }
110309
protected void add( int which , Homography2D_F64 H , DMatrixRMaj A ) {
		int idx = which*6*6;

		// Row 0
		A.data[idx++] = H.a11*H.a11-1;
		A.data[idx++] = 2*H.a11*H.a12;
		A.data[idx++] = 2*H.a11*H.a13;
		A.data[idx++] = H.a12*H.a12;
		A.data[idx++] = 2*H.a12*H.a13;
		A.data[idx++] = H.a13*H.a13;
		// Row 1
		A.data[idx++] = H.a11*H.a21;
		A.data[idx++] = H.a12*H.a21 + H.a11*H.a22-1;
		A.data[idx++] = H.a13*H.a21 + H.a11*H.a23;
		A.data[idx++] = H.a12*H.a22;
		A.data[idx++] = H.a13*H.a22 + H.a12*H.a23;
		A.data[idx++] = H.a13*H.a23;
		// Row 2
		A.data[idx++] = H.a11*H.a31;
		A.data[idx++] = H.a12*H.a31 + H.a11*H.a32;
		A.data[idx++] = H.a13*H.a31 + H.a11*H.a33-1;
		A.data[idx++] = H.a12*H.a32;
		A.data[idx++] = H.a13*H.a32 + H.a12*H.a33;
		A.data[idx++] = H.a13*H.a33;
		// Row 3
		A.data[idx++] = H.a21*H.a21;
		A.data[idx++] = 2*H.a21*H.a22;
		A.data[idx++] = 2*H.a21*H.a23;
		A.data[idx++] = H.a22*H.a22 - 1;
		A.data[idx++] = 2*H.a22*H.a23;
		A.data[idx++] = H.a23*H.a23;
		// Row 4
		A.data[idx++] = H.a21*H.a31;
		A.data[idx++] = H.a22*H.a31 + H.a21*H.a32;
		A.data[idx++] = H.a23*H.a31 + H.a21*H.a33;
		A.data[idx++] = H.a22*H.a32;
		A.data[idx++] = H.a23*H.a32 + H.a22*H.a33-1;
		A.data[idx++] = H.a23*H.a33;
		// Row 5
		A.data[idx++] = H.a31*H.a31;
		A.data[idx++] = 2*H.a31*H.a32;
		A.data[idx++] = 2*H.a31*H.a33;
		A.data[idx++] = H.a32*H.a32;
		A.data[idx++] = 2*H.a32*H.a33;
		A.data[idx  ] = H.a33*H.a33-1;
	}
533367
public static void mult( double a[] , int offsetA ,
                             DMatrixSparseCSC B ,
                             double c[] , int offsetC )
    {
        if( a.length-offsetA < B.numRows)
            throw new IllegalArgumentException("Length of 'a' isn't long enough");
        if( c.length-offsetC < B.numCols)
            throw new IllegalArgumentException("Length of 'c' isn't long enough");

        for (int k = 0; k < B.numCols; k++) {
            int idx0 = B.col_idx[k  ];
            int idx1 = B.col_idx[k+1];

            double sum = 0;
            for (int indexB = idx0; indexB < idx1; indexB++) {
                sum += a[offsetA+B.nz_rows[indexB]]*B.nz_values[indexB];
            }
            c[offsetC+k] = sum;
        }
    }
494502
public Quaternionf premul(Quaternionfc q, Quaternionf dest) {
        dest.set(q.w() * x + q.x() * w + q.y() * z - q.z() * y,
                 q.w() * y - q.x() * z + q.y() * w + q.z() * x,
                 q.w() * z + q.x() * y - q.y() * x + q.z() * w,
                 q.w() * w - q.x() * x - q.y() * y - q.z() * z);
        return dest;
    }
1029416
def add_clause(self, clause, no_return=True):
        

        if self.minisat:
            res = pysolvers.minisatgh_add_cl(self.minisat, clause)

            if res == False:
                self.status = False

            if not no_return:
                return res
762913
@Override
    public DMatrixRMaj getQ(DMatrixRMaj Q , boolean compact ) {
        if( compact ) {
            if( Q == null ) {
                Q = CommonOps_DDRM.identity(numRows,minLength);
            } else {
                if( Q.numRows != numRows || Q.numCols != minLength ) {
                    throw new IllegalArgumentException("Unexpected matrix dimension.");
                } else {
                    CommonOps_DDRM.setIdentity(Q);
                }
            }
        } else {
            if( Q == null ) {
                Q = CommonOps_DDRM.identity(numRows);
            } else {
                if( Q.numRows != numRows || Q.numCols != numRows ) {
                    throw new IllegalArgumentException("Unexpected matrix dimension.");
                } else {
                    CommonOps_DDRM.setIdentity(Q);
                }
            }
        }

        for( int j = rank-1; j >= 0; j-- ) {
            double u[] = dataQR[j];

            double vv = u[j];
            u[j] = 1;
            QrHelperFunctions_DDRM.rank1UpdateMultR(Q, u, gammas[j], j, j, numRows, v);
            u[j] = vv;
        }

        return Q;
    }
542875
void addTernaryClause(final MiniSatStyleSolver s, int a, int b, int c) {
    this.addTernaryClause(s, a, b, c, LIT_UNDEF);
  }
168814
public Quaternionf add(Quaternionfc q2) {
        x += q2.x();
        y += q2.y();
        z += q2.z();
        w += q2.w();
        return this;
    }
306101
public static void addEquals( DMatrix5x5 a , DMatrix5x5 b ) {
        a.a11 += b.a11;
        a.a12 += b.a12;
        a.a13 += b.a13;
        a.a14 += b.a14;
        a.a15 += b.a15;
        a.a21 += b.a21;
        a.a22 += b.a22;
        a.a23 += b.a23;
        a.a24 += b.a24;
        a.a25 += b.a25;
        a.a31 += b.a31;
        a.a32 += b.a32;
        a.a33 += b.a33;
        a.a34 += b.a34;
        a.a35 += b.a35;
        a.a41 += b.a41;
        a.a42 += b.a42;
        a.a43 += b.a43;
        a.a44 += b.a44;
        a.a45 += b.a45;
        a.a51 += b.a51;
        a.a52 += b.a52;
        a.a53 += b.a53;
        a.a54 += b.a54;
        a.a55 += b.a55;
    }
940821
public static void add(DMatrixD1 a , double val ) {
        final int length = a.getNumElements();

        for( int i = 0; i < length; i++ ) {
            a.plus(i, val);
        }
    }
309171
public boolean add(SatConstraintBuilder c) {
        if (this.builders.containsKey(c.getIdentifier())) {
            return false;
        }
        this.builders.put(c.getIdentifier(), c);
        return true;
    }
313164
public static void addEquals(DMatrixD1 a , double beta, DMatrixD1 b )
    {
        if( a.numCols != b.numCols || a.numRows != b.numRows ) {
            throw new MatrixDimensionException("The 'a' and 'b' matrices do not have compatible dimensions");
        }

        final int length = a.getNumElements();

        for( int i = 0; i < length; i++ ) {
            a.plus(i, beta * b.get(i));
        }
    }
196722
private void addUnitClause(final MiniSatStyleSolver s, int a, int blocking) {
    assert this.clause.size() == 0;
    assert a != LIT_UNDEF;
    assert var(a) < s.nVars();
    this.clause.push(a);
    if (blocking != LIT_UNDEF)
      this.clause.push(blocking);
    s.addClause(this.clause, null);
    this.clause.clear();
  }
109927
public static void multCol(Matrix A, int j, double c)
    {
        multCol(A, j, 0, A.rows(), c);
    }
336100
public void addClause(final Literal... literals) {
    if (this.miniSat == null && this.cleaneLing == null)
      this.result.add(this.f.clause(literals));
    else if (this.miniSat != null) {
      final LNGIntVector clauseVec = new LNGIntVector(literals.length);
      for (final Literal lit : literals) {
        int index = this.miniSat.underlyingSolver().idxForName(lit.name());
        if (index == -1) {
          index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
          this.miniSat.underlyingSolver().addName(lit.name(), index);
        }
        final int litNum;
        if (lit instanceof EncodingAuxiliaryVariable)
          litNum = !((EncodingAuxiliaryVariable) lit).negated ? index * 2 : (index * 2) ^ 1;
        else
          litNum = lit.phase() ? index * 2 : (index * 2) ^ 1;
        clauseVec.push(litNum);
      }
      this.miniSat.underlyingSolver().addClause(clauseVec, null);
      this.miniSat.setSolverToUndef();
    } else {
      for (final Literal lit : literals) {
        final int index = this.cleaneLing.getOrCreateVarIndex(lit.variable());
        if (lit instanceof EncodingAuxiliaryVariable)
          this.cleaneLing.underlyingSolver().addlit(!((EncodingAuxiliaryVariable) lit).negated ? index : -index);
        else
          this.cleaneLing.underlyingSolver().addlit(lit.phase() ? index : -index);
      }
      this.cleaneLing.underlyingSolver().addlit(CleaneLing.CLAUSE_TERMINATOR);
      this.cleaneLing.setSolverToUndef();
    }
  }