public static void invoke( final ComplexNumber[] aData, final Householder.Complex aHouseholder, final ComplexNumber[] aWorker) { final ComplexNumber[] tmpVector = aHouseholder.vector; final int tmpFirst = aHouseholder.first; final int tmpLength = tmpVector.length; final ComplexNumber tmpBeta = aHouseholder.beta; final int tmpCount = tmpLength - tmpFirst; if (tmpCount > THRESHOLD) { final DivideAndConquer tmpConqurer = new DivideAndConquer() { @Override protected void conquer(final int aFirst, final int aLimit) { MultiplyHermitianAndVector.invoke( aWorker, aFirst, aLimit, aData, tmpVector, tmpFirst); } }; tmpConqurer.invoke(tmpFirst, tmpLength, THRESHOLD); } else { MultiplyHermitianAndVector.invoke(aWorker, tmpFirst, tmpLength, aData, tmpVector, tmpFirst); } ComplexNumber tmpVal = ComplexNumber.ZERO; for (int c = tmpFirst; c < tmpLength; c++) { // tmpVal += tmpVector[c] * aWorker[c]; tmpVal = tmpVal.add(tmpVector[c].conjugate().multiply(aWorker[c])); } // tmpVal *= (tmpBeta / TWO); tmpVal = ComplexFunction.DIVIDE.invoke(tmpVal.multiply(tmpBeta), ComplexNumber.TWO); for (int c = tmpFirst; c < tmpLength; c++) { // aWorker[c] = tmpBeta * (aWorker[c] - (tmpVal * tmpVector[c])); aWorker[c] = tmpBeta.multiply(aWorker[c].subtract(tmpVal.multiply(tmpVector[c]))); } if (tmpCount > THRESHOLD) { final DivideAndConquer tmpConqurer = new DivideAndConquer() { @Override protected void conquer(final int aFirst, final int aLimit) { HermitianRank2Update.invoke(aData, aFirst, aLimit, tmpVector, aWorker); } }; tmpConqurer.invoke(tmpFirst, tmpLength, THRESHOLD); } else { HermitianRank2Update.invoke(aData, tmpFirst, tmpLength, tmpVector, aWorker); } }
public static void invoke( final double[] aData, final Householder.Primitive aHouseholder, final double[] aWorker) { final double[] tmpVector = aHouseholder.vector; final int tmpFirst = aHouseholder.first; final int tmpLength = tmpVector.length; final double tmpBeta = aHouseholder.beta; final int tmpCount = tmpLength - tmpFirst; if (tmpCount > THRESHOLD) { final DivideAndConquer tmpConqurer = new DivideAndConquer() { @Override protected void conquer(final int aFirst, final int aLimit) { MultiplyHermitianAndVector.invoke( aWorker, aFirst, aLimit, aData, tmpVector, tmpFirst); } }; tmpConqurer.invoke(tmpFirst, tmpLength, THRESHOLD); } else { MultiplyHermitianAndVector.invoke(aWorker, tmpFirst, tmpLength, aData, tmpVector, tmpFirst); } double tmpVal = ZERO; for (int c = tmpFirst; c < tmpLength; c++) { tmpVal += tmpVector[c] * aWorker[c]; } tmpVal *= (tmpBeta / TWO); for (int c = tmpFirst; c < tmpLength; c++) { aWorker[c] = tmpBeta * (aWorker[c] - (tmpVal * tmpVector[c])); } if (tmpCount > THRESHOLD) { final DivideAndConquer tmpConqurer = new DivideAndConquer() { @Override protected void conquer(final int aFirst, final int aLimit) { HermitianRank2Update.invoke(aData, aFirst, aLimit, tmpVector, aWorker); } }; tmpConqurer.invoke(tmpFirst, tmpLength, THRESHOLD); } else { HermitianRank2Update.invoke(aData, tmpFirst, tmpLength, tmpVector, aWorker); } }