当前位置: 首页>>代码示例>>Java>>正文


Java Sqrt类代码示例

本文整理汇总了Java中org.apache.commons.math3.analysis.function.Sqrt的典型用法代码示例。如果您正苦于以下问题:Java Sqrt类的具体用法?Java Sqrt怎么用?Java Sqrt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Sqrt类属于org.apache.commons.math3.analysis.function包,在下文中一共展示了Sqrt类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMath832

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
@Test
public void testMath832() {
    final UnivariateFunction f = new UnivariateFunction() {
            private final UnivariateDifferentiableFunction sqrt = new Sqrt();
            private final UnivariateDifferentiableFunction inv = new Inverse();
            private final UnivariateDifferentiableFunction func
                = FunctionUtils.add(FunctionUtils.multiply(new Constant(1e2), sqrt),
                                    FunctionUtils.multiply(new Constant(1e6), inv),
                                    FunctionUtils.multiply(new Constant(1e4),
                                                           FunctionUtils.compose(inv, sqrt)));

            public double value(double x) {
                return func.value(new DerivativeStructure(1, 1, 0, x)).getPartialDerivative(1);
            }

        };

    BrentSolver solver = new BrentSolver();
    final double result = solver.solve(99, f, 1, 1e30, 1 + 1e-10);
    Assert.assertEquals(804.93558250, result, 1e-8);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:22,代码来源:BrentSolverTest.java

示例2: sqrt

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
/**
 * Returns the square root of {@code this} diagonal operator. More
 * precisely, this method returns
 * P = diag(1 / &radic;A<sub>11</sub>, 1 / &radic;A<sub>22</sub>, &hellip;).
 *
 * @return the square root of {@code this} preconditioner
 * @since 3.1
 */
public RealLinearOperator sqrt() {
    final RealVector sqrtDiag = diag.map(new Sqrt());
    return new RealLinearOperator() {
        /** {@inheritDoc} */
        @Override
        public RealVector operate(final RealVector x) {
            return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(),
                                                            sqrtDiag.toArray()),
                                       false);
        }

        /** {@inheritDoc} */
        @Override
        public int getRowDimension() {
            return sqrtDiag.getDimension();
        }

        /** {@inheritDoc} */
        @Override
        public int getColumnDimension() {
            return sqrtDiag.getDimension();
        }
    };
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:33,代码来源:JacobiPreconditioner.java

示例3: sqrt

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
/**
 * Returns the square root of {@code this} diagonal operator. More
 * precisely, this method returns
 * P = diag(1 / &radic;A<sub>11</sub>, 1 / &radic;A<sub>22</sub>, &hellip;).
 *
 * @return the square root of {@code this} preconditioner
 */
public RealLinearOperator sqrt(){
    final RealVector sqrtDiag = diag.map(new Sqrt());
    return new RealLinearOperator() {
        /** {@inheritDoc} */
        @Override
        public RealVector operate(final RealVector x) {
            return x.ebeDivide(sqrtDiag);
        }

        /** {@inheritDoc} */
        @Override
        public int getRowDimension() {
            return sqrtDiag.getDimension();
        }

        /** {@inheritDoc} */
        @Override
        public int getColumnDimension() {
            return sqrtDiag.getDimension();
        }
    };
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:30,代码来源:JacobiPreconditioner.java

示例4: createFunctions

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
protected UnivariateFunction[] createFunctions() {
    return new UnivariateFunction[] {
        new Power(2.0), new Exp(), new Expm1(), new Log(), new Log10(),
        new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),
        new Sin(), new Tan(), new Acos(), new Asin(), new Atan(),
        new Inverse(), new Abs(), new Sqrt(), new Cbrt(), new Ceil(),
        new Floor(), new Rint(), new Signum(), new Ulp()
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:10,代码来源:RealVectorAbstractTest.java

示例5: createFunctions

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
@Override
protected UnivariateFunction[] createFunctions() {
    return new UnivariateFunction[] {
        new Power(2.0), new Exp(), new Expm1(),
        new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),
        new Sin(), new Tan(), new Acos(), new Asin(), new Atan(),
        new Abs(), new Sqrt(), new Cbrt(), new Ceil(),
        new Floor(), new Rint(), new Signum()
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:11,代码来源:SparseRealVectorTest.java

示例6: createFunctions

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
private UnivariateFunction[] createFunctions() {
    return new UnivariateFunction[] {
        new Power(2.0), new Exp(), new Expm1(), new Log(), new Log10(),
        new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),
        new Sin(), new Tan(), new Acos(), new Asin(), new Atan(),
        new Inverse(), new Abs(), new Sqrt(), new Cbrt(), new Ceil(),
        new Floor(), new Rint(), new Signum(), new Ulp()
    };
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:RealVectorAbstractTest.java

示例7: squareRoot

import org.apache.commons.math3.analysis.function.Sqrt; //导入依赖的package包/类
public Variable squareRoot(Transform transform, Variable numericVariable, Map<String, TransformOption> options) throws Exception {
    UnivariateDifferentiableFunction function = new Sqrt();
    double[] origData = numericVariable.getData();
    double[] newData = new double[origData.length];
    for (int i = 0; i < origData.length; i++) {
        newData[i] = function.value(origData[i]);
    }

    Instances weka = new Util().createWekaData(newData, transform.toString());
    return new Variable(numericVariable, transform, transform.toString(), numericVariable.getLab(), newData, weka, numericVariable.getDateFormat(), VariableType.NUMERIC);
}
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:12,代码来源:WekaApacheEngine.java


注:本文中的org.apache.commons.math3.analysis.function.Sqrt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。