net.finmath.stochastic.RandomVariableArrayImplementation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-lib Show documentation
Show all versions of finmath-lib Show documentation
finmath lib is a Mathematical Finance Library in Java.
It provides algorithms and methodologies related to mathematical finance.
The newest version!
/*
* (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
*
* Created on 09.02.2009
*/
package net.finmath.stochastic;
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleUnaryOperator;
import java.util.function.IntToDoubleFunction;
import java.util.stream.DoubleStream;
import net.finmath.functions.DoubleTernaryOperator;
/**
* An implementation of RandomVariableArray
implementing an array of
* RandomVariable
objects,
* implementing the RandomVariable
interface.
*
* @author Christian Fries
*/
public class RandomVariableArrayImplementation implements RandomVariableArray {
private static final long serialVersionUID = -5718980901166760522L;
private final RandomVariable[] elements;
public static RandomVariableArray of(final RandomVariable[] elements) {
return new RandomVariableArrayImplementation(elements.clone());
}
private RandomVariableArrayImplementation(final RandomVariable[] elements) {
super();
if(elements.length == 0) {
throw new IllegalArgumentException("Empty array.");
}
// Ensure that all elements
final int level = getLevel(elements[0]);
for(int i=1; i