List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.MatrixPrimitiveUtils.java
/** * Boolean on whether a matrix is lower triangular * @param aMatrix an array of arrays representation of the matrix to be tested. * @return boolean, true if matrix is Lower Triangular, false if matrix is not. * @throws IllegalArgumentException// w ww .j av a 2 s . c o m */ public static boolean isLowerTriangular(double[][] aMatrix) throws IllegalArgumentException { if (!isSquare(aMatrix)) { throw new IllegalArgumentException( "Matrix is not square so the notion of Lower Triangular isn't clear cut enough to be implemented"); } int rows = aMatrix.length; for (int i = 0; i < rows; i++) { for (int j = i + 1; j < rows; j++) { if (Double.doubleToLongBits(aMatrix[i][j]) != 0) { return false; } } } return true; }
From source file:com.opengamma.analytics.financial.instrument.payment.CouponOISSimplifiedDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/* w w w .j a v a 2 s. co m*/ if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final CouponOISSimplifiedDefinition other = (CouponOISSimplifiedDefinition) obj; if (!ObjectUtils.equals(_fixingPeriodEndDate, other._fixingPeriodEndDate)) { return false; } if (!ObjectUtils.equals(_fixingPeriodStartDate, other._fixingPeriodStartDate)) { return false; } if (Double.doubleToLongBits(_fixingPeriodAccrualFactor) != Double .doubleToLongBits(other._fixingPeriodAccrualFactor)) { return false; } if (!ObjectUtils.equals(_index, other._index)) { return false; } return true; }
From source file:EndianUtils.java
/** * Writes a "double" value to a byte array at a given offset. The value is * converted to the opposed endian system while writing. * @param data target byte array//from www . j a v a 2 s .co m * @param offset starting offset in the byte array * @param value value to write */ public static void writeSwappedDouble(byte[] data, int offset, double value) { writeSwappedLong(data, offset, Double.doubleToLongBits(value)); }
From source file:dbs_project.index.performance.IndexTest.java
private void getRowsByPrimitives(final Row row) { for (int i = 0; i < types.length; ++i) { if (row.isNull(i)) { continue; }// w w w. j av a2 s .c om // add up checksum to avoid dead code elimination switch (types[i]) { case STRING: checksum += row.getString(i).hashCode(); break; case INTEGER: checksum += row.getInteger(i); break; case DOUBLE: checksum += Double.doubleToLongBits(row.getDouble(i)); break; case DATE: checksum += row.getDate(i).getTime(); break; case BOOLEAN: checksum += row.getBoolean(i) ? 1 : 0; break; default: checksum += row.getObject(i).hashCode(); break; } } }
From source file:com.opengamma.maths.lowlevelapi.linearalgebra.blas.BLAS1.java
/** * DAXPY: y:=alpha*x+y/* w w w . j a v a 2s . c om*/ * @param alpha double * @param x a double[] vector * @param y a double[] vector */ public static void daxpyInplace(double alpha, double[] x, double[] y) { daxpyInputSanityChecker(x, y); final int n = y.length; if (Double.doubleToLongBits(alpha) == 0) { // short cut if alpha = 0, insanely stupid thing to do but might occur if coming from generated results return; } final int extra = n - n % 16; final int ub = ((n / 16) * 16) - 1; // the induction (variable + loop unwind) common subexpression is actually spotted by the JIT and so // doesn't need to be spelled out which is a nice change for (int i = 0; i < ub; i += 16) { y[i] += alpha * x[i]; y[i + 1] += alpha * x[i + 1]; y[i + 2] += alpha * x[i + 2]; y[i + 3] += alpha * x[i + 3]; y[i + 4] += alpha * x[i + 4]; y[i + 5] += alpha * x[i + 5]; y[i + 6] += alpha * x[i + 6]; y[i + 7] += alpha * x[i + 7]; y[i + 8] += alpha * x[i + 8]; y[i + 9] += alpha * x[i + 9]; y[i + 10] += alpha * x[i + 10]; y[i + 11] += alpha * x[i + 11]; y[i + 12] += alpha * x[i + 12]; y[i + 13] += alpha * x[i + 13]; y[i + 14] += alpha * x[i + 14]; y[i + 15] += alpha * x[i + 15]; } for (int i = extra; i < n; i++) { y[i] += alpha * x[i]; } }
From source file:ObjectUtils.java
/** * Return the same value as <code>{@link Double#hashCode()}</code>. * @see Double#hashCode()/*from w ww .j a va 2s .co m*/ */ public static int hashCode(double dbl) { long bits = Double.doubleToLongBits(dbl); return hashCode(bits); }
From source file:com.opengamma.analytics.financial.instrument.payment.CouponONSpreadSimplifiedDefinition.java
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); long temp;/*from w w w . j a va 2 s .c o m*/ temp = Double.doubleToLongBits(_fixingPeriodAccrualFactor); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + ((_fixingPeriodEndDate == null) ? 0 : _fixingPeriodEndDate.hashCode()); result = prime * result + ((_fixingPeriodStartDate == null) ? 0 : _fixingPeriodStartDate.hashCode()); result = prime * result + ((_index == null) ? 0 : _index.hashCode()); temp = Double.doubleToLongBits(_spread); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_spreadAmount); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.opengamma.analytics.financial.forex.derivative.ForexNonDeliverableForward.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*from w ww . j a v a 2 s. co m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ForexNonDeliverableForward other = (ForexNonDeliverableForward) obj; if (!ObjectUtils.equals(_currency1, other._currency1)) { return false; } if (!ObjectUtils.equals(_currency2, other._currency2)) { return false; } if (Double.doubleToLongBits(_exchangeRate) != Double.doubleToLongBits(other._exchangeRate)) { return false; } if (Double.doubleToLongBits(_fixingTime) != Double.doubleToLongBits(other._fixingTime)) { return false; } if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) { return false; } if (Double.doubleToLongBits(_paymentTime) != Double.doubleToLongBits(other._paymentTime)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFuture.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/*from ww w . j a va 2 s . com*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } InterestRateFuture other = (InterestRateFuture) obj; if (Double.doubleToLongBits(_fixingPeriodAccrualFactor) != Double .doubleToLongBits(other._fixingPeriodAccrualFactor)) { return false; } if (Double.doubleToLongBits(_fixingPeriodEndTime) != Double.doubleToLongBits(other._fixingPeriodEndTime)) { return false; } if (Double.doubleToLongBits(_fixingPeriodStartTime) != Double .doubleToLongBits(other._fixingPeriodStartTime)) { return false; } if (!ObjectUtils.equals(_forwardCurveName, other._forwardCurveName)) { return false; } if (!ObjectUtils.equals(_discountingCurveName, other._discountingCurveName)) { return false; } if (!ObjectUtils.equals(_iborIndex, other._iborIndex)) { return false; } if (Double.doubleToLongBits(_lastTradingTime) != Double.doubleToLongBits(other._lastTradingTime)) { return false; } if (!ObjectUtils.equals(_name, other._name)) { return false; } if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) { return false; } if (Double.doubleToLongBits(_paymentAccrualFactor) != Double .doubleToLongBits(other._paymentAccrualFactor)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.instrument.payment.CouponONSimplifiedDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }// www .j a v a 2 s .com if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final CouponONSimplifiedDefinition other = (CouponONSimplifiedDefinition) obj; if (!ObjectUtils.equals(_fixingPeriodEndDate, other._fixingPeriodEndDate)) { return false; } if (!ObjectUtils.equals(_fixingPeriodStartDate, other._fixingPeriodStartDate)) { return false; } if (Double.doubleToLongBits(_fixingPeriodAccrualFactor) != Double .doubleToLongBits(other._fixingPeriodAccrualFactor)) { return false; } if (!ObjectUtils.equals(_index, other._index)) { return false; } return true; }