- Timestamp:
- 12/01/12 19:02:47 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
r8933 r8982 106 106 public static IEnumerable<double> GetRow(double[,] x, int r) { 107 107 int cols = x.GetLength(1); 108 return Enumerable.Range(0, cols).Select(c => x[r, c]); 108 return GetRow(x, r, Enumerable.Range(0, cols)); 109 } 110 public static IEnumerable<double> GetRow(double[,] x, int r, IEnumerable<int> columnIndices) { 111 return columnIndices.Select(c => x[r, c]); 109 112 } 110 113 public static IEnumerable<double> GetCol(double[,] x, int c) { … … 112 115 return Enumerable.Range(0, rows).Select(r => x[r, c]); 113 116 } 114 115 116 public static void AttachValueChangeHandler<T, U>(IValueParameter<T> parameter, Action action)117 where T : ValueTypeValue<U>118 where U : struct {119 parameter.ValueChanged += (sender, args) => {120 if (parameter.Value != null) {121 parameter.Value.ValueChanged += (s, a) => action();122 action();123 }124 };125 if (parameter.Value != null) {126 parameter.Value.ValueChanged += (s, a) => action();127 }128 }129 130 public static void AttachArrayChangeHandler<T, U>(IValueParameter<T> parameter, Action action)131 where T : ValueTypeArray<U>132 where U : struct {133 parameter.ValueChanged += (sender, args) => {134 if (parameter.Value != null) {135 parameter.Value.ItemChanged += (s, a) => action();136 parameter.Value.Reset += (s, a) => action();137 action();138 }139 };140 if (parameter.Value != null) {141 parameter.Value.ItemChanged += (s, a) => action();142 parameter.Value.Reset += (s, a) => action();143 }144 }145 117 } 146 118 }
Note: See TracChangeset
for help on using the changeset viewer.