no.uib.cipr.matrix.Vector.size()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(77)

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

Vector.size介绍

[英]Size of the vector
[中]向量的大小

代码示例

代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-common-core

@Override
public int getDimensionality()
{
  return this.internalVector.size();
}

代码示例来源:origin: algorithmfoundry/Foundry

@Override
public int getDimensionality()
{
  return this.internalVector.size();
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Constructor for AbstractVector, same size as x
 * 
 * @param x
 *            Vector to get the size from
 */
protected AbstractVector(Vector x) {
  this.size = x.size();
}

代码示例来源:origin: algorithmfoundry/Foundry

@Override
public int getDimensionality()
{
  return this.internalVector.size();
}

代码示例来源:origin: com.googlecode.matrix-toolkits-java/mtj

/**
 * Constructor for AbstractVector, same size as x
 * 
 * @param x
 *            Vector to get the size from
 */
protected AbstractVector(Vector x) {
  this.size = x.size();
}

代码示例来源:origin: de.tudarmstadt.ukp.similarity.algorithms/de.tudarmstadt.ukp.similarity.algorithms.sspace-gpl

@Override
public int length()
{
  return wrapped.size();
}

代码示例来源:origin: com.googlecode.matrix-toolkits-java/mtj

/**
 * Checks the arguments to <code>transMult</code> and
 * <code>transMultAdd</code>
 */
protected void checkTransMultAdd(Vector x, Vector y) {
  if (numRows != x.size())
    throw new IndexOutOfBoundsException("A.numRows != x.size ("
        + numRows + " != " + x.size() + ")");
  if (numColumns != y.size())
    throw new IndexOutOfBoundsException("A.numColumns != y.size ("
        + numColumns + " != " + y.size() + ")");
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Checks the arguments to <code>mult</code> and <code>multAdd</code>
 */
protected void checkMultAdd(Vector x, Vector y) {
  if (numColumns != x.size())
    throw new IndexOutOfBoundsException("A.numColumns != x.size ("
        + numColumns + " != " + x.size() + ")");
  if (numRows != y.size())
    throw new IndexOutOfBoundsException("A.numRows != y.size ("
        + numRows + " != " + y.size() + ")");
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Checks the arguments to <code>transMult</code> and
 * <code>transMultAdd</code>
 */
protected void checkTransMultAdd(Vector x, Vector y) {
  if (numRows != x.size())
    throw new IndexOutOfBoundsException("A.numRows != x.size ("
        + numRows + " != " + x.size() + ")");
  if (numColumns != y.size())
    throw new IndexOutOfBoundsException("A.numColumns != y.size ("
        + numColumns + " != " + y.size() + ")");
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Checks for conformant sizes
 */
protected void checkSize(Vector y) {
  if (size != y.size())
    throw new IndexOutOfBoundsException("x.size != y.size (" + size
        + " != " + y.size() + ")");
}

代码示例来源:origin: com.googlecode.matrix-toolkits-java/mtj

/**
 * Checks for conformant sizes
 */
protected void checkSize(Vector y) {
  if (size != y.size())
    throw new IndexOutOfBoundsException("x.size != y.size (" + size
        + " != " + y.size() + ")");
}

代码示例来源:origin: com.googlecode.matrix-toolkits-java/mtj

/**
 * Checks the arguments to <code>mult</code> and <code>multAdd</code>
 */
protected void checkMultAdd(Vector x, Vector y) {
  if (numColumns != x.size())
    throw new IndexOutOfBoundsException("A.numColumns != x.size ("
        + numColumns + " != " + x.size() + ")");
  if (numRows != y.size())
    throw new IndexOutOfBoundsException("A.numRows != y.size ("
        + numRows + " != " + y.size() + ")");
}

代码示例来源:origin: com.googlecode.matrix-toolkits-java/mtj

/**
 * Checks sizes of input data for {@link #solve(Matrix, Vector, Vector)}.
 * Throws an exception if the sizes does not match.
 */
protected void checkSizes(Matrix A, Vector b, Vector x) {
  if (!A.isSquare())
    throw new IllegalArgumentException("!A.isSquare()");
  if (b.size() != A.numRows())
    throw new IllegalArgumentException("b.size() != A.numRows()");
  if (b.size() != x.size())
    throw new IllegalArgumentException("b.size() != x.size()");
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Checks sizes of input data for {@link #solve(Matrix, Vector, Vector)}.
 * Throws an exception if the sizes does not match.
 */
protected void checkSizes(Matrix A, Vector b, Vector x) {
  if (!A.isSquare())
    throw new IllegalArgumentException("!A.isSquare()");
  if (b.size() != A.numRows())
    throw new IllegalArgumentException("b.size() != A.numRows()");
  if (b.size() != x.size())
    throw new IllegalArgumentException("b.size() != x.size()");
}

代码示例来源:origin: org.dkpro.similarity/dkpro-similarity-algorithms-vsm-asl

private static int length(Vector vec)
  {
    if (vec instanceof SparseVector) {
      return ((SparseVector) vec).getUsed();
    }
    else {
      return vec.size();
    }
  }
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Populates a vector with random numbers drawn from a uniform distribution
 * between 0 and 1
 * 
 * @param x
 *            Vector to populate
 */
public static Vector random(Vector x) {
  for (int i = 0; i < x.size(); ++i)
    x.set(i, Math.random());
  return x;
}

代码示例来源:origin: fommil/matrix-toolkits-java

/**
 * Returns a dense array containing a copy of the given vector
 */
public static double[] getArray(Vector x) {
  double[] xd = new double[x.size()];
  for (VectorEntry e : x)
    xd[e.index()] = e.get();
  return xd;
}

代码示例来源:origin: com.googlecode.matrix-toolkits-java/mtj

/**
 * Returns a dense array containing a copy of the given vector
 */
public static double[] getArray(Vector x) {
  double[] xd = new double[x.size()];
  for (VectorEntry e : x)
    xd[e.index()] = e.get();
  return xd;
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.keyphrases/de.tudarmstadt.ukp.dkpro.keyphrases.textgraphs-gpl

protected Vector initScoreVector(int tokenSize) {
  Vector scoreVector = new DenseVector(tokenSize);
  double initValue = 1.0;
  for (int i = 0; i < scoreVector.size(); i++) {
    scoreVector.set(i, initValue);
  }
  return scoreVector;
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Returns the log of the density value for the given vector.
 *
 * @param valuePassed input vector
 * @return log density based on given distribution
 */
@Override
public double logDensity(double[] valuePassed) {
 // calculate mean subtractions
 Vector x = new DenseVector(valuePassed);
 return lnconstant - 0.5 * x.dot(covarianceInverse.mult(x.add(-1.0, mean), new DenseVector(x.size())));
}

相关文章