Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Functions/builtin/allall.cs @ 12075

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

#1967: ILNumerics source for experimentation

File size: 13.6 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;
45using ILNumerics.Exceptions;
46
47namespace ILNumerics  {
48    public partial class ILMath {
49
50        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
51        /// <param name="A">Input Array</param>
52        /// <returns>Scalar logical array</returns>
53        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
54        /// all elements are found to be non-zero, false otherwise.</para>
55        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
56        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
57        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
58        public static ILRetLogical allall (ILInArray<double> A) {
59            if (object.Equals(A,null))
60                throw new ILArgumentException("A must not be null!");
61            using (ILScope.Enter(A)) {
62                if (A.IsEmpty) {
63                    return new ILRetLogical(ILSize.Empty00);
64                }
65                byte retArr = 1;
66                unsafe {
67                    fixed ( double * inArrStart = A.GetArrayForRead()) {
68                         double * inArrWalk = inArrStart;
69                         double * inArrEnd = inArrStart + A.Size.NumberOfElements;
70                        while (inArrWalk < inArrEnd) {
71                            if ( *inArrWalk++ == 0) {
72                                retArr = 0;
73                                break;
74                            }
75                        }
76                    }
77                }
78                return new ILRetLogical (new byte [1] {retArr},1,1);
79            }
80        }
81
82#region HYCALPER AUTO GENERATED CODE
83
84        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
85        /// <param name="A">Input Array</param>
86        /// <returns>Scalar logical array</returns>
87        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
88        /// all elements are found to be non-zero, false otherwise.</para>
89        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
90        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
91        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
92        public static ILRetLogical allall (ILInArray<Int64> A) {
93            if (object.Equals(A,null))
94                throw new ILArgumentException("A must not be null!");
95            using (ILScope.Enter(A)) {
96                if (A.IsEmpty) {
97                    return new ILRetLogical(ILSize.Empty00);
98                }
99                byte retArr = 1;
100                unsafe {
101                    fixed ( Int64 * inArrStart = A.GetArrayForRead()) {
102                        Int64 * inArrWalk = inArrStart;
103                        Int64 * inArrEnd = inArrStart + A.Size.NumberOfElements;
104                        while (inArrWalk < inArrEnd) {
105                            if ( *inArrWalk++ == 0) {
106                                retArr = 0;
107                                break;
108                            }
109                        }
110                    }
111                }
112                return new ILRetLogical (new byte [1] {retArr},1,1);
113            }
114        }
115        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
116        /// <param name="A">Input Array</param>
117        /// <returns>Scalar logical array</returns>
118        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
119        /// all elements are found to be non-zero, false otherwise.</para>
120        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
121        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
122        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
123        public static ILRetLogical allall (ILInArray<Int32> A) {
124            if (object.Equals(A,null))
125                throw new ILArgumentException("A must not be null!");
126            using (ILScope.Enter(A)) {
127                if (A.IsEmpty) {
128                    return new ILRetLogical(ILSize.Empty00);
129                }
130                byte retArr = 1;
131                unsafe {
132                    fixed ( Int32 * inArrStart = A.GetArrayForRead()) {
133                        Int32 * inArrWalk = inArrStart;
134                        Int32 * inArrEnd = inArrStart + A.Size.NumberOfElements;
135                        while (inArrWalk < inArrEnd) {
136                            if ( *inArrWalk++ == 0) {
137                                retArr = 0;
138                                break;
139                            }
140                        }
141                    }
142                }
143                return new ILRetLogical (new byte [1] {retArr},1,1);
144            }
145        }
146        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
147        /// <param name="A">Input Array</param>
148        /// <returns>Scalar logical array</returns>
149        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
150        /// all elements are found to be non-zero, false otherwise.</para>
151        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
152        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
153        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
154        public static ILRetLogical allall (ILInArray<byte> A) {
155            if (object.Equals(A,null))
156                throw new ILArgumentException("A must not be null!");
157            using (ILScope.Enter(A)) {
158                if (A.IsEmpty) {
159                    return new ILRetLogical(ILSize.Empty00);
160                }
161                byte retArr = 1;
162                unsafe {
163                    fixed ( byte * inArrStart = A.GetArrayForRead()) {
164                        byte * inArrWalk = inArrStart;
165                        byte * inArrEnd = inArrStart + A.Size.NumberOfElements;
166                        while (inArrWalk < inArrEnd) {
167                            if ( *inArrWalk++ == 0) {
168                                retArr = 0;
169                                break;
170                            }
171                        }
172                    }
173                }
174                return new ILRetLogical (new byte [1] {retArr},1,1);
175            }
176        }
177        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
178        /// <param name="A">Input Array</param>
179        /// <returns>Scalar logical array</returns>
180        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
181        /// all elements are found to be non-zero, false otherwise.</para>
182        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
183        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
184        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
185        public static ILRetLogical allall (ILInArray<fcomplex> A) {
186            if (object.Equals(A,null))
187                throw new ILArgumentException("A must not be null!");
188            using (ILScope.Enter(A)) {
189                if (A.IsEmpty) {
190                    return new ILRetLogical(ILSize.Empty00);
191                }
192                byte retArr = 1;
193                unsafe {
194                    fixed ( fcomplex * inArrStart = A.GetArrayForRead()) {
195                        fcomplex * inArrWalk = inArrStart;
196                        fcomplex * inArrEnd = inArrStart + A.Size.NumberOfElements;
197                        while (inArrWalk < inArrEnd) {
198                            if ( *inArrWalk++ == 0) {
199                                retArr = 0;
200                                break;
201                            }
202                        }
203                    }
204                }
205                return new ILRetLogical (new byte [1] {retArr},1,1);
206            }
207        }
208        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
209        /// <param name="A">Input Array</param>
210        /// <returns>Scalar logical array</returns>
211        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
212        /// all elements are found to be non-zero, false otherwise.</para>
213        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
214        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
215        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
216        public static ILRetLogical allall (ILInArray<float> A) {
217            if (object.Equals(A,null))
218                throw new ILArgumentException("A must not be null!");
219            using (ILScope.Enter(A)) {
220                if (A.IsEmpty) {
221                    return new ILRetLogical(ILSize.Empty00);
222                }
223                byte retArr = 1;
224                unsafe {
225                    fixed ( float * inArrStart = A.GetArrayForRead()) {
226                        float * inArrWalk = inArrStart;
227                        float * inArrEnd = inArrStart + A.Size.NumberOfElements;
228                        while (inArrWalk < inArrEnd) {
229                            if ( *inArrWalk++ == 0) {
230                                retArr = 0;
231                                break;
232                            }
233                        }
234                    }
235                }
236                return new ILRetLogical (new byte [1] {retArr},1,1);
237            }
238        }
239        /// <summary>Determine if array has nonzero elements in all dimensions</summary>
240        /// <param name="A">Input Array</param>
241        /// <returns>Scalar logical array</returns>
242        /// <remarks><para>The function evaluates all elements of A in all dimensions. It returnes 'true' (1) if
243        /// all elements are found to be non-zero, false otherwise.</para>
244        /// <para>If A is empty, a scalar logical 'false' (0) is returned. </para></remarks>
245        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">If A was null.</exception>
246        /// <seealso cref="ILNumerics.ILMath.all(ILInArray{double},int)"/>
247        public static ILRetLogical allall (ILInArray<complex> A) {
248            if (object.Equals(A,null))
249                throw new ILArgumentException("A must not be null!");
250            using (ILScope.Enter(A)) {
251                if (A.IsEmpty) {
252                    return new ILRetLogical(ILSize.Empty00);
253                }
254                byte retArr = 1;
255                unsafe {
256                    fixed ( complex * inArrStart = A.GetArrayForRead()) {
257                        complex * inArrWalk = inArrStart;
258                        complex * inArrEnd = inArrStart + A.Size.NumberOfElements;
259                        while (inArrWalk < inArrEnd) {
260                            if ( *inArrWalk++ == 0) {
261                                retArr = 0;
262                                break;
263                            }
264                        }
265                    }
266                }
267                return new ILRetLogical (new byte [1] {retArr},1,1);
268            }
269        }
270
271#endregion HYCALPER AUTO GENERATED CODE
272
273    }
274}
Note: See TracBrowser for help on using the repository browser.