DoubleMatrix2D.viewRow
Code IndexAdd Codota to your IDE (free)

Best code snippets using cern.colt.matrix.DoubleMatrix2D.viewRow(Showing top 10 results out of 315)

origin: RankSys/RankSys

/**
 * Normalizes matrix of p(z|u) such that \forall_u: \sum_z p(z|u) = 1.
 *
 * @param pu_z normalized matrix of p(z|u)
 */
@Override
protected void normalizePuz(DoubleMatrix2D pu_z) {
  for (int u = 0; u < pu_z.rows(); u++) {
    DoubleMatrix1D tmp = pu_z.viewRow(u);
    double norm = tmp.aggregate(Functions.plus, Functions.identity);
    if (norm != 0.0) {
      tmp.assign(Functions.mult(1 / norm));
    }
  }
}
origin: cmu-phil/tetrad

private double multiLL(DoubleMatrix2D coeffs, Node dep, List<Node> indep){
  DoubleMatrix2D indepData = factory2D.make(internalData.subsetColumns(indep).getDoubleData().toArray());
  List<Node> depList = new ArrayList<>();
  depList.add(dep);
  DoubleMatrix2D depData = factory2D.make(internalData.subsetColumns(depList).getDoubleData().toArray());
  int N = indepData.rows();
  DoubleMatrix2D probs = Algebra.DEFAULT.mult(factory2D.appendColumns(factory2D.make(N, 1, 1.0), indepData), coeffs);
  probs = factory2D.appendColumns(factory2D.make(indepData.rows(), 1, 1.0), probs).assign(Functions.exp);
  double ll = 0;
  for(int i = 0; i < N; i++){
    DoubleMatrix1D curRow = probs.viewRow(i);
    curRow.assign(Functions.div(curRow.zSum()));
    ll += Math.log(curRow.get((int)depData.get(i,0)));
  }
  return ll;
}
origin: RankSys/RankSys

private static <O> void prepareRR1(int L, DoubleMatrix1D w, DoubleMatrix2D gt, DoubleMatrix2D q, int N, Stream<? extends IdxPref> prefs, DoubleUnaryOperator confidence, double lambda) {
  int K = w.size();
  double[][] x = new double[K + N][K];
  double[] y = new double[K + N];
  double[] c = new double[K + N];
  for (int k = 0; k < K; k++) {
    gt.viewColumn(k).toArray(x[k]);
    y[k] = 0.0;
    c[k] = 1.0;
  }
  int[] j = {K};
  prefs.forEach(iv -> {
    q.viewRow(iv.v1).toArray(x[j[0]]);
    double Cui = confidence.applyAsDouble(iv.v2);
    y[j[0]] = (Cui * iv.v2) / (Cui - 1);
    c[j[0]] = Cui - 1;
    j[0]++;
  });
  
  doRR1(L, w, x, y, c, lambda);
}
origin: cmu-phil/tetrad

private static DoubleMatrix1D margSum(DoubleMatrix2D mat, int marg){
  int n = 0;
  DoubleMatrix1D vec = null;
  DoubleFactory1D fac = DoubleFactory1D.dense;
  if(marg==1){
    n = mat.columns();
    vec = fac.make(n);
    for (int j = 0; j < mat.rows(); j++){
      if (Thread.currentThread().isInterrupted()) {
        break;
      }
      for (int i = 0; i < n; i++){
        vec.setQuick(i, vec.getQuick(i) + mat.getQuick(j,i));
      }
    }
  } else if (marg ==2){
    n = mat.rows();
    vec = fac.make(n);
    for (int i = 0; i < n; i++) {
      if (Thread.currentThread().isInterrupted()) {
        break;
      }
      vec.setQuick(i, mat.viewRow(i).zSum());
    }
  }
  return vec;
}
origin: cmu-phil/tetrad

DoubleMatrix2D wxTemp = wxProd.viewPart(0, lcumsum[i], n, l[i]);
for(int k = 0; k < n; k++){
  DoubleMatrix1D curRow = wxTemp.viewRow(k);
origin: cmu-phil/tetrad

DoubleMatrix1D curRow = wxTemp.viewRow(k);
DoubleMatrix1D curRow0 = wxTemp0.viewRow(k);
origin: cmu-phil/tetrad

wxTemp.assign(alg.mult(factory2D.diagonal(invDenom), wxTemp));
for(int k = 0; k < n; k++){
  DoubleMatrix1D curRow = wxTemp.viewRow(k);
origin: cmu-phil/tetrad

DoubleMatrix1D a18 = S.viewSelection(v, parv).viewRow(0);
a17.assign(a18);
DoubleMatrix1D a21 = algebra.mult(a20, algebra.transpose(Z)).viewRow(0);
a19.assign(a21);
DoubleMatrix1D a23 = a6.viewRow(0);
DoubleMatrix1D a24 = temp.viewSelection(range1);
a23.assign(a24);
omega.viewSelection(v, spov).viewRow(0).assign(temp.viewSelection(range2));
omega.viewSelection(spov, v).viewColumn(0).assign(temp.viewSelection(range2));
DoubleMatrix1D YX = algebra.mult(a20, Z.viewDice()).viewRow(0);
DoubleMatrix1D a24 = omega.viewSelection(v, spov).viewRow(0);
a24.assign(a23);
DoubleMatrix1D a25 = omega.viewSelection(spov, v).viewColumn(0);
origin: cmu-phil/tetrad

DoubleMatrix1D a18 = S.viewSelection(v, parv).viewRow(0);
a17.assign(a18);
DoubleMatrix1D a21 = algebra.mult(a20, algebra.transpose(Z)).viewRow(0);
a19.assign(a21);
DoubleMatrix1D a23 = a6.viewRow(0);
DoubleMatrix1D a24 = temp.viewSelection(range1);
a23.assign(a24);
omega.viewSelection(v, spov).viewRow(0).assign(temp.viewSelection(range2));
omega.viewSelection(spov, v).viewColumn(0).assign(temp.viewSelection(range2));
DoubleMatrix1D YX = algebra.mult(a20, Z.viewDice()).viewRow(0);
DoubleMatrix1D a24 = omega.viewSelection(v, spov).viewRow(0);
a24.assign(a23);
DoubleMatrix1D a25 = omega.viewSelection(spov, v).viewColumn(0);
origin: RankSys/RankSys

/**
 * Normalizes matrix of p(z|u) such that \forall_u: \sum_z p(z|u) = 1.
 *
 * @param pu_z normalized matrix of p(z|u)
 */
@Override
protected void normalizePuz(DoubleMatrix2D pu_z) {
  for (int u = 0; u < pu_z.rows(); u++) {
    DoubleMatrix1D tmp = pu_z.viewRow(u);
    double norm = tmp.aggregate(Functions.plus, Functions.identity);
    if (norm != 0.0) {
      tmp.assign(Functions.mult(1 / norm));
    }
  }
}
cern.colt.matrixDoubleMatrix2DviewRow

Popular methods of DoubleMatrix2D

  • columns
  • assign
  • rows
  • get
  • set
  • viewColumn
  • copy
  • setQuick
  • toArray
  • viewPart
  • getQuick
  • viewDice
  • getQuick,
  • viewDice,
  • viewSelection,
  • zSum,
  • aggregate,
  • like,
  • toString,
  • zMult

Popular classes and methods

  • getOriginalFilename (MultipartFile)
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Graphics2D (java.awt)
  • Rectangle (java.awt)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • File (java.io)
    LocalStorage based File implementation for GWT. Should probably have used Harmony as a starting poin
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • DateFormat (java.text)
    DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates
  • Option (scala)

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)