com.opengamma.strata.math.impl.minimization.PositiveOrZero Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of strata-math Show documentation
Show all versions of strata-math Show documentation
Mathematic support for Strata
/*
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.math.impl.minimization;
import java.util.function.Function;
import com.opengamma.strata.collect.array.DoubleArray;
/**
* A function from a vector x ({@link DoubleArray } to Boolean that returns true
* iff all the elements of x are positive or zero.
*/
public class PositiveOrZero implements Function {
@Override
public Boolean apply(DoubleArray x) {
double[] data = x.toArray();
for (double value : data) {
if (value < 0.0) {
return false;
}
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy