cern.colt.matrix.linalg.Algebra.normInfinity()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(92)

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

Algebra.normInfinity介绍

[英]Returns the infinity norm of vector x, which is Max(abs(x[i])).
[中]返回向量x的无穷范数,即Max(abs(x[i])。

代码示例

代码示例来源:origin: com.github.vincentk/joptimizer

/**
 * Calculate the scaled residual
 * <br> ||Ax-b||_oo/( ||A||_oo . ||x||_oo + ||b||_oo ), with
 * <br> ||x||_oo = max(||x[i]||)
 */
public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix1D x, DoubleMatrix1D b){
  double residual = -Double.MAX_VALUE;
  double nix = Algebra.DEFAULT.normInfinity(x);
  double nib = Algebra.DEFAULT.normInfinity(b);
  if(Double.compare(nix, 0.)==0 && Double.compare(nib, 0.)==0){
    return 0;
  }else{
    double num = Algebra.DEFAULT.normInfinity(ColtUtils.zMult(A, x, b, -1));
    double den = Algebra.DEFAULT.normInfinity(A) * nix + nib;
    residual =  num / den;
    //log.debug("scaled residual: " + residual);
    
    return residual;
  }
}

代码示例来源:origin: com.github.vincentk/joptimizer

/**
 * Calculate the scaled residual 
 * <br> ||Ax-b||_oo/( ||A||_oo . ||x||_oo + ||b||_oo ), with
 * <br> ||x||_oo = max(||x[i]||)
 */
public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix2D X, DoubleMatrix2D B){
  double residual = -Double.MAX_VALUE;
  double niX = Algebra.DEFAULT.normInfinity(X);
  double niB = Algebra.DEFAULT.normInfinity(B);
  if(Double.compare(niX, 0.)==0 && Double.compare(niB, 0.)==0){
    return 0;
  }else{
    double num = Algebra.DEFAULT.normInfinity(Algebra.DEFAULT.mult(A, X).assign(B,	Functions.minus));
    double den = Algebra.DEFAULT.normInfinity(A) * niX + niB;
    residual =  num / den;
    //log.debug("scaled residual: " + residual);
    
    return residual;
  }
}

代码示例来源:origin: blazegraph/database

public static void main(String[] args) {
    DoubleMatrix1D x1 = DoubleFactory1D.dense
        .make(new double[] { 1.0, 2.0});
    DoubleMatrix1D x2 = DoubleFactory1D.dense
        .make(new double[] { 1.0, -2.0});
    DoubleMatrix1D x3 = DoubleFactory1D.dense.make(new double[] { -1.0, -2.0});

    System.out.println(Algebra.DEFAULT.normInfinity(x1));
    System.out.println(Algebra.DEFAULT.normInfinity(x2));
    System.out.println(Algebra.DEFAULT.normInfinity(x3));
  }
}

代码示例来源:origin: com.blazegraph/colt

public static void main(String[] args) {
    DoubleMatrix1D x1 = DoubleFactory1D.dense
        .make(new double[] { 1.0, 2.0});
    DoubleMatrix1D x2 = DoubleFactory1D.dense
        .make(new double[] { 1.0, -2.0});
    DoubleMatrix1D x3 = DoubleFactory1D.dense.make(new double[] { -1.0, -2.0});

    System.out.println(Algebra.DEFAULT.normInfinity(x1));
    System.out.println(Algebra.DEFAULT.normInfinity(x2));
    System.out.println(Algebra.DEFAULT.normInfinity(x3));
  }
}

代码示例来源:origin: com.github.vincentk/joptimizer

double normC = -Double.MAX_VALUE;
for(int i=0; i<r; i++){
  double dri = ALG.normInfinity(AK.viewRow(i));
  DR.setQuick(i, Math.sqrt(dri));
  DRInv.setQuick(i, 1./Math.sqrt(dri));
  double dci = ALG.normInfinity(AK.viewColumn(j));
  DC.setQuick(j, Math.sqrt(dci));
  DCInv.setQuick(j, 1./Math.sqrt(dci));

代码示例来源:origin: blazegraph/database

try { values.add(String.valueOf(normInfinity(matrix)));} 
catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }

代码示例来源:origin: com.blazegraph/colt

try { values.add(String.valueOf(normInfinity(matrix)));} 
catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }

相关文章