|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Runtime.InteropServices; |
| 5 | +using System.Text; |
| 6 | +using Numpy; |
| 7 | +using Numpy.Models; |
| 8 | +using Python.Runtime; |
| 9 | + |
| 10 | +namespace Numpy |
| 11 | +{ |
| 12 | + /// <summary> |
| 13 | + /// Manual type conversions |
| 14 | + /// </summary> |
| 15 | + public static partial class np |
| 16 | + { |
| 17 | + |
| 18 | + /// <summary> |
| 19 | + /// Return coordinate matrices from coordinate vectors.<br></br> |
| 20 | + /// |
| 21 | + /// Make N-D coordinate arrays for vectorized evaluations of |
| 22 | + /// N-D scalar/vector fields over N-D grids, given |
| 23 | + /// one-dimensional coordinate arrays x1, x2,…, xn.<br></br> |
| 24 | + /// |
| 25 | + /// Notes |
| 26 | + /// |
| 27 | + /// This function supports both indexing conventions through the indexing |
| 28 | + /// keyword argument.<br></br> |
| 29 | + /// Giving the string ‘ij’ returns a meshgrid with |
| 30 | + /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing.<br></br> |
| 31 | + /// |
| 32 | + /// In the 2-D case with inputs of length M and N, the outputs are of shape |
| 33 | + /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing.<br></br> |
| 34 | + /// In the 3-D case |
| 35 | + /// with inputs of length M, N and P, outputs are of shape (N, M, P) for |
| 36 | + /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing.<br></br> |
| 37 | + /// The difference is |
| 38 | + /// illustrated by the following code snippet: |
| 39 | + /// |
| 40 | + /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. |
| 41 | + /// </summary> |
| 42 | + /// <param name="xi"> |
| 43 | + /// 1-D arrays representing the coordinates of a grid. |
| 44 | + /// </param> |
| 45 | + /// <param name="indexing"> |
| 46 | + /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output.<br></br> |
| 47 | + /// |
| 48 | + /// See Notes for more details. |
| 49 | + /// </param> |
| 50 | + /// <param name="sparse"> |
| 51 | + /// If True a sparse grid is returned in order to conserve memory.<br></br> |
| 52 | + /// |
| 53 | + /// Default is False. |
| 54 | + /// </param> |
| 55 | + /// <param name="copy"> |
| 56 | + /// If False, a view into the original arrays are returned in order to |
| 57 | + /// conserve memory.<br></br> |
| 58 | + /// Default is True.<br></br> |
| 59 | + /// Please note that |
| 60 | + /// sparse=False, copy=False will likely return non-contiguous |
| 61 | + /// arrays.<br></br> |
| 62 | + /// Furthermore, more than one element of a broadcast array |
| 63 | + /// may refer to a single memory location.<br></br> |
| 64 | + /// If you need to write to the |
| 65 | + /// arrays, make copies first. |
| 66 | + /// </param> |
| 67 | + /// <returns> |
| 68 | + /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , |
| 69 | + /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ |
| 70 | + /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ |
| 71 | + /// with the elements of xi repeated to fill the matrix along |
| 72 | + /// the first dimension for x1, the second for x2 and so on. |
| 73 | + /// </returns> |
| 74 | + public static NDarray[] meshgrid(NDarray[] xi, string indexing = "xy", bool? sparse = null, bool? copy = null) |
| 75 | + { |
| 76 | + var __self__ = self; |
| 77 | + var pyargs = ToTuple(xi); |
| 78 | + var kwargs = new PyDict(); |
| 79 | + if (indexing != "xy") kwargs["indexing"] = ToPython(indexing); |
| 80 | + if (sparse != null) kwargs["sparse"] = ToPython(sparse); |
| 81 | + if (copy != null) kwargs["copy"] = ToPython(copy); |
| 82 | + dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); |
| 83 | + return ToCsharp<NDarray[]>(py); |
| 84 | + } |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// Return coordinate matrices from coordinate vectors.<br></br> |
| 88 | + /// |
| 89 | + /// Make N-D coordinate arrays for vectorized evaluations of |
| 90 | + /// N-D scalar/vector fields over N-D grids, given |
| 91 | + /// one-dimensional coordinate arrays x1, x2,…, xn.<br></br> |
| 92 | + /// |
| 93 | + /// Notes |
| 94 | + /// |
| 95 | + /// This function supports both indexing conventions through the indexing |
| 96 | + /// keyword argument.<br></br> |
| 97 | + /// Giving the string ‘ij’ returns a meshgrid with |
| 98 | + /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing.<br></br> |
| 99 | + /// |
| 100 | + /// In the 2-D case with inputs of length M and N, the outputs are of shape |
| 101 | + /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing.<br></br> |
| 102 | + /// In the 3-D case |
| 103 | + /// with inputs of length M, N and P, outputs are of shape (N, M, P) for |
| 104 | + /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing.<br></br> |
| 105 | + /// The difference is |
| 106 | + /// illustrated by the following code snippet: |
| 107 | + /// |
| 108 | + /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. |
| 109 | + /// </summary> |
| 110 | + /// <param name="xi"> |
| 111 | + /// 1-D arrays representing the coordinates of a grid. |
| 112 | + /// </param> |
| 113 | + /// <returns> |
| 114 | + /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , |
| 115 | + /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ |
| 116 | + /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ |
| 117 | + /// with the elements of xi repeated to fill the matrix along |
| 118 | + /// the first dimension for x1, the second for x2 and so on. |
| 119 | + /// </returns> |
| 120 | + public static NDarray[] meshgrid(params NDarray[] xi) |
| 121 | + { |
| 122 | + var __self__ = self; |
| 123 | + var pyargs = ToTuple(xi); |
| 124 | + var kwargs = new PyDict(); |
| 125 | + dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); |
| 126 | + return ToCsharp<NDarray[]>(py); |
| 127 | + } |
| 128 | + |
| 129 | + } |
| 130 | +} |
0 commit comments