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