Java Code Examples for org.apache.commons.math3.util.MathArrays#ebeDivide()
The following examples show how to use
org.apache.commons.math3.util.MathArrays#ebeDivide() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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(); } }; }
Example 2
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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(); } }; }
Example 3
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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(); } }; }
Example 4
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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(); } }; }
Example 5
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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(); } }; }
Example 6
Source File: EBEDivideEvaluator.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public Object doWork(Object first, Object second) throws IOException{ if(null == first){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory))); } if(null == second){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the second value",toExpression(constructingFactory))); } if(!(first instanceof List<?>)){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the first value, expecting a list of numbers",toExpression(constructingFactory), first.getClass().getSimpleName())); } if(!(second instanceof List<?>)){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the second value, expecting a list of numbers",toExpression(constructingFactory), first.getClass().getSimpleName())); } @SuppressWarnings({"unchecked"}) double[] result = MathArrays.ebeDivide( ((List) first).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray(), ((List) second).stream().mapToDouble(value -> ((Number) value).doubleValue()).toArray() ); List<Number> numbers = new ArrayList<>(); for(double d : result) { numbers.add(d); } return numbers; }
Example 7
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public RealVector operate(final RealVector x) { // Dimension check is carried out by ebeDivide return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(), diag.toArray()), false); }
Example 8
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public RealVector operate(final RealVector x) { // Dimension check is carried out by ebeDivide return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(), diag.toArray()), false); }
Example 9
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public RealVector operate(final RealVector x) { // Dimension check is carried out by ebeDivide return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(), diag.toArray()), false); }
Example 10
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public RealVector operate(final RealVector x) { // Dimension check is carried out by ebeDivide return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(), diag.toArray()), false); }
Example 11
Source File: JacobiPreconditioner.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public RealVector operate(final RealVector x) { // Dimension check is carried out by ebeDivide return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(), diag.toArray()), false); }