samer@0: /* samer@0: * Copyright (c) 2000, Samer Abdallah, King's College London. samer@0: * All rights reserved. samer@0: * samer@0: * This software is provided AS iS and WITHOUT ANY WARRANTY; samer@0: * without even the implied warranty of MERCHANTABILITY or samer@0: * FITNESS FOR A PARTICULAR PURPOSE. samer@0: */ samer@0: samer@0: package samer.maths; samer@0: import samer.core.*; samer@0: samer@0: samer@0: public class Linear extends Function samer@0: { samer@0: private double a, b; samer@0: samer@0: public Linear() { this( Shell.getDouble("a",1), Shell.getDouble("b",0)); } samer@0: public Linear(double a, double b) { this.a = a; this.b = b; } samer@0: samer@0: public double apply(double t) { return a*t+b; } samer@0: public void apply(double [] x) { samer@0: for (int i=0; i