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