forked from SciSharp/NumSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNdArray.HStack.cs
More file actions
26 lines (24 loc) · 1.28 KB
/
NdArray.HStack.cs
File metadata and controls
26 lines (24 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
namespace NumSharp
{
public partial class NDArray
{
/// <summary>
/// Stack arrays in sequence horizontally (column wise).
/// This is equivalent to concatenation along the second axis, except for 1-D arrays where it concatenates along the first axis.Rebuilds arrays divided by hsplit.
/// This function makes most sense for arrays with up to 3 dimensions.For instance, for pixel-data with a height(first axis), width(second axis), and r/g/b channels(third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
/// </summary>
/// <param name="tup">The arrays must have the same shape along all but the second axis, except 1-D arrays which can be any length.</param>
/// <returns>The array formed by stacking the given arrays.</returns>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.hstack.html</remarks>
public NDArray hstack(params NDArray[] tup)
{
if (tup == null)
throw new ArgumentNullException(nameof(tup));
NDArray[] list = new NDArray[1 + tup.Length];
list[0] = this;
tup.CopyTo(list, 1);
return np.hstack(list);
}
}
}