Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Functions/builtin/reshape.cs @ 9407

Last change on this file since 9407 was 9102, checked in by gkronber, 12 years ago

#1967: ILNumerics source for experimentation

File size: 15.9 KB
Line 
1///
2///    This file is part of ILNumerics Community Edition.
3///
4///    ILNumerics Community Edition - high performance computing for applications.
5///    Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
6///
7///    ILNumerics Community Edition is free software: you can redistribute it and/or modify
8///    it under the terms of the GNU General Public License version 3 as published by
9///    the Free Software Foundation.
10///
11///    ILNumerics Community Edition is distributed in the hope that it will be useful,
12///    but WITHOUT ANY WARRANTY; without even the implied warranty of
13///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14///    GNU General Public License for more details.
15///
16///    You should have received a copy of the GNU General Public License
17///    along with ILNumerics Community Edition. See the file License.txt in the root
18///    of your distribution package. If not, see <http://www.gnu.org/licenses/>.
19///
20///    In addition this software uses the following components and/or licenses:
21///
22///    =================================================================================
23///    The Open Toolkit Library License
24///   
25///    Copyright (c) 2006 - 2009 the Open Toolkit library.
26///   
27///    Permission is hereby granted, free of charge, to any person obtaining a copy
28///    of this software and associated documentation files (the "Software"), to deal
29///    in the Software without restriction, including without limitation the rights to
30///    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
31///    the Software, and to permit persons to whom the Software is furnished to do
32///    so, subject to the following conditions:
33///
34///    The above copyright notice and this permission notice shall be included in all
35///    copies or substantial portions of the Software.
36///
37///    =================================================================================
38///   
39
40using System;
41using System.Collections.Generic;
42using System.Text;
43using ILNumerics.Storage;
44using ILNumerics.Misc;
45
46
47
48namespace ILNumerics {
49    public partial class ILMath {
50
51
52        /// <summary>
53        /// Array reshaping
54        /// </summary>
55        /// <param name="A">Input array A</param>
56        /// <param name="dim">New dimension</param>
57        /// <returns>Reshaped array</returns>
58        /// <remarks>A will not be changed. A new array is created, having
59        /// the size and number of dimensions specified by dim. </remarks>
60        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
61        /// If the number of elements in A and the number of elements for the
62        /// new dimensions specified by <paramref name="dim"/>
63        /// do not match.</exception>
64        public static ILRetArray<double> reshape(ILInArray<double> A, ILSize dim) {
65            using (ILScope.Enter(A))
66                return A.Reshape(dim);
67        }
68        /// <summary>
69        /// Array reshaping
70        /// </summary>
71        /// <param name="A">Input array A</param>
72        /// <param name="newDimensions">New dimensions. This may be
73        /// a comma seperated list or an int array</param>
74        /// <returns>Reshaped array</returns>
75        /// <remarks>A will not be changed. A new array is created, having
76        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
77        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
78        /// If the number of elements in A and the number of elements specified
79        /// by <paramref name="newDimensions"/> do not match.</exception>
80        public static ILRetArray<double> reshape(ILInArray<double> A, params int[] newDimensions) {
81            using (ILScope.Enter(A))
82                return A.Reshape(new ILSize(newDimensions));
83        }
84
85#region HYCALPER AUTO GENERATED CODE
86
87        /// <summary>
88        /// Array reshaping
89        /// </summary>
90        /// <param name="A">Input array A</param>
91        /// <param name="dim">New dimension</param>
92        /// <returns>Reshaped array</returns>
93        /// <remarks>A will not be changed. A new array is created, having
94        /// the size and number of dimensions specified by dim. </remarks>
95        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
96        /// If the number of elements in A and the number of elements for the
97        /// new dimensions specified by <paramref name="dim"/>
98        /// do not match.</exception>
99        public static ILRetArray<fcomplex> reshape(ILInArray<fcomplex> A, ILSize dim) {
100            using (ILScope.Enter(A))
101                return A.Reshape(dim);
102        }
103        /// <summary>
104        /// Array reshaping
105        /// </summary>
106        /// <param name="A">Input array A</param>
107        /// <param name="newDimensions">New dimensions. This may be
108        /// a comma seperated list or an int array</param>
109        /// <returns>Reshaped array</returns>
110        /// <remarks>A will not be changed. A new array is created, having
111        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
112        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
113        /// If the number of elements in A and the number of elements specified
114        /// by <paramref name="newDimensions"/> do not match.</exception>
115        public static ILRetArray<fcomplex> reshape(ILInArray<fcomplex> A, params int[] newDimensions) {
116            using (ILScope.Enter(A))
117                return A.Reshape(new ILSize(newDimensions));
118        }
119        /// <summary>
120        /// Array reshaping
121        /// </summary>
122        /// <param name="A">Input array A</param>
123        /// <param name="dim">New dimension</param>
124        /// <returns>Reshaped array</returns>
125        /// <remarks>A will not be changed. A new array is created, having
126        /// the size and number of dimensions specified by dim. </remarks>
127        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
128        /// If the number of elements in A and the number of elements for the
129        /// new dimensions specified by <paramref name="dim"/>
130        /// do not match.</exception>
131        public static ILRetArray<complex> reshape(ILInArray<complex> A, ILSize dim) {
132            using (ILScope.Enter(A))
133                return A.Reshape(dim);
134        }
135        /// <summary>
136        /// Array reshaping
137        /// </summary>
138        /// <param name="A">Input array A</param>
139        /// <param name="newDimensions">New dimensions. This may be
140        /// a comma seperated list or an int array</param>
141        /// <returns>Reshaped array</returns>
142        /// <remarks>A will not be changed. A new array is created, having
143        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
144        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
145        /// If the number of elements in A and the number of elements specified
146        /// by <paramref name="newDimensions"/> do not match.</exception>
147        public static ILRetArray<complex> reshape(ILInArray<complex> A, params int[] newDimensions) {
148            using (ILScope.Enter(A))
149                return A.Reshape(new ILSize(newDimensions));
150        }
151        /// <summary>
152        /// Array reshaping
153        /// </summary>
154        /// <param name="A">Input array A</param>
155        /// <param name="dim">New dimension</param>
156        /// <returns>Reshaped array</returns>
157        /// <remarks>A will not be changed. A new array is created, having
158        /// the size and number of dimensions specified by dim. </remarks>
159        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
160        /// If the number of elements in A and the number of elements for the
161        /// new dimensions specified by <paramref name="dim"/>
162        /// do not match.</exception>
163        public static ILRetArray<byte> reshape(ILInArray<byte> A, ILSize dim) {
164            using (ILScope.Enter(A))
165                return A.Reshape(dim);
166        }
167        /// <summary>
168        /// Array reshaping
169        /// </summary>
170        /// <param name="A">Input array A</param>
171        /// <param name="newDimensions">New dimensions. This may be
172        /// a comma seperated list or an int array</param>
173        /// <returns>Reshaped array</returns>
174        /// <remarks>A will not be changed. A new array is created, having
175        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
176        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
177        /// If the number of elements in A and the number of elements specified
178        /// by <paramref name="newDimensions"/> do not match.</exception>
179        public static ILRetArray<byte> reshape(ILInArray<byte> A, params int[] newDimensions) {
180            using (ILScope.Enter(A))
181                return A.Reshape(new ILSize(newDimensions));
182        }
183        /// <summary>
184        /// Array reshaping
185        /// </summary>
186        /// <param name="A">Input array A</param>
187        /// <param name="dim">New dimension</param>
188        /// <returns>Reshaped array</returns>
189        /// <remarks>A will not be changed. A new array is created, having
190        /// the size and number of dimensions specified by dim. </remarks>
191        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
192        /// If the number of elements in A and the number of elements for the
193        /// new dimensions specified by <paramref name="dim"/>
194        /// do not match.</exception>
195        public static ILRetArray<Int64> reshape(ILInArray<Int64> A, ILSize dim) {
196            using (ILScope.Enter(A))
197                return A.Reshape(dim);
198        }
199        /// <summary>
200        /// Array reshaping
201        /// </summary>
202        /// <param name="A">Input array A</param>
203        /// <param name="newDimensions">New dimensions. This may be
204        /// a comma seperated list or an int array</param>
205        /// <returns>Reshaped array</returns>
206        /// <remarks>A will not be changed. A new array is created, having
207        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
208        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
209        /// If the number of elements in A and the number of elements specified
210        /// by <paramref name="newDimensions"/> do not match.</exception>
211        public static ILRetArray<Int64> reshape(ILInArray<Int64> A, params int[] newDimensions) {
212            using (ILScope.Enter(A))
213                return A.Reshape(new ILSize(newDimensions));
214        }
215        /// <summary>
216        /// Array reshaping
217        /// </summary>
218        /// <param name="A">Input array A</param>
219        /// <param name="dim">New dimension</param>
220        /// <returns>Reshaped array</returns>
221        /// <remarks>A will not be changed. A new array is created, having
222        /// the size and number of dimensions specified by dim. </remarks>
223        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
224        /// If the number of elements in A and the number of elements for the
225        /// new dimensions specified by <paramref name="dim"/>
226        /// do not match.</exception>
227        public static ILRetArray<Int32> reshape(ILInArray<Int32> A, ILSize dim) {
228            using (ILScope.Enter(A))
229                return A.Reshape(dim);
230        }
231        /// <summary>
232        /// Array reshaping
233        /// </summary>
234        /// <param name="A">Input array A</param>
235        /// <param name="newDimensions">New dimensions. This may be
236        /// a comma seperated list or an int array</param>
237        /// <returns>Reshaped array</returns>
238        /// <remarks>A will not be changed. A new array is created, having
239        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
240        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
241        /// If the number of elements in A and the number of elements specified
242        /// by <paramref name="newDimensions"/> do not match.</exception>
243        public static ILRetArray<Int32> reshape(ILInArray<Int32> A, params int[] newDimensions) {
244            using (ILScope.Enter(A))
245                return A.Reshape(new ILSize(newDimensions));
246        }
247        /// <summary>
248        /// Array reshaping
249        /// </summary>
250        /// <param name="A">Input array A</param>
251        /// <param name="dim">New dimension</param>
252        /// <returns>Reshaped array</returns>
253        /// <remarks>A will not be changed. A new array is created, having
254        /// the size and number of dimensions specified by dim. </remarks>
255        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
256        /// If the number of elements in A and the number of elements for the
257        /// new dimensions specified by <paramref name="dim"/>
258        /// do not match.</exception>
259        public static ILRetArray<float> reshape(ILInArray<float> A, ILSize dim) {
260            using (ILScope.Enter(A))
261                return A.Reshape(dim);
262        }
263        /// <summary>
264        /// Array reshaping
265        /// </summary>
266        /// <param name="A">Input array A</param>
267        /// <param name="newDimensions">New dimensions. This may be
268        /// a comma seperated list or an int array</param>
269        /// <returns>Reshaped array</returns>
270        /// <remarks>A will not be changed. A new array is created, having
271        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
272        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
273        /// If the number of elements in A and the number of elements specified
274        /// by <paramref name="newDimensions"/> do not match.</exception>
275        public static ILRetArray<float> reshape(ILInArray<float> A, params int[] newDimensions) {
276            using (ILScope.Enter(A))
277                return A.Reshape(new ILSize(newDimensions));
278        }
279
280#endregion HYCALPER AUTO GENERATED CODE
281
282        /// <summary>
283        /// Array reshaping
284        /// </summary>
285        /// <param name="A">Input array A</param>
286        /// <param name="newDimensions">New dimensions array. This may be
287        /// a comma seperated list or an int array</param>
288        /// <returns>Reshaped array</returns>
289        /// <remarks>A will not be changed. A new array is created, having
290        /// the size and number of dimensions specified by <paramref name="newDimensions"/>. </remarks>
291        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
292        /// If the number of elements in A and the number of elements specified
293        /// by <paramref name="newDimensions"/>
294        /// do not match.</exception>
295        public static ILRetArray<T> reshape<T>(ILInArray<T> A, params int[] newDimensions) {
296            return A.Reshape(new ILSize(newDimensions));
297        }
298        /// <summary>
299        /// Array reshaping
300        /// </summary>
301        /// <param name="A">Input array A</param>
302        /// <param name="dim">New dimension</param>
303        /// <returns>Reshaped array</returns>
304        /// <remarks>A will not be changed. A new reference array is created, having
305        /// the size and number of dimensions specified by dim. </remarks>
306        /// <exception cref="ILNumerics.Exceptions.ILArgumentSizeException">
307        /// If the number of elements in A and the number of elements for the
308        /// new dimensions specified by <paramref name="dim"/>
309        /// do not match.</exception>
310        public static ILRetArray<T> reshape<T>(ILInArray<T> A, ILSize dim) {
311            using (ILScope.Enter(A))
312                return A.Reshape(dim);
313        }
314    }
315}
Note: See TracBrowser for help on using the repository browser.