/** {@inheritDoc} */ public RealVector projection(RealVector v) { return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) { return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) throws IllegalArgumentException { checkVectorDimensions(v.getDimension()); return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) throws IllegalArgumentException { checkVectorDimensions(v.getDimension()); return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** * Subtracts a multiple of one row from another. * <p> * After application of this operation, the following will hold: * minuendRow = minuendRow - multiple * subtrahendRow * </p> * @param minuendRow row index * @param subtrahendRow row index * @param multiple multiplication factor */ protected void subtractRow(final int minuendRow, final int subtrahendRow, final double multiple) { tableau.setRowVector(minuendRow, tableau.getRowVector(minuendRow) .subtract(tableau.getRowVector(subtrahendRow).mapMultiply(multiple))); }
/** * Subtracts a multiple of one row from another. * <p> * After application of this operation, the following will hold: * minuendRow = minuendRow - multiple * subtrahendRow * </p> * @param minuendRow row index * @param subtrahendRow row index * @param multiple multiplication factor */ protected void subtractRow(final int minuendRow, final int subtrahendRow, final double multiple) { tableau.setRowVector(minuendRow, tableau.getRowVector(minuendRow) .subtract(tableau.getRowVector(subtrahendRow).mapMultiply(multiple))); }
/** * Get a new equation equivalent to this one with a positive right hand side. * @param constraint reference constraint * @return new equation */ private LinearConstraint normalize(final LinearConstraint constraint) { if (constraint.getValue() < 0) { return new LinearConstraint(constraint.getCoefficients().mapMultiply(-1), constraint.getRelationship().oppositeRelationship(), -1 * constraint.getValue()); } return new LinearConstraint(constraint.getCoefficients(), constraint.getRelationship(), constraint.getValue()); }
/** * Get a new equation equivalent to this one with a positive right hand side. * @param constraint reference constraint * @return new equation */ private LinearConstraint normalize(final LinearConstraint constraint) { if (constraint.getValue() < 0) { return new LinearConstraint(constraint.getCoefficients().mapMultiply(-1), constraint.getRelationship().oppositeRelationship(), -1 * constraint.getValue()); } return new LinearConstraint(constraint.getCoefficients(), constraint.getRelationship(), constraint.getValue()); }
double product=matrix.operate(cachedV.getColumnVector(i)).dotProduct(tmp); if (product<0) { cachedU.setColumnVector(i, tmp.mapMultiply(-1.0));
matrix.setEntry(zIndex, zIndex, maximize ? 1 : -1); RealVector objectiveCoefficients = maximize ? f.getCoefficients().mapMultiply(-1) : f.getCoefficients(); copyArray(objectiveCoefficients.getData(), matrix.getDataRef()[zIndex]); matrix.setEntry(zIndex, width - 1,
matrix.setEntry(zIndex, zIndex, maximize ? 1 : -1); RealVector objectiveCoefficients = maximize ? f.getCoefficients().mapMultiply(-1) : f.getCoefficients(); copyArray(objectiveCoefficients.getData(), matrix.getDataRef()[zIndex]); matrix.setEntry(zIndex, width - 1,
double product=matrix.operate(cachedV.getColumnVector(i)).dotProduct(tmp); if (product<0) { cachedU.setColumnVector(i, tmp.mapMultiply(-1.0));