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

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

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

Vector.norm介绍

[英]Computes the given norm of the vector
[中]计算向量的给定范数

代码示例

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

@Override
public double norm2()
{
  return this.internalVector.norm(
    no.uib.cipr.matrix.Vector.Norm.Two );
}

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

@Override
public double norm2()
{
  return this.internalVector.norm(
    no.uib.cipr.matrix.Vector.Norm.Two );
}

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

@Override
public double norm2()
{
  return this.internalVector.norm(
    no.uib.cipr.matrix.Vector.Norm.Two );
}

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

public boolean converged(Vector r, Vector x)
    throws IterativeSolverNotConvergedException {
  return converged(r.norm(normType), x);
}

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

public boolean converged(Vector r, Vector x)
    throws IterativeSolverNotConvergedException {
  return converged(r.norm(normType), x);
}

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

public boolean converged(Vector r)
    throws IterativeSolverNotConvergedException {
  return converged(r.norm(normType));
}

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

public boolean converged(Vector r)
    throws IterativeSolverNotConvergedException {
  return converged(r.norm(normType));
}

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

/**
   * Calculates the norm of the given vector. If multiple vectors are given, calculates the
   * product of the vector norms. If no vector is given, 1.0 is returned.
   *
   * @param aVectors a list of vectors.
   * @return the vector norm or product of vector norms.
   */
  public double apply(Vector... aVectors)
  {
    double result = 1.0;
    if (!this.equals(NONE)) {
      for (Vector v : aVectors) {
        switch (this) {
        case L1:
          result = result * v.norm(Norm.One);
          break;
        case L2:
          result = result * v.norm(Norm.TwoRobust);
          break;
        default:
          throw new IllegalStateException("Norm ["+this+"] not supported");
        }
      }
    }
    return result;
  }
}

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

/**
   * Calculates the norm of the given vector. If multiple vectors are given, calculates the
   * product of the vector norms. If no vector is given, 1.0 is returned.
   *
   * @param aVectors a list of vectors.
   * @return the vector norm or product of vector norms.
   */
  public double apply(Vector... aVectors)
  {
    double result = 1.0;
    if (!this.equals(NONE)) {
      for (Vector v : aVectors) {
        switch (this) {
        case L1:
          result = result * v.norm(Norm.One);
          break;
        case L2:
          result = result * v.norm(Norm.TwoRobust);
          break;
        default:
          throw new IllegalStateException("Norm ["+this+"] not supported");
        }
      }
    }
    return result;
  }
}

代码示例来源:origin: dkpro/dkpro-similarity

/**
   * Calculates the norm of the given vector. If multiple vectors are given, calculates the
   * product of the vector norms. If no vector is given, 1.0 is returned.
   *
   * @param aVectors a list of vectors.
   * @return the vector norm or product of vector norms.
   */
  public double apply(Vector... aVectors)
  {
    double result = 1.0;
    if (!this.equals(NONE)) {
      for (Vector v : aVectors) {
        switch (this) {
        case L1:
          result = result * v.norm(Norm.One);
          break;
        case L2:
          result = result * v.norm(Norm.TwoRobust);
          break;
        default:
          throw new IllegalStateException("Norm ["+this+"] not supported");
        }
      }
    }
    return result;
  }
}

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

@Override
protected boolean convergedI(double r, Vector x)
    throws IterativeSolverNotConvergedException {
  // Store initial residual
  if (isFirst())
    initR = r;
  // Check for convergence
  if (r < Math.max(rtol * (normA * x.norm(normType) + normb), atol))
    return true;
  // Check for divergence
  if (r > dtol * initR)
    throw new IterativeSolverNotConvergedException(
        NotConvergedException.Reason.Divergence, this);
  if (iter >= maxIter)
    throw new IterativeSolverNotConvergedException(
        NotConvergedException.Reason.Iterations, this);
  if (Double.isNaN(r))
    throw new IterativeSolverNotConvergedException(
        NotConvergedException.Reason.Divergence, this);
  // Neither convergence nor divergence
  return false;
}

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

@Override
protected boolean convergedI(double r, Vector x)
    throws IterativeSolverNotConvergedException {
  // Store initial residual
  if (isFirst())
    initR = r;
  // Check for convergence
  if (r < Math.max(rtol * (normA * x.norm(normType) + normb), atol))
    return true;
  // Check for divergence
  if (r > dtol * initR)
    throw new IterativeSolverNotConvergedException(
        NotConvergedException.Reason.Divergence, this);
  if (iter >= maxIter)
    throw new IterativeSolverNotConvergedException(
        NotConvergedException.Reason.Iterations, this);
  if (Double.isNaN(r))
    throw new IterativeSolverNotConvergedException(
        NotConvergedException.Reason.Divergence, this);
  // Neither convergence nor divergence
  return false;
}

代码示例来源:origin: openimaj/openimaj

@Override
public Vector[] apply(double[] in) {
  Vector[] vmat = new Vector[in.length];
  
  vmat[0] = new DenseVector(in);
  double norm = vmat[0].norm(Norm.Two);
  vmat[0].scale(1/norm);
  for (int j = 1; j < in.length; j++) {
    Vector randvec = randvec(vmat[0].size(),norm);
    vmat[j] = new DenseVector(vmat[0]).add(randvec);
    for (int i = 0; i < j; i++) {
      vmat[j].add(-1, project(vmat[j],vmat[i]));
    }
    vmat[j].scale(1/vmat[j].norm(Norm.Two));
  }
  return vmat;
}

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

double normr = r.norm(Norm.Two);
M.apply(b, u);
      w.add(-H.get(k, i), v[k]);
    H.set(i + 1, i, w.norm(Norm.Two));
    v[i + 1].set(1. / H.get(i + 1, i), w);
  normr = r.norm(Norm.Two);

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

double normr = r.norm(Norm.Two);
M.apply(b, u);
      w.add(-H.get(k, i), v[k]);
    H.set(i + 1, i, w.norm(Norm.Two));
    v[i + 1].set(1. / H.get(i + 1, i), w);
  normr = r.norm(Norm.Two);

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

rho = y.norm(Norm.Two);
xi = z.norm(Norm.Two);
  M1.apply(v_tld, y);
  rho_1 = rho;
  rho = y.norm(Norm.Two);
  xi = z.norm(Norm.Two);

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

rho = y.norm(Norm.Two);
xi = z.norm(Norm.Two);
  M1.apply(v_tld, y);
  rho_1 = rho;
  rho = y.norm(Norm.Two);
  xi = z.norm(Norm.Two);

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

m_Weights.scale(1.0 / m_Weights.norm(Vector.Norm.Two));

相关文章