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 |
|
---|
49 | namespace ILNumerics {
|
---|
50 | public partial class ILMath {
|
---|
51 |
|
---|
52 | |
---|
53 | /// <summary>
|
---|
54 | /// Horizontal array concatenation
|
---|
55 | /// </summary>
|
---|
56 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
57 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
58 | /// must match - except for the second dimension (index 1).</param>
|
---|
59 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
60 | /// </returns>
|
---|
61 | public static ILRetArray<double> horzcat(params ILInArray<double>[] arrays) {
|
---|
62 | return horzcat<double>(arrays);
|
---|
63 | }
|
---|
64 | |
---|
65 | #region HYCALPER AUTO GENERATED CODE
|
---|
66 | |
---|
67 | /// <summary>
|
---|
68 | /// Horizontal array concatenation
|
---|
69 | /// </summary>
|
---|
70 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
71 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
72 | /// must match - except for the second dimension (index 1).</param>
|
---|
73 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
74 | /// </returns>
|
---|
75 | public static ILRetArray<fcomplex> horzcat(params ILInArray<fcomplex>[] arrays) {
|
---|
76 | return horzcat<fcomplex>(arrays);
|
---|
77 | }
|
---|
78 | /// <summary>
|
---|
79 | /// Horizontal array concatenation
|
---|
80 | /// </summary>
|
---|
81 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
82 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
83 | /// must match - except for the second dimension (index 1).</param>
|
---|
84 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
85 | /// </returns>
|
---|
86 | public static ILRetArray<complex> horzcat(params ILInArray<complex>[] arrays) {
|
---|
87 | return horzcat<complex>(arrays);
|
---|
88 | }
|
---|
89 | /// <summary>
|
---|
90 | /// Horizontal array concatenation
|
---|
91 | /// </summary>
|
---|
92 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
93 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
94 | /// must match - except for the second dimension (index 1).</param>
|
---|
95 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
96 | /// </returns>
|
---|
97 | public static ILRetArray<byte> horzcat(params ILInArray<byte>[] arrays) {
|
---|
98 | return horzcat<byte>(arrays);
|
---|
99 | }
|
---|
100 | /// <summary>
|
---|
101 | /// Horizontal array concatenation
|
---|
102 | /// </summary>
|
---|
103 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
104 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
105 | /// must match - except for the second dimension (index 1).</param>
|
---|
106 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
107 | /// </returns>
|
---|
108 | public static ILRetArray<Int64> horzcat(params ILInArray<Int64>[] arrays) {
|
---|
109 | return horzcat<Int64>(arrays);
|
---|
110 | }
|
---|
111 | /// <summary>
|
---|
112 | /// Horizontal array concatenation
|
---|
113 | /// </summary>
|
---|
114 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
115 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
116 | /// must match - except for the second dimension (index 1).</param>
|
---|
117 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
118 | /// </returns>
|
---|
119 | public static ILRetArray<Int32> horzcat(params ILInArray<Int32>[] arrays) {
|
---|
120 | return horzcat<Int32>(arrays);
|
---|
121 | }
|
---|
122 | /// <summary>
|
---|
123 | /// Horizontal array concatenation
|
---|
124 | /// </summary>
|
---|
125 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
126 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
127 | /// must match - except for the second dimension (index 1).</param>
|
---|
128 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
129 | /// </returns>
|
---|
130 | public static ILRetArray<float> horzcat(params ILInArray<float>[] arrays) {
|
---|
131 | return horzcat<float>(arrays);
|
---|
132 | }
|
---|
133 |
|
---|
134 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
135 |
|
---|
136 | /// <summary>
|
---|
137 | /// Horizontal array concatenation
|
---|
138 | /// </summary>
|
---|
139 | /// <param name="arrays">Arrays to be concatenated with each other. All
|
---|
140 | /// arrays must be of the same inner type. The dimensions of all arrays
|
---|
141 | /// must match - except for the second dimension (index 1).</param>
|
---|
142 | /// <returns>Larger array having all arrays in 'arrays' placed next to each other.
|
---|
143 | /// </returns>
|
---|
144 | public static ILRetArray<T> horzcat<T>(params ILInArray<T>[] arrays) {
|
---|
145 | using (ILScope.Enter(arrays)) {
|
---|
146 | if (arrays == null)
|
---|
147 | throw new ILArgumentException("input argument must not be null!");
|
---|
148 | if (arrays.Length == 0 || object.Equals(arrays[0], null))
|
---|
149 | return ILRetArray<T>.empty(ILSize.Empty00);
|
---|
150 | if (arrays.Length == 1)
|
---|
151 | return arrays[0].C;
|
---|
152 | ILDenseStorage<T> ret = arrays[0].Storage.Concat(arrays[1].Storage, 1);
|
---|
153 | for (int i = 2; i < arrays.Length; i++) {
|
---|
154 | ILDenseStorage<T> tmp = ret.Concat(arrays[i].Storage, 1);
|
---|
155 | ret.Dispose();
|
---|
156 | ret = tmp;
|
---|
157 | }
|
---|
158 | return new ILRetArray<T>(ret);
|
---|
159 | }
|
---|
160 | }
|
---|
161 | }
|
---|
162 | }
|
---|