Changeset 10422 for branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression
- Timestamp:
- 01/29/14 14:34:44 (11 years ago)
- Location:
- branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression/Instances.DataAnalysis.GaussianProcessRegression-3.3.csproj
r9338 r10422 98 98 </PropertyGroup> 99 99 <ItemGroup> 100 <Reference Include="ALGLIB-3.6.0, Version=3.6.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 101 <SpecificVersion>False</SpecificVersion> 102 <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.6.0.dll</HintPath> 103 <Private>False</Private> 100 <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 101 <SpecificVersion>False</SpecificVersion> 102 <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath> 104 103 </Reference> 105 104 <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> -
branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression/Plugin.cs.frame
r9112 r10422 25 25 [Plugin("HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression", "3.3.7.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.ALGLIB", "3. 6.0")]27 [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")] 28 28 [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")] 29 29 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/HeuristicLab.Problems.GaussianProcessTuning/HeuristicLab.Problems.Instances.DataAnalysis.GaussianProcessRegression/Util.cs
r9124 r10422 52 52 K[i, j] = covFunction.Covariance(x, i, j); 53 53 54 if (!alglib.spdmatrixcholesky(ref K, K.GetLength(0), true)) throw new ArgumentException();55 54 // if (!alglib.spdmatrixcholesky(ref K, K.GetLength(0), true)) throw new ArgumentException(); 55 K = toeplitz_cholesky_lower(K.GetLength(0), K); 56 56 List<double> target = new List<double>(K.GetLength(0)); 57 57 for (int i = 0; i < K.GetLength(0); i++) { … … 67 67 return target; 68 68 } 69 70 //****************************************************************************80 71 72 public static double[,] toeplitz_cholesky_lower(int n, double[,] a) 73 74 //****************************************************************************80 75 // 76 // Purpose: 77 // 78 // TOEPLITZ_CHOLESKY_LOWER: lower Cholesky factor of a Toeplitz matrix. 79 // 80 // Discussion: 81 // 82 // The Toeplitz matrix must be positive semi-definite. 83 // 84 // After factorization, A = L * L'. 85 // 86 // Licensing: 87 // 88 // This code is distributed under the GNU LGPL license. 89 // 90 // Modified: 91 // 92 // 13 November 2012 93 // 29 January 2014: adapted to C# by Gabriel Kronberger 94 // Author: 95 // 96 // John Burkardt 97 // 98 // Reference: 99 // 100 // Michael Stewart, 101 // Cholesky factorization of semi-definite Toeplitz matrices. 102 // 103 // Parameters: 104 // 105 // Input, int N, the order of the matrix. 106 // 107 // Input, double A[N,N], the Toeplitz matrix. 108 // 109 // Output, double TOEPLITZ_CHOLESKY_LOWER[N,N], the lower Cholesky factor. 110 // 111 { 112 double div; 113 double[] g; 114 double g1j; 115 double g2j; 116 int i; 117 int j; 118 double[,] l; 119 double rho; 120 121 l = new double[n, n]; 122 123 for (j = 0; j < n; j++) { 124 for (i = 0; i < n; i++) { 125 l[i, j] = 0.0; 126 } 127 } 128 g = new double[2 * n]; 129 130 for (j = 0; j < n; j++) { 131 g[0 + j * 2] = a[0, j]; 132 } 133 g[1 + 0 * 2] = 0.0; 134 for (j = 1; j < n; j++) { 135 g[1 + j * 2] = a[j, 0]; 136 } 137 138 for (i = 0; i < n; i++) { 139 l[i, 0] = g[0 + i * 2]; 140 } 141 for (j = n - 1; 1 <= j; j--) { 142 g[0 + j * 2] = g[0 + (j - 1) * 2]; 143 } 144 g[0 + 0 * 2] = 0.0; 145 146 for (i = 1; i < n; i++) { 147 rho = -g[1 + i * 2] / g[0 + i * 2]; 148 div = Math.Sqrt((1.0 - rho) * (1.0 + rho)); 149 150 for (j = i; j < n; j++) { 151 g1j = g[0 + j * 2]; 152 g2j = g[1 + j * 2]; 153 g[0 + j * 2] = (g1j + rho * g2j) / div; 154 g[1 + j * 2] = (rho * g1j + g2j) / div; 155 } 156 157 for (j = i; j < n; j++) { 158 l[j, i] = g[0 + j * 2]; 159 } 160 for (j = n - 1; i < j; j--) { 161 g[0 + j * 2] = g[0 + (j - 1) * 2]; 162 } 163 g[0 + i * 2] = 0.0; 164 } 165 166 167 return l; 168 } 169 //****************************************************************************80 170 171 public static double[,] toeplitz_cholesky_upper(int n, double[,] a) 172 173 //****************************************************************************80 174 // 175 // Purpose: 176 // 177 // TOEPLITZ_CHOLESKY_UPPER: upper Cholesky factor of a Toeplitz matrix. 178 // 179 // Discussion: 180 // 181 // The Toeplitz matrix must be positive semi-definite. 182 // 183 // After factorization, A = R' * R. 184 // 185 // Licensing: 186 // 187 // This code is distributed under the GNU LGPL license. 188 // 189 // Modified: 190 // 191 // 14 November 2012 192 // 29 January 2014: adapted to C# by Gabriel Kronberger 193 // 194 // Author: 195 // 196 // John Burkardt 197 // 198 // Reference: 199 // 200 // Michael Stewart, 201 // Cholesky factorization of semi-definite Toeplitz matrices. 202 // 203 // Parameters: 204 // 205 // Input, int N, the order of the matrix. 206 // 207 // Input, double A[N,N], the Toeplitz matrix. 208 // 209 // Output, double TOEPLITZ_CHOLESKY_UPPER[N,N], the upper Cholesky factor. 210 // 211 { 212 double div; 213 double[] g; 214 double g1j; 215 double g2j; 216 int i; 217 int j; 218 double[,] r; 219 double rho; 220 221 r = new double[n, n]; 222 223 for (j = 0; j < n; j++) { 224 for (i = 0; i < n; i++) { 225 r[i, j] = 0.0; 226 } 227 } 228 g = new double[2 * n]; 229 230 for (j = 0; j < n; j++) { 231 g[0 + j * 2] = a[0, j]; 232 } 233 234 g[1 + 0 * 2] = 0.0; 235 for (j = 1; j < n; j++) { 236 g[1 + j * 2] = a[j, 0]; 237 } 238 for (j = 0; j < n; j++) { 239 r[0, j] = g[0 + j * 2]; 240 } 241 for (j = n - 1; 1 <= j; j--) { 242 g[0 + j * 2] = g[0 + (j - 1) * 2]; 243 } 244 g[0 + 0 * 2] = 0.0; 245 246 for (i = 1; i < n; i++) { 247 rho = -g[1 + i * 2] / g[0 + i * 2]; 248 div = Math.Sqrt((1.0 - rho) * (1.0 + rho)); 249 for (j = i; j < n; j++) { 250 g1j = g[0 + j * 2]; 251 g2j = g[1 + j * 2]; 252 g[0 + j * 2] = (g1j + rho * g2j) / div; 253 g[1 + j * 2] = (rho * g1j + g2j) / div; 254 } 255 for (j = i; j < n; j++) { 256 r[i, j] = g[0 + j * 2]; 257 } 258 for (j = n - 1; i < j; j--) { 259 g[0 + j * 2] = g[0 + (j - 1) * 2]; 260 } 261 g[0 + i * 2] = 0.0; 262 } 263 264 return r; 265 } 69 266 } 70 267 }
Note: See TracChangeset
for help on using the changeset viewer.