本文整理汇总了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);
}
示例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 / √A<sub>11</sub>, 1 / √A<sub>22</sub>, …).
*
* @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();
}
};
}
示例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 / √A<sub>11</sub>, 1 / √A<sub>22</sub>, …).
*
* @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();
}
};
}
示例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()
};
}
示例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()
};
}
示例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()
};
}
示例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);
}