- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {OutputStreamWriter o =
OutputStream out;new OutputStreamWriter(out)
OutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
HttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
- Smart code suggestions by Codota
}
@Override public void divide(int idx, double val) { v.divide(idx, val); }
@Override public void divide(int idx, int val) { v.divide(idx, val); }
/** * Compute the householder vector of a given vector * * Complexity: O(sparsity(n)) * * @return A vector with v(1) = 1 and (I - 2vv^T /v^Tv)x is zero in all but * first component */ public static Vector<Double> house(Vector<Double> x, int j) { final int n = x.length(); double mu = 0.0; final double[] x2 = x.toDoubleArray(); for (int i = j; i < n; i++) { mu += x2[i] * x2[i]; } mu = Math.sqrt(mu); final Vector<Double> v = x.clone(); if (mu != 0.0) { final double beta = x.doubleValue(0) + Math.signum(x.doubleValue(0)) * mu; for (int i = 1; i < v.length(); i++) { v.divide(i, beta); } } v.put(0, 1); return v; }
public BetaLMImpl(File data) throws IOException { final ParallelReader pr = ParallelReader.fromFile(data); this.W = pr.W(); this.x = pr.x; this.mu = new RealVector(this.W); this.mu_f = new RealVector(this.W); this.sumMu2 = initMu(x, this.W); if (method == Method.DF_DICE || method == Method.DF_JACCARD) { df = new RealVector(this.W); this.dfSp = null; for (int j = 0; j < x.length; j++) { for (int w : x[j][0].keySet()) { df.add(w, 1); } } for (int w = 0; w < this.W; w++) { df.divide(w,x.length); } } else { df = null; dfSp = null; } }