本文整理汇总了Java中org.ujmp.core.Matrix.setColumnLabel方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix.setColumnLabel方法的具体用法?Java Matrix.setColumnLabel怎么用?Java Matrix.setColumnLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ujmp.core.Matrix
的用法示例。
在下文中一共展示了Matrix.setColumnLabel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Matrix m = Matrix.Factory.zeros(ValueType.OBJECT, 5, 5);
m.randn(Ret.ORIG);
m.setLabel("test");
m.setColumnLabel(0, "col0");
m.setColumnLabel(1, "col1");
m.setColumnLabel(2, "col2");
m.setColumnLabel(3, "col3");
m.setColumnLabel(4, "col4");
m.setRowLabel(0, "row0");
m.setRowLabel(1, "row1");
m.setRowLabel(2, "row2");
m.setRowLabel(3, "row3");
m.setRowLabel(4, "row4");
m.setAsDouble(Double.NaN, 2, 2);
m.setAsDouble(Double.NEGATIVE_INFINITY, 3, 2);
System.out.println(m);
System.out.println(m.includeAnnotation(Ret.NEW, Matrix.COLUMN));
}
示例2: setAnnotation
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
public final static void setAnnotation(Matrix m) {
m.setLabel("label");
m.setDimensionLabel(Matrix.ROW, "rows");
m.setDimensionLabel(Matrix.COLUMN, "columns");
for (int r = 0; r < m.getRowCount(); r++) {
if (r == 0) {
continue;
}
m.setRowLabel(r, "row" + r);
}
for (int c = 0; c < m.getColumnCount(); c++) {
if (c == 1) {
continue;
}
m.setColumnLabel(c, "col" + c);
}
}
示例3: testReverseAnnotation
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public void testReverseAnnotation() throws Exception {
Matrix m = Matrix.Factory.zeros(10, 10);
m.setColumnLabel(3, "col3");
m.setRowLabel(3, "row3");
m.setColumnLabel(5, "col5");
m.setRowLabel(5, "row5");
assertEquals(3, m.getRowForLabel("row3"));
assertEquals(3, m.getColumnForLabel("col3"));
assertEquals(5, m.getRowForLabel("row5"));
assertEquals(5, m.getColumnForLabel("col5"));
assertEquals(-1, m.getColumnForLabel("col1"));
assertEquals(-1, m.getRowForLabel("col1"));
}
示例4: testCols
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public void testCols() {
Matrix m1 = Matrix.Factory.zeros(2, 1);
m1.setLabel("label");
m1.setColumnLabel(0, "col1");
Matrix m2 = m1.appendHorizontally(Ret.NEW, Matrix.Factory.zeros(2, 1));
m2.setColumnLabel(1, "col2");
assertEquals("label", m2.getLabelObject());
assertEquals("col1", m2.getColumnLabel(0));
assertEquals("col2", m2.getColumnLabel(1));
}
示例5: getMatrix
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
private Matrix getMatrix(ValueType valueType) {
Matrix m = Matrix.Factory.zeros(valueType, 4, 4);
m.setRowLabel(0, "row0");
m.setRowLabel(1, "row1");
m.setRowLabel(2, "row2");
m.setRowLabel(3, "row3");
m.setColumnLabel(0, "col0");
m.setColumnLabel(1, "col1");
m.setColumnLabel(2, "col2");
m.setColumnLabel(3, "col3");
m.setAsDouble(1, 0, 0);
m.setAsDouble(2, 0, 1);
m.setAsDouble(30, 0, 2);
m.setAsDouble(4, 0, 3);
m.setAsDouble(5, 1, 0);
m.setAsDouble(6, 1, 1);
m.setAsDouble(-700, 1, 2);
m.setAsDouble(8, 1, 3);
m.setAsDouble(9, 2, 0);
m.setAsDouble(1, 2, 1);
m.setAsDouble(-2, 2, 2);
m.setAsDouble(3, 2, 3);
m.setAsDouble(-4, 3, 0);
m.setAsDouble(5, 3, 1);
m.setAsDouble(6, 3, 2);
m.setAsDouble(7, 3, 3);
return m;
}
示例6: testTransposeNewSmall
import org.ujmp.core.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();
}
}
示例7: testTransposeLinkSmall
import org.ujmp.core.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();
}
}
示例8: getResult
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
private Matrix getResult(ValueType valueType) {
Matrix m = Matrix.Factory.zeros(valueType, 4, 4);
if (ValueType.STRING.equals(valueType) || ValueType.OBJECT.equals(valueType)) {
m.setRowLabel(0, "row2");
m.setRowLabel(1, "row1");
m.setRowLabel(2, "row0");
m.setRowLabel(3, "row3");
} else {
m.setRowLabel(0, "row1");
m.setRowLabel(1, "row2");
m.setRowLabel(2, "row3");
m.setRowLabel(3, "row0");
}
m.setColumnLabel(0, "col0");
m.setColumnLabel(1, "col1");
m.setColumnLabel(2, "col2");
m.setColumnLabel(3, "col3");
if (ValueType.STRING.equals(valueType) || ValueType.OBJECT.equals(valueType)) {
m.setAsDouble(9, 0, 0);
m.setAsDouble(1, 0, 1);
m.setAsDouble(-2, 0, 2);
m.setAsDouble(3, 0, 3);
m.setAsDouble(5, 1, 0);
m.setAsDouble(6, 1, 1);
m.setAsDouble(-700, 1, 2);
m.setAsDouble(8, 1, 3);
m.setAsDouble(1, 2, 0);
m.setAsDouble(2, 2, 1);
m.setAsDouble(30, 2, 2);
m.setAsDouble(4, 2, 3);
m.setAsDouble(-4, 3, 0);
m.setAsDouble(5, 3, 1);
m.setAsDouble(6, 3, 2);
m.setAsDouble(7, 3, 3);
} else {
m.setAsDouble(5, 0, 0);
m.setAsDouble(6, 0, 1);
m.setAsDouble(-700, 0, 2);
m.setAsDouble(8, 0, 3);
m.setAsDouble(9, 1, 0);
m.setAsDouble(1, 1, 1);
m.setAsDouble(-2, 1, 2);
m.setAsDouble(3, 1, 3);
m.setAsDouble(-4, 2, 0);
m.setAsDouble(5, 2, 1);
m.setAsDouble(6, 2, 2);
m.setAsDouble(7, 2, 3);
m.setAsDouble(1, 3, 0);
m.setAsDouble(2, 3, 1);
m.setAsDouble(30, 3, 2);
m.setAsDouble(4, 3, 3);
}
return m;
}
示例9: getResultReverse
import org.ujmp.core.Matrix; //导入方法依赖的package包/类
private Matrix getResultReverse(ValueType valueType) {
Matrix m = Matrix.Factory.zeros(valueType, 4, 4);
if (ValueType.STRING.equals(valueType) || ValueType.OBJECT.equals(valueType)) {
m.setRowLabel(0, "row3");
m.setRowLabel(1, "row0");
m.setRowLabel(2, "row1");
m.setRowLabel(3, "row2");
} else {
m.setRowLabel(0, "row0");
m.setRowLabel(1, "row3");
m.setRowLabel(2, "row2");
m.setRowLabel(3, "row1");
}
m.setColumnLabel(0, "col0");
m.setColumnLabel(1, "col1");
m.setColumnLabel(2, "col2");
m.setColumnLabel(3, "col3");
if (ValueType.STRING.equals(valueType) || ValueType.OBJECT.equals(valueType)) {
m.setAsDouble(-4, 0, 0);
m.setAsDouble(5, 0, 1);
m.setAsDouble(6, 0, 2);
m.setAsDouble(7, 0, 3);
m.setAsDouble(1, 1, 0);
m.setAsDouble(2, 1, 1);
m.setAsDouble(30, 1, 2);
m.setAsDouble(4, 1, 3);
m.setAsDouble(5, 2, 0);
m.setAsDouble(6, 2, 1);
m.setAsDouble(-700, 2, 2);
m.setAsDouble(8, 2, 3);
m.setAsDouble(9, 3, 0);
m.setAsDouble(1, 3, 1);
m.setAsDouble(-2, 3, 2);
m.setAsDouble(3, 3, 3);
} else {
m.setAsDouble(1, 0, 0);
m.setAsDouble(2, 0, 1);
m.setAsDouble(30, 0, 2);
m.setAsDouble(4, 0, 3);
m.setAsDouble(-4, 1, 0);
m.setAsDouble(5, 1, 1);
m.setAsDouble(6, 1, 2);
m.setAsDouble(7, 1, 3);
m.setAsDouble(9, 2, 0);
m.setAsDouble(1, 2, 1);
m.setAsDouble(-2, 2, 2);
m.setAsDouble(3, 2, 3);
m.setAsDouble(5, 3, 0);
m.setAsDouble(6, 3, 1);
m.setAsDouble(-700, 3, 2);
m.setAsDouble(8, 3, 3);
}
return m;
}