Example usage for java.lang Double doubleToLongBits

List of usage examples for java.lang Double doubleToLongBits

Introduction

In this page you can find the example usage for java.lang Double doubleToLongBits.

Prototype

@HotSpotIntrinsicCandidate
public static long doubleToLongBits(double value) 

Source Link

Document

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

Usage

From source file:com.opengamma.analytics.financial.model.option.definition.FadeInOptionDefinition.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;/*w w w.  j a v  a 2s . c o  m*/
    temp = Double.doubleToLongBits(_lowerBound);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_upperBound);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.financial.var.StudentTVaRParameters.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }// ww w. j  a va 2 s.  c o  m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    StudentTVaRParameters other = (StudentTVaRParameters) obj;
    if (Double.doubleToLongBits(_dof) != Double.doubleToLongBits(other._dof)) {
        return false;
    }
    if (Double.doubleToLongBits(_horizon) != Double.doubleToLongBits(other._horizon)) {
        return false;
    }
    if (Double.doubleToLongBits(_periods) != Double.doubleToLongBits(other._periods)) {
        return false;
    }
    if (Double.doubleToLongBits(_quantile) != Double.doubleToLongBits(other._quantile)) {
        return false;
    }
    return true;
}

From source file:com.eTilbudsavis.etasdk.model.Si.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    long temp;// w w  w .j a  va2  s.  co m
    temp = Double.doubleToLongBits(mFactor);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((mSymbol == null) ? 0 : mSymbol.hashCode());
    return result;
}

From source file:com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _quantity;
    long temp;/*from   w w w. ja  v  a 2 s. c  o  m*/
    temp = Double.doubleToLongBits(_referencePrice);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _underlyingOption.hashCode();
    return result;
}

From source file:com.opengamma.analytics.financial.model.option.definition.PoweredOptionDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//  ww  w. ja  va2s  .co m
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final PoweredOptionDefinition other = (PoweredOptionDefinition) obj;
    if (Double.doubleToLongBits(_power) != Double.doubleToLongBits(other._power)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.commodity.derivative.CommodityFutureOption.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _underlying.hashCode();
    result = prime * result + _exerciseType.hashCode();
    result = prime * result + (_isCall ? 1231 : 1237);
    long temp;//from  w  w  w . j  av  a2 s .c om
    temp = Double.doubleToLongBits(_strike);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_expiry);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.financial.simpleinstruments.derivative.SimpleFXFuture.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*w w  w  .j ava 2s. co m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    SimpleFXFuture other = (SimpleFXFuture) obj;
    if (Double.doubleToLongBits(_expiry) != Double.doubleToLongBits(other._expiry)) {
        return false;
    }
    if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) {
        return false;
    }
    if (Double.doubleToLongBits(_settlement) != Double.doubleToLongBits(other._settlement)) {
        return false;
    }
    if (Double.doubleToLongBits(_unitAmount) != Double.doubleToLongBits(other._unitAmount)) {
        return false;
    }
    if (!ObjectUtils.equals(_payCurrency, other._payCurrency)) {
        return false;
    }
    if (!ObjectUtils.equals(_receiveCurrency, other._receiveCurrency)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.CompressedSparseColumnFormatMatrix.java

/**
 * Construct from DoubleMatrix2D type// w w w . j a  v a  2 s . c o m
 * @param m is a DoubleMatrix2D
 */
public CompressedSparseColumnFormatMatrix(DoubleMatrix2D m) {
    Validate.notNull(m);

    //get number of elements
    _els = m.getNumberOfElements();

    // tmp arrays, in case we get in a fully populated matrix, intelligent design upstream should ensure that this is overkill!
    double[] dataTmp = new double[_els];
    int[] colPtrTmp = new int[_els + 1];
    int[] rowIdxTmp = new int[_els];

    // we need unwind the array m into coordinate form
    int ptr = 0;
    int i;
    int localMaxEntrisInACol;
    _maxEntriesInAColumn = -1;
    for (i = 0; i < m.getNumberOfColumns(); i++) {
        colPtrTmp[i] = ptr;
        localMaxEntrisInACol = 0;
        for (int j = 0; j < m.getNumberOfRows(); j++) {
            if (Double.doubleToLongBits(m.getEntry(j, i)) != 0L) {
                rowIdxTmp[ptr] = j;
                dataTmp[ptr] = m.getEntry(j, i);
                ptr++;
                localMaxEntrisInACol++;
            }
        }
        if (localMaxEntrisInACol > _maxEntriesInAColumn) {
            _maxEntriesInAColumn = localMaxEntrisInACol;
        }
    }
    colPtrTmp[i] = ptr;

    // return correct 0 to correct length of the vector buffers
    _values = Arrays.copyOfRange(dataTmp, 0, ptr);
    _colPtr = Arrays.copyOfRange(colPtrTmp, 0, i + 1); // yes, the +1 is correct, it allows the computation of the number of elements in the final row!
    _rowIdx = Arrays.copyOfRange(rowIdxTmp, 0, ptr);
    _rows = m.getNumberOfRows();
    _cols = m.getNumberOfColumns();
}

From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.MatrixPrimitiveUtils.java

/**
 * Counts number of *true* nonzero elements in a vector
 * @param aVector which is the vector (array of doubles) being tested
 * @return tmp the number of nonzero elements in the vector
 *///ww  w.jav a2s  .  c o  m
public static int numberOfNonZeroElementsInVector(double[] aVector) {
    int tmp = 0;
    for (int i = 0; i < aVector.length; i++) {
        if (Double.doubleToLongBits(aVector[i]) != 0L) {
            tmp++;
        }
    }
    return tmp;
}

From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w w  w.j a v  a 2  s .  c o  m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final EuropeanVanillaOption other = (EuropeanVanillaOption) obj;
    if (_isCall != other._isCall) {
        return false;
    }
    if (Double.doubleToLongBits(_k) != Double.doubleToLongBits(other._k)) {
        return false;
    }
    if (Double.doubleToLongBits(_t) != Double.doubleToLongBits(other._t)) {
        return false;
    }
    return true;
}