Free cookie consent management tool by TermsFeed Policy Generator

Changeset 203


Ignore:
Timestamp:
04/28/08 21:40:46 (16 years ago)
Author:
gkronber
Message:

prototype implementation for fast evaluation of basic functions

Location:
branches/ExperimentalFunctionsBaking
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/ExperimentalFunctionsBaking/Addition.cs

    r155 r203  
    4646    }
    4747
    48     public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     48    public static double Add(double[] args) {
    4949      // (+ 3) => 3
    5050      // (+ 2 3) => 5
     
    5757    }
    5858
     59    public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     60      return Addition.Add(args);
     61    }
     62
    5963    public override void Accept(IFunctionVisitor visitor) {
    6064      visitor.Visit(this);
  • branches/ExperimentalFunctionsBaking/Division.cs

    r155 r203  
    5252    }
    5353
    54     public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     54    public static double Divide(double[] args) {
    5555      // (/ 3) => 1/3
    5656      // (/ 2 3) => 2/3
    5757      // (/ 3 4 5) => 3/20
    58 
    5958      if(args.Length == 1) {
    6059        double divisor = args[0];
     
    7271    }
    7372
     73    public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     74      return Division.Divide(args);
     75    }
     76
    7477    public override void Accept(IFunctionVisitor visitor) {
    7578      visitor.Visit(this);
  • branches/ExperimentalFunctionsBaking/FunctionBase.cs

    r189 r203  
    4242
    4343    public virtual IFunctionTree GetTreeNode() {
    44       return new FunctionTree(this);
     44      return new BakedFunctionTree(this);
    4545    }
    4646
  • branches/ExperimentalFunctionsBaking/HeuristicLab.Functions.csproj

    r201 r203  
    5151    <Compile Include="And.cs" />
    5252    <Compile Include="Average.cs" />
     53    <Compile Include="BakedFunctionTree.cs" />
    5354    <Compile Include="Constant.cs" />
    54     <Compile Include="BakedFunctionTree.cs" />
    5555    <Compile Include="GreaterThan.cs" />
    5656    <Compile Include="FunctionTree.cs" />
  • branches/ExperimentalFunctionsBaking/Multiplication.cs

    r155 r203  
    4545      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
    4646    }
    47 
    48     public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     47    public static double Multipy(double[] args) {
    4948      // (* 3) => 3
    5049      // (* 2 3) => 6
     
    5655      return result;
    5756    }
     57    public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     58      return Multiplication.Multipy(args);
     59    }
    5860
    5961    public override void Accept(IFunctionVisitor visitor) {
  • branches/ExperimentalFunctionsBaking/Substraction.cs

    r155 r203  
    4646    }
    4747
    48 
    49     public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     48    public static double Substract(double[] args) {
    5049      if(args.Length == 1) {
    5150        return -args[0];
     
    5958    }
    6059
     60    public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     61      return Substraction.Substract(args);
     62    }
     63
    6164    public override void Accept(IFunctionVisitor visitor) {
    6265      visitor.Visit(this);
Note: See TracChangeset for help on using the changeset viewer.