org.ujmp.core.Matrix.getLabel()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中org.ujmp.core.Matrix.getLabel()方法的一些代码示例,展示了Matrix.getLabel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getLabel()方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:getLabel

Matrix.getLabel介绍

暂无

代码示例

代码示例来源:origin: ujmp/universal-java-matrix-package

public final String getLabel() {
  return matrix.getLabel();
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public final String getDescription() {
  return matrix.getLabel();
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public static final String format(Object o) {
  if (o == null) {
    return "";
  }
  if (o instanceof String) {
    return (String) o;
  }
  if (o instanceof Matrix) {
    Matrix m = (Matrix) o;
    if (m.getLabel() != null) {
      return "[" + m.getLabel() + "]";
    } else {
      return "[Matrix]";
    }
  }
  if (o instanceof Number) {
    return format((Number) o);
  }
  return o.toString();
}

代码示例来源:origin: ujmp/universal-java-matrix-package

private StringBuffer format(Matrix obj, StringBuffer toAppendTo, FieldPosition pos) {
  if (obj == null) {
    if (usePadding) {
      pad(toAppendTo, ' ', width);
    }
    return toAppendTo;
  } else if (multiLine) {
    return formatMultiLine(obj, toAppendTo, pos);
  } else {
    if (obj.getLabel() != null) {
      toAppendTo.append("[" + obj.getLabel() + "]");
    } else {
      toAppendTo.append("[Matrix]");
    }
    return toAppendTo;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public final String toString() {
  if (matrix.getLabel() != null) {
    return Coordinates.toString("[", "x", "]", matrix.getSize()) + matrix.getClass().getSimpleName() + " ["
        + matrix.getLabel() + "]";
  } else {
    return Coordinates.toString("[", "x", "]", matrix.getSize()) + matrix.getClass().getSimpleName();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public static final void toWriter(Writer w, Matrix m, Object... parameters) throws IOException {
  w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  w.write("<graphml>\n");
  w.write("<key id=\"k0\" for=\"node\" attr.name=\"variableName\" attr.type=\"string\"></key>\n");
  w.write("<key id=\"k1\" for=\"node\" attr.name=\"description\" attr.type=\"string\"></key>\n");
  w.write("<key id=\"k2\" for=\"edge\" attr.name=\"confidence\" attr.type=\"double\"><default>0.0</default></key>\n");
  w.write("<key id=\"k3\" for=\"edge\" attr.name=\"directed\" attr.type=\"boolean\"><default>false</default></key>\n");
  w.write("<key id=\"k5\" for=\"node\" attr.name=\"xPos\" attr.type=\"string\"></key>\n");
  w.write("<key id=\"k6\" for=\"node\" attr.name=\"yPos\" attr.type=\"string\"></key>\n");
  w.write("<graph id=\"" + m.getLabel() + "\" edgedefault=\"undirected\">\n");
  for (int i = 0; i < m.getRowCount(); i++) {
    w.write("<node id=\"node" + i + "\">\n");
    w.write("<data key=\"k0\">" + m.getRowLabel(i).replaceAll("[<>&]", "") + "</data>\n");
    // w.write("<data key=\"k5\">" + n.getPosX() + "</data>\n");
    // w.write("<data key=\"k6\">" + n.getPosY() + "</data>\n");
    w.write("</node>\n");
  }
  int id = 0;
  for (long[] c : m.allCoordinates()) {
    if (m.getAsDouble(c) > 0.0) {
      w.write("<edge id=\"edge" + (id++) + "\" ");
      w.write("source=\"node" + c[Matrix.ROW] + "\" ");
      w.write("target=\"node" + c[Matrix.COLUMN] + "\">\n");
      w.write("</edge>\n");
    }
  }
  w.write("</graph>\n");
  w.write("</graphml>");
  w.close();
}

代码示例来源:origin: jdmp/java-data-mining-package

public DefaultMatrixPage(HttpServletRequest request, String path, Matrix matrix, Object... parameters) {
  super();
  if (matrix == null) {
    setTitle("JDMP Search: not found");
    add(new H1Tag("sample not found"));
  } else {
    setTitle("JDMP Search: " + matrix.getLabel());
    add(new H1Tag(matrix.getLabel()));
  }
}

代码示例来源:origin: jdmp/java-data-mining-package

public final Sample linkToMatrix(Matrix input) {
  Sample s = new DefaultSample();
  s.put(Sample.INPUT, input);
  s.setLabel(input.getLabel());
  return s;
}

代码示例来源:origin: ujmp/universal-java-matrix-package

s = "";
Matrix ma = (Matrix) value;
if (ma.getLabel() != null) {
  s += "[" + ma.getLabel() + "]";
} else {
  s += ma.getClass().getSimpleName();

代码示例来源:origin: ujmp/universal-java-matrix-package

writer.write("set title '" + StringUtil.format(matrix.getLabel()) + "'" + EOL);
writer.write("plot ");

代码示例来源:origin: ujmp/universal-java-matrix-package

Matrix m = (Matrix) v;
String s = m.getClass().getSimpleName();
if (m.getLabel() != null) {
  s += " " + m.getLabel();

代码示例来源:origin: ujmp/universal-java-matrix-package

format(m.getLabel(), toAppendTo, pos);
toAppendTo.append("   ");
for (int col = 0; col < columnCount && col < maxColumns; col++) {

代码示例来源:origin: ujmp/universal-java-matrix-package

mean.setLabel(m.getLabel() + "-" + benchmarkName + "-mean");
  mean.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
  means.add(mean);
  std.setLabel(m.getLabel() + "-" + benchmarkName + "-std");
  std.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
  stds.add(std);
  min.setLabel(m.getLabel() + "-" + benchmarkName + "-min");
  min.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
  mins.add(min);
  max.setLabel(m.getLabel() + "-" + benchmarkName + "-max");
  max.setMetaDataDimensionMatrix(Matrix.ROW, columnLabels);
  maxs.add(max);
  ListMatrix<String> matrixLabels = new DefaultListMatrix<String>();
  for (Matrix m : means) {
    matrixLabels.add(m.getLabel().split("-")[0]);
if (!allmeans.getLabel().contains("diff")) {
  try {
    long jamaRow = allmeans.getRowForLabel(JamaDenseDoubleMatrix2D.class
    for (int c = 0; c < valueCount.getColumnCount(); c++) {
      int s = extractSize(allmeans.getColumnLabel(c));
      if (allmeans.getLabel().contains("tall")) {
        valueCount.setAsInt(s * s / 2, 0, c);
      } else {

代码示例来源:origin: ujmp/universal-java-matrix-package

private void export(Matrix matrix) {
  String name = matrix.getLabel();
  for (int r = 0; r < matrix.getRowCount(); r++) {
    matrix.setRowLabel(r, String.valueOf(extractSize(matrix.getRowLabel(r))));
  Matrix firstPart = Matrix.Factory.horCat(Matrix.Factory.linkToValue(matrix.getLabel()),
      matrix.getMetaDataDimensionMatrix(Matrix.ROW));
  Matrix lastPart = Matrix.Factory.horCat(matrix.getMetaDataDimensionMatrix(Matrix.COLUMN),
      plt.setColumnLabel(c, matrix.getColumnLabel(c - 1));
    plt.setLabel(matrix.getLabel());
    Object[] params = null;
    if (matrix.getLabel().contains("stdpercent")) {
      params = new Object[] { "xy", "logx", };
    } else {

代码示例来源:origin: ujmp/universal-java-matrix-package

public MLDenseDoubleMatrix(Matrix m) {
  super(m.getSize());
  if (m.getMetaData() != null) {
    setMetaData(m.getMetaData().clone());
    this.matrix = new MLDouble(m.getLabel(), MathUtil.toIntArray(m.getSize()));
  } else {
    this.matrix = new MLDouble("matrix" + System.nanoTime(), MathUtil.toIntArray(m
        .getSize()));
  }
  init();
  for (long[] c : m.availableCoordinates()) {
    setAsDouble(m.getAsDouble(c), c);
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public final static void compareAnnotation(Matrix m) {
  for (int r = 0; r < m.getRowCount(); r++) {
    if (r == 0) {
      assertEquals(null, m.getRowLabel(r));
    } else {
      assertEquals("row" + r, m.getRowLabel(r));
    }
  }
  for (int c = 0; c < m.getColumnCount(); c++) {
    if (c == 1) {
      assertEquals(null, m.getColumnLabel(c));
    } else {
      assertEquals("col" + c, m.getColumnLabel(c));
    }
  }
  assertEquals("label", m.getLabel());
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public final void testTransposeNewSmall() throws Exception {
  Matrix m = createMatrixWithAnnotation(2, 3);
  m.setAsDouble(1.0, 0, 0);
  m.setAsDouble(2.0, 0, 1);
  m.setAsDouble(3.0, 0, 2);
  m.setAsDouble(4.0, 1, 0);
  m.setAsDouble(5.0, 1, 1);
  m.setAsDouble(6.0, 1, 2);
  m.setLabel("label");
  m.setRowLabel(1, "row1");
  m.setColumnLabel(2, "col2");
  Matrix r = m.transpose(Ret.NEW);
  assertEquals(getLabel(), m.getRowCount(), r.getColumnCount());
  assertEquals(getLabel(), m.getColumnCount(), r.getRowCount());
  assertEquals(getLabel(), 1.0, r.getAsDouble(0, 0), TOLERANCE);
  assertEquals(getLabel(), 4.0, r.getAsDouble(0, 1), TOLERANCE);
  assertEquals(getLabel(), 2.0, r.getAsDouble(1, 0), TOLERANCE);
  assertEquals(getLabel(), 5.0, r.getAsDouble(1, 1), TOLERANCE);
  assertEquals(getLabel(), 3.0, r.getAsDouble(2, 0), TOLERANCE);
  assertEquals(getLabel(), 6.0, r.getAsDouble(2, 1), TOLERANCE);
  assertEquals(getLabel(), "label", r.getLabel());
  assertEquals(getLabel(), "row1", r.getColumnLabel(1));
  assertEquals(getLabel(), "col2", r.getRowLabel(2));
  if (m instanceof Erasable) {
    ((Erasable) m).erase();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

@Test
public final void testTransposeLinkSmall() throws Exception {
  Matrix m = createMatrixWithAnnotation(2, 3);
  m.setAsDouble(1.0, 0, 0);
  m.setAsDouble(2.0, 0, 1);
  m.setAsDouble(3.0, 0, 2);
  m.setAsDouble(4.0, 1, 0);
  m.setAsDouble(5.0, 1, 1);
  m.setAsDouble(6.0, 1, 2);
  m.setLabel("label");
  m.setRowLabel(1, "row1");
  m.setColumnLabel(2, "col2");
  Matrix r = m.transpose(Ret.LINK);
  assertEquals(getLabel(), m.getRowCount(), r.getColumnCount());
  assertEquals(getLabel(), m.getColumnCount(), r.getRowCount());
  assertEquals(getLabel(), 1.0, r.getAsDouble(0, 0), TOLERANCE);
  assertEquals(getLabel(), 4.0, r.getAsDouble(0, 1), TOLERANCE);
  assertEquals(getLabel(), 2.0, r.getAsDouble(1, 0), TOLERANCE);
  assertEquals(getLabel(), 5.0, r.getAsDouble(1, 1), TOLERANCE);
  assertEquals(getLabel(), 3.0, r.getAsDouble(2, 0), TOLERANCE);
  assertEquals(getLabel(), 6.0, r.getAsDouble(2, 1), TOLERANCE);
  assertEquals(getLabel(), "label", r.getLabel());
  assertEquals(getLabel(), "row1", r.getColumnLabel(1));
  assertEquals(getLabel(), "col2", r.getRowLabel(2));
  if (m instanceof Erasable) {
    ((Erasable) m).erase();
  }
}

相关文章

Matrix类方法