All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.opengamma.strata.math.impl.function.DoublesVectorFunctionProvider Maven / Gradle / Ivy

There is a newer version: 2.12.46
Show newest version
/*
 * Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.strata.math.impl.function;

import java.util.List;

import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.collect.DoubleArrayMath;

/**
 * An abstraction for anything that provides a {@link VectorFunction} for a set of data points (as Double).
 */
public abstract class DoublesVectorFunctionProvider implements VectorFunctionProvider {

  @Override
  public VectorFunction from(List x) {
    ArgChecker.notNull(x, "x");
    return from(x.toArray(new Double[0]));
  }

  @Override
  public VectorFunction from(Double[] x) {
    ArgChecker.notNull(x, "x");
    return from(DoubleArrayMath.toPrimitive(x));
  }

  /**
   * Produces a vector function that depends in some way on the given data points.
   * 
   * @param x  the array of data points
   * @return a {@link VectorFunction}
   */
  public abstract VectorFunction from(double[] x);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy