Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Functions/builtin/maxall.cs @ 11316

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

#1967: ILNumerics source for experimentation

File size: 9.7 KB
RevLine 
[9102]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
40#pragma warning disable
41using System;
42using System.Collections.Generic;
43using System.Text;
44using ILNumerics.Storage;
45using ILNumerics.Misc;
46using ILNumerics.Exceptions;
47
48
49namespace ILNumerics {
50
51    public partial class ILMath {
52
53
54        /// <summary>
55        /// Maximum for all elements of A
56        /// </summary>
57        /// <param name="A">Input array</param>
58        /// <returns><para>Scalar maximum of all elements for A</para>
59        /// <para>If A is empty, an empty array will be returned.</para></returns>
60        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
61        /// <seealso cref="ILNumerics.ILMath.max"/>
62        public static ILRetArray<double> maxall(ILInArray<double> A) {
63            using (ILScope.Enter(A)) {
64                if (object.Equals(A, null))
65                    throw new ILArgumentException("input argument must not be null");
66                if (A.IsEmpty) {
67                    return empty<double>(ILSize.Empty00);
68                }
69               
70                double retVal =  double.MinValue;
71                unsafe {
72                    fixed ( double* inArrStart = A.GetArrayForRead()) {
73                       
74                        double* inArrWalk = inArrStart;
75                       
76                        double* inArrEnd = inArrStart + A.Size.NumberOfElements;
77                        while (inArrWalk < inArrEnd) {
78                            if (retVal < *inArrWalk)
79                                retVal = *inArrWalk;
80                            inArrWalk++;
81                        }
82                    }
83                }
84                return array<double>(retVal, 1, 1);
85            }
86        }
87
88#region HYCALPER AUTO GENERATED CODE
89
90        /// <summary>
91        /// Maximum for all elements of A
92        /// </summary>
93        /// <param name="A">Input array</param>
94        /// <returns><para>Scalar maximum of all elements for A</para>
95        /// <para>If A is empty, an empty array will be returned.</para></returns>
96        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
97        /// <seealso cref="ILNumerics.ILMath.max"/>
98        public static ILRetArray<Int64> maxall(ILInArray<Int64> A) {
99            using (ILScope.Enter(A)) {
100                if (object.Equals(A, null))
101                    throw new ILArgumentException("input argument must not be null");
102                if (A.IsEmpty) {
103                    return empty<Int64>(ILSize.Empty00);
104                }
105               
106                Int64 retVal =  Int64.MinValue;
107                unsafe {
108                    fixed ( Int64* inArrStart = A.GetArrayForRead()) {
109                       
110                        Int64* inArrWalk = inArrStart;
111                       
112                        Int64* inArrEnd = inArrStart + A.Size.NumberOfElements;
113                        while (inArrWalk < inArrEnd) {
114                            if (retVal < *inArrWalk)
115                                retVal = *inArrWalk;
116                            inArrWalk++;
117                        }
118                    }
119                }
120                return array<Int64>(retVal, 1, 1);
121            }
122        }
123        /// <summary>
124        /// Maximum for all elements of A
125        /// </summary>
126        /// <param name="A">Input array</param>
127        /// <returns><para>Scalar maximum of all elements for A</para>
128        /// <para>If A is empty, an empty array will be returned.</para></returns>
129        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
130        /// <seealso cref="ILNumerics.ILMath.max"/>
131        public static ILRetArray<Int32> maxall(ILInArray<Int32> A) {
132            using (ILScope.Enter(A)) {
133                if (object.Equals(A, null))
134                    throw new ILArgumentException("input argument must not be null");
135                if (A.IsEmpty) {
136                    return empty<Int32>(ILSize.Empty00);
137                }
138               
139                Int32 retVal =  Int32.MinValue;
140                unsafe {
141                    fixed ( Int32* inArrStart = A.GetArrayForRead()) {
142                       
143                        Int32* inArrWalk = inArrStart;
144                       
145                        Int32* inArrEnd = inArrStart + A.Size.NumberOfElements;
146                        while (inArrWalk < inArrEnd) {
147                            if (retVal < *inArrWalk)
148                                retVal = *inArrWalk;
149                            inArrWalk++;
150                        }
151                    }
152                }
153                return array<Int32>(retVal, 1, 1);
154            }
155        }
156        /// <summary>
157        /// Maximum for all elements of A
158        /// </summary>
159        /// <param name="A">Input array</param>
160        /// <returns><para>Scalar maximum of all elements for A</para>
161        /// <para>If A is empty, an empty array will be returned.</para></returns>
162        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
163        /// <seealso cref="ILNumerics.ILMath.max"/>
164        public static ILRetArray<byte> maxall(ILInArray<byte> A) {
165            using (ILScope.Enter(A)) {
166                if (object.Equals(A, null))
167                    throw new ILArgumentException("input argument must not be null");
168                if (A.IsEmpty) {
169                    return empty<byte>(ILSize.Empty00);
170                }
171               
172                byte retVal =  byte.MinValue;
173                unsafe {
174                    fixed ( byte* inArrStart = A.GetArrayForRead()) {
175                       
176                        byte* inArrWalk = inArrStart;
177                       
178                        byte* inArrEnd = inArrStart + A.Size.NumberOfElements;
179                        while (inArrWalk < inArrEnd) {
180                            if (retVal < *inArrWalk)
181                                retVal = *inArrWalk;
182                            inArrWalk++;
183                        }
184                    }
185                }
186                return array<byte>(retVal, 1, 1);
187            }
188        }
189        /// <summary>
190        /// Maximum for all elements of A
191        /// </summary>
192        /// <param name="A">Input array</param>
193        /// <returns><para>Scalar maximum of all elements for A</para>
194        /// <para>If A is empty, an empty array will be returned.</para></returns>
195        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
196        /// <seealso cref="ILNumerics.ILMath.max"/>
197        public static ILRetArray<float> maxall(ILInArray<float> A) {
198            using (ILScope.Enter(A)) {
199                if (object.Equals(A, null))
200                    throw new ILArgumentException("input argument must not be null");
201                if (A.IsEmpty) {
202                    return empty<float>(ILSize.Empty00);
203                }
204               
205                float retVal =  float.MinValue;
206                unsafe {
207                    fixed ( float* inArrStart = A.GetArrayForRead()) {
208                       
209                        float* inArrWalk = inArrStart;
210                       
211                        float* inArrEnd = inArrStart + A.Size.NumberOfElements;
212                        while (inArrWalk < inArrEnd) {
213                            if (retVal < *inArrWalk)
214                                retVal = *inArrWalk;
215                            inArrWalk++;
216                        }
217                    }
218                }
219                return array<float>(retVal, 1, 1);
220            }
221        }
222
223#endregion HYCALPER AUTO GENERATED CODE
224
225    }
226}
Note: See TracBrowser for help on using the repository browser.