public DefaultDenseDoubleMatrix2D(int rows, int columns) { super(rows, columns); this.rows = rows; this.cols = columns; this.size = new long[] { rows, columns }; this.values = new double[MathUtil.longToInt((long) rows * (long) columns)]; }
public final DenseMatrix zeros(long... size) { if (size.length == 2) { return new DefaultDenseDoubleMatrix2D(MathUtil.longToInt(size[ROW]), MathUtil.longToInt(size[COLUMN])); } else if (size.length > 2) { return new DefaultDenseDoubleMatrixMultiD(size); } else { throw new RuntimeException("Size must be at least 2-dimensional"); } }
protected void recalcWidthCache() { long width = (getColumnCount64() - columnWidths.size()) * getDefaultColumnWidth(); for (Long column : columnWidths.keySet()) { width += columnWidths.get(column); } totalColumnWidth = MathUtil.longToInt(width); }
public int size() { MatchAllQueryBuilder query = QueryBuilders.matchAllQuery(); CountResponse response = client.prepareCount(index).setTypes(type).setQuery(query).execute().actionGet(); return MathUtil.longToInt(response.getCount()); }
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()); } }
public JSciDenseDoubleMatrix2D(Matrix source) { this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount())); for (long[] c : source.availableCoordinates()) { setDouble(source.getAsDouble(c), c); } if (source.getMetaData() != null) { setMetaData(source.getMetaData().clone()); } }
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()); } }
public ParallelColtSparseDoubleMatrix2D(Matrix source) { this(MathUtil.longToInt(source.getRowCount()), MathUtil.longToInt(source.getColumnCount())); for (long[] c : source.availableCoordinates()) { setDouble(source.getAsDouble(c), c); } if (source.getMetaData() != null) { setMetaData(source.getMetaData().clone()); } }
public int count(String string) { QueryBuilder query = QueryBuilders.queryString(string).defaultOperator(Operator.AND); CountResponse response = client.prepareCount(index).setTypes(type).setQuery(query).execute().actionGet(); return MathUtil.longToInt(response.getCount()); }