org.apache.mahout.math.Matrix.clone()方法的使用及代码示例

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

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

Matrix.clone介绍

[英]Return a copy of the recipient
[中]返回收件人的副本

代码示例

代码示例来源:origin: apache/mahout

@Override
public Vector clone() {
 MatrixVectorView r = (MatrixVectorView) super.clone();
 r.matrix = matrix.clone();
 r.row = row;
 r.column = column;
 r.rowStride = rowStride;
 r.columnStride = columnStride;
 return r;
}

代码示例来源:origin: apache/mahout

@Override
public Matrix clone() {
 MatrixView clone = (MatrixView) super.clone();
 clone.matrix = matrix.clone();
 clone.offset = offset.clone();
 return clone;
}

代码示例来源:origin: apache/mahout

@Override
public Matrix clone() {
 PivotedMatrix clone = (PivotedMatrix) super.clone();
 base = base.clone();
 rowPivot = rowPivot.clone();
 rowUnpivot = rowUnpivot.clone();
 columnPivot = columnPivot.clone();
 columnUnpivot = columnUnpivot.clone();
 return clone;
}

代码示例来源:origin: apache/mahout

mType = a.like(1,1);
Matrix qTmp = a.clone();
 q = qTmp.viewPart(0, rows, 0, min).clone();
} else {
 q = qTmp;

代码示例来源:origin: apache/mahout

@Test
public void testCopy() {
 Matrix copy = test.clone();
 assertSame("wrong class", copy.getClass(), test.getClass());
 for (int row = 0; row < test.rowSize(); row++) {
  for (int col = 0; col < test.columnSize(); col++) {
   assertEquals("value[" + row + "][" + col + ']',
     test.getQuick(row, col), copy.getQuick(row, col), EPSILON);
  }
 }
}

代码示例来源:origin: apache/mahout

@Test
public void testClone() {
 double oldValue = 1.23;
 double newValue = 2.34;
 double[][] values = {{oldValue, 3}, {3, 5}, {7, 9}};
 Matrix matrix = matrixFactory(values);
 Matrix clone = matrix.clone();
 clone.set(0, 0, newValue);
 //test whether the update in the clone is reflected in the original matrix
 assertEquals("Matrix clone is not independent of the original",
  oldValue, matrix.get(0, 0), EPSILON);
}

代码示例来源:origin: apache/mahout

@Test
public void testCopy() {
 Matrix copy = test.clone();
 assertTrue("wrong class", copy instanceof MatrixView);
 for (int row = 0; row < test.rowSize(); row++) {
  for (int col = 0; col < test.columnSize(); col++) {
   assertEquals("value[" + row + "][" + col + ']',
     test.getQuick(row, col), copy.getQuick(row, col), EPSILON);
  }
 }
}

代码示例来源:origin: apache/mahout

assertEquals(0, r.clone().assign(Functions.ABS).minus(rRef.clone().assign(Functions.ABS)).aggregate(Functions.PLUS, Functions.IDENTITY), 1.0e-12);
printMatrix("q", q);
assertEquals(0, q.clone().assign(Functions.ABS).minus(qRef.clone().assign(Functions.ABS)).aggregate(Functions.PLUS, Functions.IDENTITY), 1.0e-12);

代码示例来源:origin: apache/mahout

printMatrix("rRef", rRef);
printMatrix("rActual", rActual);
assertEquals(0, rActual.clone().assign(Functions.ABS).minus(rRef.clone().assign(Functions.ABS)).aggregate(Functions.PLUS, Functions.IDENTITY), 1.0e-12);
printMatrix("q", q);
assertEquals(0, q.clone().assign(Functions.ABS).minus(qRef.clone().assign(Functions.ABS)).aggregate(Functions.PLUS, Functions.IDENTITY), 1.0e-12);

代码示例来源:origin: apache/mahout

qr = a.clone();
originalRows = a.numRows();
originalColumns = a.numCols();

代码示例来源:origin: org.apache.mahout/mahout-mr

/**
 * Assign the content of another HMM model to this one
 *
 * @param model The HmmModel that will be assigned to this one
 */
public void assign(HmmModel model) {
 this.nrOfHiddenStates = model.nrOfHiddenStates;
 this.nrOfOutputStates = model.nrOfOutputStates;
 this.hiddenStateNames = model.hiddenStateNames;
 this.outputStateNames = model.outputStateNames;
 // for now clone the matrix/vectors
 this.initialProbabilities = model.initialProbabilities.clone();
 this.emissionMatrix = model.emissionMatrix.clone();
 this.transitionMatrix = model.transitionMatrix.clone();
}

代码示例来源:origin: org.apache.mahout/mahout-math

@Override
public Vector clone() {
 MatrixVectorView r = (MatrixVectorView) super.clone();
 r.matrix = matrix.clone();
 r.row = row;
 r.column = column;
 r.rowStride = rowStride;
 r.columnStride = columnStride;
 return r;
}

代码示例来源:origin: cloudera/mahout

@Override
 public Vector clone() {
  MatrixVectorView r = (MatrixVectorView) super.clone();
  r.matrix = matrix.clone();
  r.row = row;
  r.column = column;
  r.rowStride = rowStride;
  r.columnStride = columnStride;
  return r;
 }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

/**
 * Get a copy of this model
 */
@Override
public HmmModel clone() {
 HmmModel model = new HmmModel(transitionMatrix.clone(), emissionMatrix.clone(), initialProbabilities.clone());
 if (hiddenStateNames != null) {
  model.hiddenStateNames = HashBiMap.create(hiddenStateNames);
 }
 if (outputStateNames != null) {
  model.outputStateNames = HashBiMap.create(outputStateNames);
 }
 return model;
}

代码示例来源:origin: org.apache.mahout/mahout-core

/**
 * Get a copy of this model
 */
@Override
public HmmModel clone() {
 HmmModel model = new HmmModel(transitionMatrix.clone(), emissionMatrix.clone(), initialProbabilities.clone());
 if (hiddenStateNames != null) {
  model.hiddenStateNames = HashBiMap.create(hiddenStateNames);
 }
 if (outputStateNames != null) {
  model.outputStateNames = HashBiMap.create(outputStateNames);
 }
 return model;
}

代码示例来源:origin: org.apache.mahout/mahout-math

@Override
public Matrix clone() {
 MatrixView clone = (MatrixView) super.clone();
 clone.matrix = matrix.clone();
 clone.offset = offset.clone();
 return clone;
}

代码示例来源:origin: cloudera/mahout

@Override
public Matrix clone() {
 MatrixView clone = (MatrixView) super.clone();
 clone.matrix = matrix.clone();
 clone.offset = offset.clone();
 return clone;
}

代码示例来源:origin: org.apache.mahout/mahout-math

@Override
public Matrix clone() {
 PivotedMatrix clone = (PivotedMatrix) super.clone();
 base = base.clone();
 rowPivot = rowPivot.clone();
 rowUnpivot = rowUnpivot.clone();
 columnPivot = columnPivot.clone();
 columnUnpivot = columnUnpivot.clone();
 return clone;
}

代码示例来源:origin: cloudera/mahout

@Test
public void testCopy() {
 Matrix copy = test.clone();
 assertSame("wrong class", copy.getClass(), test.getClass());
 for (int row = 0; row < test.rowSize(); row++) {
  for (int col = 0; col < test.columnSize(); col++) {
   assertEquals("value[" + row + "][" + col + ']',
     test.getQuick(row, col), copy.getQuick(row, col), EPSILON);
  }
 }
}

代码示例来源:origin: cloudera/mahout

@Test
public void testCopy() {
 Matrix copy = test.clone();
 assertTrue("wrong class", copy instanceof MatrixView);
 for (int row = 0; row < test.rowSize(); row++) {
  for (int col = 0; col < test.columnSize(); col++) {
   assertEquals("value[" + row + "][" + col + ']',
     test.getQuick(row, col), copy.getQuick(row, col), EPSILON);
  }
 }
}

相关文章