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

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

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

Matrix.getColumnCount介绍

暂无

代码示例

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

public Atimes(boolean ignoreNaN, Matrix m1, Matrix m2) {
  super(m1, m2);
  this.ignoreNaN = ignoreNaN;
  this.size = new long[] { m1.getRowCount(), m2.getColumnCount() };
}

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

/**
 * Constructor which takes an existing Matrix to copy data and structure
 * from. <br>
 * Block stripe size will be defaulted internally.
 * 
 * @param m
 *            - matrix to copy data from.
 */
public BlockDenseDoubleMatrix2D(Matrix m) {
  this(m, deriveDefaultBlockStripeSize((int) m.getRowCount(), (int) m.getColumnCount()));
}

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

public final Matrix solve(Matrix source, Matrix b) {
    if (source.getRowCount() >= source.getColumnCount()) {
      QRMatrix qr = new QRMatrix(source);
      return qr.solve(b);
    } else {
      throw new RuntimeException("only matrices m>=n are allowed");
    }
  }
};

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

public DefaultDenseGenericMatrix2D(Matrix m) {
  super(m.getRowCount(), m.getColumnCount());
  values = new Object[(int) m.getRowCount()][(int) m.getColumnCount()];
  for (long[] c : m.allCoordinates()) {
    setAsObject(m.getAsObject(c), c);
  }
}

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

public ValueToColumn(Matrix matrix) {
  super(matrix);
  if (matrix.getColumnCount() != 1) {
    throw new RuntimeException("matrix must have one column");
  }
  for (long[] c : getSource().availableCoordinates()) {
    max = Math.max(max, getSource().getAsInt(c));
  }
  this.size = new long[] { getSource().getRowCount(), max + 1 };
}

代码示例来源:origin: org.ujmp/ujmp-colt

public ColtSparseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new SparseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

代码示例来源:origin: org.ujmp/ujmp-la4j

public La4JDenseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new Basic2DMatrix((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

代码示例来源:origin: org.ujmp/ujmp-colt

public Matrix mtimes(Matrix m) {
  if (m instanceof ColtDenseDoubleMatrix2D) {
    DenseDoubleMatrix2D ret = new DenseDoubleMatrix2D((int) getRowCount(), (int) m.getColumnCount());
    matrix.zMult(((ColtDenseDoubleMatrix2D) m).matrix, ret);
    return new ColtDenseDoubleMatrix2D(ret);
  } else {
    return super.mtimes(m);
  }
}

代码示例来源:origin: org.ujmp/ujmp-jama

public JamaDenseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new Jama.Matrix((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

代码示例来源:origin: org.ujmp/ujmp-colt

public ColtDenseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new DenseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

代码示例来源:origin: org.ujmp/ujmp-jblas

public Matrix mtimes(Matrix m) {
  if (m instanceof JBlasDenseDoubleMatrix2D) {
    DoubleMatrix r = new DoubleMatrix((int) getRowCount(), (int) m.getColumnCount());
    matrix.mmuli(((JBlasDenseDoubleMatrix2D) m).matrix, r);
    return new JBlasDenseDoubleMatrix2D(r);
  } else {
    return super.mtimes(m);
  }
}

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

public ColtSparseDoubleMatrix2D(Matrix source) {
  super(source.getRowCount(), source.getColumnCount());
  this.matrix = new SparseDoubleMatrix2D((int) source.getRowCount(), (int) source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

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

public ArrayDenseStringMatrix2D(Matrix source) {
  this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount()));
  for (long[] c : source.availableCoordinates()) {
    setAsString(source.getAsString(c), c);
  }
}

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

public AbstractMapToTiledMatrix2DWrapper(Map<Coordinates, ObjectMatrix2D> map, Matrix source) {
  this(map, source.getRowCount(), source.getColumnCount());
  for (long[] c : source.availableCoordinates()) {
    setObject(source.getAsObject(c), c);
  }
  MapMatrix<String, Object> a = source.getMetaData();
  if (a != null) {
    setMetaData(a.clone());
  }
}

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

public JScienceDenseDoubleMatrix2D(Matrix matrix) {
  super(matrix.getRowCount(), matrix.getColumnCount());
  this.matrix = Float64Matrix.valueOf(matrix.toDoubleArray());
  if (matrix.getMetaData() != null) {
    setMetaData(matrix.getMetaData().clone());
  }
}

代码示例来源:origin: org.ujmp/ujmp-mtj

public MTJDenseDoubleMatrix2D(Matrix m) {
  super(m.getRowCount(), m.getColumnCount());
  if (m instanceof MTJDenseDoubleMatrix2D) {
    this.matrix = ((MTJDenseDoubleMatrix2D) m).matrix.copy();
  } else {
    this.matrix = new DenseMatrix(m.toDoubleArray());
  }
  if (m.getMetaData() != null) {
    setMetaData(m.getMetaData().clone());
  }
}

代码示例来源:origin: org.ujmp/ujmp-mtj

public double getDouble(long... coordinates) {
  if (inv == null) {
    DenseMatrix A = new MTJDenseDoubleMatrix2D(getSource()).getWrappedObject();
    DenseMatrix I = Matrices.identity((int) getSource().getColumnCount());
    DenseMatrix AI = I.copy();
    inv = new MTJDenseDoubleMatrix2D((DenseMatrix) A.solve(I, AI));
  }
  return inv.getAsDouble(coordinates);
}

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

public double getDouble(long... coordinates) {
  if (inv == null) {
    DenseMatrix A = new MTJDenseDoubleMatrix2D(getSource()).getWrappedObject();
    DenseMatrix I = Matrices.identity((int) getSource().getColumnCount());
    DenseMatrix AI = I.copy();
    inv = new MTJDenseDoubleMatrix2D((DenseMatrix) A.solve(I, AI));
  }
  return inv.getAsDouble(coordinates);
}

代码示例来源:origin: org.ujmp/ujmp-vecmath

public VecMathDenseDoubleMatrix2D(Matrix source) {
  this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount()));
  for (long[] c : source.availableCoordinates()) {
    setAsDouble(source.getAsDouble(c), c);
  }
  if (source.getMetaData() != null) {
    setMetaData(source.getMetaData().clone());
  }
}

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

@Test
public void testDeleteRow0() {
  Matrix m = getMatrix();
  m = m.deleteRows(Ret.NEW, 0);
  assertEquals(4, m.getRowCount());
  assertEquals(5, m.getColumnCount());
  assertEquals(1, m.getAsLong(0, 0));
  assertEquals(2, m.getAsLong(0, 1));
  assertEquals(1, m.getAsLong(1, 0));
}

相关文章

Matrix类方法