- Timestamp:
- 09/10/12 13:28:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
r8562 r8612 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 24 27 25 28 namespace HeuristicLab.Algorithms.DataAnalysis { 26 publicstatic class Util {29 internal static class Util { 27 30 public static double ScalarProd(IEnumerable<double> v, IEnumerable<double> u) { 28 31 return v.Zip(u, (vi, ui) => vi * ui).Sum(); … … 94 97 return Enumerable.Range(0, rows).Select(r => x[r, c]); 95 98 } 99 100 101 public static void AttachValueChangeHandler<T, U>(IValueParameter<T> parameter, Action action) 102 where T : ValueTypeValue<U> 103 where U : struct { 104 parameter.ValueChanged += (sender, args) => { 105 if (parameter.Value != null) { 106 parameter.Value.ValueChanged += (s, a) => action(); 107 action(); 108 } 109 }; 110 if (parameter.Value != null) { 111 parameter.Value.ValueChanged += (s, a) => action(); 112 } 113 } 114 115 public static void AttachArrayChangeHandler<T, U>(IValueParameter<T> parameter, Action action) 116 where T : ValueTypeArray<U> 117 where U : struct { 118 parameter.ValueChanged += (sender, args) => { 119 if (parameter.Value != null) { 120 parameter.Value.ItemChanged += (s, a) => action(); 121 parameter.Value.Reset += (s, a) => action(); 122 action(); 123 } 124 }; 125 if (parameter.Value != null) { 126 parameter.Value.ItemChanged += (s, a) => action(); 127 parameter.Value.Reset += (s, a) => action(); 128 } 129 } 96 130 } 97 131 }
Note: See TracChangeset
for help on using the changeset viewer.