From a8850b5b3d45b2f9b9d0ab637d4814d33ea5726c Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Thu, 22 Dec 2022 14:05:33 +0100 Subject: [PATCH 01/17] Add a test that shows how to copy data from a byte array into a float64 NDArray --- test/Numpy.UnitTest/NumpyTest.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 3870e80..3779ac0 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -961,6 +961,30 @@ public async Task AsscalarRemovedInNumpyV1_23() Assert.AreEqual(143d, new NDarray(new[] { 143d }).item()); } + [TestMethod] + public async Task IssueByMaLichtenegger() + { + // byte array als uint32 array + var bytes = new byte[] { 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0 }; + var uints =np.zeros(new Shape(3), np.uint32); + Console.WriteLine(uints.repr); + var ctypes = uints.PyObject.ctypes; + long ptr = ctypes.data; + Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); + Console.WriteLine(uints.repr); + Assert.AreEqual("array([1, 2, 3], dtype=uint32)", uints.repr); + // byte array als float64 array + bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0 }; + var doubles = np.zeros(new Shape(2), np.float64); + Console.WriteLine(doubles.repr); + ctypes = doubles.PyObject.ctypes; + ptr = ctypes.data; + Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); + Console.WriteLine(doubles.repr); + Assert.IsTrue(doubles[0].asscalar() != 0); + Assert.IsTrue(doubles[1].asscalar() == 0); + } + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs From 88afed8ff9d0f89038eff332cd66b845b8bfd6ca Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Tue, 3 Jan 2023 19:09:06 +0100 Subject: [PATCH 02/17] Add a WPF example (issue #111) --- Numpy.NET.sln | 13 ++- WpfExample/App.xaml | 9 ++ WpfExample/App.xaml.cs | 16 ++++ WpfExample/AssemblyInfo.cs | 10 +++ WpfExample/MainWindow.xaml | 17 ++++ WpfExample/MainWindow.xaml.cs | 88 +++++++++++++++++++ WpfExample/WpfExample.csproj | 14 +++ .../MatmulExample/MatmulExample.csproj | 2 +- 8 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 WpfExample/App.xaml create mode 100644 WpfExample/App.xaml.cs create mode 100644 WpfExample/AssemblyInfo.cs create mode 100644 WpfExample/MainWindow.xaml create mode 100644 WpfExample/MainWindow.xaml.cs create mode 100644 WpfExample/WpfExample.csproj diff --git a/Numpy.NET.sln b/Numpy.NET.sln index aca6f6a..a0a1c92 100644 --- a/Numpy.NET.sln +++ b/Numpy.NET.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30503.244 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33103.184 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Numpy", "src\Numpy\Numpy.csproj", "{D527C885-AD64-4499-9E92-F9A543C0D14B}" EndProject @@ -35,7 +35,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApiExample_netcore3.1", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomInstallLocationExample", "src\Examples\CustomInstallLocationExample\CustomInstallLocationExample.csproj", "{BB0A367A-8A36-454F-9F92-2FD6DA665A39}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlicingExample", "src\Examples\SlicingExample\SlicingExample.csproj", "{FB116716-8C1F-4926-86F9-03AE46C7FA58}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlicingExample", "src\Examples\SlicingExample\SlicingExample.csproj", "{FB116716-8C1F-4926-86F9-03AE46C7FA58}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfExample", "WpfExample\WpfExample.csproj", "{BF447620-877B-4000-BF75-527AEF94F347}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -107,6 +109,10 @@ Global {FB116716-8C1F-4926-86F9-03AE46C7FA58}.Debug|Any CPU.Build.0 = Debug|Any CPU {FB116716-8C1F-4926-86F9-03AE46C7FA58}.Release|Any CPU.ActiveCfg = Release|Any CPU {FB116716-8C1F-4926-86F9-03AE46C7FA58}.Release|Any CPU.Build.0 = Release|Any CPU + {BF447620-877B-4000-BF75-527AEF94F347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF447620-877B-4000-BF75-527AEF94F347}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF447620-877B-4000-BF75-527AEF94F347}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF447620-877B-4000-BF75-527AEF94F347}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -119,6 +125,7 @@ Global {53C73261-DD84-47D1-A9BA-E553D34FF0A3} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} {BB0A367A-8A36-454F-9F92-2FD6DA665A39} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} {FB116716-8C1F-4926-86F9-03AE46C7FA58} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} + {BF447620-877B-4000-BF75-527AEF94F347} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5EB08541-5168-443C-B524-A5CB7E7C613D} diff --git a/WpfExample/App.xaml b/WpfExample/App.xaml new file mode 100644 index 0000000..8bcbf4d --- /dev/null +++ b/WpfExample/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WpfExample/App.xaml.cs b/WpfExample/App.xaml.cs new file mode 100644 index 0000000..66421cb --- /dev/null +++ b/WpfExample/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfExample +{ + + public partial class App : Application + { + + } +} diff --git a/WpfExample/AssemblyInfo.cs b/WpfExample/AssemblyInfo.cs new file mode 100644 index 0000000..74087a1 --- /dev/null +++ b/WpfExample/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WpfExample/MainWindow.xaml b/WpfExample/MainWindow.xaml new file mode 100644 index 0000000..82bf2e4 --- /dev/null +++ b/WpfExample/MainWindow.xaml @@ -0,0 +1,17 @@ + + + + + + Run the blocking example first, then the non-blocking example will be activated. + + + + diff --git a/WpfExample/MainWindow.xaml.cs b/WpfExample/MainWindow.xaml.cs new file mode 100644 index 0000000..a5e2290 --- /dev/null +++ b/WpfExample/MainWindow.xaml.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Numpy; +using Python.Runtime; + +namespace WpfExample +{ + + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + + private bool _allowThreads = false; + + private void WriteLine(string text) + { + TextBox.AppendText(text + "\n"); + TextBox.ScrollToEnd(); + } + + private void OnBlockingClick(object sender, RoutedEventArgs e) + { + WriteLine("Example 1: Matrix multiplication with NumPy on the GUI thread (blocking):"); + // before starting the measurement, let us call numpy once to get the setup checks done. + np.arange(1); + var stopwatch = Stopwatch.StartNew(); + + var a1 = np.arange(60000).reshape(300, 200); + var a2 = np.arange(80000).reshape(200, 400); + + var result = np.matmul(a1, a2); + stopwatch.Stop(); + + WriteLine($"execution time with NumPy: {stopwatch.Elapsed.TotalMilliseconds}ms\n"); + WriteLine("Result:\n" + result.repr); + WriteLine("\nNote: blocking usage is not recommended. "); + WriteLine("\nIf you close the program without runnning example 2 it will hang indefinitely. "); + Button1.IsEnabled = false; + Button2.IsEnabled = true; + } + + private async void OnNonBlockingClick(object sender, RoutedEventArgs e) + { + WriteLine("Example 2: Matrix multiplication with NumPy on a background thread (non-blocking):"); + + if (!_allowThreads) { + // https://github.com/pythonnet/pythonnet/issues/109 + PythonEngine.BeginAllowThreads(); + _allowThreads=true; + } + var stopwatch = Stopwatch.StartNew(); + var resultString = ""; + await Task.Run(() => { + using (Py.GIL()) { + + + var a1 = np.arange(60000).reshape(300, 200); + var a2 = np.arange(80000).reshape(200, 400); + + var result = np.matmul(a1, a2); + stopwatch.Stop(); + resultString = result.repr; + } + }); + await this.Dispatcher.BeginInvoke(() => { + WriteLine($"execution time with NumPy: {stopwatch.Elapsed.TotalMilliseconds}ms\n"); + WriteLine("Result:\n" + resultString); + }); + WriteLine("\nNote: if you close the program now it will not hang because of PythonEngine.BeginAllowThreads();\nWe only have to make sure to enclose all calculations in using(Py.GIL()) { }"); + } + } +} diff --git a/WpfExample/WpfExample.csproj b/WpfExample/WpfExample.csproj new file mode 100644 index 0000000..475c825 --- /dev/null +++ b/WpfExample/WpfExample.csproj @@ -0,0 +1,14 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + diff --git a/src/Examples/MatmulExample/MatmulExample.csproj b/src/Examples/MatmulExample/MatmulExample.csproj index e308509..29065e7 100644 --- a/src/Examples/MatmulExample/MatmulExample.csproj +++ b/src/Examples/MatmulExample/MatmulExample.csproj @@ -6,7 +6,7 @@ - + From 7f6eadb6566478c5e04cd044e08b97df965f9f0e Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Tue, 3 Jan 2023 21:50:06 +0100 Subject: [PATCH 03/17] Fix tests hanging at the end despite running through successfully --- test/Numpy.UnitTest/NumpyTest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 3779ac0..98da705 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -17,6 +17,12 @@ namespace Numpy.UnitTest [TestClass] public class NumpyTest { + [AssemblyCleanup()] + public static void AssemblyCleanup() + { + PythonEngine.BeginAllowThreads(); + } + [TestMethod] public void empty() { From a07cf8b9e5305cb8f1456be5c73662e7da0f03ad Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 11 Feb 2023 12:02:30 +0100 Subject: [PATCH 04/17] np.split: add overload to accept scalar integer index instead of int[] (#114) --- .../NumPy/ApiGenerator.cs | 4 ++ src/Numpy/Models/NDarray.gen.cs | 37 +++++++++++++++++ src/Numpy/np.array_manipulation.gen.cs | 41 +++++++++++++++++++ src/Numpy/np.string.gen.cs | 37 +++++++++++++++++ test/Numpy.UnitTest/NumpyTest.cs | 23 +++++++++++ 5 files changed, 142 insertions(+) diff --git a/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs index a1a525e..5b57142 100644 --- a/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs +++ b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs @@ -1140,6 +1140,10 @@ private IEnumerable InferOverloads(Function decl) yield break; case "gradient": // don't generate. yield break; + case "split": + yield return decl; + yield return decl.Clone(f => { f.Arguments[1].Type = "int"; }); + yield break; } // without args we don't need to consider possible overloads diff --git a/src/Numpy/Models/NDarray.gen.cs b/src/Numpy/Models/NDarray.gen.cs index 203b0e0..83d6b30 100644 --- a/src/Numpy/Models/NDarray.gen.cs +++ b/src/Numpy/Models/NDarray.gen.cs @@ -954,6 +954,43 @@ public NDarray[] split(int[] indices_or_sections, int? axis = 0) return ToCsharp(py); } + /// + /// Split an array into multiple sub-arrays. + /// + /// + /// If indices_or_sections is an integer, N, the array will be divided + /// into N equal arrays along axis.

+ /// If such a split is not possible, + /// an error is raised.

+ /// + /// If indices_or_sections is a 1-D array of sorted integers, the entries + /// indicate where along axis the array is split.

+ /// For example, + /// [2, 3] would, for axis=0, result in + /// + /// If an index exceeds the dimension of the array along axis, + /// an empty sub-array is returned correspondingly. + /// + /// + /// The axis along which to split, default is 0. + /// + /// + /// A list of sub-arrays. + /// + public NDarray[] split(int indices_or_sections, int? axis = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + indices_or_sections, + }); + var kwargs=new PyDict(); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } + /// /// Construct an array by repeating A the number of times given by reps.

/// diff --git a/src/Numpy/np.array_manipulation.gen.cs b/src/Numpy/np.array_manipulation.gen.cs index a526e7a..911bafb 100644 --- a/src/Numpy/np.array_manipulation.gen.cs +++ b/src/Numpy/np.array_manipulation.gen.cs @@ -1133,6 +1133,47 @@ public static NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis return ToCsharp(py); } + /// + /// Split an array into multiple sub-arrays. + /// + /// + /// Array to be divided into sub-arrays. + /// + /// + /// If indices_or_sections is an integer, N, the array will be divided + /// into N equal arrays along axis.

+ /// If such a split is not possible, + /// an error is raised.

+ /// + /// If indices_or_sections is a 1-D array of sorted integers, the entries + /// indicate where along axis the array is split.

+ /// For example, + /// [2, 3] would, for axis=0, result in + /// + /// If an index exceeds the dimension of the array along axis, + /// an empty sub-array is returned correspondingly. + /// + /// + /// The axis along which to split, default is 0. + /// + /// + /// A list of sub-arrays. + /// + public static NDarray[] split(NDarray ary, int indices_or_sections, int? axis = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ary, + indices_or_sections, + }); + var kwargs=new PyDict(); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } + /// /// Construct an array by repeating A the number of times given by reps.

/// diff --git a/src/Numpy/np.string.gen.cs b/src/Numpy/np.string.gen.cs index 6628111..78e53d2 100644 --- a/src/Numpy/np.string.gen.cs +++ b/src/Numpy/np.string.gen.cs @@ -677,6 +677,43 @@ public static NDarray split(string[] a, string sep = null, int? maxsplit = null) } } + public static partial class core { + public static partial class defchararray { + /// + /// For each element in a, return a list of the words in the + /// string, using sep as the delimiter string.

+ /// + /// Calls str.split element-wise. + ///
+ /// + /// If sep is not specified or None, any whitespace string is a + /// separator. + /// + /// + /// If maxsplit is given, at most maxsplit splits are done. + /// + /// + /// Array of list objects + /// + public static NDarray split(string[] a, int? sep = null, int? maxsplit = null) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (sep!=null) kwargs["sep"]=ToPython(sep); + if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } + } + } + public static partial class core { public static partial class defchararray { /// diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 98da705..ab7502e 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -991,6 +991,29 @@ public async Task IssueByMaLichtenegger() Assert.IsTrue(doubles[1].asscalar() == 0); } + [TestMethod] + public async Task IssueByMartinDevans() + { + //>>> x = np.arange(9) + //>>> np.split(x, 3) + //[array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8])] + var x = np.arange(9); + var b = np.split(x, 3).repr(); + var a = "(array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]))"; + Assert.AreEqual(a, b); + //>>> x = np.arange(8.0) + //>>> np.split(x, [3, 5, 6, 10]) + //[array([0., 1., 2.]), + //array([3., 4.]), + //array([5.]), + //array([6., 7.]), + //array([], dtype = float64)] + x = np.arange(8); + b = np.split(x, new[] { 3, 5, 6, 10 }).repr(); + a = "(array([0, 1, 2]), array([3, 4]), array([5]), array([6, 7]), array([], dtype=int32))"; + Assert.AreEqual(a, b); + } + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs From af720bcee2237bd466e372641ed8afbe4faa022f Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 11 Feb 2023 13:36:20 +0100 Subject: [PATCH 05/17] v1.32 --- src/Numpy/Numpy.csproj | 2 +- src/ReleaseBot/Program.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Numpy/Numpy.csproj b/src/Numpy/Numpy.csproj index d80a831..412d24b 100644 --- a/src/Numpy/Numpy.csproj +++ b/src/Numpy/Numpy.csproj @@ -14,7 +14,7 @@ https://github.com/SciSharp/Numpy.NET Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 3.11.1.31 + 3.11.1.32 https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true 3.10.0.0 3.10.0.0 diff --git a/src/ReleaseBot/Program.cs b/src/ReleaseBot/Program.cs index 2a5d9a4..f394ab7 100644 --- a/src/ReleaseBot/Program.cs +++ b/src/ReleaseBot/Program.cs @@ -13,7 +13,7 @@ namespace ReleaseBot { class Program { - private const string V = "1.31"; // <--- numpy.net version! + private const string V = "1.32"; // <--- numpy.net version! private const string PythonNetVersion = "3.0.1"; private const string PythonVersion = "3.11"; // relevant only for Numpy with included binaries private const string NumpyVersion = "1.23.5"; From 7732a4eef9d20fef118d70b0b842393c30aec8c1 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 11 Feb 2023 19:08:27 +0100 Subject: [PATCH 06/17] Generate all static np functions with first arg of type NDarray as extension method (#114) --- .../NumPy/ApiGenerator.cs | 19 +- src/CodeMinion.Core/CodeGenerator.cs | 5 +- src/CodeMinion.Core/Models/Function.cs | 5 + src/Numpy/Models/NDarray.gen.cs | 12625 ---------------- src/Numpy/Numpy.csproj | 2 +- src/Numpy/np.array_manipulation.gen.cs | 56 +- src/Numpy/np.bitwise.gen.cs | 14 +- src/Numpy/np.dtype.routines.gen.cs | 4 +- src/Numpy/np.financial.gen.cs | 18 +- src/Numpy/np.indexing.gen.cs | 34 +- src/Numpy/np.io.gen.cs | 6 +- src/Numpy/np.linalg.gen.cs | 16 +- src/Numpy/np.linalg_fft.gen.cs | 2 +- src/Numpy/np.logic.gen.cs | 54 +- src/Numpy/np.math.gen.cs | 182 +- src/Numpy/np.other.gen.cs | 2 +- src/Numpy/np.padding.gen.cs | 2 +- src/Numpy/np.set.gen.cs | 12 +- src/Numpy/np.sorting.gen.cs | 34 +- src/Numpy/np.staticstics.gen.cs | 96 +- test/Numpy.UnitTest/NumpyTest.cs | 2 + 21 files changed, 286 insertions(+), 12904 deletions(-) diff --git a/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs index 5b57142..5709388 100644 --- a/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs +++ b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs @@ -431,18 +431,17 @@ private void ParseNumpyDocPage(StaticApi api, string link, HtmlDoc html_doc, Tes { // do not add to NDArray instance methods case "copyto": - case "transpose": - case "amax": - case "amin": - case "real": - case "imag": + //case "transpose": + //case "amax": + //case "amin": + //case "real": + //case "imag": continue; } - - var dc = d.Clone(); - dc.Arguments.RemoveAt(0); - //dc.ForwardToStaticImpl = "NumPy.Instance"; - ndarray_api.Declarations.Add(dc); + decl.IsExtensionFunction = true; + //var dc = d.Clone(); + //dc.Arguments.RemoveAt(0); + //ndarray_api.Declarations.Add(dc); } } diff --git a/src/CodeMinion.Core/CodeGenerator.cs b/src/CodeMinion.Core/CodeGenerator.cs index 900f9da..ab2017a 100644 --- a/src/CodeMinion.Core/CodeGenerator.cs +++ b/src/CodeMinion.Core/CodeGenerator.cs @@ -90,7 +90,7 @@ protected virtual void GenerateApiFunction(Declaration decl, CodeWriter s, bool var prefix_str = ""; if (prefix && levels > 0) prefix_str = string.Join("_", class_names.Skip(1)) + "_"; - s.Out($"public {(@static ? "static ":"")}{retval} {EscapeName(prefix_str + decl.Name)}{func.SharpOnlyPostfix}{generics}({arguments})"); + s.Out($"public {(@static ? "static ":"")}{retval} {EscapeName(prefix_str + decl.Name)}{func.SharpOnlyPostfix}{generics}({(@static && func.IsExtensionFunction ? "this " : "")}{arguments})"); s.Block(() => { GenerateFunctionBody(func, s, prefix_str); @@ -596,7 +596,8 @@ public virtual void GenerateDynamicApi(DynamicApi api, CodeWriter s) { if (decl.ManualOverride || decl.Ignore) continue; - GenerateApiFunction(decl, s); + if (decl is Function && !(decl as Function).IsExtensionFunction) + GenerateApiFunction(decl, s); } catch (Exception e) { diff --git a/src/CodeMinion.Core/Models/Function.cs b/src/CodeMinion.Core/Models/Function.cs index 75f3ffd..8525999 100644 --- a/src/CodeMinion.Core/Models/Function.cs +++ b/src/CodeMinion.Core/Models/Function.cs @@ -11,6 +11,11 @@ public class Function : Declaration public bool IsConstructor { get; set; } + /// + /// Generate only the static function which also serves as an extension function + /// + public bool IsExtensionFunction { get; set; } = false; + /// /// Generic type parameters of the function /// diff --git a/src/Numpy/Models/NDarray.gen.cs b/src/Numpy/Models/NDarray.gen.cs index 83d6b30..2bd1fa4 100644 --- a/src/Numpy/Models/NDarray.gen.cs +++ b/src/Numpy/Models/NDarray.gen.cs @@ -456,12630 +456,5 @@ public void __setstate__(int version, Shape shape, Dtype dtype, bool isFortran, dynamic py = __self__.InvokeMethod("__setstate__", pyargs, kwargs); } - /// - /// Gives a new shape to an array without changing its data.

- /// - /// Notes - /// - /// It is not always possible to change the shape of an array without - /// copying the data.

- /// If you want an error to be raised when the data is copied, - /// you should assign the new shape to the shape attribute of the array: - /// - /// The order keyword gives the index ordering both for fetching the values - /// from a, and then placing the values into the output array.

- /// - /// For example, let’s say you have an array: - /// - /// You can think of reshaping as first raveling the array (using the given - /// index order), then inserting the elements from the raveled array into the - /// new array using the same kind of index ordering as was used for the - /// raveling. - ///
- /// - /// The new shape should be compatible with the original shape.

- /// If - /// an integer, then the result will be a 1-D array of that length.

- /// - /// One shape dimension can be -1. In this case, the value is - /// inferred from the length of the array and remaining dimensions. - /// - /// - /// Read the elements of a using this index order, and place the - /// elements into the reshaped array using this index order.

- /// ‘C’ - /// means to read / write the elements using C-like index order, - /// with the last axis index changing fastest, back to the first - /// axis index changing slowest.

- /// ‘F’ means to read / write the - /// elements using Fortran-like index order, with the first index - /// changing fastest, and the last index changing slowest.

- /// Note that - /// the ‘C’ and ‘F’ options take no account of the memory layout of - /// the underlying array, and only refer to the order of indexing.

- /// - /// ‘A’ means to read / write the elements in Fortran-like index - /// order if a is Fortran contiguous in memory, C-like order - /// otherwise. - /// - /// - /// This will be a new view object if possible; otherwise, it will - /// be a copy.

- /// Note there is no guarantee of the memory layout (C- or - /// Fortran- contiguous) of the returned array. - ///
- public NDarray reshape(Shape newshape, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - newshape, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("reshape", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a contiguous flattened array.

- /// - /// A 1-D array, containing the elements of the input, is returned.

- /// A copy is - /// made only if needed.

- /// - /// As of NumPy 1.10, the returned array will have the same type as the input - /// array.

- /// (for example, a masked array will be returned for a masked array - /// input) - /// - /// Notes - /// - /// In row-major, C-style order, in two dimensions, the row index - /// varies the slowest, and the column index the quickest.

- /// This can - /// be generalized to multiple dimensions, where row-major order - /// implies that the index along the first axis varies slowest, and - /// the index along the last quickest.

- /// The opposite holds for - /// column-major, Fortran-style index ordering.

- /// - /// When a view is desired in as many cases as possible, arr.reshape(-1) - /// may be preferable. - ///
- /// - /// The elements of a are read using this index order.

- /// ‘C’ means - /// to index the elements in row-major, C-style order, - /// with the last axis index changing fastest, back to the first - /// axis index changing slowest.

- /// ‘F’ means to index the elements - /// in column-major, Fortran-style order, with the - /// first index changing fastest, and the last index changing - /// slowest.

- /// Note that the ‘C’ and ‘F’ options take no account of - /// the memory layout of the underlying array, and only refer to - /// the order of axis indexing.

- /// ‘A’ means to read the elements in - /// Fortran-like index order if a is Fortran contiguous in - /// memory, C-like order otherwise.

- /// ‘K’ means to read the - /// elements in the order they occur in memory, except for - /// reversing the data when strides are negative.

- /// By default, ‘C’ - /// index order is used. - /// - /// - /// y is an array of the same subtype as a, with shape (a.size,).

- /// - /// Note that matrices are special cased for backward compatibility, if a - /// is a matrix, then y is a 1-D ndarray. - ///
- public NDarray ravel(string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ravel", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Move axes of an array to new positions.

- /// - /// Other axes remain in their original order. - ///
- /// - /// Original positions of the axes to move.

- /// These must be unique. - /// - /// - /// Destination positions for each of the original axes.

- /// These must also be - /// unique. - /// - /// - /// Array with moved axes.

- /// This array is a view of the input array. - ///
- public NDarray moveaxis(int[] source, int[] destination) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - source, - destination, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("moveaxis", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Roll the specified axis backwards, until it lies in a given position.

- /// - /// This function continues to be supported for backward compatibility, but you - /// should prefer moveaxis.

- /// The moveaxis function was added in NumPy - /// 1.11. - ///
- /// - /// The axis to roll backwards.

- /// The positions of the other axes do not - /// change relative to one another. - /// - /// - /// The axis is rolled until it lies before this position.

- /// The default, - /// 0, results in a “complete” roll. - /// - /// - /// For NumPy >= 1.10.0 a view of a is always returned.

- /// For earlier - /// NumPy versions a view of a is returned only if the order of the - /// axes is changed, otherwise the input array is returned. - ///
- public NDarray rollaxis(int axis, int? start = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - axis, - }); - var kwargs=new PyDict(); - if (start!=0) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("rollaxis", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Interchange two axes of an array. - /// - /// - /// First axis. - /// - /// - /// Second axis. - /// - /// - /// For NumPy >= 1.10.0, if a is an ndarray, then a view of a is - /// returned; otherwise a new array is created.

- /// For earlier NumPy - /// versions a view of a is returned only if the order of the - /// axes is changed, otherwise the input array is returned. - ///
- public NDarray swapaxes(int axis1, int axis2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - axis1, - axis2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("swapaxes", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Produce an object that mimics broadcasting. - /// - /// - /// Input parameters. - /// - /// - /// Broadcast the input parameters against one another, and - /// return an object that encapsulates the result.

- /// - /// Amongst others, it has shape and nd properties, and - /// may be used as an iterator. - ///
- public NDarray broadcast(NDarray in1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - in1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("broadcast", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Broadcast an array to a new shape.

- /// - /// Notes - ///
- /// - /// The shape of the desired array. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// A readonly view on the original array with the given shape.

- /// It is - /// typically not contiguous.

- /// Furthermore, more than one element of a - /// broadcasted array may refer to a single memory location. - ///
- public NDarray broadcast_to(Shape shape, bool? subok = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (subok!=false) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("broadcast_to", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Expand the shape of an array.

- /// - /// Insert a new axis that will appear at the axis position in the expanded - /// array shape. - ///
- /// - /// Position in the expanded axes where the new axis is placed. - /// - /// - /// Output array.

- /// The number of dimensions is one greater than that of - /// the input array. - ///
- public NDarray expand_dims(int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - axis, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("expand_dims", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Remove single-dimensional entries from the shape of an array. - /// - /// - /// Selects a subset of the single-dimensional entries in the - /// shape.

- /// If an axis is selected with shape entry greater than - /// one, an error is raised. - /// - /// - /// The input array, but with all or a subset of the - /// dimensions of length 1 removed.

- /// This is always a itself - /// or a view into a. - ///
- public NDarray squeeze(Axis axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("squeeze", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array converted to a float type. - /// - /// - /// Float type code to coerce input array a.

- /// If dtype is one of the - /// ‘int’ dtypes, it is replaced with float64. - /// - /// - /// The input a as a float ndarray. - /// - public NDarray asfarray(Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("asfarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array (ndim >= 1) laid out in Fortran order in memory. - /// - /// - /// By default, the data-type is inferred from the input data. - /// - /// - /// The input a in Fortran, or column-major, order. - /// - public NDarray asfortranarray(Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("asfortranarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert the input to an array, checking for NaNs or Infs. - /// - /// - /// By default, the data-type is inferred from the input data. - /// - /// - /// Whether to use row-major (C-style) or - /// column-major (Fortran-style) memory representation.

- /// - /// Defaults to ‘C’. - /// - /// - /// Array interpretation of a.

- /// No copy is performed if the input - /// is already an ndarray.

- /// If a is a subclass of ndarray, a base - /// class ndarray is returned. - ///
- public NDarray asarray_chkfinite(Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray_chkfinite", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an ndarray of the provided type that satisfies requirements.

- /// - /// This function is useful to be sure that an array with the correct flags - /// is returned for passing to compiled code (perhaps through ctypes).

- /// - /// Notes - /// - /// The returned array will be guaranteed to have the listed requirements - /// by making a copy if needed. - ///
- /// - /// The required data-type.

- /// If None preserve the current dtype.

- /// If your - /// application requires the data to be in native byteorder, include - /// a byteorder specification as a part of the dtype specification. - /// - /// - /// The requirements list can be any of the following - /// - public NDarray require(Dtype dtype, string[] requirements = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - }); - var kwargs=new PyDict(); - if (requirements!=null) kwargs["requirements"]=ToPython(requirements); - dynamic py = __self__.InvokeMethod("require", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Split an array into multiple sub-arrays. - /// - /// - /// If indices_or_sections is an integer, N, the array will be divided - /// into N equal arrays along axis.

- /// If such a split is not possible, - /// an error is raised.

- /// - /// If indices_or_sections is a 1-D array of sorted integers, the entries - /// indicate where along axis the array is split.

- /// For example, - /// [2, 3] would, for axis=0, result in - /// - /// If an index exceeds the dimension of the array along axis, - /// an empty sub-array is returned correspondingly. - /// - /// - /// The axis along which to split, default is 0. - /// - /// - /// A list of sub-arrays. - /// - public NDarray[] split(int[] indices_or_sections, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - indices_or_sections, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Split an array into multiple sub-arrays. - /// - /// - /// If indices_or_sections is an integer, N, the array will be divided - /// into N equal arrays along axis.

- /// If such a split is not possible, - /// an error is raised.

- /// - /// If indices_or_sections is a 1-D array of sorted integers, the entries - /// indicate where along axis the array is split.

- /// For example, - /// [2, 3] would, for axis=0, result in - /// - /// If an index exceeds the dimension of the array along axis, - /// an empty sub-array is returned correspondingly. - /// - /// - /// The axis along which to split, default is 0. - /// - /// - /// A list of sub-arrays. - /// - public NDarray[] split(int indices_or_sections, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - indices_or_sections, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Construct an array by repeating A the number of times given by reps.

- /// - /// If reps has length d, the result will have dimension of - /// max(d, A.ndim).

- /// - /// If A.ndim < d, A is promoted to be d-dimensional by prepending new - /// axes.

- /// So a shape (3,) array is promoted to (1, 3) for 2-D replication, - /// or shape (1, 1, 3) for 3-D replication.

- /// If this is not the desired - /// behavior, promote A to d-dimensions manually before calling this - /// function.

- /// - /// If A.ndim > d, reps is promoted to A.ndim by pre-pending 1’s to it.

- /// - /// Thus for an A of shape (2, 3, 4, 5), a reps of (2, 2) is treated as - /// (1, 1, 2, 2).

- /// - /// Note : Although tile may be used for broadcasting, it is strongly - /// recommended to use numpy’s broadcasting operations and functions. - ///
- /// - /// The number of repetitions of A along each axis. - /// - /// - /// The tiled output array. - /// - public NDarray tile(NDarray reps) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - reps, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Repeat elements of an array. - /// - /// - /// The number of repetitions for each element.

- /// repeats is broadcasted - /// to fit the shape of the given axis. - /// - /// - /// The axis along which to repeat values.

- /// By default, use the - /// flattened input array, and return a flat output array. - /// - /// - /// Output array which has the same shape as a, except along - /// the given axis. - /// - public NDarray repeat(int[] repeats, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - repeats, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("repeat", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array with sub-arrays along an axis deleted.

- /// For a one - /// dimensional array, this returns those entries not returned by - /// arr[obj].

- /// - /// Notes - /// - /// Often it is preferable to use a boolean mask.

- /// For example: - /// - /// Is equivalent to np.delete(arr, [0,2,4], axis=0), but allows further - /// use of mask. - ///
- /// - /// Indicate which sub-arrays to remove. - /// - /// - /// The axis along which to delete the subarray defined by obj.

- /// - /// If axis is None, obj is applied to the flattened array. - /// - /// - /// A copy of arr with the elements specified by obj removed.

- /// Note - /// that delete does not occur in-place.

- /// If axis is None, out is - /// a flattened array. - ///
- public NDarray delete(Slice obj, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("delete", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Append values to the end of an array. - /// - /// - /// These values are appended to a copy of arr.

- /// It must be of the - /// correct shape (the same shape as arr, excluding axis).

- /// If - /// axis is not specified, values can be any shape and will be - /// flattened before use. - /// - /// - /// The axis along which values are appended.

- /// If axis is not - /// given, both arr and values are flattened before use. - /// - /// - /// A copy of arr with values appended to axis.

- /// Note that - /// append does not occur in-place: a new array is allocated and - /// filled.

- /// If axis is None, out is a flattened array. - ///
- public NDarray append(NDarray values, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - values, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("append", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Trim the leading and/or trailing zeros from a 1-D array or sequence. - /// - /// - /// A string with ‘f’ representing trim from front and ‘b’ to trim from - /// back.

- /// Default is ‘fb’, trim zeros from both front and back of the - /// array. - /// - /// - /// The result of trimming the input.

- /// The input data type is preserved. - ///
- public NDarray trim_zeros(string trim = "fb") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (trim!="fb") kwargs["trim"]=ToPython(trim); - dynamic py = __self__.InvokeMethod("trim_zeros", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the unique elements of an array.

- /// - /// Returns the sorted unique elements of an array.

- /// There are three optional - /// outputs in addition to the unique elements: - /// - /// Notes - /// - /// When an axis is specified the subarrays indexed by the axis are sorted.

- /// - /// This is done by making the specified axis the first dimension of the array - /// and then flattening the subarrays in C order.

- /// The flattened subarrays are - /// then viewed as a structured type with each element given a label, with the - /// effect that we end up with a 1-D array of structured types that can be - /// treated in the same way as any other 1-D array.

- /// The result is that the - /// flattened subarrays are sorted in lexicographic order starting with the - /// first element. - ///
- /// - /// The axis to operate on.

- /// If None, ar will be flattened.

- /// If an integer, - /// the subarrays indexed by the given axis will be flattened and treated - /// as the elements of a 1-D array with the dimension of the given axis, - /// see the notes for more details.

- /// Object arrays or structured arrays - /// that contain objects are not supported if the axis kwarg is used.

- /// The - /// default is None. - /// - /// - /// The sorted unique values. - /// - public NDarray unique(int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unique", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the unique elements of an array.

- /// - /// Returns the sorted unique elements of an array.

- /// There are three optional - /// outputs in addition to the unique elements: - /// - /// Notes - /// - /// When an axis is specified the subarrays indexed by the axis are sorted.

- /// - /// This is done by making the specified axis the first dimension of the array - /// and then flattening the subarrays in C order.

- /// The flattened subarrays are - /// then viewed as a structured type with each element given a label, with the - /// effect that we end up with a 1-D array of structured types that can be - /// treated in the same way as any other 1-D array.

- /// The result is that the - /// flattened subarrays are sorted in lexicographic order starting with the - /// first element. - ///
- /// - /// If True, also return the indices of ar (along the specified axis, - /// if provided, or in the flattened array) that result in the unique array. - /// - /// - /// If True, also return the indices of the unique array (for the specified - /// axis, if provided) that can be used to reconstruct ar. - /// - /// - /// If True, also return the number of times each unique item appears - /// in ar. - /// - /// - /// The axis to operate on.

- /// If None, ar will be flattened.

- /// If an integer, - /// the subarrays indexed by the given axis will be flattened and treated - /// as the elements of a 1-D array with the dimension of the given axis, - /// see the notes for more details.

- /// Object arrays or structured arrays - /// that contain objects are not supported if the axis kwarg is used.

- /// The - /// default is None. - /// - /// - /// The sorted unique values. - /// - public NDarray[] unique(bool return_index, bool return_inverse, bool return_counts, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (return_index!=null) kwargs["return_index"]=ToPython(return_index); - if (return_inverse!=null) kwargs["return_inverse"]=ToPython(return_inverse); - if (return_counts!=null) kwargs["return_counts"]=ToPython(return_counts); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unique", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Reverse the order of elements in an array along the given axis.

- /// - /// The shape of the array is preserved, but the elements are reordered.

- /// - /// Notes - /// - /// flip(m, 0) is equivalent to flipud(m).

- /// - /// flip(m, 1) is equivalent to fliplr(m).

- /// - /// flip(m, n) corresponds to m[...,::-1,...] with ::-1 at position n.

- /// - /// flip(m) corresponds to m[::-1,::-1,...,::-1] with ::-1 at all - /// positions.

- /// - /// flip(m, (0, 1)) corresponds to m[::-1,::-1,...] with ::-1 at - /// position 0 and position 1. - ///
- /// - /// Axis or axes along which to flip over.

- /// The default, - /// axis=None, will flip over all of the axes of the input array.

- /// - /// If axis is negative it counts from the last to the first axis.

- /// - /// If axis is a tuple of ints, flipping is performed on all of the axes - /// specified in the tuple. - /// - /// - /// A view of m with the entries of axis reversed.

- /// Since a view is - /// returned, this operation is done in constant time. - ///
- public NDarray flip(Axis axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("flip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Flip array in the left/right direction.

- /// - /// Flip the entries in each row in the left/right direction.

- /// - /// Columns are preserved, but appear in a different order than before.

- /// - /// Notes - /// - /// Equivalent to m[:,::-1].

- /// Requires the array to be at least 2-D. - ///
- /// - /// A view of m with the columns reversed.

- /// Since a view - /// is returned, this operation is . - ///
- public NDarray fliplr() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("fliplr"); - return ToCsharp(py); - } - - /// - /// Flip array in the up/down direction.

- /// - /// Flip the entries in each column in the up/down direction.

- /// - /// Rows are preserved, but appear in a different order than before.

- /// - /// Notes - /// - /// Equivalent to m[::-1,...].

- /// - /// Does not require the array to be two-dimensional. - ///
- /// - /// A view of m with the rows reversed.

- /// Since a view is - /// returned, this operation is . - ///
- public NDarray flipud() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("flipud"); - return ToCsharp(py); - } - - /// - /// Roll array elements along a given axis.

- /// - /// Elements that roll beyond the last position are re-introduced at - /// the first.

- /// - /// Notes - /// - /// Supports rolling over multiple dimensions simultaneously. - ///
- /// - /// The number of places by which elements are shifted.

- /// If a tuple, - /// then axis must be a tuple of the same size, and each of the - /// given axes is shifted by the corresponding number.

- /// If an int - /// while axis is a tuple of ints, then the same value is used for - /// all given axes. - /// - /// - /// Axis or axes along which elements are shifted.

- /// By default, the - /// array is flattened before shifting, after which the original - /// shape is restored. - /// - /// - /// Output array, with the same shape as a. - /// - public NDarray roll(int[] shift, Axis axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shift, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("roll", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Rotate an array by 90 degrees in the plane specified by axes.

- /// - /// Rotation direction is from the first towards the second axis.

- /// - /// Notes - /// - /// rot90(m, k=1, axes=(1,0)) is the reverse of rot90(m, k=1, axes=(0,1)) - /// rot90(m, k=1, axes=(1,0)) is equivalent to rot90(m, k=-1, axes=(0,1)) - ///
- /// - /// Number of times the array is rotated by 90 degrees. - /// - /// - /// The array is rotated in the plane defined by the axes.

- /// - /// Axes must be different. - /// - /// - /// A rotated view of m. - /// - public NDarray rot90(int k = 1, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (k!=1) kwargs["k"]=ToPython(k); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("rot90", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the bit-wise AND of two arrays element-wise.

- /// - /// Computes the bit-wise AND of the underlying binary representation of - /// the integers in the input arrays.

- /// This ufunc implements the C/Python - /// operator &. - ///
- /// - /// Only integer and boolean types are handled. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Result.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray bitwise_and(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("bitwise_and", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the bit-wise OR of two arrays element-wise.

- /// - /// Computes the bit-wise OR of the underlying binary representation of - /// the integers in the input arrays.

- /// This ufunc implements the C/Python - /// operator |. - ///
- /// - /// Only integer and boolean types are handled. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Result.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray bitwise_or(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("bitwise_or", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the bit-wise XOR of two arrays element-wise.

- /// - /// Computes the bit-wise XOR of the underlying binary representation of - /// the integers in the input arrays.

- /// This ufunc implements the C/Python - /// operator ^. - ///
- /// - /// Only integer and boolean types are handled. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Result.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray bitwise_xor(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("bitwise_xor", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute bit-wise inversion, or bit-wise NOT, element-wise.

- /// - /// Computes the bit-wise NOT of the underlying binary representation of - /// the integers in the input arrays.

- /// This ufunc implements the C/Python - /// operator ~. - /// - /// For signed integer inputs, the two’s complement is returned.

- /// In a - /// two’s-complement system negative numbers are represented by the two’s - /// complement of the absolute value.

- /// This is the most common method of - /// representing signed integers on computers [1].

- /// A N-bit - /// two’s-complement system can represent every integer in the range - /// to . - /// - /// Notes - /// - /// bitwise_not is an alias for invert: - /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Result.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray invert(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("invert", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Shift the bits of an integer to the right.

- /// - /// Bits are shifted to the right x2. Because the internal - /// representation of numbers is in binary format, this operation is - /// equivalent to dividing x1 by 2**x2. - ///
- /// - /// Number of bits to remove at the right of x1. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Return x1 with bits shifted x2 times to the right.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray right_shift(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("right_shift", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Packs the elements of a binary-valued array into bits in a uint8 array.

- /// - /// The result is padded to full bytes by inserting zero bits at the end. - ///
- /// - /// The dimension over which bit-packing is done.

- /// - /// None implies packing the flattened array. - /// - /// - /// Array of type uint8 whose elements represent bits corresponding to the - /// logical (0 or nonzero) value of the input elements.

- /// The shape of - /// packed has the same number of dimensions as the input (unless axis - /// is None, in which case the output is 1-D). - ///
- public NDarray packbits(int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("packbits", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Unpacks elements of a uint8 array into a binary-valued output array.

- /// - /// Each element of myarray represents a bit-field that should be unpacked - /// into a binary-valued output array.

- /// The shape of the output array is either - /// 1-D (if axis is None) or the same shape as the input array with unpacking - /// done along the axis specified. - ///
- /// - /// The dimension over which bit-unpacking is done.

- /// - /// None implies unpacking the flattened array. - /// - /// - /// The elements are binary-valued (0 or 1). - /// - public NDarray unpackbits(int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unpackbits", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For scalar a, returns the data type with the smallest size - /// and smallest scalar kind which can hold its value.

- /// For non-scalar - /// array a, returns the vector’s dtype unmodified.

- /// - /// Floating point values are not demoted to integers, - /// and complex values are not demoted to floats.

- /// - /// Notes - ///
- /// - /// The minimal data type. - /// - public Dtype min_scalar_type() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("min_scalar_type"); - return ToCsharp(py); - } - - /// - /// Return a scalar type which is common to the input arrays.

- /// - /// The return type will always be an inexact (i.e.

- /// floating point) scalar - /// type, even if all the arrays are integer arrays.

- /// If one of the inputs is - /// an integer array, the minimum precision type that is returned is a - /// 64-bit floating point dtype.

- /// - /// All input arrays except int64 and uint64 can be safely cast to the - /// returned dtype without loss of information. - ///
- /// - /// Input arrays. - /// - /// - /// Data type code. - /// - public Dtype common_type(NDarray array1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("common_type", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Modified Bessel function of the first kind, order 0.

- /// - /// Usually denoted . This function does broadcast, but will not - /// “up-cast” int dtype arguments unless accompanied by at least one float or - /// complex dtype argument (see Raises below).

- /// - /// Notes - /// - /// We use the algorithm published by Clenshaw [1] and referenced by - /// Abramowitz and Stegun [2], for which the function domain is - /// partitioned into the two intervals [0,8] and (8,inf), and Chebyshev - /// polynomial expansions are employed in each interval.

- /// Relative error on - /// the domain [0,30] using IEEE arithmetic is documented [3] as having a - /// peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000).

- /// - /// References - ///
- /// - /// The modified Bessel function evaluated at each of the elements of x. - /// - public NDarray i0() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("i0"); - return ToCsharp(py); - } - - /// - /// Compute the future value.

- /// - /// Notes - /// - /// The future value is computed by solving the equation: - /// - /// or, when rate == 0: - /// - /// References - ///
- /// - /// Number of compounding periods - /// - /// - /// Payment - /// - /// - /// Present value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)).

- /// - /// Defaults to {‘end’, 0}. - /// - /// - /// Future values.

- /// If all input is scalar, returns a scalar float.

- /// If - /// any input is array_like, returns future values for each input element.

- /// - /// If multiple inputs are array_like, they all must have the same shape. - ///
- public NDarray fv(NDarray nper, NDarray pmt, NDarray pv, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - nper, - pmt, - pv, - }); - var kwargs=new PyDict(); - if (@when!="end") kwargs["when"]=ToPython(@when); - dynamic py = __self__.InvokeMethod("fv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the present value.

- /// - /// Notes - /// - /// The present value is computed by solving the equation: - /// - /// or, when rate = 0: - /// - /// for pv, which is then returned.

- /// - /// References - ///
- /// - /// Number of compounding periods - /// - /// - /// Payment - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - /// - /// Present value of a series of payments or investments. - /// - public NDarray pv(NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - nper, - pmt, - }); - var kwargs=new PyDict(); - if (fv!=null) kwargs["fv"]=ToPython(fv); - if (@when!="end") kwargs["when"]=ToPython(@when); - dynamic py = __self__.InvokeMethod("pv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the payment against loan principal plus interest.

- /// - /// Notes - /// - /// The payment is computed by solving the equation: - /// - /// or, when rate == 0: - /// - /// for pmt.

- /// - /// Note that computing a monthly mortgage payment is only - /// one use for this function.

- /// For example, pmt returns the - /// periodic deposit one must make to achieve a specified - /// future balance given an initial deposit, a fixed, - /// periodically compounded interest rate, and the total - /// number of periods.

- /// - /// References - ///
- /// - /// Number of compounding periods - /// - /// - /// Present value - /// - /// - /// Future value (default = 0) - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - /// - /// Payment against loan plus interest.

- /// If all input is scalar, returns a - /// scalar float.

- /// If any input is array_like, returns payment for each - /// input element.

- /// If multiple inputs are array_like, they all must have - /// the same shape. - ///
- public NDarray pmt(NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - nper, - pv, - }); - var kwargs=new PyDict(); - if (fv!=null) kwargs["fv"]=ToPython(fv); - if (@when!="end") kwargs["when"]=ToPython(@when); - dynamic py = __self__.InvokeMethod("pmt", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the payment against loan principal. - /// - /// - /// Amount paid against the loan changes.

- /// The per is the period of - /// interest. - /// - /// - /// Number of compounding periods - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public void ppmt(NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - per, - nper, - pv, - }); - var kwargs=new PyDict(); - if (fv!=null) kwargs["fv"]=ToPython(fv); - if (@when!="end") kwargs["when"]=ToPython(@when); - dynamic py = __self__.InvokeMethod("ppmt", pyargs, kwargs); - } - - /// - /// Compute the interest portion of a payment.

- /// - /// Notes - /// - /// The total payment is made up of payment against principal plus interest.

- /// - /// pmt = ppmt + ipmt - ///
- /// - /// Interest paid against the loan changes during the life or the loan.

- /// - /// The per is the payment period to calculate the interest amount. - /// - /// - /// Number of compounding periods - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)).

- /// - /// Defaults to {‘end’, 0}. - /// - /// - /// Interest portion of payment.

- /// If all input is scalar, returns a scalar - /// float.

- /// If any input is array_like, returns interest payment for each - /// input element.

- /// If multiple inputs are array_like, they all must have - /// the same shape. - ///
- public NDarray ipmt(NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - per, - nper, - pv, - }); - var kwargs=new PyDict(); - if (fv!=null) kwargs["fv"]=ToPython(fv); - if (@when!="end") kwargs["when"]=ToPython(@when); - dynamic py = __self__.InvokeMethod("ipmt", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Internal Rate of Return (IRR).

- /// - /// This is the “average” periodically compounded rate of return - /// that gives a net present value of 0.0; for a more complete explanation, - /// see Notes below.

- /// - /// decimal.Decimal type is not supported.

- /// - /// Notes - /// - /// The IRR is perhaps best understood through an example (illustrated - /// using np.irr in the Examples section below).

- /// Suppose one invests 100 - /// units and then makes the following withdrawals at regular (fixed) - /// intervals: 39, 59, 55, 20. Assuming the ending value is 0, one’s 100 - /// unit investment yields 173 units; however, due to the combination of - /// compounding and the periodic withdrawals, the “average” rate of return - /// is neither simply 0.73/4 nor (1.73)^0.25-1. Rather, it is the solution - /// (for ) of the equation: - /// - /// In general, for values , - /// irr is the solution of the equation: [G] - /// - /// References - ///
- /// - /// Internal Rate of Return for periodic input values. - /// - public float irr() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("irr"); - return ToCsharp(py); - } - - /// - /// Modified internal rate of return. - /// - /// - /// Interest rate paid on the cash flows - /// - /// - /// Interest rate received on the cash flows upon reinvestment - /// - /// - /// Modified internal rate of return - /// - public float mirr(ValueType finance_rate, ValueType reinvest_rate) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - finance_rate, - reinvest_rate, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mirr", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the number of periodic payments.

- /// - /// decimal.Decimal type is not supported.

- /// - /// Notes - /// - /// The number of periods nper is computed by solving the equation: - /// - /// but if rate = 0 then: - ///
- /// - /// Payment - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public void nper(NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - pmt, - pv, - }); - var kwargs=new PyDict(); - if (fv!=null) kwargs["fv"]=ToPython(fv); - if (@when!="end") kwargs["when"]=ToPython(@when); - dynamic py = __self__.InvokeMethod("nper", pyargs, kwargs); - } - - /// - /// Compute the rate of interest per period.

- /// - /// Notes - /// - /// The rate of interest is computed by iteratively solving the - /// (non-linear) equation: - /// - /// for rate.

- /// - /// References - /// - /// Wheeler, D.

- /// A., E.

- /// Rathke, and R.

- /// Weir (Eds.) (2009, May).

- /// Open Document - /// Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated - /// Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. - /// Organization for the Advancement of Structured Information Standards - /// (OASIS).

- /// Billerica, MA, USA.

- /// [ODT Document].

- /// Available: - /// http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula - /// OpenDocument-formula-20090508.odt - ///
- /// - /// Payment - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - /// - /// Starting guess for solving the rate of interest, default 0.1 - /// - /// - /// Required tolerance for the solution, default 1e-6 - /// - /// - /// Maximum iterations in finding the solution - /// - public void rate(NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - pmt, - pv, - fv, - }); - var kwargs=new PyDict(); - if (@when!="end") kwargs["when"]=ToPython(@when); - if (guess!=null) kwargs["guess"]=ToPython(guess); - if (tol!=null) kwargs["tol"]=ToPython(tol); - if (maxiter!=100) kwargs["maxiter"]=ToPython(maxiter); - dynamic py = __self__.InvokeMethod("rate", pyargs, kwargs); - } - - /// - /// Return the indices of the elements that are non-zero.

- /// - /// Returns a tuple of arrays, one for each dimension of a, - /// containing the indices of the non-zero elements in that - /// dimension.

- /// The values in a are always tested and returned in - /// row-major, C-style order.

- /// The corresponding non-zero - /// values can be obtained with: - /// - /// To group the indices by element, rather than dimension, use: - /// - /// The result of this is always a 2-D array, with a row for - /// each non-zero element. - ///
- /// - /// Indices of elements that are non-zero. - /// - public NDarray[] nonzero() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("nonzero"); - return ToCsharp(py); - } - - /// - /// Return elements chosen from x or y depending on condition.

- /// - /// Notes - /// - /// If all the arrays are 1-D, where is equivalent to: - ///
- /// - /// Values from which to choose.

- /// x, y and condition need to be - /// broadcastable to some shape. - /// - /// - /// Values from which to choose.

- /// x, y and condition need to be - /// broadcastable to some shape. - /// - /// - /// An array with elements from x where condition is True, and elements - /// from y elsewhere. - /// - public NDarray @where(NDarray y, NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - y, - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("where", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return elements chosen from x or y depending on condition.

- /// - /// Notes - /// - /// If all the arrays are 1-D, where is equivalent to: - ///
- /// - /// An array with elements from x where condition is True, and elements - /// from y elsewhere. - /// - public NDarray[] @where() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("where"); - return ToCsharp(py); - } - - /// - /// Converts a flat index or array of flat indices into a tuple - /// of coordinate arrays. - /// - /// - /// The shape of the array to use for unraveling indices. - /// - /// - /// Determines whether the indices should be viewed as indexing in - /// row-major (C-style) or column-major (Fortran-style) order. - /// - /// - /// Each array in the tuple has the same shape as the indices - /// array. - /// - public NDarray[] unravel_index(Shape shape, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("unravel_index", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices to access the main diagonal of an n-dimensional array.

- /// - /// See diag_indices for full details.

- /// - /// Notes - ///
- public void diag_indices_from() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("diag_indices_from"); - } - - /// - /// Return the indices for the lower-triangle of arr.

- /// - /// See tril_indices for full details.

- /// - /// Notes - ///
- /// - /// Diagonal offset (see tril for details). - /// - public void tril_indices_from(int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril_indices_from", pyargs, kwargs); - } - - /// - /// Return the indices for the upper-triangle of arr.

- /// - /// See triu_indices for full details.

- /// - /// Notes - ///
- /// - /// Diagonal offset (see triu for details). - /// - /// - /// Indices for the upper-triangle of arr. - /// - public NDarray[] triu_indices_from(int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("triu_indices_from", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Take values from the input array by matching 1d index and data slices.

- /// - /// This iterates over matching 1d slices oriented along the specified axis in - /// the index and data arrays, and uses the former to look up values in the - /// latter.

- /// These slices can be different lengths.

- /// - /// Functions returning an index along an axis, like argsort and - /// argpartition, produce suitable indices for this function.

- /// - /// Notes - /// - /// This is equivalent to (but faster than) the following use of ndindex and - /// s_, which sets each of ii and kk to a tuple of indices: - /// - /// Equivalently, eliminating the inner loop, the last two lines would be: - ///
- /// - /// Indices to take along each 1d slice of arr.

- /// This must match the - /// dimension of arr, but dimensions Ni and Nj only need to broadcast - /// against arr. - /// - /// - /// The axis to take 1d slices along.

- /// If axis is None, the input array is - /// treated as if it had first been flattened to 1d, for consistency with - /// sort and argsort. - /// - public NDarray take_along_axis(NDarray indices, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - indices, - axis, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("take_along_axis", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return specified diagonals.

- /// - /// If a is 2-D, returns the diagonal of a with the given offset, - /// i.e., the collection of elements of the form a[i, i+offset].

- /// If - /// a has more than two dimensions, then the axes specified by axis1 - /// and axis2 are used to determine the 2-D sub-array whose diagonal is - /// returned.

- /// The shape of the resulting array can be determined by - /// removing axis1 and axis2 and appending an index to the right equal - /// to the size of the resulting diagonals.

- /// - /// In versions of NumPy prior to 1.7, this function always returned a new, - /// independent array containing a copy of the values in the diagonal.

- /// - /// In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, - /// but depending on this fact is deprecated.

- /// Writing to the resulting - /// array continues to work as it used to, but a FutureWarning is issued.

- /// - /// Starting in NumPy 1.9 it returns a read-only view on the original array.

- /// - /// Attempting to write to the resulting array will produce an error.

- /// - /// In some future release, it will return a read/write view and writing to - /// the returned array will alter your original array.

- /// The returned array - /// will have the same type as the input array.

- /// - /// If you don’t write to the array returned by this function, then you can - /// just ignore all of the above.

- /// - /// If you depend on the current behavior, then we suggest copying the - /// returned array explicitly, i.e., use np.diagonal(a).copy() instead - /// of just np.diagonal(a).

- /// This will work with both past and future - /// versions of NumPy. - ///
- /// - /// Offset of the diagonal from the main diagonal.

- /// Can be positive or - /// negative.

- /// Defaults to main diagonal (0). - /// - /// - /// Axis to be used as the first axis of the 2-D sub-arrays from which - /// the diagonals should be taken.

- /// Defaults to first axis (0). - /// - /// - /// Axis to be used as the second axis of the 2-D sub-arrays from - /// which the diagonals should be taken.

- /// Defaults to second axis (1). - /// - /// - /// If a is 2-D, then a 1-D array containing the diagonal and of the - /// same type as a is returned unless a is a matrix, in which case - /// a 1-D array rather than a (2-D) matrix is returned in order to - /// maintain backward compatibility.

- /// - /// If a.ndim > 2, then the dimensions specified by axis1 and axis2 - /// are removed, and a new axis inserted at the end corresponding to the - /// diagonal. - ///
- public NDarray diagonal(int? offset = 0, int? axis1 = 0, int? axis2 = 1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (offset!=0) kwargs["offset"]=ToPython(offset); - if (axis1!=0) kwargs["axis1"]=ToPython(axis1); - if (axis2!=1) kwargs["axis2"]=ToPython(axis2); - dynamic py = __self__.InvokeMethod("diagonal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Change elements of an array based on conditional and input values.

- /// - /// Similar to np.copyto(arr, vals, where=mask), the difference is that - /// place uses the first N elements of vals, where N is the number of - /// True values in mask, while copyto uses the elements where mask - /// is True.

- /// - /// Note that extract does the exact opposite of place. - ///
- /// - /// Boolean mask array.

- /// Must have the same size as a. - /// - /// - /// Values to put into a.

- /// Only the first N elements are used, where - /// N is the number of True values in mask.

- /// If vals is smaller - /// than N, it will be repeated, and if elements of a are to be masked, - /// this sequence must be non-empty. - /// - public void place(NDarray mask, NDarray vals) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - mask, - vals, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("place", pyargs, kwargs); - } - - /// - /// Replaces specified elements of an array with given values.

- /// - /// The indexing works on the flattened target array.

- /// put is roughly - /// equivalent to: - ///
- /// - /// Target indices, interpreted as integers. - /// - /// - /// Values to place in a at target indices.

- /// If v is shorter than - /// ind it will be repeated as necessary. - /// - /// - /// Specifies how out-of-bounds indices will behave.

- /// - /// ‘clip’ mode means that all indices that are too large are replaced - /// by the index that addresses the last element along that axis.

- /// Note - /// that this disables indexing with negative numbers. - /// - public void put(NDarray ind, NDarray v, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ind, - v, - }); - var kwargs=new PyDict(); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("put", pyargs, kwargs); - } - - /// - /// Put values into the destination array by matching 1d index and data slices.

- /// - /// This iterates over matching 1d slices oriented along the specified axis in - /// the index and data arrays, and uses the former to place values into the - /// latter.

- /// These slices can be different lengths.

- /// - /// Functions returning an index along an axis, like argsort and - /// argpartition, produce suitable indices for this function.

- /// - /// Notes - /// - /// This is equivalent to (but faster than) the following use of ndindex and - /// s_, which sets each of ii and kk to a tuple of indices: - /// - /// Equivalently, eliminating the inner loop, the last two lines would be: - ///
- /// - /// Indices to change along each 1d slice of arr.

- /// This must match the - /// dimension of arr, but dimensions in Ni and Nj may be 1 to broadcast - /// against arr. - /// - /// - /// values to insert at those indices.

- /// Its shape and dimension are - /// broadcast to match that of indices. - /// - /// - /// The axis to take 1d slices along.

- /// If axis is None, the destination - /// array is treated as if a flattened 1d view had been created of it. - /// - public void put_along_axis(NDarray indices, NDarray[] values, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - indices, - values, - axis, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("put_along_axis", pyargs, kwargs); - } - - /// - /// Changes elements of an array based on conditional and input values.

- /// - /// Sets a.flat[n] = values[n] for each n where mask.flat[n]==True.

- /// - /// If values is not the same size as a and mask then it will repeat.

- /// - /// This gives behavior different from a[mask] = values. - ///
- /// - /// Boolean mask array.

- /// It has to be the same shape as a. - /// - /// - /// Values to put into a where mask is True.

- /// If values is smaller - /// than a it will be repeated. - /// - public void putmask(NDarray mask, NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - mask, - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("putmask", pyargs, kwargs); - } - - /// - /// Fill the main diagonal of the given array of any dimensionality.

- /// - /// For an array a with a.ndim >= 2, the diagonal is the list of - /// locations with indices a[i, ..., i] all identical.

- /// This function - /// modifies the input array in-place, it does not return a value.

- /// - /// Notes - /// - /// This functionality can be obtained via diag_indices, but internally - /// this version uses a much faster implementation that never constructs the - /// indices and uses simple slicing. - ///
- /// - /// Value to be written on the diagonal, its type must be compatible with - /// that of the array a. - /// - /// - /// For tall matrices in NumPy version up to 1.6.2, the - /// diagonal “wrapped” after N columns.

- /// You can have this behavior - /// with this option.

- /// This affects only tall matrices. - /// - public void fill_diagonal(ValueType val, bool wrap = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - val, - }); - var kwargs=new PyDict(); - if (wrap!=false) kwargs["wrap"]=ToPython(wrap); - dynamic py = __self__.InvokeMethod("fill_diagonal", pyargs, kwargs); - } - - /* - /// - /// Efficient multi-dimensional iterator object to iterate over arrays.

- /// - /// To get started using this object, see the - /// introductory guide to array iteration.

- /// - /// Notes - /// - /// nditer supersedes flatiter.

- /// The iterator implementation behind - /// nditer is also exposed by the NumPy C API.

- /// - /// The Python exposure supplies two iteration interfaces, one which follows - /// the Python iterator protocol, and another which mirrors the C-style - /// do-while pattern.

- /// The native Python approach is better in most cases, but - /// if you need the iterator’s coordinates or index, use the C-style pattern. - ///
- /// - /// Flags to control the behavior of the iterator. - /// - /// - /// This is a list of flags for each operand.

- /// At minimum, one of - /// “readonly”, “readwrite”, or “writeonly” must be specified. - /// - /// - /// The required data type(s) of the operands.

- /// If copying or buffering - /// is enabled, the data will be converted to/from their original types. - /// - /// - /// Controls the iteration order.

- /// ‘C’ means C order, ‘F’ means - /// Fortran order, ‘A’ means ‘F’ order if all the arrays are Fortran - /// contiguous, ‘C’ order otherwise, and ‘K’ means as close to the - /// order the array elements appear in memory as possible.

- /// This also - /// affects the element memory order of “allocate” operands, as they - /// are allocated to be compatible with iteration order.

- /// - /// Default is ‘K’. - /// - /// - /// Controls what kind of data casting may occur when making a copy - /// or buffering.

- /// Setting this to ‘unsafe’ is not recommended, - /// as it can adversely affect accumulations. - /// - /// - /// If provided, is a list of ints or None for each operands.

- /// - /// The list of axes for an operand is a mapping from the dimensions - /// of the iterator to the dimensions of the operand.

- /// A value of - /// -1 can be placed for entries, causing that dimension to be - /// treated as “newaxis”. - /// - /// - /// The desired shape of the iterator.

- /// This allows “allocate” operands - /// with a dimension mapped by op_axes not corresponding to a dimension - /// of a different operand to get a value not equal to 1 for that - /// dimension. - /// - /// - /// When buffering is enabled, controls the size of the temporary - /// buffers.

- /// Set to 0 for the default value. - /// - public void nditer(string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (flags!=null) kwargs["flags"]=ToPython(flags); - if (op_flags!=null) kwargs["op_flags"]=ToPython(op_flags); - if (op_dtypes!=null) kwargs["op_dtypes"]=ToPython(op_dtypes); - if (order!=null) kwargs["order"]=ToPython(order); - if (casting!=null) kwargs["casting"]=ToPython(casting); - if (op_axes!=null) kwargs["op_axes"]=ToPython(op_axes); - if (itershape!=null) kwargs["itershape"]=ToPython(itershape); - if (buffersize!=null) kwargs["buffersize"]=ToPython(buffersize); - dynamic py = __self__.InvokeMethod("nditer", pyargs, kwargs); - } - */ - - /// - /// Multidimensional index iterator.

- /// - /// Return an iterator yielding pairs of array coordinates and values. - ///
- public void ndenumerate() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("ndenumerate"); - } - - /* - /// - /// Create nditers for use in nested loops - /// - /// Create a tuple of nditer objects which iterate in nested loops over - /// different axes of the op argument.

- /// The first iterator is used in the - /// outermost loop, the last in the innermost loop.

- /// Advancing one will change - /// the subsequent iterators to point at its new element. - ///
- /// - /// Each item is used as an “op_axes” argument to an nditer - /// - /// - /// An nditer for each item in axes, outermost first - /// - public tuple of nditer nested_iters(params int[] axes) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("nested_iters", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Return a string representation of an array.

- /// - /// Notes - /// - /// If a formatter is specified for a certain type, the precision keyword is - /// ignored for that type.

- /// - /// This is a very flexible function; array_repr and array_str are using - /// array2string internally so keywords with the same name should work - /// identically in all three functions. - ///
- /// - /// The maximum number of columns the string should span.

- /// Newline - /// characters splits the string appropriately after array elements. - /// - /// - /// Floating point precision.

- /// Default is the current printing - /// precision (usually 8), which can be altered using set_printoptions. - /// - /// - /// Represent very small numbers as zero.

- /// A number is “very small” if it - /// is smaller than the current printing precision. - /// - /// - /// Inserted between elements. - /// - /// - /// The length of the prefix and suffix strings are used to respectively - /// align and wrap the output.

- /// An array is typically printed as: - /// - /// The output is left-padded by the length of the prefix string, and - /// wrapping is forced at the column max_line_width - len(suffix).

- /// - /// It should be noted that the content of prefix and suffix strings are - /// not included in the output. - /// - /// - /// If not None, the keys should indicate the type(s) that the respective - /// formatting function applies to.

- /// Callables should return a string.

- /// - /// Types that are not specified (by their corresponding keys) are handled - /// by the default formatters.

- /// Individual types for which a formatter - /// can be set are: - /// - /// Other keys that can be used to set a group of types at once are: - /// - /// - /// Total number of array elements which trigger summarization - /// rather than full repr. - /// - /// - /// Number of array items in summary at beginning and end of - /// each dimension. - /// - /// - /// Controls printing of the sign of floating-point types.

- /// If ‘+’, always - /// print the sign of positive values.

- /// If ‘ ‘, always prints a space - /// (whitespace character) in the sign position of positive values.

- /// If - /// ‘-‘, omit the sign character of positive values. - /// - /// - /// Controls the interpretation of the precision option for - /// floating-point types.

- /// Can take the following values: - /// - /// - /// If set to the string ‘1.13’ enables 1.13 legacy printing mode.

- /// This - /// approximates numpy 1.13 print output by including a space in the sign - /// position of floats and different behavior for 0d arrays.

- /// If set to - /// False, disables legacy mode.

- /// Unrecognized strings will be ignored - /// with a warning for forward compatibility. - /// - /// - /// String representation of the array. - /// - public string array2string(int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (max_line_width!=null) kwargs["max_line_width"]=ToPython(max_line_width); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (suppress_small!=null) kwargs["suppress_small"]=ToPython(suppress_small); - if (separator!=" ") kwargs["separator"]=ToPython(separator); - if (prefix!="") kwargs["prefix"]=ToPython(prefix); - if (suffix!="") kwargs["suffix"]=ToPython(suffix); - if (formatter!=null) kwargs["formatter"]=ToPython(formatter); - if (threshold!=null) kwargs["threshold"]=ToPython(threshold); - if (edgeitems!=null) kwargs["edgeitems"]=ToPython(edgeitems); - if (sign!=null) kwargs["sign"]=ToPython(sign); - if (floatmode!=null) kwargs["floatmode"]=ToPython(floatmode); - if (legacy!=null) kwargs["legacy"]=ToPython(legacy); - dynamic py = __self__.InvokeMethod("array2string", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Return the string representation of an array. - /// - /// - /// The maximum number of columns the string should span.

- /// Newline - /// characters split the string appropriately after array elements. - /// - /// - /// Floating point precision.

- /// Default is the current printing precision - /// (usually 8), which can be altered using set_printoptions. - /// - /// - /// Represent very small numbers as zero, default is False.

- /// Very small - /// is defined by precision, if the precision is 8 then - /// numbers smaller than 5e-9 are represented as zero. - /// - /// - /// The string representation of an array. - /// - public string array_repr(int? max_line_width = null, int? precision = null, bool? suppress_small = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (max_line_width!=null) kwargs["max_line_width"]=ToPython(max_line_width); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (suppress_small!=null) kwargs["suppress_small"]=ToPython(suppress_small); - dynamic py = __self__.InvokeMethod("array_repr", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a string representation of the data in an array.

- /// - /// The data in the array is returned as a single string.

- /// This function is - /// similar to array_repr, the difference being that array_repr also - /// returns information on the kind of array and its data type. - ///
- /// - /// Inserts newlines if text is longer than max_line_width.

- /// The - /// default is, indirectly, 75. - /// - /// - /// Floating point precision.

- /// Default is the current printing precision - /// (usually 8), which can be altered using set_printoptions. - /// - /// - /// Represent numbers “very close” to zero as zero; default is False.

- /// - /// Very close is defined by precision: if the precision is 8, e.g., - /// numbers smaller (in absolute value) than 5e-9 are represented as - /// zero. - /// - public void array_str(int? max_line_width = null, int? precision = null, bool? suppress_small = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (max_line_width!=null) kwargs["max_line_width"]=ToPython(max_line_width); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (suppress_small!=null) kwargs["suppress_small"]=ToPython(suppress_small); - dynamic py = __self__.InvokeMethod("array_str", pyargs, kwargs); - } - - /// - /// Dot product of two arrays.

- /// Specifically, - ///
- /// - /// Second argument. - /// - /// - /// Output argument.

- /// This must have the exact kind that would be returned - /// if it was not used.

- /// In particular, it must have the right type, must be - /// C-contiguous, and its dtype must be the dtype that would be returned - /// for dot(a,b).

- /// This is a performance feature.

- /// Therefore, if these - /// conditions are not met, an exception is raised, instead of attempting - /// to be flexible. - /// - /// - /// Returns the dot product of a and b.

- /// If a and b are both - /// scalars or both 1-D arrays then a scalar is returned; otherwise - /// an array is returned.

- /// - /// If out is given, then it is returned. - ///
- public NDarray dot(NDarray b, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("dot", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the dot product of two vectors.

- /// - /// The vdot(a, b) function handles complex numbers differently than - /// dot(a, b).

- /// If the first argument is complex the complex conjugate - /// of the first argument is used for the calculation of the dot product.

- /// - /// Note that vdot handles multidimensional arrays differently than dot: - /// it does not perform a matrix product, but flattens input arguments - /// to 1-D vectors first.

- /// Consequently, it should only be used for vectors. - ///
- /// - /// Second argument to the dot product. - /// - /// - /// Dot product of a and b.

- /// Can be an int, float, or - /// complex depending on the types of a and b. - ///
- public NDarray vdot(NDarray b) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("vdot", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Inner product of two arrays.

- /// - /// Ordinary inner product of vectors for 1-D arrays (without complex - /// conjugation), in higher dimensions a sum product over the last axes.

- /// - /// Notes - /// - /// For vectors (1-D arrays) it computes the ordinary inner-product: - /// - /// More generally, if ndim(a) = r > 0 and ndim(b) = s > 0: - /// - /// or explicitly: - /// - /// In addition a or b may be scalars, in which case: - ///
- /// - /// If a and b are nonscalar, their last dimensions must match. - /// - /// - /// out.shape = a.shape[:-1] + b.shape[:-1] - /// - public NDarray inner(NDarray a) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("inner", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the outer product of two vectors.

- /// - /// Given two vectors, a = [a0, a1, ..., aM] and - /// b = [b0, b1, ..., bN], - /// the outer product [1] is: - /// - /// References - ///
- /// - /// Second input vector.

- /// Input is flattened if - /// not already 1-dimensional. - /// - /// - /// A location where the result is stored - /// - /// - /// out[i, j] = a[i] * b[j] - /// - public NDarray outer(NDarray b, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("outer", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Matrix product of two arrays.

- /// - /// Notes - /// - /// The behavior depends on the arguments in the following way.

- /// - /// matmul differs from dot in two important ways: - /// - /// The matmul function implements the semantics of the @ operator introduced - /// in Python 3.5 following PEP465. - ///
- /// - /// Input arrays, scalars not allowed. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that matches the signature (n,k),(k,m)->(n,m).

- /// If not - /// provided or None, a freshly-allocated array is returned. - /// - /// - /// The matrix product of the inputs.

- /// - /// This is a scalar only when both x1, x2 are 1-d vectors. - ///
- public NDarray matmul(NDarray x1, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("matmul", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute tensor dot product along specified axes for arrays >= 1-D.

- /// - /// Given two tensors (arrays of dimension greater than or equal to one), - /// a and b, and an array_like object containing two array_like - /// objects, (a_axes, b_axes), sum the products of a’s and b’s - /// elements (components) over the axes specified by a_axes and - /// b_axes.

- /// The third argument can be a single non-negative - /// integer_like scalar, N; if it is such, then the last N - /// dimensions of a and the first N dimensions of b are summed - /// over.

- /// - /// Notes - /// - /// When axes is integer_like, the sequence for evaluation will be: first - /// the -Nth axis in a and 0th axis in b, and the -1th axis in a and - /// Nth axis in b last.

- /// - /// When there is more than one axis to sum over - and they are not the last - /// (first) axes of a (b) - the argument axes should consist of - /// two sequences of the same length, with the first axis to sum over given - /// first in both sequences, the second axis second, and so forth. - ///
- /// - /// Tensors to “dot”. - /// - public NDarray tensordot(NDarray a, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("tensordot", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Kronecker product of two arrays.

- /// - /// Computes the Kronecker product, a composite array made of blocks of the - /// second array scaled by the first.

- /// - /// Notes - /// - /// The function assumes that the number of dimensions of a and b - /// are the same, if necessary prepending the smallest with ones.

- /// - /// If a.shape = (r0,r1,..,rN) and b.shape = (s0,s1,…,sN), - /// the Kronecker product has shape (r0*s0, r1*s1, …, rN*SN).

- /// - /// The elements are products of elements from a and b, organized - /// explicitly by: - /// - /// where: - /// - /// In the common 2-D case (N=1), the block structure can be visualized: - ///
- public NDarray kron(NDarray a) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("kron", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the sum along diagonals of the array.

- /// - /// If a is 2-D, the sum along its diagonal with the given offset - /// is returned, i.e., the sum of elements a[i,i+offset] for all i.

- /// - /// If a has more than two dimensions, then the axes specified by axis1 and - /// axis2 are used to determine the 2-D sub-arrays whose traces are returned.

- /// - /// The shape of the resulting array is the same as that of a with axis1 - /// and axis2 removed. - ///
- /// - /// Offset of the diagonal from the main diagonal.

- /// Can be both positive - /// and negative.

- /// Defaults to 0. - /// - /// - /// Axes to be used as the first and second axis of the 2-D sub-arrays - /// from which the diagonals should be taken.

- /// Defaults are the first two - /// axes of a. - /// - /// - /// Axes to be used as the first and second axis of the 2-D sub-arrays - /// from which the diagonals should be taken.

- /// Defaults are the first two - /// axes of a. - /// - /// - /// Determines the data-type of the returned array and of the accumulator - /// where the elements are summed.

- /// If dtype has the value None and a is - /// of integer type of precision less than the default integer - /// precision, then the default integer precision is used.

- /// Otherwise, - /// the precision is the same as that of a. - /// - /// - /// Array into which the output is placed.

- /// Its type is preserved and - /// it must be of the right shape to hold the output. - /// - /// - /// If a is 2-D, the sum along the diagonal is returned.

- /// If a has - /// larger dimensions, then an array of sums along diagonals is returned. - ///
- public NDarray trace(int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (offset!=0) kwargs["offset"]=ToPython(offset); - if (axis2!=null) kwargs["axis2"]=ToPython(axis2); - if (axis1!=null) kwargs["axis1"]=ToPython(axis1); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("trace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Test whether all array elements along a given axis evaluate to True.

- /// - /// Notes - /// - /// Not a Number (NaN), positive infinity and negative infinity - /// evaluate to True because these are not equal to zero. - ///
- /// - /// Axis or axes along which a logical AND reduction is performed.

- /// - /// The default (axis = None) is to perform a logical AND over all - /// the dimensions of the input array.

- /// axis may be negative, in - /// which case it counts from the last to the first axis.

- /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternate output array in which to place the result.

- /// - /// It must have the same shape as the expected output and its - /// type is preserved (e.g., if dtype(out) is float, the result - /// will consist of 0.0’s and 1.0’s).

- /// See doc.ufuncs (Section - /// “Output arguments”) for more details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the all method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new boolean or array is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public NDarray all(Axis axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("all", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Test whether all array elements along a given axis evaluate to True.

- /// - /// Notes - /// - /// Not a Number (NaN), positive infinity and negative infinity - /// evaluate to True because these are not equal to zero. - ///
- /// - /// A new boolean or array is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public bool all() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("all"); - return ToCsharp(py); - } - - /// - /// Test whether any array element along a given axis evaluates to True.

- /// - /// Returns single boolean unless axis is not None - /// - /// Notes - /// - /// Not a Number (NaN), positive infinity and negative infinity evaluate - /// to True because these are not equal to zero. - ///
- /// - /// Axis or axes along which a logical OR reduction is performed.

- /// - /// The default (axis = None) is to perform a logical OR over all - /// the dimensions of the input array.

- /// axis may be negative, in - /// which case it counts from the last to the first axis.

- /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternate output array in which to place the result.

- /// It must have - /// the same shape as the expected output and its type is preserved - /// (e.g., if it is of type float, then it will remain so, returning - /// 1.0 for True and 0.0 for False, regardless of the type of a).

- /// - /// See doc.ufuncs (Section “Output arguments”) for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the any method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new boolean or ndarray is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public NDarray any(Axis axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("any", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Test whether any array element along a given axis evaluates to True.

- /// - /// Returns single boolean unless axis is not None - /// - /// Notes - /// - /// Not a Number (NaN), positive infinity and negative infinity evaluate - /// to True because these are not equal to zero. - ///
- /// - /// A new boolean or ndarray is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public bool any() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("any"); - return ToCsharp(py); - } - - /// - /// Test element-wise for finiteness (not infinity or not Not a Number).

- /// - /// The result is returned as a boolean array.

- /// - /// Notes - /// - /// Not a Number, positive infinity and negative infinity are considered - /// to be non-finite.

- /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// This means that Not a Number is not equivalent to infinity.

- /// - /// Also that positive infinity is not equivalent to negative infinity.

- /// But - /// infinity is equivalent to positive infinity.

- /// Errors result if the - /// second argument is also supplied when x is a scalar input, or if - /// first and second arguments have different shapes. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// True where x is not positive infinity, negative infinity, - /// or NaN; false otherwise.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray isfinite(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("isfinite", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Test element-wise for positive or negative infinity.

- /// - /// Returns a boolean array of the same shape as x, True where x == - /// +/-inf, otherwise False.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// - /// Errors result if the second argument is supplied when the first - /// argument is a scalar, or if the first and second arguments have - /// different shapes. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// True where x is positive or negative infinity, false otherwise.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray isinf(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("isinf", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Test element-wise for NaN and return result as a boolean array.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// This means that Not a Number is not equivalent to infinity. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// True where x is NaN, false otherwise.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray isnan(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("isnan", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Test element-wise for NaT (not a time) and return result as a boolean array. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// True where x is NaT, false otherwise.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray isnat(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("isnat", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Test element-wise for negative infinity, return result as bool array.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// - /// Errors result if the second argument is also supplied when x is a scalar - /// input, if first and second arguments have different shapes, or if the - /// first argument has complex values. - ///
- /// - /// A boolean array with the same shape and type as x to store the - /// result. - /// - /// - /// A boolean array with the same dimensions as the input.

- /// - /// If second argument is not supplied then a numpy boolean array is - /// returned with values True where the corresponding element of the - /// input is negative infinity and values False where the element of - /// the input is not negative infinity.

- /// - /// If a second argument is supplied the result is stored there.

- /// If the - /// type of that array is a numeric type the result is represented as - /// zeros and ones, if the type is boolean then as False and True.

- /// The - /// return value out is then a reference to that array. - ///
- public NDarray isneginf(NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("isneginf", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Test element-wise for positive infinity, return result as bool array.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// - /// Errors result if the second argument is also supplied when x is a scalar - /// input, if first and second arguments have different shapes, or if the - /// first argument has complex values - ///
- /// - /// A boolean array with the same shape as x to store the result. - /// - /// - /// A boolean array with the same dimensions as the input.

- /// - /// If second argument is not supplied then a boolean array is returned - /// with values True where the corresponding element of the input is - /// positive infinity and values False where the element of the input is - /// not positive infinity.

- /// - /// If a second argument is supplied the result is stored there.

- /// If the - /// type of that array is a numeric type the result is represented as zeros - /// and ones, if the type is boolean then as False and True.

- /// - /// The return value out is then a reference to that array. - ///
- public NDarray isposinf(NDarray y = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - dynamic py = __self__.InvokeMethod("isposinf", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns a bool array, where True if input element is complex.

- /// - /// What is tested is whether the input has a non-zero imaginary part, not if - /// the input type is complex. - ///
- /// - /// Output array. - /// - public NDarray iscomplex() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("iscomplex"); - return ToCsharp(py); - } - - /// - /// Returns True if the array is Fortran contiguous but not C contiguous.

- /// - /// This function is obsolete and, because of changes due to relaxed stride - /// checking, its return value for the same array may differ for versions - /// of NumPy >= 1.10.0 and previous versions.

- /// If you only want to check if an - /// array is Fortran contiguous use a.flags.f_contiguous instead. - ///
- public bool isfortran() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("isfortran"); - return ToCsharp(py); - } - - /// - /// Returns a bool array, where True if input element is real.

- /// - /// If element has complex type with zero complex part, the return value - /// for that element is True. - ///
- /// - /// Boolean array of same shape as x. - /// - public NDarray isreal() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("isreal"); - return ToCsharp(py); - } - - /// - /// Compute the truth value of x1 AND x2 element-wise. - /// - /// - /// Input arrays.

- /// x1 and x2 must be of the same shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Boolean result with the same shape as x1 and x2 of the logical - /// AND operation on corresponding elements of x1 and x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray logical_and(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("logical_and", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the truth value of x1 OR x2 element-wise. - /// - /// - /// Logical OR is applied to the elements of x1 and x2. - /// They have to be of the same shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Boolean result with the same shape as x1 and x2 of the logical - /// OR operation on elements of x1 and x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray logical_or(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("logical_or", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the truth value of NOT x element-wise. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Boolean result with the same shape as x of the NOT operation - /// on elements of x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray logical_not(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("logical_not", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the truth value of x1 XOR x2, element-wise. - /// - /// - /// Logical XOR is applied to the elements of x1 and x2. They must - /// be broadcastable to the same shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Boolean result of the logical XOR operation applied to the elements - /// of x1 and x2; the shape is determined by whether or not - /// broadcasting of one or both arrays was required.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray logical_xor(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("logical_xor", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Returns True if two arrays are element-wise equal within a tolerance.

- /// - /// The tolerance values are positive, typically very small numbers.

- /// The - /// relative difference (rtol * abs(b)) and the absolute difference - /// atol are added together to compare against the absolute difference - /// between a and b.

- /// - /// If either array contains one or more NaNs, False is returned.

- /// - /// Infs are treated as equal if they are in the same place and of the same - /// sign in both arrays.

- /// - /// Notes - /// - /// If the following equation is element-wise True, then allclose returns - /// True.

- /// - /// The above equation is not symmetric in a and b, so that - /// allclose(a, b) might be different from allclose(b, a) in - /// some rare cases.

- /// - /// The comparison of a and b uses standard broadcasting, which - /// means that a and b need not have the same shape in order for - /// allclose(a, b) to evaluate to True.

- /// The same is true for - /// equal but not array_equal. - ///
- /// - /// Input arrays to compare. - /// - /// - /// The relative tolerance parameter (see Notes). - /// - /// - /// The absolute tolerance parameter (see Notes). - /// - /// - /// Whether to compare NaN’s as equal.

- /// If True, NaN’s in a will be - /// considered equal to NaN’s in b in the output array. - /// - /// - /// Returns True if the two arrays are equal within the given - /// tolerance; False otherwise. - /// - public bool allclose(NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (rtol!=1e-05f) kwargs["rtol"]=ToPython(rtol); - if (atol!=1e-08f) kwargs["atol"]=ToPython(atol); - if (equal_nan!=false) kwargs["equal_nan"]=ToPython(equal_nan); - dynamic py = __self__.InvokeMethod("allclose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns a boolean array where two arrays are element-wise equal within a - /// tolerance.

- /// - /// The tolerance values are positive, typically very small numbers.

- /// The - /// relative difference (rtol * abs(b)) and the absolute difference - /// atol are added together to compare against the absolute difference - /// between a and b.

- /// - /// Notes - /// - /// For finite values, isclose uses the following equation to test whether - /// two floating point values are equivalent.

- /// - /// Unlike the built-in math.isclose, the above equation is not symmetric - /// in a and b – it assumes b is the reference value – so that - /// isclose(a, b) might be different from isclose(b, a).

- /// Furthermore, - /// the default value of atol is not zero, and is used to determine what - /// small values should be considered close to zero.

- /// The default value is - /// appropriate for expected values of order unity: if the expected values - /// are significantly smaller than one, it can result in false positives.

- /// - /// atol should be carefully selected for the use case at hand.

- /// A zero value - /// for atol will result in False if either a or b is zero. - ///
- /// - /// Input arrays to compare. - /// - /// - /// The relative tolerance parameter (see Notes). - /// - /// - /// The absolute tolerance parameter (see Notes). - /// - /// - /// Whether to compare NaN’s as equal.

- /// If True, NaN’s in a will be - /// considered equal to NaN’s in b in the output array. - /// - /// - /// Returns a boolean array of where a and b are equal within the - /// given tolerance.

- /// If both a and b are scalars, returns a single - /// boolean value. - ///
- public NDarray isclose(NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (rtol!=1e-05f) kwargs["rtol"]=ToPython(rtol); - if (atol!=1e-08f) kwargs["atol"]=ToPython(atol); - if (equal_nan!=false) kwargs["equal_nan"]=ToPython(equal_nan); - dynamic py = __self__.InvokeMethod("isclose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// True if two arrays have the same shape and elements, False otherwise. - /// - /// - /// Input arrays. - /// - /// - /// Returns True if the arrays are equal. - /// - public bool array_equal(NDarray a1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("array_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns True if input arrays are shape consistent and all elements equal.

- /// - /// Shape consistent means they are either the same shape, or one input array - /// can be broadcasted to create the same shape as the other one. - ///
- /// - /// Input arrays. - /// - /// - /// True if equivalent, False otherwise. - /// - public bool array_equiv(NDarray a1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("array_equiv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the truth value of (x1 > x2) element-wise. - /// - /// - /// Input arrays.

- /// If x1.shape != x2.shape, they must be - /// broadcastable to a common shape (which may be the shape of one or - /// the other). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise comparison of x1 and x2. - /// Typically of type bool, unless dtype=object is passed.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray greater(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("greater", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the truth value of (x1 >= x2) element-wise. - /// - /// - /// Input arrays.

- /// If x1.shape != x2.shape, they must be - /// broadcastable to a common shape (which may be the shape of one or - /// the other). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise comparison of x1 and x2. - /// Typically of type bool, unless dtype=object is passed.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray greater_equal(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("greater_equal", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the truth value of (x1 < x2) element-wise. - /// - /// - /// Input arrays.

- /// If x1.shape != x2.shape, they must be - /// broadcastable to a common shape (which may be the shape of one or - /// the other). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise comparison of x1 and x2. - /// Typically of type bool, unless dtype=object is passed.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray less(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("less", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the truth value of (x1 =< x2) element-wise. - /// - /// - /// Input arrays.

- /// If x1.shape != x2.shape, they must be - /// broadcastable to a common shape (which may be the shape of one or - /// the other). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise comparison of x1 and x2. - /// Typically of type bool, unless dtype=object is passed.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray less_equal(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("less_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 == x2) element-wise. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise comparison of x1 and x2. - /// Typically of type bool, unless dtype=object is passed.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray equal(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 != x2) element-wise. - /// - /// - /// Input arrays. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise comparison of x1 and x2. - /// Typically of type bool, unless dtype=object is passed.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray not_equal(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("not_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Trigonometric sine, element-wise.

- /// - /// Notes - /// - /// The sine is one of the fundamental functions of trigonometry (the - /// mathematical study of triangles).

- /// Consider a circle of radius 1 - /// centered on the origin.

- /// A ray comes in from the axis, makes - /// an angle at the origin (measured counter-clockwise from that axis), and - /// departs from the origin.

- /// The coordinate of the outgoing - /// ray’s intersection with the unit circle is the sine of that angle.

- /// It - /// ranges from -1 for to +1 for The - /// function has zeroes where the angle is a multiple of . - /// Sines of angles between and are negative.

- /// - /// The numerous properties of the sine and related functions are included - /// in any standard trigonometry text. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The sine of each element of x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray sin(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("sin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Cosine element-wise.

- /// - /// Notes - /// - /// If out is provided, the function writes the result into it, - /// and returns a reference to out.

- /// (See Examples) - /// - /// References - /// - /// M.

- /// Abramowitz and I.

- /// A.

- /// Stegun, Handbook of Mathematical Functions.

- /// - /// New York, NY: Dover, 1972. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding cosine values.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray cos(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("cos", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute tangent element-wise.

- /// - /// Equivalent to np.sin(x)/np.cos(x) element-wise.

- /// - /// Notes - /// - /// If out is provided, the function writes the result into it, - /// and returns a reference to out.

- /// (See Examples) - /// - /// References - /// - /// M.

- /// Abramowitz and I.

- /// A.

- /// Stegun, Handbook of Mathematical Functions.

- /// - /// New York, NY: Dover, 1972. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding tangent values.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray tan(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("tan", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Inverse sine, element-wise.

- /// - /// Notes - /// - /// arcsin is a multivalued function: for each x there are infinitely - /// many numbers z such that . The convention is to - /// return the angle z whose real part lies in [-pi/2, pi/2].

- /// - /// For real-valued input data types, arcsin always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, arcsin is a complex analytic function that - /// has, by convention, the branch cuts [-inf, -1] and [1, inf] and is - /// continuous from above on the former and from below on the latter.

- /// - /// The inverse sine is also known as asin or sin^{-1}. - /// - /// References - /// - /// Abramowitz, M.

- /// and Stegun, I.

- /// A., Handbook of Mathematical Functions, - /// 10th printing, New York: Dover, 1964, pp.

- /// 79ff.

- /// - /// http://www.math.sfu.ca/~cbm/aands/ - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The inverse sine of each element in x, in radians and in the - /// closed interval [-pi/2, pi/2].

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray arcsin(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arcsin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Trigonometric inverse cosine, element-wise.

- /// - /// The inverse of cos so that, if y = cos(x), then x = arccos(y).

- /// - /// Notes - /// - /// arccos is a multivalued function: for each x there are infinitely - /// many numbers z such that cos(z) = x.

- /// The convention is to return - /// the angle z whose real part lies in [0, pi].

- /// - /// For real-valued input data types, arccos always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, arccos is a complex analytic function that - /// has branch cuts [-inf, -1] and [1, inf] and is continuous from - /// above on the former and from below on the latter.

- /// - /// The inverse cos is also known as acos or cos^-1. - /// - /// References - /// - /// M.

- /// Abramowitz and I.A.

- /// Stegun, “Handbook of Mathematical Functions”, - /// 10th printing, 1964, pp.

- /// 79. http://www.math.sfu.ca/~cbm/aands/ - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The angle of the ray intersecting the unit circle at the given - /// x-coordinate in radians [0, pi].

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray arccos(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arccos", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Trigonometric inverse tangent, element-wise.

- /// - /// The inverse of tan, so that if y = tan(x) then x = arctan(y).

- /// - /// Notes - /// - /// arctan is a multi-valued function: for each x there are infinitely - /// many numbers z such that tan(z) = x.

- /// The convention is to return - /// the angle z whose real part lies in [-pi/2, pi/2].

- /// - /// For real-valued input data types, arctan always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, arctan is a complex analytic function that - /// has [1j, infj] and [-1j, -infj] as branch cuts, and is continuous - /// from the left on the former and from the right on the latter.

- /// - /// The inverse tangent is also known as atan or tan^{-1}. - /// - /// References - /// - /// Abramowitz, M.

- /// and Stegun, I.

- /// A., Handbook of Mathematical Functions, - /// 10th printing, New York: Dover, 1964, pp.

- /// 79. - /// http://www.math.sfu.ca/~cbm/aands/ - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Out has the same shape as x.

- /// Its real part is in - /// [-pi/2, pi/2] (arctan(+/-inf) returns +/-pi/2).

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray arctan(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arctan", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Given the “legs” of a right triangle, return its hypotenuse.

- /// - /// Equivalent to sqrt(x1**2 + x2**2), element-wise.

- /// If x1 or - /// x2 is scalar_like (i.e., unambiguously cast-able to a scalar type), - /// it is broadcast for use with each element of the other argument.

- /// - /// (See Examples) - ///
- /// - /// Leg of the triangle(s). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The hypotenuse of the triangle(s).

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray hypot(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("hypot", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Element-wise arc tangent of x1/x2 choosing the quadrant correctly.

- /// - /// The quadrant (i.e., branch) is chosen so that arctan2(x1, x2) is - /// the signed angle in radians between the ray ending at the origin and - /// passing through the point (1,0), and the ray ending at the origin and - /// passing through the point (x2, x1).

- /// (Note the role reversal: the - /// “y-coordinate” is the first function parameter, the “x-coordinate” - /// is the second.) By IEEE convention, this function is defined for - /// x2 = +/-0 and for either or both of x1 and x2 = +/-inf (see - /// Notes for specific values).

- /// - /// This function is not defined for complex-valued arguments; for the - /// so-called argument of complex values, use angle.

- /// - /// Notes - /// - /// arctan2 is identical to the atan2 function of the underlying - /// C library.

- /// The following special values are defined in the C - /// standard: [1] - /// - /// Note that +0 and -0 are distinct floating point numbers, as are +inf - /// and -inf.

- /// - /// References - ///
- /// - /// x-coordinates.

- /// x2 must be broadcastable to match the shape of - /// x1 or vice versa. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Array of angles in radians, in the range [-pi, pi].

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray arctan2(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arctan2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert angles from radians to degrees. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding degree values; if out was supplied this is a - /// reference to it.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray degrees(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("degrees", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert angles from degrees to radians. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding radian values.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray radians(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("radians", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Unwrap by changing deltas between values to 2*pi complement.

- /// - /// Unwrap radian phase p by changing absolute jumps greater than - /// discont to their 2*pi complement along the given axis.

- /// - /// Notes - /// - /// If the discontinuity in p is smaller than pi, but larger than - /// discont, no unwrapping is done because taking the 2*pi complement - /// would only make the discontinuity larger. - ///
- /// - /// Maximum discontinuity between values, default is pi. - /// - /// - /// Axis along which unwrap will operate, default is the last axis. - /// - /// - /// Output array. - /// - public NDarray unwrap(float? discont = 3.141592653589793f, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (discont!=3.141592653589793f) kwargs["discont"]=ToPython(discont); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unwrap", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert angles from degrees to radians.

- /// - /// Notes - /// - /// deg2rad(x) is x * pi / 180. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding angle in radians.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray deg2rad(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("deg2rad", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert angles from radians to degrees.

- /// - /// Notes - /// - /// rad2deg(x) is 180 * x / pi. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding angle in degrees.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray rad2deg(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("rad2deg", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Hyperbolic sine, element-wise.

- /// - /// Equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or - /// -1j * np.sin(1j*x).

- /// - /// Notes - /// - /// If out is provided, the function writes the result into it, - /// and returns a reference to out.

- /// (See Examples) - /// - /// References - /// - /// M.

- /// Abramowitz and I.

- /// A.

- /// Stegun, Handbook of Mathematical Functions.

- /// - /// New York, NY: Dover, 1972, pg.

- /// 83. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding hyperbolic sine values.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray sinh(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("sinh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Hyperbolic cosine, element-wise.

- /// - /// Equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j*x). - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array of same shape as x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray cosh(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("cosh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute hyperbolic tangent element-wise.

- /// - /// Equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x).

- /// - /// Notes - /// - /// If out is provided, the function writes the result into it, - /// and returns a reference to out.

- /// (See Examples) - /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The corresponding hyperbolic tangent values.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray tanh(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("tanh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Inverse hyperbolic sine element-wise.

- /// - /// Notes - /// - /// arcsinh is a multivalued function: for each x there are infinitely - /// many numbers z such that sinh(z) = x.

- /// The convention is to return the - /// z whose imaginary part lies in [-pi/2, pi/2].

- /// - /// For real-valued input data types, arcsinh always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, it - /// returns nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, arccos is a complex analytical function that - /// has branch cuts [1j, infj] and [-1j, -infj] and is continuous from - /// the right on the former and from the left on the latter.

- /// - /// The inverse hyperbolic sine is also known as asinh or sinh^-1. - /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Array of the same shape as x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray arcsinh(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arcsinh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Inverse hyperbolic cosine, element-wise.

- /// - /// Notes - /// - /// arccosh is a multivalued function: for each x there are infinitely - /// many numbers z such that cosh(z) = x.

- /// The convention is to return the - /// z whose imaginary part lies in [-pi, pi] and the real part in - /// [0, inf].

- /// - /// For real-valued input data types, arccosh always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, it - /// yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, arccosh is a complex analytical function that - /// has a branch cut [-inf, 1] and is continuous from above on it.

- /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Array of the same shape as x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray arccosh(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arccosh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Inverse hyperbolic tangent element-wise.

- /// - /// Notes - /// - /// arctanh is a multivalued function: for each x there are infinitely - /// many numbers z such that tanh(z) = x.

- /// The convention is to return - /// the z whose imaginary part lies in [-pi/2, pi/2].

- /// - /// For real-valued input data types, arctanh always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, arctanh is a complex analytical function - /// that has branch cuts [-1, -inf] and [1, inf] and is continuous from - /// above on the former and from below on the latter.

- /// - /// The inverse hyperbolic tangent is also known as atanh or tanh^-1. - /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Array of the same shape as x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray arctanh(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("arctanh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Evenly round to the given number of decimals.

- /// - /// Notes - /// - /// For values exactly halfway between rounded decimal values, NumPy - /// rounds to the nearest even value.

- /// Thus 1.5 and 2.5 round to 2.0, - /// -0.5 and 0.5 round to 0.0, etc.

- /// Results may also be surprising due - /// to the inexact representation of decimal fractions in the IEEE - /// floating point standard [1] and errors introduced when scaling - /// by powers of ten.

- /// - /// References - ///
- /// - /// Number of decimal places to round to (default: 0).

- /// If - /// decimals is negative, it specifies the number of positions to - /// the left of the decimal point. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type of the output - /// values will be cast if necessary.

- /// See doc.ufuncs (Section - /// “Output arguments”) for details. - /// - /// - /// An array of the same type as a, containing the rounded values.

- /// - /// Unless out was specified, a new array is created.

- /// A reference to - /// the result is returned.

- /// - /// The real and imaginary parts of complex numbers are rounded - /// separately.

- /// The result of rounding a float is a float. - ///
- public NDarray around(int? decimals = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (decimals!=0) kwargs["decimals"]=ToPython(decimals); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("around", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Round elements of the array to the nearest integer. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array is same shape and type as x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray rint(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("rint", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Round to nearest integer towards zero.

- /// - /// Round an array of floats element-wise to nearest integer towards zero.

- /// - /// The rounded values are returned as floats. - ///
- /// - /// Output array - /// - /// - /// The array of rounded numbers - /// - public NDarray fix(NDarray y = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - dynamic py = __self__.InvokeMethod("fix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the floor of the input, element-wise.

- /// - /// The floor of the scalar x is the largest integer i, such that - /// i <= x.

- /// It is often denoted as . - /// - /// Notes - /// - /// Some spreadsheet programs calculate the “floor-towards-zero”, in other - /// words floor(-2.5) == -2. NumPy instead uses the definition of - /// floor where floor(-2.5) == -3. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The floor of each element in x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray floor(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("floor", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the ceiling of the input, element-wise.

- /// - /// The ceil of the scalar x is the smallest integer i, such that - /// i >= x.

- /// It is often denoted as . - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The ceiling of each element in x, with float dtype.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray ceil(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("ceil", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the truncated value of the input, element-wise.

- /// - /// The truncated value of the scalar x is the nearest integer i which - /// is closer to zero than x is.

- /// In short, the fractional part of the - /// signed number x is discarded.

- /// - /// Notes - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The truncated value of each element in x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray trunc(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("trunc", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the product of array elements over a given axis.

- /// - /// Notes - /// - /// Arithmetic is modular when using integer types, and no error is - /// raised on overflow.

- /// That means that, on a 32-bit platform: - /// - /// The product of an empty array is the neutral element 1: - ///
- /// - /// Axis or axes along which a product is performed.

- /// The default, - /// axis=None, will calculate the product of all the elements in the - /// input array.

- /// If axis is negative it counts from the last to the - /// first axis.

- /// - /// If axis is a tuple of ints, a product is performed on all of the - /// axes specified in the tuple instead of a single axis or all the - /// axes as before. - /// - /// - /// The type of the returned array, as well as of the accumulator in - /// which the elements are multiplied.

- /// The dtype of a is used by - /// default unless a has an integer dtype of less precision than the - /// default platform integer.

- /// In that case, if a is signed then the - /// platform integer is used while if a is unsigned then an unsigned - /// integer of the same precision as the platform integer is used. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type of the output - /// values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left in the - /// result as dimensions with size one.

- /// With this option, the result - /// will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the prod method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// The starting value for this product.

- /// See reduce for details. - /// - /// - /// An array shaped as a but with the specified axis removed.

- /// - /// Returns a reference to out if specified. - ///
- public NDarray prod(Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - if (initial!=null) kwargs["initial"]=ToPython(initial); - dynamic py = __self__.InvokeMethod("prod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Sum of array elements over a given axis.

- /// - /// Notes - /// - /// Arithmetic is modular when using integer types, and no error is - /// raised on overflow.

- /// - /// The sum of an empty array is the neutral element 0: - ///
- /// - /// Axis or axes along which a sum is performed.

- /// The default, - /// axis=None, will sum all of the elements of the input array.

- /// If - /// axis is negative it counts from the last to the first axis.

- /// - /// If axis is a tuple of ints, a sum is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// The type of the returned array and of the accumulator in which the - /// elements are summed.

- /// The dtype of a is used by default unless a - /// has an integer dtype of less precision than the default platform - /// integer.

- /// In that case, if a is signed then the platform integer - /// is used while if a is unsigned then an unsigned integer of the - /// same precision as the platform integer is used. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type of the output - /// values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the sum method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// Starting value for the sum.

- /// See reduce for details. - /// - /// - /// An array with the same shape as a, with the specified - /// axis removed.

- /// If a is a 0-d array, or if axis is None, a scalar - /// is returned.

- /// If an output array is specified, a reference to - /// out is returned. - ///
- public NDarray sum(Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - if (initial!=null) kwargs["initial"]=ToPython(initial); - dynamic py = __self__.InvokeMethod("sum", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the product of array elements over a given axis treating Not a - /// Numbers (NaNs) as ones.

- /// - /// One is returned for slices that are all-NaN or empty. - ///
- /// - /// Axis or axes along which the product is computed.

- /// The default is to compute - /// the product of the flattened array. - /// - /// - /// The type of the returned array and of the accumulator in which the - /// elements are summed.

- /// By default, the dtype of a is used.

- /// An - /// exception is when a has an integer type with less precision than - /// the platform (u)intp.

- /// In that case, the default will be either - /// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 - /// bits.

- /// For inexact inputs, dtype must be inexact. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None.

- /// If provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// See - /// doc.ufuncs for details.

- /// The casting of NaN to integer can yield - /// unexpected results. - /// - /// - /// If True, the axes which are reduced are left in the result as - /// dimensions with size one.

- /// With this option, the result will - /// broadcast correctly against the original arr. - /// - /// - /// A new array holding the result is returned unless out is - /// specified, in which case it is returned. - /// - public NDarray nanprod(Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanprod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the sum of array elements over a given axis treating Not a - /// Numbers (NaNs) as zero.

- /// - /// In NumPy versions <= 1.9.0 Nan is returned for slices that are all-NaN or - /// empty.

- /// In later versions zero is returned.

- /// - /// Notes - /// - /// If both positive and negative infinity are present, the sum will be Not - /// A Number (NaN). - ///
- /// - /// Axis or axes along which the sum is computed.

- /// The default is to compute the - /// sum of the flattened array. - /// - /// - /// The type of the returned array and of the accumulator in which the - /// elements are summed.

- /// By default, the dtype of a is used.

- /// An - /// exception is when a has an integer type with less precision than - /// the platform (u)intp.

- /// In that case, the default will be either - /// (u)int32 or (u)int64 depending on whether the platform is 32 or 64 - /// bits.

- /// For inexact inputs, dtype must be inexact. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None.

- /// If provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// See - /// doc.ufuncs for details.

- /// The casting of NaN to integer can yield - /// unexpected results. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a.

- /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray.

- /// If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// A new array holding the result is returned unless out is - /// specified, in which it is returned.

- /// The result has the same - /// size as a, and the same shape as a if axis is not None - /// or a is a 1-d array. - ///
- public NDarray nansum(Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nansum", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the cumulative product of elements along a given axis.

- /// - /// Notes - /// - /// Arithmetic is modular when using integer types, and no error is - /// raised on overflow. - ///
- /// - /// Axis along which the cumulative product is computed.

- /// By default - /// the input is flattened. - /// - /// - /// Type of the returned array, as well as of the accumulator in which - /// the elements are multiplied.

- /// If dtype is not specified, it - /// defaults to the dtype of a, unless a has an integer dtype with - /// a precision less than that of the default platform integer.

- /// In - /// that case, the default platform integer is used instead. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output - /// but the type of the resulting values will be cast if necessary. - /// - /// - /// A new array holding the result is returned unless out is - /// specified, in which case a reference to out is returned. - /// - public NDarray cumprod(int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("cumprod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the cumulative sum of the elements along a given axis.

- /// - /// Notes - /// - /// Arithmetic is modular when using integer types, and no error is - /// raised on overflow. - ///
- /// - /// Axis along which the cumulative sum is computed.

- /// The default - /// (None) is to compute the cumsum over the flattened array. - /// - /// - /// Type of the returned array and of the accumulator in which the - /// elements are summed.

- /// If dtype is not specified, it defaults - /// to the dtype of a, unless a has an integer dtype with a - /// precision less than that of the default platform integer.

- /// In - /// that case, the default platform integer is used. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output - /// but the type will be cast if necessary.

- /// See doc.ufuncs - /// (Section “Output arguments”) for more details. - /// - /// - /// A new array holding the result is returned unless out is - /// specified, in which case a reference to out is returned.

- /// The - /// result has the same size as a, and the same shape as a if - /// axis is not None or a is a 1-d array. - ///
- public NDarray cumsum(int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("cumsum", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the cumulative product of array elements over a given axis treating Not a - /// Numbers (NaNs) as one.

- /// The cumulative product does not change when NaNs are - /// encountered and leading NaNs are replaced by ones.

- /// - /// Ones are returned for slices that are all-NaN or empty. - ///
- /// - /// Axis along which the cumulative product is computed.

- /// By default - /// the input is flattened. - /// - /// - /// Type of the returned array, as well as of the accumulator in which - /// the elements are multiplied.

- /// If dtype is not specified, it - /// defaults to the dtype of a, unless a has an integer dtype with - /// a precision less than that of the default platform integer.

- /// In - /// that case, the default platform integer is used instead. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output - /// but the type of the resulting values will be cast if necessary. - /// - /// - /// A new array holding the result is returned unless out is - /// specified, in which case it is returned. - /// - public NDarray nancumprod(int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("nancumprod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the cumulative sum of array elements over a given axis treating Not a - /// Numbers (NaNs) as zero.

- /// The cumulative sum does not change when NaNs are - /// encountered and leading NaNs are replaced by zeros.

- /// - /// Zeros are returned for slices that are all-NaN or empty. - ///
- /// - /// Axis along which the cumulative sum is computed.

- /// The default - /// (None) is to compute the cumsum over the flattened array. - /// - /// - /// Type of the returned array and of the accumulator in which the - /// elements are summed.

- /// If dtype is not specified, it defaults - /// to the dtype of a, unless a has an integer dtype with a - /// precision less than that of the default platform integer.

- /// In - /// that case, the default platform integer is used. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output - /// but the type will be cast if necessary.

- /// See doc.ufuncs - /// (Section “Output arguments”) for more details. - /// - /// - /// A new array holding the result is returned unless out is - /// specified, in which it is returned.

- /// The result has the same - /// size as a, and the same shape as a if axis is not None - /// or a is a 1-d array. - ///
- public NDarray nancumsum(int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("nancumsum", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calculate the n-th discrete difference along the given axis.

- /// - /// The first difference is given by out[n] = a[n+1] - a[n] along - /// the given axis, higher differences are calculated by using diff - /// recursively.

- /// - /// Notes - /// - /// Type is preserved for boolean arrays, so the result will contain - /// False when consecutive elements are the same and True when they - /// differ.

- /// - /// For unsigned integer arrays, the results will also be unsigned.

- /// This - /// should not be surprising, as the result is consistent with - /// calculating the difference directly: - /// - /// If this is not desirable, then the array should be cast to a larger - /// integer type first: - ///
- /// - /// The number of times values are differenced.

- /// If zero, the input - /// is returned as-is. - /// - /// - /// The axis along which the difference is taken, default is the - /// last axis. - /// - /// - /// Values to prepend or append to “a” along axis prior to - /// performing the difference.

- /// Scalar values are expanded to - /// arrays with length 1 in the direction of axis and the shape - /// of the input array in along all other axes.

- /// Otherwise the - /// dimension and shape must match “a” except along axis. - /// - /// - /// Values to prepend or append to “a” along axis prior to - /// performing the difference.

- /// Scalar values are expanded to - /// arrays with length 1 in the direction of axis and the shape - /// of the input array in along all other axes.

- /// Otherwise the - /// dimension and shape must match “a” except along axis. - /// - /// - /// The n-th differences.

- /// The shape of the output is the same as a - /// except along axis where the dimension is smaller by n.

- /// The - /// type of the output is the same as the type of the difference - /// between any two elements of a.

- /// This is the same as the type of - /// a in most cases.

- /// A notable exception is datetime64, which - /// results in a timedelta64 output array. - ///
- public NDarray diff(int? n = 1, int? axis = -1, NDarray append = null, NDarray prepend = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (n!=1) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (append!=null) kwargs["append"]=ToPython(append); - if (prepend!=null) kwargs["prepend"]=ToPython(prepend); - dynamic py = __self__.InvokeMethod("diff", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// The differences between consecutive elements of an array.

- /// - /// Notes - /// - /// When applied to masked arrays, this function drops the mask information - /// if the to_begin and/or to_end parameters are used. - ///
- /// - /// Number(s) to append at the end of the returned differences. - /// - /// - /// Number(s) to prepend at the beginning of the returned differences. - /// - /// - /// The differences.

- /// Loosely, this is ary.flat[1:] - ary.flat[:-1]. - ///
- public NDarray ediff1d(NDarray to_end = null, NDarray to_begin = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (to_end!=null) kwargs["to_end"]=ToPython(to_end); - if (to_begin!=null) kwargs["to_begin"]=ToPython(to_begin); - dynamic py = __self__.InvokeMethod("ediff1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the cross product of two (arrays of) vectors.

- /// - /// The cross product of a and b in is a vector perpendicular - /// to both a and b.

- /// If a and b are arrays of vectors, the vectors - /// are defined by the last axis of a and b by default, and these axes - /// can have dimensions 2 or 3.

- /// Where the dimension of either a or b is - /// 2, the third component of the input vector is assumed to be zero and the - /// cross product calculated accordingly.

- /// In cases where both input vectors - /// have dimension 2, the z-component of the cross product is returned.

- /// - /// Notes - /// - /// Supports full broadcasting of the inputs. - ///
- /// - /// Components of the second vector(s). - /// - /// - /// Axis of a that defines the vector(s).

- /// By default, the last axis. - /// - /// - /// Axis of b that defines the vector(s).

- /// By default, the last axis. - /// - /// - /// Axis of c containing the cross product vector(s).

- /// Ignored if - /// both input vectors have dimension 2, as the return is scalar.

- /// - /// By default, the last axis. - /// - /// - /// If defined, the axis of a, b and c that defines the vector(s) - /// and cross product(s).

- /// Overrides axisa, axisb and axisc. - /// - /// - /// Vector cross product(s). - /// - public NDarray cross(NDarray b, int? axisa = -1, int? axisb = -1, int? axisc = -1, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - }); - var kwargs=new PyDict(); - if (axisa!=-1) kwargs["axisa"]=ToPython(axisa); - if (axisb!=-1) kwargs["axisb"]=ToPython(axisb); - if (axisc!=-1) kwargs["axisc"]=ToPython(axisc); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("cross", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Integrate along the given axis using the composite trapezoidal rule.

- /// - /// Integrate y (x) along given axis.

- /// - /// Notes - /// - /// Image [2] illustrates trapezoidal rule – y-axis locations of points - /// will be taken from y array, by default x-axis distances between - /// points will be 1.0, alternatively they can be provided with x array - /// or with dx scalar.

- /// Return value will be equal to combined area under - /// the red lines.

- /// - /// References - ///
- /// - /// The sample points corresponding to the y values.

- /// If x is None, - /// the sample points are assumed to be evenly spaced dx apart.

- /// The - /// default is None. - /// - /// - /// The spacing between sample points when x is None.

- /// The default is 1. - /// - /// - /// The axis along which to integrate. - /// - /// - /// Definite integral as approximated by trapezoidal rule. - /// - public float trapz(NDarray x = null, float? dx = 1.0f, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (x!=null) kwargs["x"]=ToPython(x); - if (dx!=1.0f) kwargs["dx"]=ToPython(dx); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("trapz", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calculate the exponential of all elements in the input array.

- /// - /// Notes - /// - /// The irrational number e is also known as Euler’s number.

- /// It is - /// approximately 2.718281, and is the base of the natural logarithm, - /// ln (this means that, if , - /// then . For real input, exp(x) is always positive.

- /// - /// For complex arguments, x = a + ib, we can write - /// . The first term, , is already - /// known (it is the real argument, described above).

- /// The second term, - /// , is , a function with - /// magnitude 1 and a periodic phase.

- /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, element-wise exponential of x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray exp(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("exp", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calculate exp(x) - 1 for all elements in the array.

- /// - /// Notes - /// - /// This function provides greater precision than exp(x) - 1 - /// for small values of x. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Element-wise exponential minus one: out = exp(x) - 1.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray expm1(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("expm1", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calculate 2**p for all p in the input array.

- /// - /// Notes - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Element-wise 2 to the power x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray exp2(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("exp2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Natural logarithm, element-wise.

- /// - /// The natural logarithm log is the inverse of the exponential function, - /// so that log(exp(x)) = x.

- /// The natural logarithm is logarithm in base - /// e.

- /// - /// Notes - /// - /// Logarithm is a multivalued function: for each x there is an infinite - /// number of z such that exp(z) = x.

- /// The convention is to return the - /// z whose imaginary part lies in [-pi, pi].

- /// - /// For real-valued input data types, log always returns real output.

- /// For - /// each value that cannot be expressed as a real number or infinity, it - /// yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, log is a complex analytical function that - /// has a branch cut [-inf, 0] and is continuous from above on it.

- /// log - /// handles the floating-point negative zero as an infinitesimal negative - /// number, conforming to the C99 standard.

- /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The natural logarithm of x, element-wise.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray log(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("log", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the base 10 logarithm of the input array, element-wise.

- /// - /// Notes - /// - /// Logarithm is a multivalued function: for each x there is an infinite - /// number of z such that 10**z = x.

- /// The convention is to return the - /// z whose imaginary part lies in [-pi, pi].

- /// - /// For real-valued input data types, log10 always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, log10 is a complex analytical function that - /// has a branch cut [-inf, 0] and is continuous from above on it.

- /// - /// log10 handles the floating-point negative zero as an infinitesimal - /// negative number, conforming to the C99 standard.

- /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The logarithm to the base 10 of x, element-wise.

- /// NaNs are - /// returned where x is negative.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray log10(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("log10", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Base-2 logarithm of x.

- /// - /// Notes - /// - /// Logarithm is a multivalued function: for each x there is an infinite - /// number of z such that 2**z = x.

- /// The convention is to return the z - /// whose imaginary part lies in [-pi, pi].

- /// - /// For real-valued input data types, log2 always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, log2 is a complex analytical function that - /// has a branch cut [-inf, 0] and is continuous from above on it.

- /// log2 - /// handles the floating-point negative zero as an infinitesimal negative - /// number, conforming to the C99 standard. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Base-2 logarithm of x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray log2(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("log2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the natural logarithm of one plus the input array, element-wise.

- /// - /// Calculates log(1 + x).

- /// - /// Notes - /// - /// For real-valued input, log1p is accurate also for x so small - /// that 1 + x == 1 in floating-point accuracy.

- /// - /// Logarithm is a multivalued function: for each x there is an infinite - /// number of z such that exp(z) = 1 + x.

- /// The convention is to return - /// the z whose imaginary part lies in [-pi, pi].

- /// - /// For real-valued input data types, log1p always returns real output.

- /// - /// For each value that cannot be expressed as a real number or infinity, - /// it yields nan and sets the invalid floating point error flag.

- /// - /// For complex-valued input, log1p is a complex analytical function that - /// has a branch cut [-inf, -1] and is continuous from above on it.

- /// - /// log1p handles the floating-point negative zero as an infinitesimal - /// negative number, conforming to the C99 standard.

- /// - /// References - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Natural logarithm of 1 + x, element-wise.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray log1p(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("log1p", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Logarithm of the sum of exponentiations of the inputs.

- /// - /// Calculates log(exp(x1) + exp(x2)).

- /// This function is useful in - /// statistics where the calculated probabilities of events may be so small - /// as to exceed the range of normal floating point numbers.

- /// In such cases - /// the logarithm of the calculated probability is stored.

- /// This function - /// allows adding probabilities stored in such a fashion.

- /// - /// Notes - ///
- /// - /// Input values. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Logarithm of exp(x1) + exp(x2).

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray logaddexp(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("logaddexp", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Logarithm of the sum of exponentiations of the inputs in base-2. - /// - /// Calculates log2(2**x1 + 2**x2).

- /// This function is useful in machine - /// learning when the calculated probabilities of events may be so small as - /// to exceed the range of normal floating point numbers.

- /// In such cases - /// the base-2 logarithm of the calculated probability can be used instead.

- /// - /// This function allows adding probabilities stored in such a fashion.

- /// - /// Notes - ///
- /// - /// Input values. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Base-2 logarithm of 2**x1 + 2**x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray logaddexp2(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("logaddexp2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the sinc function.

- /// - /// The sinc function is . - /// - /// Notes - /// - /// sinc(0) is the limit value 1.

- /// - /// The name sinc is short for “sine cardinal” or “sinus cardinalis”. - /// - /// The sinc function is used in various signal processing applications, - /// including in anti-aliasing, in the construction of a Lanczos resampling - /// filter, and in interpolation.

- /// - /// For bandlimited interpolation of discrete-time signals, the ideal - /// interpolation kernel is proportional to the sinc function.

- /// - /// References - ///
- /// - /// sinc(x), which has the same shape as the input. - /// - public NDarray sinc() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("sinc"); - return ToCsharp(py); - } - - /// - /// Returns element-wise True where signbit is set (less than zero). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Output array, or reference to out if that was supplied.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray signbit(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("signbit", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Change the sign of x1 to that of x2, element-wise.

- /// - /// If both arguments are arrays or sequences, they have to be of the same - /// length.

- /// If x2 is a scalar, its sign will be copied to all elements of - /// x1. - ///
- /// - /// The sign of x2 is copied to x1. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The values of x1 with the sign of x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray copysign(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("copysign", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Decompose the elements of x into mantissa and twos exponent.

- /// - /// Returns (mantissa, exponent), where x = mantissa * 2**exponent`. - /// The mantissa is lies in the open interval(-1, 1), while the twos - /// exponent is a signed integer.

- /// - /// Notes - /// - /// Complex dtypes are not supported, they will raise a TypeError. - ///
- /// - /// Output array for the mantissa.

- /// Must have the same shape as x. - /// - /// - /// Output array for the exponent.

- /// Must have the same shape as x. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// A tuple of: - /// mantissa - /// Floating values between -1 and 1. - /// This is a scalar if x is a scalar. - /// exponent - /// Integer exponents of 2. - /// This is a scalar if x is a scalar. - /// - public (NDarray, NDarray) frexp(NDarray out1 = null, NDarray out2 = null, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (out1!=null) kwargs["out1"]=ToPython(out1); - if (out2!=null) kwargs["out2"]=ToPython(out2); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("frexp", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Returns x1 * 2**x2, element-wise.

- /// - /// The mantissas x1 and twos exponents x2 are used to construct - /// floating point numbers x1 * 2**x2. - /// - /// Notes - /// - /// Complex dtypes are not supported, they will raise a TypeError.

- /// - /// ldexp is useful as the inverse of frexp, if used by itself it is - /// more clear to simply use the expression x1 * 2**x2. - ///
- /// - /// Array of twos exponents. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The result of x1 * 2**x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray ldexp(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("ldexp", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the next floating-point value after x1 towards x2, element-wise. - /// - /// - /// The direction where to look for the next representable value of x1. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The next representable values of x1 in the direction of x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray nextafter(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("nextafter", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the distance between x and the nearest adjacent number.

- /// - /// Notes - /// - /// It can be considered as a generalization of EPS: - /// spacing(np.float64(1)) == np.finfo(np.float64).eps, and there - /// should not be any representable number between x + spacing(x) and - /// x for any finite x.

- /// - /// Spacing of +- inf and NaN is NaN. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The spacing of values of x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray spacing(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("spacing", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the lowest common multiple of |x1| and |x2| - /// - /// - /// Arrays of values - /// - /// - /// The lowest common multiple of the absolute value of the inputs - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray lcm(NDarray x1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("lcm", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the greatest common divisor of |x1| and |x2| - /// - /// - /// Arrays of values - /// - /// - /// The greatest common divisor of the absolute value of the inputs - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray gcd(NDarray x1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("gcd", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Add arguments element-wise.

- /// - /// Notes - /// - /// Equivalent to x1 + x2 in terms of array broadcasting. - ///
- /// - /// The arrays to be added.

- /// If x1.shape != x2.shape, they must be - /// broadcastable to a common shape (which may be the shape of one or - /// the other). - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The sum of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray @add(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("add", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the reciprocal of the argument, element-wise.

- /// - /// Calculates 1/x.

- /// - /// Notes - /// - /// For integer arguments with absolute value larger than 1 the result is - /// always zero because of the way Python handles integer division.

- /// For - /// integer zero the result is an overflow. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Return array.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray reciprocal(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("reciprocal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Numerical positive, element-wise.

- /// - /// Notes - /// - /// Equivalent to x.copy(), but only defined for types that support - /// arithmetic. - ///
- /// - /// Returned array or scalar: y = +x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray positive() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("positive"); - return ToCsharp(py); - } - - /// - /// Numerical negative, element-wise. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Returned array or scalar: y = -x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray negative(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("negative", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Multiply arguments element-wise.

- /// - /// Notes - /// - /// Equivalent to x1 * x2 in terms of array broadcasting. - ///
- /// - /// Input arrays to be multiplied. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The product of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray multiply(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("multiply", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns a true division of the inputs, element-wise.

- /// - /// Instead of the Python traditional ‘floor division’, this returns a true - /// division.

- /// True division adjusts the output type to present the best - /// answer, regardless of input types.

- /// - /// Notes - /// - /// The floor division operator // was added in Python 2.2 making - /// // and / equivalent operators.

- /// The default floor division - /// operation of / can be replaced by true division with from - /// __future__ import division.

- /// - /// In Python 3.0, // is the floor division operator and / the - /// true division operator.

- /// The true_divide(x1, x2) function is - /// equivalent to true division in Python. - ///
- /// - /// Divisor array. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray divide(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("divide", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// First array elements raised to powers from second array, element-wise.

- /// - /// Raise each base in x1 to the positionally-corresponding power in - /// x2. x1 and x2 must be broadcastable to the same shape.

- /// Note that an - /// integer type raised to a negative integer power will raise a ValueError. - ///
- /// - /// The exponents. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The bases in x1 raised to the exponents in x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray power(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("power", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Subtract arguments, element-wise.

- /// - /// Notes - /// - /// Equivalent to x1 - x2 in terms of array broadcasting. - ///
- /// - /// The arrays to be subtracted from each other. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The difference of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray subtract(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("subtract", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns a true division of the inputs, element-wise.

- /// - /// Instead of the Python traditional ‘floor division’, this returns a true - /// division.

- /// True division adjusts the output type to present the best - /// answer, regardless of input types.

- /// - /// Notes - /// - /// The floor division operator // was added in Python 2.2 making - /// // and / equivalent operators.

- /// The default floor division - /// operation of / can be replaced by true division with from - /// __future__ import division.

- /// - /// In Python 3.0, // is the floor division operator and / the - /// true division operator.

- /// The true_divide(x1, x2) function is - /// equivalent to true division in Python. - ///
- /// - /// Divisor array. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray true_divide(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("true_divide", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the largest integer smaller or equal to the division of the inputs.

- /// - /// It is equivalent to the Python // operator and pairs with the - /// Python % (remainder), function so that b = a % b + b * (a // b) - /// up to roundoff. - ///
- /// - /// Denominator. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// y = floor(x1/x2) - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray floor_divide(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("floor_divide", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// First array elements raised to powers from second array, element-wise.

- /// - /// Raise each base in x1 to the positionally-corresponding power in x2. - /// x1 and x2 must be broadcastable to the same shape.

- /// This differs from - /// the power function in that integers, float16, and float32 are promoted to - /// floats with a minimum precision of float64 so that the result is always - /// inexact.

- /// The intent is that the function will return a usable result for - /// negative powers and seldom overflow for positive powers. - ///
- /// - /// The exponents. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The bases in x1 raised to the exponents in x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray float_power(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("float_power", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the element-wise remainder of division.

- /// - /// This is the NumPy implementation of the C library function fmod, the - /// remainder has the same sign as the dividend x1. It is equivalent to - /// the Matlab(TM) rem function and should not be confused with the - /// Python modulus operator x1 % x2. - /// - /// Notes - /// - /// The result of the modulo operation for negative dividend and divisors - /// is bound by conventions.

- /// For fmod, the sign of result is the sign of - /// the dividend, while for remainder the sign of the result is the sign - /// of the divisor.

- /// The fmod function is equivalent to the Matlab(TM) - /// rem function. - ///
- /// - /// Divisor. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The remainder of the division of x1 by x2. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray fmod(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("fmod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return element-wise remainder of division.

- /// - /// Computes the remainder complementary to the floor_divide function.

- /// It is - /// equivalent to the Python modulus operator``x1 % x2`` and has the same sign - /// as the divisor x2. The MATLAB function equivalent to np.remainder - /// is mod.

- /// - /// Notes - /// - /// Returns 0 when x2 is 0 and both x1 and x2 are (arrays of) - /// integers. - ///
- /// - /// Divisor array. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The element-wise remainder of the quotient floor_divide(x1, x2).

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray mod(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("mod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the fractional and integral parts of an array, element-wise.

- /// - /// The fractional and integral parts are negative if the given number is - /// negative.

- /// - /// Notes - /// - /// For integer input the return values are floats. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// A tuple of: - /// y1 - /// Fractional part of x. - /// This is a scalar if x is a scalar. - /// y2 - /// Integral part of x. - /// This is a scalar if x is a scalar. - /// - public (NDarray, NDarray) modf(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("modf", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Return element-wise remainder of division.

- /// - /// Computes the remainder complementary to the floor_divide function.

- /// It is - /// equivalent to the Python modulus operator``x1 % x2`` and has the same sign - /// as the divisor x2. The MATLAB function equivalent to np.remainder - /// is mod.

- /// - /// Notes - /// - /// Returns 0 when x2 is 0 and both x1 and x2 are (arrays of) - /// integers. - ///
- /// - /// Divisor array. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The element-wise remainder of the quotient floor_divide(x1, x2).

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray remainder(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("remainder", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return element-wise quotient and remainder simultaneously.

- /// - /// np.divmod(x, y) is equivalent to (x // y, x % y), but faster - /// because it avoids redundant work.

- /// It is used to implement the Python - /// built-in function divmod on NumPy arrays. - ///
- /// - /// Divisor array. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// A tuple of: - /// out1 - /// Element-wise quotient resulting from floor division. - /// This is a scalar if both x1 and x2 are scalars. - /// out2 - /// Element-wise remainder from floor division. - /// This is a scalar if both x1 and x2 are scalars. - /// - public (NDarray, NDarray) divmod(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("divmod", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Return the angle of the complex argument. - /// - /// - /// Return angle in degrees if True, radians if False (default). - /// - /// - /// The counterclockwise angle from the positive real axis on - /// the complex plane, with dtype as numpy.float64. - /// - public NDarray angle(bool? deg = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (deg!=false) kwargs["deg"]=ToPython(deg); - dynamic py = __self__.InvokeMethod("angle", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the complex conjugate, element-wise.

- /// - /// The complex conjugate of a complex number is obtained by changing the - /// sign of its imaginary part. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The complex conjugate of x, with same dtype as y.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray conj(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("conj", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the discrete, linear convolution of two one-dimensional sequences.

- /// - /// The convolution operator is often seen in signal processing, where it - /// models the effect of a linear time-invariant system on a signal [1].

- /// In - /// probability theory, the sum of two independent random variables is - /// distributed according to the convolution of their individual - /// distributions.

- /// - /// If v is longer than a, the arrays are swapped before computation.

- /// - /// Notes - /// - /// The discrete convolution operation is defined as - /// - /// It can be shown that a convolution in time/space - /// is equivalent to the multiplication in the Fourier - /// domain, after appropriate padding (padding is necessary to prevent - /// circular convolution).

- /// Since multiplication is more efficient (faster) - /// than convolution, the function scipy.signal.fftconvolve exploits the - /// FFT to calculate the convolution of large data-sets.

- /// - /// References - ///
- /// - /// Second one-dimensional input array. - /// - /// - /// Discrete, linear convolution of a and v. - /// - public NDarray convolve(NDarray v, string mode = "full") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - }); - var kwargs=new PyDict(); - if (mode!="full") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("convolve", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Clip (limit) the values in an array.

- /// - /// Given an interval, values outside the interval are clipped to - /// the interval edges.

- /// For example, if an interval of [0, 1] - /// is specified, values smaller than 0 become 0, and values larger - /// than 1 become 1. - ///
- /// - /// Minimum value.

- /// If None, clipping is not performed on lower - /// interval edge.

- /// Not more than one of a_min and a_max may be - /// None. - /// - /// - /// Maximum value.

- /// If None, clipping is not performed on upper - /// interval edge.

- /// Not more than one of a_min and a_max may be - /// None.

- /// If a_min or a_max are array_like, then the three - /// arrays will be broadcasted to match their shapes. - /// - /// - /// The results will be placed in this array.

- /// It may be the input - /// array for in-place clipping.

- /// out must be of the right shape - /// to hold the output.

- /// Its type is preserved. - /// - /// - /// An array with the elements of a, but where values - /// < a_min are replaced with a_min, and those > a_max - /// with a_max. - /// - public NDarray clip(NDarray a_min, NDarray a_max, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a_min, - a_max, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("clip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the non-negative square-root of an array, element-wise.

- /// - /// Notes - /// - /// sqrt has–consistent with common convention–as its branch cut the - /// real “interval” [-inf, 0), and is continuous from above on it.

- /// - /// A branch cut is a curve in the complex plane across which a given - /// complex function fails to be continuous. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// An array of the same shape as x, containing the positive - /// square-root of each element in x.

- /// If any element in x is - /// complex, a complex array is returned (and the square-roots of - /// negative reals are calculated).

- /// If all of the elements in x - /// are real, so is y, with negative elements returning nan.

- /// - /// If out was provided, y is a reference to it.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray sqrt(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("sqrt", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the cube-root of an array, element-wise. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// An array of the same shape as x, containing the cube - /// cube-root of each element in x.

- /// - /// If out was provided, y is a reference to it.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray cbrt(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("cbrt", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the element-wise square of the input. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// Element-wise x*x, of the same shape and dtype as x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray square(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("square", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calculate the absolute value element-wise.

- /// - /// np.abs is a shorthand for this function. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// An ndarray containing the absolute value of - /// each element in x.

- /// For complex input, a + ib, the - /// absolute value is . - /// This is a scalar if x is a scalar. - ///
- public NDarray absolute(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("absolute", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the absolute values element-wise.

- /// - /// This function returns the absolute values (positive magnitude) of the - /// data in x.

- /// Complex values are not handled, use absolute to find the - /// absolute values of complex data. - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The absolute values of x, the returned values are always floats.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray fabs(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("fabs", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns an element-wise indication of the sign of a number.

- /// - /// The sign function returns -1 if x < 0, 0 if x==0, 1 if x > 0.

- /// nan - /// is returned for nan inputs.

- /// - /// For complex inputs, the sign function returns - /// sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j.

- /// - /// complex(nan, 0) is returned for complex nan inputs.

- /// - /// Notes - /// - /// There is more than one definition of sign in common use for complex - /// numbers.

- /// The definition used here is equivalent to - /// which is different from a common alternative, . - ///
- /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The sign of x.

- /// - /// This is a scalar if x is a scalar. - ///
- public NDarray sign(NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("sign", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the Heaviside step function.

- /// - /// The Heaviside step function is defined as: - /// - /// where x2 is often taken to be 0.5, but 0 and 1 are also sometimes used.

- /// - /// Notes - /// - /// References - ///
- /// - /// The value of the function when x1 is 0. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The output array, element-wise Heaviside step function of x1. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray heaviside(NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("heaviside", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Element-wise maximum of array elements.

- /// - /// Compare two arrays and returns a new array containing the element-wise - /// maxima.

- /// If one of the elements being compared is a NaN, then that - /// element is returned.

- /// If both elements are NaNs then the first is - /// returned.

- /// The latter distinction is important for complex NaNs, which - /// are defined as at least one of the real or imaginary parts being a NaN.

- /// - /// The net effect is that NaNs are propagated.

- /// - /// Notes - /// - /// The maximum is equivalent to np.where(x1 >= x2, x1, x2) when - /// neither x1 nor x2 are nans, but it is faster and does proper - /// broadcasting. - ///
- /// - /// The arrays holding the elements to be compared.

- /// They must have - /// the same shape, or shapes that can be broadcast to a single shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The maximum of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray maximum(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("maximum", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Element-wise minimum of array elements.

- /// - /// Compare two arrays and returns a new array containing the element-wise - /// minima.

- /// If one of the elements being compared is a NaN, then that - /// element is returned.

- /// If both elements are NaNs then the first is - /// returned.

- /// The latter distinction is important for complex NaNs, which - /// are defined as at least one of the real or imaginary parts being a NaN.

- /// - /// The net effect is that NaNs are propagated.

- /// - /// Notes - /// - /// The minimum is equivalent to np.where(x1 <= x2, x1, x2) when - /// neither x1 nor x2 are NaNs, but it is faster and does proper - /// broadcasting. - ///
- /// - /// The arrays holding the elements to be compared.

- /// They must have - /// the same shape, or shapes that can be broadcast to a single shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The minimum of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray minimum(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("minimum", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Element-wise maximum of array elements.

- /// - /// Compare two arrays and returns a new array containing the element-wise - /// maxima.

- /// If one of the elements being compared is a NaN, then the - /// non-nan element is returned.

- /// If both elements are NaNs then the first - /// is returned.

- /// The latter distinction is important for complex NaNs, - /// which are defined as at least one of the real or imaginary parts being - /// a NaN.

- /// The net effect is that NaNs are ignored when possible.

- /// - /// Notes - /// - /// The fmax is equivalent to np.where(x1 >= x2, x1, x2) when neither - /// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. - ///
- /// - /// The arrays holding the elements to be compared.

- /// They must have - /// the same shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The maximum of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray fmax(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("fmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Element-wise minimum of array elements.

- /// - /// Compare two arrays and returns a new array containing the element-wise - /// minima.

- /// If one of the elements being compared is a NaN, then the - /// non-nan element is returned.

- /// If both elements are NaNs then the first - /// is returned.

- /// The latter distinction is important for complex NaNs, - /// which are defined as at least one of the real or imaginary parts being - /// a NaN.

- /// The net effect is that NaNs are ignored when possible.

- /// - /// Notes - /// - /// The fmin is equivalent to np.where(x1 <= x2, x1, x2) when neither - /// x1 nor x2 are NaNs, but it is faster and does proper broadcasting. - ///
- /// - /// The arrays holding the elements to be compared.

- /// They must have - /// the same shape. - /// - /// - /// A location into which the result is stored.

- /// If provided, it must have - /// a shape that the inputs broadcast to.

- /// If not provided or None, - /// a freshly-allocated array is returned.

- /// A tuple (possible only as a - /// keyword argument) must have length equal to the number of outputs. - /// - /// - /// Values of True indicate to calculate the ufunc at that position, values - /// of False indicate to leave the value in the output alone. - /// - /// - /// The minimum of x1 and x2, element-wise.

- /// - /// This is a scalar if both x1 and x2 are scalars. - ///
- public NDarray fmin(NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("fmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Replace NaN with zero and infinity with large finite numbers.

- /// - /// If x is inexact, NaN is replaced by zero, and infinity and -infinity - /// replaced by the respectively largest and most negative finite floating - /// point values representable by x.dtype.

- /// - /// For complex dtypes, the above is applied to each of the real and - /// imaginary components of x separately.

- /// - /// If x is not inexact, then no replacements are made.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// This means that Not a Number is not equivalent to infinity. - ///
- /// - /// Whether to create a copy of x (True) or to replace values - /// in-place (False).

- /// The in-place operation only occurs if - /// casting to an array does not require a copy.

- /// - /// Default is True. - /// - /// - /// x, with the non-finite values replaced.

- /// If copy is False, this may - /// be x itself. - ///
- public NDarray nan_to_num(bool? copy = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (copy!=true) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("nan_to_num", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// If complex input returns a real array if complex parts are close to zero.

- /// - /// “Close to zero” is defined as tol * (machine epsilon of the type for - /// a).

- /// - /// Notes - /// - /// Machine epsilon varies from machine to machine and between data types - /// but Python floats on most platforms have a machine epsilon equal to - /// 2.2204460492503131e-16. You can use ‘np.finfo(float).eps’ to print - /// out the machine epsilon for floats. - ///
- /// - /// Tolerance in machine epsilons for the complex part of the elements - /// in the array. - /// - /// - /// If a is real, the type of a is used for the output.

- /// If a - /// has complex elements, the returned type is float. - ///
- public NDarray real_if_close(float tol = 100) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (tol!=100) kwargs["tol"]=ToPython(tol); - dynamic py = __self__.InvokeMethod("real_if_close", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// One-dimensional linear interpolation.

- /// - /// Returns the one-dimensional piecewise linear interpolant to a function - /// with given discrete data points (xp, fp), evaluated at x.

- /// - /// Notes - /// - /// Does not check that the x-coordinate sequence xp is increasing.

- /// - /// If xp is not increasing, the results are nonsense.

- /// - /// A simple check for increasing is: - ///
- /// - /// The x-coordinates of the data points, must be increasing if argument - /// period is not specified.

- /// Otherwise, xp is internally sorted after - /// normalizing the periodic boundaries with xp = xp % period. - /// - /// - /// The y-coordinates of the data points, same length as xp. - /// - /// - /// Value to return for x < xp[0], default is fp[0]. - /// - /// - /// Value to return for x > xp[-1], default is fp[-1]. - /// - /// - /// A period for the x-coordinates.

- /// This parameter allows the proper - /// interpolation of angular x-coordinates.

- /// Parameters left and right - /// are ignored if period is specified. - /// - /// - /// The interpolated values, same shape as x. - /// - public float or complex (corresponding to fp) or ndarray interp(1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - xp, - fp, - }); - var kwargs=new PyDict(); - if (left!=null) kwargs["left"]=ToPython(left); - if (right!=null) kwargs["right"]=ToPython(right); - if (period!=null) kwargs["period"]=ToPython(period); - dynamic py = __self__.InvokeMethod("interp", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Pads an array.

- /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes.

- /// This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis.

- /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced.

- /// It has the - /// following signature: - /// - /// where - ///
- /// - /// Number of values padded to the edges of each axis.

- /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis.

- /// - /// ((before, after),) yields same before and after pad for each axis.

- /// - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. - /// - /// - /// One of the following string values or a user supplied function. - /// - /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value.

- /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis.

- /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis.

- /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes.

- /// - /// Default is None, to use the entire axis. - /// - /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis.

- /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis.

- /// - /// ((before, after),) yields same before and after constants for each - /// axis.

- /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes.

- /// - /// Default is 0. - /// - /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array.

- /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis.

- /// - /// ((before, after),) yields same before and after end values for each - /// axis.

- /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes.

- /// - /// Default is 0. - /// - /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value.

- /// For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. - /// - /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. - /// - public NDarray pad(NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - pad_width, - mode, - }); - var kwargs=new PyDict(); - if (stat_length!=null) kwargs["stat_length"]=ToPython(stat_length); - if (constant_values!=null) kwargs["constant_values"]=ToPython(constant_values); - if (end_values!=null) kwargs["end_values"]=ToPython(end_values); - if (reflect_type!=null) kwargs["reflect_type"]=ToPython(reflect_type); - dynamic py = __self__.InvokeMethod("pad", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Test whether each element of a 1-D array is also present in a second array.

- /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise.

- /// - /// We recommend using isin instead of in1d for new code.

- /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences.

- /// in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]).

- /// - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. - ///
- /// - /// The values against which to test each value of ar1. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation.

- /// Default is False. - /// - /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise).

- /// - /// Default is False.

- /// np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). - /// - /// - /// The values ar1[in1d] are in ar2. - /// - public NDarray in1d(NDarray ar2, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (invert!=false) kwargs["invert"]=ToPython(invert); - dynamic py = __self__.InvokeMethod("in1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the intersection of two arrays.

- /// - /// Return the sorted, unique values that are in both of the input arrays. - ///
- /// - /// Input arrays.

- /// Will be flattened if not already 1D. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation.

- /// Default is False. - /// - /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned.

- /// The first instance of a value is used if there are - /// multiple.

- /// Default is False. - /// - /// - /// A tuple of: - /// intersect1d - /// Sorted 1D array of common and unique elements. - /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. - /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. - /// - public (NDarray, NDarray, NDarray) intersect1d(NDarray ar1, bool assume_unique = false, bool return_indices = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (return_indices!=false) kwargs["return_indices"]=ToPython(return_indices); - dynamic py = __self__.InvokeMethod("intersect1d", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); - } - - /// - /// Calculates element in test_elements, broadcasting over element only.

- /// - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise.

- /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in.

- /// - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences.

- /// - /// element and test_elements are converted to arrays if they are not - /// already.

- /// If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements.

- /// This is a consequence - /// of the array constructor’s way of handling non-sequence collections.

- /// - /// Converting the set to a list usually gives the desired behavior. - ///
- /// - /// The values against which to test each value of element.

- /// - /// This argument is flattened if it is an array or array_like.

- /// - /// See notes for behavior with non-array-like parameters. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation.

- /// Default is False. - /// - /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements.

- /// Default is False.

- /// - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). - /// - /// - /// Has the same shape as element.

- /// The values element[isin] - /// are in test_elements. - ///
- public NDarray isin(NDarray test_elements, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - test_elements, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (invert!=false) kwargs["invert"]=ToPython(invert); - dynamic py = __self__.InvokeMethod("isin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the set difference of two arrays.

- /// - /// Return the unique values in ar1 that are not in ar2. - ///
- /// - /// Input comparison array. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation.

- /// Default is False. - /// - /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. - /// - public NDarray setdiff1d(NDarray ar2, bool assume_unique = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - dynamic py = __self__.InvokeMethod("setdiff1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the set exclusive-or of two arrays.

- /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. - ///
- /// - /// Input arrays. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation.

- /// Default is False. - /// - /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. - /// - public NDarray setxor1d(NDarray ar1, bool assume_unique = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - dynamic py = __self__.InvokeMethod("setxor1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the union of two arrays.

- /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. - ///
- /// - /// Input arrays.

- /// They are flattened if they are not already 1D. - /// - /// - /// Unique, sorted union of the input arrays. - /// - public NDarray union1d(NDarray ar1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("union1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a sorted copy of an array.

- /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable.

- /// A - /// stable sort keeps items with the same key in the same relative - /// order.

- /// The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis.

- /// Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis.

- /// - /// The sort order for complex numbers is lexicographic.

- /// If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts.

- /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour.

- /// In numpy versions >= 1.4.0 nan - /// values are sorted to the end.

- /// The extended sort order is: - /// - /// where R is a non-nan real value.

- /// Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists.

- /// - /// Non-nan values are sorted as before.

- /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress.

- /// This makes its - /// worst case O(n*log(n)).

- /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted.

- /// It is currently mapped to - /// merge sort. - ///
- /// - /// Axis along which to sort.

- /// If None, the array is flattened before - /// sorting.

- /// The default is -1, which sorts along the last axis. - /// - /// - /// Sorting algorithm.

- /// Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc.

- /// A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray sort(int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="quicksort") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Perform an indirect stable sort using a sequence of keys.

- /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns.

- /// The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on.

- /// The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape.

- /// If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. - ///
- /// - /// Axis to be indirectly sorted.

- /// By default, sort over the last axis. - /// - /// - /// Array of indices that sort the keys along the specified axis. - /// - public NDarray lexsort(int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("lexsort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices that would sort an array.

- /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword.

- /// It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order.

- /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms.

- /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values.

- /// The enhanced sort order is documented in sort. - ///
- /// - /// Axis along which to sort.

- /// The default is -1 (the last axis).

- /// If None, - /// the flattened array is used. - /// - /// - /// Sorting algorithm. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc.

- /// A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of indices that sort a along the specified axis.

- /// - /// If a is one-dimensional, a[index_array] yields a sorted a.

- /// - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. - ///
- public NDarray argsort(int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="quicksort") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("argsort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of an array sorted along the first axis.

- /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). - ///
- /// - /// Array of the same type and shape as a. - /// - public NDarray msort() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("msort"); - return ToCsharp(py); - } - - /// - /// Sort a complex array using the real part first, then the imaginary part. - /// - /// - /// Always returns a sorted complex array. - /// - public NDarray sort_complex() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("sort_complex"); - return ToCsharp(py); - } - - /// - /// Return a partitioned copy of an array.

- /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array.

- /// All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it.

- /// The ordering of the elements in the two - /// partitions is undefined.

- /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable.

- /// A stable sort keeps items with the same key in the same - /// relative order.

- /// The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis.

- /// Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis.

- /// - /// The sort order for complex numbers is lexicographic.

- /// If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. - ///
- /// - /// Element index to partition by.

- /// The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it.

- /// The order of all elements in the partitions is undefined.

- /// If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. - /// - /// - /// Axis along which to sort.

- /// If None, the array is flattened before - /// sorting.

- /// The default is -1, which sorts along the last axis. - /// - /// - /// Selection algorithm.

- /// Default is ‘introselect’. - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc.

- /// A single - /// field can be specified as a string.

- /// Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray partition(int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - kth, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="introselect") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword.

- /// It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order.

- /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. - ///
- /// - /// Element index to partition by.

- /// The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it.

- /// The order all - /// elements in the partitions is undefined.

- /// If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. - /// - /// - /// Axis along which to sort.

- /// The default is -1 (the last axis).

- /// If - /// None, the flattened array is used. - /// - /// - /// Selection algorithm.

- /// Default is ‘introselect’ - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc.

- /// A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of indices that partition a along the specified axis.

- /// - /// If a is one-dimensional, a[index_array] yields a partitioned a.

- /// - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. - ///
- public NDarray argpartition(int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - kth, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="introselect") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("argpartition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices of the maximum values along an axis.

- /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. - ///
- /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array.

- /// It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array.

- /// It has the same shape as a.shape - /// with the dimension along axis removed. - ///
- public NDarray argmax(int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("argmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs.

- /// For all-NaN slices ValueError is raised.

- /// Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. - ///
- /// - /// Axis along which to operate.

- /// By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmax(int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("nanargmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices of the minimum values along an axis.

- /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. - ///
- /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array.

- /// It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array.

- /// It has the same shape as a.shape - /// with the dimension along axis removed. - ///
- public NDarray argmin(int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("argmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs.

- /// For all-NaN slices ValueError is raised.

- /// Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. - ///
- /// - /// Axis along which to operate.

- /// By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmin(int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("nanargmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the indices of array elements that are non-zero, grouped by element.

- /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)).

- /// - /// The output of argwhere is not suitable for indexing arrays.

- /// - /// For this purpose use nonzero(a) instead. - ///
- /// - /// Indices of elements that are non-zero.

- /// Indices are grouped by element. - ///
- public NDarray argwhere() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("argwhere"); - return ToCsharp(py); - } - - /// - /// Return indices that are non-zero in the flattened version of a.

- /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. - ///
- /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. - /// - public NDarray flatnonzero() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("flatnonzero"); - return ToCsharp(py); - } - - /// - /// Find indices where elements should be inserted to maintain order.

- /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved.

- /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points.

- /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values.

- /// The enhanced sort order is documented in sort.

- /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. - ///
- /// - /// Values to insert into a. - /// - /// - /// If ‘left’, the index of the first suitable location found is given.

- /// - /// If ‘right’, return the last such index.

- /// If there is no suitable - /// index, return either 0 or N (where N is the length of a). - /// - /// - /// Optional array of integer indices that sort array a into ascending - /// order.

- /// They are typically the result of argsort. - /// - /// - /// Array of insertion points with the same shape as v. - /// - public NDarray searchsorted(NDarray v, string side = "left", NDarray sorter = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - }); - var kwargs=new PyDict(); - if (side!="left") kwargs["side"]=ToPython(side); - if (sorter!=null) kwargs["sorter"]=ToPython(sorter); - dynamic py = __self__.InvokeMethod("searchsorted", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the elements of an array that satisfy some condition.

- /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)).

- /// If - /// condition is boolean np.extract is equivalent to arr[condition].

- /// - /// Note that place does the exact opposite of extract. - ///
- /// - /// Input array of the same size as condition. - /// - /// - /// Rank 1 array of values from arr where condition is True. - /// - public NDarray extract(NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("extract", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Counts the number of non-zero values in the array a.

- /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string.

- /// Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - ///
- /// - /// Axis or tuple of axes along which to count non-zeros.

- /// - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. - /// - /// - /// Number of non-zero values in the array along a given axis.

- /// - /// Otherwise, the total number of non-zero values in the array - /// is returned. - ///
- public NDarray count_nonzero(Axis axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("count_nonzero", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Counts the number of non-zero values in the array a.

- /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string.

- /// Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - ///
- /// - /// Number of non-zero values in the array along a given axis.

- /// - /// Otherwise, the total number of non-zero values in the array - /// is returned. - ///
- public int count_nonzero() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("count_nonzero"); - return ToCsharp(py); - } - - /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs.

- /// - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// This means that Not a Number is not equivalent to infinity.

- /// - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e.

- /// negative) number.

- /// - /// If the input has a integer type the function is equivalent to np.min. - ///
- /// - /// Axis or axes along which the minimum is computed.

- /// The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a.

- /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray.

- /// If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis - /// removed.

- /// If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned.

- /// The same dtype as a is returned. - ///
- public NDarray nanmin(Axis axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs.

- /// When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice.

- /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754).

- /// This means that Not a Number is not equivalent to infinity.

- /// - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e.

- /// negative) number.

- /// - /// If the input has a integer type the function is equivalent to np.max. - ///
- /// - /// Axis or axes along which the maximum is computed.

- /// The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a.

- /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray.

- /// If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis removed.

- /// - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned.

- /// The same dtype as a is returned. - ///
- public NDarray nanmax(Axis axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Range of values (maximum - minimum) along an axis.

- /// - /// The name of the function comes from the acronym for ‘peak to peak’. - ///
- /// - /// Axis along which to find the peaks.

- /// By default, flatten the - /// array.

- /// axis may be negative, in - /// which case it counts from the last to the first axis.

- /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. - /// - public NDarray ptp(Axis axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("ptp", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the q-th percentile of the data along the specified axis.

- /// - /// Returns the q-th percentile(s) of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V.

- /// The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly.

- /// This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - ///
- /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed.

- /// The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one.

- /// With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar.

- /// If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public NDarray percentile(NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the q-th percentile of the data along the specified axis.

- /// - /// Returns the q-th percentile(s) of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V.

- /// The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly.

- /// This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - ///
- /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar.

- /// If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public double percentile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values.

- /// - /// Returns the qth percentile(s) of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V.

- /// The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly.

- /// This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - ///
- /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed.

- /// The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one.

- /// With this option, the - /// result will broadcast correctly against the original array a.

- /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array.

- /// If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar.

- /// If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public NDarray nanpercentile(NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values.

- /// - /// Returns the qth percentile(s) of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V.

- /// The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly.

- /// This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - ///
- /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar.

- /// If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public double nanpercentile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the q-th quantile of the data along the specified axis.

- /// - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V.

- /// The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly.

- /// This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - ///
- /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed.

- /// The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one.

- /// With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar.

- /// If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public NDarray quantile(NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the q-th quantile of the data along the specified axis.

- /// - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V.

- /// The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly.

- /// This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - ///
- /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar.

- /// If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public double quantile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values.

- /// - /// Returns the qth quantile(s) of the array elements.

- /// - /// .. versionadded:: 1.15.0 - ///
- /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed.

- /// The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one.

- /// With this option, the - /// result will broadcast correctly against the original array a.

- /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array.

- /// If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar.

- /// If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public NDarray nanquantile(NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values.

- /// - /// Returns the qth quantile(s) of the array elements.

- /// - /// .. versionadded:: 1.15.0 - ///
- /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory.

- /// In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar.

- /// If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles.

- /// The other axes are - /// the axes that remain after the reduction of a.

- /// If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public double nanquantile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the median along the specified axis.

- /// - /// Returns the median of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - ///
- /// - /// Axis or axes along which the medians are computed.

- /// The default - /// is to compute the median along a flattened version of the array.

- /// - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations.

- /// The input array will be modified by the call to - /// median.

- /// This will save memory when you do not need to preserve - /// the contents of the input array.

- /// Treat the input as undefined, - /// but it will probably be fully or partially sorted.

- /// Default is - /// False.

- /// If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original arr. - /// - /// - /// A new array holding the result.

- /// If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public NDarray median(Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the median along the specified axis.

- /// - /// Returns the median of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - ///
- /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations.

- /// The input array will be modified by the call to - /// median.

- /// This will save memory when you do not need to preserve - /// the contents of the input array.

- /// Treat the input as undefined, - /// but it will probably be fully or partially sorted.

- /// Default is - /// False.

- /// If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result.

- /// If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public double median(NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Axis or axes along which to average a.

- /// The default, - /// axis=None, will average over all of the elements of the input array.

- /// - /// If axis is negative it counts from the last to the first axis.

- /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// An array of weights associated with the values in a.

- /// Each value in - /// a contributes to the average according to its associated weight.

- /// - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a.

- /// - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False.

- /// If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned.

- /// - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis.

- /// When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element.

- /// sum_of_weights is of the - /// same type as retval.

- /// The result dtype follows a genereal pattern.

- /// - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral.

- /// Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights.

- /// If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - ///
- public NDarray average(Axis axis, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (returned!=false) kwargs["returned"]=ToPython(returned); - dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// An array of weights associated with the values in a.

- /// Each value in - /// a contributes to the average according to its associated weight.

- /// - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a.

- /// - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False.

- /// If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned.

- /// - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis.

- /// When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element.

- /// sum_of_weights is of the - /// same type as retval.

- /// The result dtype follows a genereal pattern.

- /// - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral.

- /// Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights.

- /// If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - ///
- public double average(NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (returned!=false) kwargs["returned"]=ToPython(returned); - dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the arithmetic mean along the specified axis.

- /// - /// Returns the average of the array elements.

- /// The average is taken over - /// the flattened array by default, otherwise over the specified axis.

- /// - /// float64 intermediate and return values are used for integer inputs.

- /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements.

- /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has.

- /// Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below).

- /// Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue.

- /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - ///
- /// - /// Axis or axes along which the means are computed.

- /// The default is to - /// compute the mean of the flattened array.

- /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the mean.

- /// For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// - /// See doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public NDarray mean(Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the arithmetic mean along the specified axis.

- /// - /// Returns the average of the array elements.

- /// The average is taken over - /// the flattened array by default, otherwise over the specified axis.

- /// - /// float64 intermediate and return values are used for integer inputs.

- /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements.

- /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has.

- /// Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below).

- /// Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue.

- /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - ///
- /// - /// Type to use in computing the mean.

- /// For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// - /// See doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public double mean(Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the standard deviation along the specified axis.

- /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements.

- /// The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis.

- /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)).

- /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x).

- /// If, however, ddof is specified, - /// the divisor N - ddof is used instead.

- /// In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population.

- /// ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables.

- /// The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se.

- /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the std is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below).

- /// - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - ///
- /// - /// Axis or axes along which the standard deviation is computed.

- /// The - /// default is to compute the standard deviation of the flattened array.

- /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the standard deviation.

- /// For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom.

- /// The divisor used in calculations - /// is N - ddof, where N represents the number of elements.

- /// - /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public NDarray std(Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the standard deviation along the specified axis.

- /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements.

- /// The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis.

- /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)).

- /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x).

- /// If, however, ddof is specified, - /// the divisor N - ddof is used instead.

- /// In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population.

- /// ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables.

- /// The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se.

- /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the std is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below).

- /// - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - ///
- /// - /// Type to use in computing the standard deviation.

- /// For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom.

- /// The divisor used in calculations - /// is N - ddof, where N represents the number of elements.

- /// - /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public double std(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the variance along the specified axis.

- /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution.

- /// The variance is computed for the flattened array by - /// default, otherwise over the specified axis.

- /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2).

- /// - /// The mean is normally calculated as x.sum() / N, where N = len(x).

- /// - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead.

- /// In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population.

- /// - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables.

- /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the variance is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below).

- /// Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - ///
- /// - /// Axis or axes along which the variance is computed.

- /// The default is to - /// compute the variance of the flattened array.

- /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the variance.

- /// For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements.

- /// By - /// default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the input array.

- /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be.

- /// If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public NDarray @var(Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the variance along the specified axis.

- /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution.

- /// The variance is computed for the flattened array by - /// default, otherwise over the specified axis.

- /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2).

- /// - /// The mean is normally calculated as x.sum() / N, where N = len(x).

- /// - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead.

- /// In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population.

- /// - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables.

- /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the variance is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below).

- /// Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - ///
- /// - /// Type to use in computing the variance.

- /// For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements.

- /// By - /// default ddof is zero. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public double @var(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs.

- /// - /// Returns the median of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - ///
- /// - /// Axis or axes along which the medians are computed.

- /// The default - /// is to compute the median along a flattened version of the array.

- /// - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations.

- /// The input array will be modified by the call to - /// median.

- /// This will save memory when you do not need to preserve - /// the contents of the input array.

- /// Treat the input as undefined, - /// but it will probably be fully or partially sorted.

- /// Default is - /// False.

- /// If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a.

- /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array.

- /// If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// A new array holding the result.

- /// If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public NDarray nanmedian(Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs.

- /// - /// Returns the median of the array elements.

- /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - ///
- /// - /// Alternative output array in which to place the result.

- /// It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations.

- /// The input array will be modified by the call to - /// median.

- /// This will save memory when you do not need to preserve - /// the contents of the input array.

- /// Treat the input as undefined, - /// but it will probably be fully or partially sorted.

- /// Default is - /// False.

- /// If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result.

- /// If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input.

- /// If out is specified, that array is - /// returned instead. - ///
- public double nanmedian(NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs.

- /// - /// Returns the average of the array elements.

- /// The average is taken over - /// the flattened array by default, otherwise over the specified axis.

- /// - /// float64 intermediate and return values are used for integer inputs.

- /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised.

- /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements.

- /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - ///
- /// - /// Axis or axes along which the means are computed.

- /// The default is to compute - /// the mean of the flattened array. - /// - /// - /// Type to use in computing the mean.

- /// For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a.

- /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray.

- /// If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned.

- /// Nan is - /// returned for slices that contain only NaNs. - ///
- public NDarray nanmean(Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs.

- /// - /// Returns the average of the array elements.

- /// The average is taken over - /// the flattened array by default, otherwise over the specified axis.

- /// - /// float64 intermediate and return values are used for integer inputs.

- /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised.

- /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements.

- /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - ///
- /// - /// Type to use in computing the mean.

- /// For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result.

- /// The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary.

- /// See - /// doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned.

- /// Nan is - /// returned for slices that contain only NaNs. - ///
- public double nanmean(Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs.

- /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements.

- /// The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis.

- /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised.

- /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)).

- /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x).

- /// If, however, ddof is - /// specified, the divisor N - ddof is used instead.

- /// In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population.

- /// ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables.

- /// - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se.

- /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the std is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below).

- /// Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - ///
- /// - /// Axis or axes along which the standard deviation is computed.

- /// The default is - /// to compute the standard deviation of the flattened array. - /// - /// - /// Type to use in computing the standard deviation.

- /// For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom.

- /// The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements.

- /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a.

- /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes.

- /// If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array.

- /// If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - ///
- public NDarray nanstd(Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs.

- /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements.

- /// The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis.

- /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised.

- /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)).

- /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x).

- /// If, however, ddof is - /// specified, the divisor N - ddof is used instead.

- /// In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population.

- /// ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables.

- /// - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se.

- /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the std is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below).

- /// Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - ///
- /// - /// Type to use in computing the standard deviation.

- /// For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result.

- /// It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom.

- /// The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements.

- /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array.

- /// If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - ///
- public double nanstd(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs.

- /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution.

- /// The variance is computed for the flattened array by - /// default, otherwise over the specified axis.

- /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised.

- /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2).

- /// - /// The mean is normally calculated as x.sum() / N, where N = len(x).

- /// - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead.

- /// In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population.

- /// ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables.

- /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the variance is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below).

- /// Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue.

- /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - ///
- /// - /// Axis or axes along which the variance is computed.

- /// The default is to compute - /// the variance of the flattened array. - /// - /// - /// Type to use in computing the variance.

- /// For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements.

- /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one.

- /// With this option, - /// the result will broadcast correctly against the original a. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array.

- /// If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - ///
- public NDarray nanvar(Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs.

- /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution.

- /// The variance is computed for the flattened array by - /// default, otherwise over the specified axis.

- /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised.

- /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2).

- /// - /// The mean is normally calculated as x.sum() / N, where N = len(x).

- /// - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead.

- /// In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population.

- /// ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables.

- /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative.

- /// - /// For floating-point input, the variance is computed using the same - /// precision the input has.

- /// Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below).

- /// Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue.

- /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - ///
- /// - /// Type to use in computing the variance.

- /// For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result.

- /// It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements.

- /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array.

- /// If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - ///
- public double nanvar(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return Pearson product-moment correlation coefficients.

- /// - /// Please refer to the documentation for cov for more detail.

- /// The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive.

- /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1.

- /// The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case.

- /// - /// This function accepts but discards arguments bias and ddof.

- /// This is - /// for backwards compatibility with previous versions of this function.

- /// These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. - ///
- /// - /// An additional set of variables and observations.

- /// y has the same - /// shape as x. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns.

- /// Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// The correlation coefficient matrix of the variables. - /// - public NDarray corrcoef(NDarray y = null, bool? rowvar = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); - dynamic py = __self__.InvokeMethod("corrcoef", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Cross-correlation of two 1-dimensional sequences.

- /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate.

- /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently.

- /// Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. - ///
- /// - /// Input sequences. - /// - /// - /// Refer to the convolve docstring.

- /// Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. - /// - /// - /// Discrete cross-correlation of a and v. - /// - public NDarray correlate(NDarray a, string mode = "valid") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (mode!="valid") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("correlate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Estimate a covariance matrix, given data and weights.

- /// - /// Covariance indicates the level to which two variables vary together.

- /// - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm.

- /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity.

- /// The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. - ///
- /// - /// An additional set of variables and observations.

- /// y has the same form - /// as that of m. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns.

- /// Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate).

- /// If bias is True, - /// then normalization is by N.

- /// These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. - /// - /// - /// If not None the default value implied by bias is overridden.

- /// - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average.

- /// See the notes for the details.

- /// The default value - /// is None. - /// - /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. - /// - /// - /// 1-D array of observation vector weights.

- /// These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. - /// - /// - /// The covariance matrix of the variables. - /// - public NDarray cov(NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); - if (bias!=false) kwargs["bias"]=ToPython(bias); - if (ddof!=null) kwargs["ddof"]=ToPython(ddof); - if (fweights!=null) kwargs["fweights"]=ToPython(fweights); - if (aweights!=null) kwargs["aweights"]=ToPython(aweights); - dynamic py = __self__.InvokeMethod("cov", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the histogram of a set of data.

- /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open.

- /// In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3).

- /// The last bin, however, is [3, 4], which - /// includes 4. - ///
- /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default).

- /// If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths.

- /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins.

- /// If not provided, range - /// is simply (a.min(), a.max()).

- /// Values outside the range are - /// ignored.

- /// The first element of the range must be less than or - /// equal to the second.

- /// range affects the automatic bin - /// computation as well.

- /// While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths.

- /// It should not be used. - /// - /// - /// An array of weights, of the same shape as a.

- /// Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1).

- /// If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin.

- /// If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1.

- /// Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function.

- /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Compute the histogram of a set of data.

- /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open.

- /// In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3).

- /// The last bin, however, is [3, 4], which - /// includes 4. - ///
- /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default).

- /// If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths.

- /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins.

- /// If not provided, range - /// is simply (a.min(), a.max()).

- /// Values outside the range are - /// ignored.

- /// The first element of the range must be less than or - /// equal to the second.

- /// range affects the automatic bin - /// computation as well.

- /// While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths.

- /// It should not be used. - /// - /// - /// An array of weights, of the same shape as a.

- /// Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1).

- /// If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin.

- /// If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1.

- /// Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function.

- /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Compute the histogram of a set of data.

- /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open.

- /// In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3).

- /// The last bin, however, is [3, 4], which - /// includes 4. - ///
- /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default).

- /// If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths.

- /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins.

- /// If not provided, range - /// is simply (a.min(), a.max()).

- /// Values outside the range are - /// ignored.

- /// The first element of the range must be less than or - /// equal to the second.

- /// range affects the automatic bin - /// computation as well.

- /// While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths.

- /// It should not be used. - /// - /// - /// An array of weights, of the same shape as a.

- /// Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1).

- /// If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin.

- /// If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1.

- /// Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function.

- /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples.

- /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1.

- /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis.

- /// Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal).

- /// This ensures compatibility with histogramdd. - ///
- /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]].

- /// All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin.

- /// - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically.

- /// To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i).

- /// - /// Weights are normalized to 1 if normed is True.

- /// If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples.

- /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1.

- /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis.

- /// Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal).

- /// This ensures compatibility with histogramdd. - ///
- /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]].

- /// All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin.

- /// - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically.

- /// To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i).

- /// - /// Weights are normalized to 1 if normed is True.

- /// If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples.

- /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1.

- /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis.

- /// Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal).

- /// This ensures compatibility with histogramdd. - ///
- /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]].

- /// All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin.

- /// - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically.

- /// To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i).

- /// - /// Weights are normalized to 1 if normed is True.

- /// If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins.

- /// - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension.

- /// - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin.

- /// - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically.

- /// To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …).

- /// - /// Weights are normalized to 1 if normed is True.

- /// If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins.

- /// - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension.

- /// - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin.

- /// - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically.

- /// To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …).

- /// - /// Weights are normalized to 1 if normed is True.

- /// If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins.

- /// - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension.

- /// - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin.

- /// - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically.

- /// To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …).

- /// - /// Weights are normalized to 1 if normed is True.

- /// If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - return (ToCsharp(py[0]), ToCsharp(py[1])); - } - - /// - /// Count number of occurrences of each value in array of non-negative ints.

- /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x.

- /// If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x).

- /// - /// Each bin gives the number of occurrences of its index value in x.

- /// - /// If weights is specified the input array is weighted by it, i.e.

- /// if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. - ///
- /// - /// Weights, array of the same shape as x. - /// - /// - /// A minimum number of bins for the output array. - /// - /// - /// The result of binning the input array.

- /// - /// The length of out is equal to np.amax(x)+1. - ///
- public NDarray bincount(NDarray weights = null, int? minlength = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (minlength!=0) kwargs["minlength"]=ToPython(minlength); - dynamic py = __self__.InvokeMethod("bincount", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function.

- /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation.

- /// Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators.

- /// These are simply plug-in methods - /// that give good starting points for number of bins.

- /// In the equations - /// below, is the binwidth and is the number of - /// bins.

- /// All estimators that compute bin counts are recast to bin width - /// using the ptp of the data.

- /// The final bin count is obtained from - /// np.round(np.ceil(range / h)). - ///
- /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default).

- /// If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths.

- /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range.

- /// While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions.

- /// For visualisation, - /// using the ‘auto’ option is suggested.

- /// Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins.

- /// If not provided, range - /// is simply (a.min(), a.max()).

- /// Values outside the range are - /// ignored.

- /// The first element of the range must be less than or - /// equal to the second.

- /// range affects the automatic bin - /// computation as well.

- /// While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a.

- /// Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1).

- /// This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(int? bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function.

- /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation.

- /// Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators.

- /// These are simply plug-in methods - /// that give good starting points for number of bins.

- /// In the equations - /// below, is the binwidth and is the number of - /// bins.

- /// All estimators that compute bin counts are recast to bin width - /// using the ptp of the data.

- /// The final bin count is obtained from - /// np.round(np.ceil(range / h)). - ///
- /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default).

- /// If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths.

- /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range.

- /// While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions.

- /// For visualisation, - /// using the ‘auto’ option is suggested.

- /// Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins.

- /// If not provided, range - /// is simply (a.min(), a.max()).

- /// Values outside the range are - /// ignored.

- /// The first element of the range must be less than or - /// equal to the second.

- /// range affects the automatic bin - /// computation as well.

- /// While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a.

- /// Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1).

- /// This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function.

- /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation.

- /// Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators.

- /// These are simply plug-in methods - /// that give good starting points for number of bins.

- /// In the equations - /// below, is the binwidth and is the number of - /// bins.

- /// All estimators that compute bin counts are recast to bin width - /// using the ptp of the data.

- /// The final bin count is obtained from - /// np.round(np.ceil(range / h)). - ///
- /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default).

- /// If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths.

- /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range.

- /// While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions.

- /// For visualisation, - /// using the ‘auto’ option is suggested.

- /// Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins.

- /// If not provided, range - /// is simply (a.min(), a.max()).

- /// Values outside the range are - /// ignored.

- /// The first element of the range must be less than or - /// equal to the second.

- /// range affects the automatic bin - /// computation as well.

- /// While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a.

- /// Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1).

- /// This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(List bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the indices of the bins to which each value in input array belongs.

- /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate.

- /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError.

- /// - /// np.digitize is implemented in terms of np.searchsorted.

- /// This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search.

- /// It also removes - /// the requirement for the input array to be 1-dimensional.

- /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too.

- /// - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks.

- /// Perhaps more importantly, it supports all dtypes. - ///
- /// - /// Array of bins.

- /// It has to be 1-dimensional and monotonic. - /// - /// - /// Indicating whether the intervals include the right or the left bin - /// edge.

- /// Default behavior is (right==False) indicating that the interval - /// does not include the right edge.

- /// The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. - /// - /// - /// Output array of indices, of same shape as x. - /// - public NDarray digitize(NDarray bins, bool? right = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - bins, - }); - var kwargs=new PyDict(); - if (right!=false) kwargs["right"]=ToPython(right); - dynamic py = __self__.InvokeMethod("digitize", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the roots of a polynomial with coefficients given in p.

- /// - /// The values in the rank-1 array p are coefficients of a polynomial.

- /// - /// If the length of p is n+1 then the polynomial is described by: - /// - /// Notes - /// - /// The algorithm relies on computing the eigenvalues of the - /// companion matrix [1].

- /// - /// References - ///
- /// - /// An array containing the roots of the polynomial. - /// - public NDarray roots() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("roots"); - return ToCsharp(py); - } - } } diff --git a/src/Numpy/Numpy.csproj b/src/Numpy/Numpy.csproj index 412d24b..0c95d06 100644 --- a/src/Numpy/Numpy.csproj +++ b/src/Numpy/Numpy.csproj @@ -14,7 +14,7 @@ https://github.com/SciSharp/Numpy.NET Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 3.11.1.32 + 3.11.1.33 https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true 3.10.0.0 3.10.0.0 diff --git a/src/Numpy/np.array_manipulation.gen.cs b/src/Numpy/np.array_manipulation.gen.cs index 911bafb..d032a45 100644 --- a/src/Numpy/np.array_manipulation.gen.cs +++ b/src/Numpy/np.array_manipulation.gen.cs @@ -144,7 +144,7 @@ public static void copyto(NDarray dst, NDarray src, string casting = "same_kind" /// Note there is no guarantee of the memory layout (C- or /// Fortran- contiguous) of the returned array. /// - public static NDarray reshape(NDarray a, Shape newshape, string order = null) + public static NDarray reshape(this NDarray a, Shape newshape, string order = null) { //auto-generated code, do not change var __self__=self; @@ -218,7 +218,7 @@ public static NDarray reshape(NDarray a, Shape newshape, string order = null) /// Note that matrices are special cased for backward compatibility, if a /// is a matrix, then y is a 1-D ndarray. /// - public static NDarray ravel(NDarray a, string order = null) + public static NDarray ravel(this NDarray a, string order = null) { //auto-generated code, do not change var __self__=self; @@ -285,7 +285,7 @@ public static NDarray flatten(string order = null) /// Array with moved axes.

/// This array is a view of the input array. /// - public static NDarray moveaxis(NDarray a, int[] source, int[] destination) + public static NDarray moveaxis(this NDarray a, int[] source, int[] destination) { //auto-generated code, do not change var __self__=self; @@ -327,7 +327,7 @@ public static NDarray moveaxis(NDarray a, int[] source, int[] destination) /// NumPy versions a view of a is returned only if the order of the /// axes is changed, otherwise the input array is returned. /// - public static NDarray rollaxis(NDarray a, int axis, int? start = 0) + public static NDarray rollaxis(this NDarray a, int axis, int? start = 0) { //auto-generated code, do not change var __self__=self; @@ -361,7 +361,7 @@ public static NDarray rollaxis(NDarray a, int axis, int? start = 0) /// versions a view of a is returned only if the order of the /// axes is changed, otherwise the input array is returned. /// - public static NDarray swapaxes(NDarray a, int axis1, int axis2) + public static NDarray swapaxes(this NDarray a, int axis1, int axis2) { //auto-generated code, do not change var __self__=self; @@ -398,7 +398,7 @@ public static NDarray swapaxes(NDarray a, int axis1, int axis2) /// A view is returned whenever /// possible. /// - public static NDarray transpose(NDarray a, int[] axes = null) + public static NDarray transpose(this NDarray a, int[] axes = null) { //auto-generated code, do not change var __self__=self; @@ -434,7 +434,7 @@ public static NDarray transpose(NDarray a, int[] axes = null) /// A view is returned whenever /// possible. /// - public static NDarray transpose(NDarray[] a, int[] axes = null) + public static NDarray transpose(this NDarray[] a, int[] axes = null) { //auto-generated code, do not change var __self__=self; @@ -552,7 +552,7 @@ public static NDarray atleast_3d(params NDarray[] arys) /// Amongst others, it has shape and nd properties, and /// may be used as an iterator. /// - public static NDarray broadcast(NDarray in2, NDarray in1) + public static NDarray broadcast(this NDarray in2, NDarray in1) { //auto-generated code, do not change var __self__=self; @@ -588,7 +588,7 @@ public static NDarray broadcast(NDarray in2, NDarray in1) /// Furthermore, more than one element of a /// broadcasted array may refer to a single memory location. /// - public static NDarray broadcast_to(NDarray array, Shape shape, bool? subok = false) + public static NDarray broadcast_to(this NDarray array, Shape shape, bool? subok = false) { //auto-generated code, do not change var __self__=self; @@ -653,7 +653,7 @@ public static NDarray[] broadcast_arrays(NDarray[] args, bool? subok = null) /// The number of dimensions is one greater than that of /// the input array. /// - public static NDarray expand_dims(NDarray a, int axis) + public static NDarray expand_dims(this NDarray a, int axis) { //auto-generated code, do not change var __self__=self; @@ -685,7 +685,7 @@ public static NDarray expand_dims(NDarray a, int axis) /// This is always a itself /// or a view into a. /// - public static NDarray squeeze(NDarray a, Axis axis = null) + public static NDarray squeeze(this NDarray a, Axis axis = null) { //auto-generated code, do not change var __self__=self; @@ -713,7 +713,7 @@ public static NDarray squeeze(NDarray a, Axis axis = null) /// /// The input a as a float ndarray. /// - public static NDarray asfarray(NDarray a, Dtype dtype = null) + public static NDarray asfarray(this NDarray a, Dtype dtype = null) { //auto-generated code, do not change var __self__=self; @@ -739,7 +739,7 @@ public static NDarray asfarray(NDarray a, Dtype dtype = null) /// /// The input a in Fortran, or column-major, order. /// - public static NDarray asfortranarray(NDarray a, Dtype dtype = null) + public static NDarray asfortranarray(this NDarray a, Dtype dtype = null) { //auto-generated code, do not change var __self__=self; @@ -779,7 +779,7 @@ public static NDarray asfortranarray(NDarray a, Dtype dtype = null) /// If a is a subclass of ndarray, a base /// class ndarray is returned. /// - public static NDarray asarray_chkfinite(NDarray a, Dtype dtype = null, string order = null) + public static NDarray asarray_chkfinite(this NDarray a, Dtype dtype = null, string order = null) { //auto-generated code, do not change var __self__=self; @@ -818,7 +818,7 @@ public static NDarray asarray_chkfinite(NDarray a, Dtype dtype = null, string or /// /// The requirements list can be any of the following /// - public static NDarray require(NDarray a, Dtype dtype, string[] requirements = null) + public static NDarray require(this NDarray a, Dtype dtype, string[] requirements = null) { //auto-generated code, do not change var __self__=self; @@ -1118,7 +1118,7 @@ public static NDarray block(nested list of array_like or scalars (but not tuples /// /// A list of sub-arrays. /// - public static NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis = 0) + public static NDarray[] split(this NDarray ary, int[] indices_or_sections, int? axis = 0) { //auto-generated code, do not change var __self__=self; @@ -1159,7 +1159,7 @@ public static NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis /// /// A list of sub-arrays. /// - public static NDarray[] split(NDarray ary, int indices_or_sections, int? axis = 0) + public static NDarray[] split(this NDarray ary, int indices_or_sections, int? axis = 0) { //auto-generated code, do not change var __self__=self; @@ -1205,7 +1205,7 @@ public static NDarray[] split(NDarray ary, int indices_or_sections, int? axis = /// /// The tiled output array. /// - public static NDarray tile(NDarray A, NDarray reps) + public static NDarray tile(this NDarray A, NDarray reps) { //auto-generated code, do not change var __self__=self; @@ -1239,7 +1239,7 @@ public static NDarray tile(NDarray A, NDarray reps) /// Output array which has the same shape as a, except along /// the given axis. /// - public static NDarray repeat(NDarray a, int[] repeats, int? axis = null) + public static NDarray repeat(this NDarray a, int[] repeats, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -1286,7 +1286,7 @@ public static NDarray repeat(NDarray a, int[] repeats, int? axis = null) /// If axis is None, out is /// a flattened array. /// - public static NDarray delete(NDarray arr, Slice obj, int? axis = null) + public static NDarray delete(this NDarray arr, Slice obj, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -1327,7 +1327,7 @@ public static NDarray delete(NDarray arr, Slice obj, int? axis = null) /// filled.

/// If axis is None, out is a flattened array. /// - public static NDarray append(NDarray arr, NDarray values, int? axis = null) + public static NDarray append(this NDarray arr, NDarray values, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -1358,7 +1358,7 @@ public static NDarray append(NDarray arr, NDarray values, int? axis = null) /// The result of trimming the input.

/// The input data type is preserved. /// - public static NDarray trim_zeros(NDarray filt, string trim = "fb") + public static NDarray trim_zeros(this NDarray filt, string trim = "fb") { //auto-generated code, do not change var __self__=self; @@ -1480,7 +1480,7 @@ public static NDarray unique(NDarray ar, int? axis = null) /// /// The sorted unique values. /// - public static NDarray[] unique(NDarray ar, bool return_index, bool return_inverse, bool return_counts, int? axis = null) + public static NDarray[] unique(this NDarray ar, bool return_index, bool return_inverse, bool return_counts, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -1534,7 +1534,7 @@ public static NDarray[] unique(NDarray ar, bool return_index, bool return_invers /// Since a view is /// returned, this operation is done in constant time. /// - public static NDarray flip(NDarray m, Axis axis = null) + public static NDarray flip(this NDarray m, Axis axis = null) { //auto-generated code, do not change var __self__=self; @@ -1568,7 +1568,7 @@ public static NDarray flip(NDarray m, Axis axis = null) /// Since a view /// is returned, this operation is . /// - public static NDarray fliplr(NDarray m) + public static NDarray fliplr(this NDarray m) { //auto-generated code, do not change var __self__=self; @@ -1602,7 +1602,7 @@ public static NDarray fliplr(NDarray m) /// Since a view is /// returned, this operation is . /// - public static NDarray flipud(NDarray m) + public static NDarray flipud(this NDarray m) { //auto-generated code, do not change var __self__=self; @@ -1646,7 +1646,7 @@ public static NDarray flipud(NDarray m) /// /// Output array, with the same shape as a. /// - public static NDarray roll(NDarray a, int[] shift, Axis axis = null) + public static NDarray roll(this NDarray a, int[] shift, Axis axis = null) { //auto-generated code, do not change var __self__=self; @@ -1685,7 +1685,7 @@ public static NDarray roll(NDarray a, int[] shift, Axis axis = null) /// /// A rotated view of m. /// - public static NDarray rot90(NDarray m, int k = 1, int[] axes = null) + public static NDarray rot90(this NDarray m, int k = 1, int[] axes = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.bitwise.gen.cs b/src/Numpy/np.bitwise.gen.cs index 77857e7..6e0ffbb 100644 --- a/src/Numpy/np.bitwise.gen.cs +++ b/src/Numpy/np.bitwise.gen.cs @@ -51,7 +51,7 @@ public static partial class np /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray bitwise_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray bitwise_and(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -99,7 +99,7 @@ public static NDarray bitwise_and(NDarray x2, NDarray x1, NDarray @out = null, N /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray bitwise_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray bitwise_or(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -147,7 +147,7 @@ public static NDarray bitwise_or(NDarray x2, NDarray x1, NDarray @out = null, ND /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray bitwise_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray bitwise_xor(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -208,7 +208,7 @@ public static NDarray bitwise_xor(NDarray x2, NDarray x1, NDarray @out = null, N /// /// This is a scalar if x is a scalar. /// - public static NDarray invert(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray invert(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -301,7 +301,7 @@ public static NDarray left_shift(NDarray x1, NDarray x2, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray right_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray right_shift(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -338,7 +338,7 @@ public static NDarray right_shift(NDarray x1, NDarray x2, NDarray @out = null, N /// packed has the same number of dimensions as the input (unless axis /// is None, in which case the output is 1-D). /// - public static NDarray packbits(NDarray myarray, int? axis = null) + public static NDarray packbits(this NDarray myarray, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -372,7 +372,7 @@ public static NDarray packbits(NDarray myarray, int? axis = null) /// /// The elements are binary-valued (0 or 1). /// - public static NDarray unpackbits(NDarray myarray, int? axis = null) + public static NDarray unpackbits(this NDarray myarray, int? axis = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.dtype.routines.gen.cs b/src/Numpy/np.dtype.routines.gen.cs index 92ba698..b02cba6 100644 --- a/src/Numpy/np.dtype.routines.gen.cs +++ b/src/Numpy/np.dtype.routines.gen.cs @@ -119,7 +119,7 @@ public static Dtype promote_types(Dtype type1, Dtype type2) /// /// The minimal data type. /// - public static Dtype min_scalar_type(NDarray a) + public static Dtype min_scalar_type(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -215,7 +215,7 @@ public static Dtype result_type(list of arrays and dtypes arrays_and_dtypes) /// /// Data type code. /// - public static Dtype common_type(NDarray array2, NDarray array1) + public static Dtype common_type(this NDarray array2, NDarray array1) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.financial.gen.cs b/src/Numpy/np.financial.gen.cs index 0ea9927..9210c0b 100644 --- a/src/Numpy/np.financial.gen.cs +++ b/src/Numpy/np.financial.gen.cs @@ -55,7 +55,7 @@ public static partial class np /// /// If multiple inputs are array_like, they all must have the same shape. /// - public static NDarray fv(NDarray rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") + public static NDarray fv(this NDarray rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") { //auto-generated code, do not change var __self__=self; @@ -103,7 +103,7 @@ public static NDarray fv(NDarray rate, NDarray nper, NDarray pmt, NDarray pv, st /// /// Present value of a series of payments or investments. /// - public static NDarray pv(NDarray rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") + public static NDarray pv(this NDarray rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") { //auto-generated code, do not change var __self__=self; @@ -206,7 +206,7 @@ public static float npv(ValueType rate, NDarray values) /// If multiple inputs are array_like, they all must have /// the same shape. /// - public static NDarray pmt(NDarray rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") + public static NDarray pmt(this NDarray rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") { //auto-generated code, do not change var __self__=self; @@ -246,7 +246,7 @@ public static NDarray pmt(NDarray rate, NDarray nper, NDarray pv, NDarray fv = n /// /// When payments are due (‘begin’ (1) or ‘end’ (0)) /// - public static void ppmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") + public static void ppmt(this NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") { //auto-generated code, do not change var __self__=self; @@ -303,7 +303,7 @@ public static void ppmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDa /// If multiple inputs are array_like, they all must have /// the same shape. /// - public static NDarray ipmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") + public static NDarray ipmt(this NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") { //auto-generated code, do not change var __self__=self; @@ -358,7 +358,7 @@ public static NDarray ipmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, /// /// Internal Rate of Return for periodic input values. /// - public static float irr(NDarray values) + public static float irr(this NDarray values) { //auto-generated code, do not change var __self__=self; @@ -389,7 +389,7 @@ public static float irr(NDarray values) /// /// Modified internal rate of return /// - public static float mirr(NDarray values, ValueType finance_rate, ValueType reinvest_rate) + public static float mirr(this NDarray values, ValueType finance_rate, ValueType reinvest_rate) { //auto-generated code, do not change var __self__=self; @@ -430,7 +430,7 @@ public static float mirr(NDarray values, ValueType finance_rate, ValueType reinv /// /// When payments are due (‘begin’ (1) or ‘end’ (0)) /// - public static void nper(NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") + public static void nper(this NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") { //auto-generated code, do not change var __self__=self; @@ -497,7 +497,7 @@ public static void nper(NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null /// /// Maximum iterations in finding the solution /// - public static void rate(NDarray nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) + public static void rate(this NDarray nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.indexing.gen.cs b/src/Numpy/np.indexing.gen.cs index ca8d8fb..1d2d8b5 100644 --- a/src/Numpy/np.indexing.gen.cs +++ b/src/Numpy/np.indexing.gen.cs @@ -132,7 +132,7 @@ public static void s_(bool maketuple) /// /// Indices of elements that are non-zero. /// - public static NDarray[] nonzero(NDarray a) + public static NDarray[] nonzero(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -169,7 +169,7 @@ public static NDarray[] nonzero(NDarray a) /// An array with elements from x where condition is True, and elements /// from y elsewhere. /// - public static NDarray @where(NDarray condition, NDarray y, NDarray x) + public static NDarray @where(this NDarray condition, NDarray y, NDarray x) { //auto-generated code, do not change var __self__=self; @@ -198,7 +198,7 @@ public static NDarray @where(NDarray condition, NDarray y, NDarray x) /// An array with elements from x where condition is True, and elements /// from y elsewhere. /// - public static NDarray[] @where(NDarray condition) + public static NDarray[] @where(this NDarray condition) { //auto-generated code, do not change var __self__=self; @@ -359,7 +359,7 @@ public static NDarray ravel_multi_index(tuple of array_like multi_index, tuple o /// Each array in the tuple has the same shape as the indices /// array. /// - public static NDarray[] unravel_index(NDarray indices, Shape shape, string order = null) + public static NDarray[] unravel_index(this NDarray indices, Shape shape, string order = null) { //auto-generated code, do not change var __self__=self; @@ -413,7 +413,7 @@ public static void diag_indices(int n, int? ndim = 2) /// /// Notes ///
- public static void diag_indices_from(NDarray arr) + public static void diag_indices_from(this NDarray arr) { //auto-generated code, do not change var __self__=self; @@ -524,7 +524,7 @@ public static NDarray[] tril_indices(int n, int? k = 0, int? m = null) /// /// Diagonal offset (see tril for details). /// - public static void tril_indices_from(NDarray arr, int? k = 0) + public static void tril_indices_from(this NDarray arr, int? k = 0) { //auto-generated code, do not change var __self__=self; @@ -593,7 +593,7 @@ public static NDarray[] triu_indices(int n, int? k = 0, int? m = null) /// /// Indices for the upper-triangle of arr. /// - public static NDarray[] triu_indices_from(NDarray arr, int? k = 0) + public static NDarray[] triu_indices_from(this NDarray arr, int? k = 0) { //auto-generated code, do not change var __self__=self; @@ -709,7 +709,7 @@ public static NDarray take(NDarray[] a, NDarray[] indices, int? axis = null, NDa /// treated as if it had first been flattened to 1d, for consistency with /// sort and argsort. /// - public static NDarray take_along_axis(NDarray arr, NDarray indices, int? axis = null) + public static NDarray take_along_axis(this NDarray arr, NDarray indices, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -907,7 +907,7 @@ public static NDarray compress(NDarray condition, NDarray a, int? axis = n /// are removed, and a new axis inserted at the end corresponding to the /// diagonal. /// - public static NDarray diagonal(NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) + public static NDarray diagonal(this NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) { //auto-generated code, do not change var __self__=self; @@ -1059,7 +1059,7 @@ public static NDarray as_strided(NDarray x, Shape shape = null, int[] strides = /// than N, it will be repeated, and if elements of a are to be masked, /// this sequence must be non-empty. /// - public static void place(NDarray arr, NDarray mask, NDarray vals) + public static void place(this NDarray arr, NDarray mask, NDarray vals) { //auto-generated code, do not change var __self__=self; @@ -1099,7 +1099,7 @@ public static void place(NDarray arr, NDarray mask, NDarray vals) /// Note /// that this disables indexing with negative numbers. /// - public static void put(NDarray a, NDarray ind, NDarray v, string mode = "raise") + public static void put(this NDarray a, NDarray ind, NDarray v, string mode = "raise") { //auto-generated code, do not change var __self__=self; @@ -1151,7 +1151,7 @@ public static void put(NDarray a, NDarray ind, NDarray v, string mode = "raise") /// If axis is None, the destination /// array is treated as if a flattened 1d view had been created of it. /// - public static void put_along_axis(NDarray arr, NDarray indices, NDarray[] values, int axis) + public static void put_along_axis(this NDarray arr, NDarray indices, NDarray[] values, int axis) { //auto-generated code, do not change var __self__=self; @@ -1187,7 +1187,7 @@ public static void put_along_axis(NDarray arr, NDarray indices, NDarray[] values /// If values is smaller /// than a it will be repeated. /// - public static void putmask(NDarray a, NDarray mask, NDarray values) + public static void putmask(this NDarray a, NDarray mask, NDarray values) { //auto-generated code, do not change var __self__=self; @@ -1229,7 +1229,7 @@ public static void putmask(NDarray a, NDarray mask, NDarray values) /// with this option.

/// This affects only tall matrices. /// - public static void fill_diagonal(NDarray a, ValueType val, bool wrap = false) + public static void fill_diagonal(this NDarray a, ValueType val, bool wrap = false) { //auto-generated code, do not change var __self__=self; @@ -1317,7 +1317,7 @@ public static void fill_diagonal(NDarray a, ValueType val, bool wrap = false) /// buffers.

/// Set to 0 for the default value. /// - public static void nditer(NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) + public static void nditer(this NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) { //auto-generated code, do not change var __self__=self; @@ -1346,7 +1346,7 @@ public static void nditer(NDarray op, string[] flags = null, list of list of str /// /// Input array. /// - public static void ndenumerate(NDarray arr) + public static void ndenumerate(this NDarray arr) { //auto-generated code, do not change var __self__=self; @@ -1401,7 +1401,7 @@ public static void ndindex(params int[] args) /// /// An nditer for each item in axes, outermost first /// - public static tuple of nditer nested_iters(NDarray op, int[] axes = null) + public static tuple of nditer nested_iters(this NDarray op, int[] axes = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.io.gen.cs b/src/Numpy/np.io.gen.cs index 25fbf28..8e09d8f 100644 --- a/src/Numpy/np.io.gen.cs +++ b/src/Numpy/np.io.gen.cs @@ -579,7 +579,7 @@ public static List tolist() /// /// String representation of the array. /// - public static string array2string(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) + public static string array2string(this NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) { //auto-generated code, do not change var __self__=self; @@ -630,7 +630,7 @@ public static string array2string(NDarray a, int? max_line_width = null, int? pr /// /// The string representation of an array. /// - public static string array_repr(NDarray arr, int? max_line_width = null, int? precision = null, bool? suppress_small = null) + public static string array_repr(this NDarray arr, int? max_line_width = null, int? precision = null, bool? suppress_small = null) { //auto-generated code, do not change var __self__=self; @@ -674,7 +674,7 @@ public static string array_repr(NDarray arr, int? max_line_width = null, int? pr /// numbers smaller (in absolute value) than 5e-9 are represented as /// zero. /// - public static void array_str(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null) + public static void array_str(this NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.linalg.gen.cs b/src/Numpy/np.linalg.gen.cs index 898921f..61256b6 100644 --- a/src/Numpy/np.linalg.gen.cs +++ b/src/Numpy/np.linalg.gen.cs @@ -49,7 +49,7 @@ public static partial class np /// /// If out is given, then it is returned. /// - public static NDarray dot(NDarray a, NDarray b, NDarray @out = null) + public static NDarray dot(this NDarray a, NDarray b, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -144,7 +144,7 @@ public static NDarray multi_dot(params NDarray[] arrays) /// Can be an int, float, or /// complex depending on the types of a and b. /// - public static NDarray vdot(NDarray a, NDarray b) + public static NDarray vdot(this NDarray a, NDarray b) { //auto-generated code, do not change var __self__=self; @@ -183,7 +183,7 @@ public static NDarray vdot(NDarray a, NDarray b) /// /// out.shape = a.shape[:-1] + b.shape[:-1] /// - public static NDarray inner(NDarray b, NDarray a) + public static NDarray inner(this NDarray b, NDarray a) { //auto-generated code, do not change var __self__=self; @@ -222,7 +222,7 @@ public static NDarray inner(NDarray b, NDarray a) /// /// out[i, j] = a[i] * b[j] /// - public static NDarray outer(NDarray a, NDarray b, NDarray @out = null) + public static NDarray outer(this NDarray a, NDarray b, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -267,7 +267,7 @@ public static NDarray outer(NDarray a, NDarray b, NDarray @out = null) /// /// This is a scalar only when both x1, x2 are 1-d vectors. /// - public static NDarray matmul(NDarray x2, NDarray x1, NDarray @out = null) + public static NDarray matmul(this NDarray x2, NDarray x1, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -312,7 +312,7 @@ public static NDarray matmul(NDarray x2, NDarray x1, NDarray @out = null) /// /// Tensors to “dot”. /// - public static NDarray tensordot(NDarray b, NDarray a, int[] axes = null) + public static NDarray tensordot(this NDarray b, NDarray a, int[] axes = null) { //auto-generated code, do not change var __self__=self; @@ -441,7 +441,7 @@ public static NDarray matrix_power(NDarray a, int n) /// /// In the common 2-D case (N=1), the block structure can be visualized: ///
- public static NDarray kron(NDarray b, NDarray a) + public static NDarray kron(this NDarray b, NDarray a) { //auto-generated code, do not change var __self__=self; @@ -694,7 +694,7 @@ public static (NDarray, NDarray) slogdet(NDarray a) /// If a has /// larger dimensions, then an array of sums along diagonals is returned. /// - public static NDarray trace(NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) + public static NDarray trace(this NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.linalg_fft.gen.cs b/src/Numpy/np.linalg_fft.gen.cs index 512458d..d4d0676 100644 --- a/src/Numpy/np.linalg_fft.gen.cs +++ b/src/Numpy/np.linalg_fft.gen.cs @@ -1095,7 +1095,7 @@ public static NDarray ifftn(NDarray a, int[] s = null, int[] axes = null, string /// /// The modified Bessel function evaluated at each of the elements of x. /// - public static NDarray i0(NDarray x) + public static NDarray i0(this NDarray x) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.logic.gen.cs b/src/Numpy/np.logic.gen.cs index 9f07c3a..14e190f 100644 --- a/src/Numpy/np.logic.gen.cs +++ b/src/Numpy/np.logic.gen.cs @@ -67,7 +67,7 @@ public static partial class np /// A new boolean or array is returned unless out is specified, /// in which case a reference to out is returned. /// - public static NDarray all(NDarray a, Axis axis, NDarray @out = null, bool? keepdims = null) + public static NDarray all(this NDarray a, Axis axis, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -98,7 +98,7 @@ public static NDarray all(NDarray a, Axis axis, NDarray @out = null, bool? /// A new boolean or array is returned unless out is specified, /// in which case a reference to out is returned. /// - public static bool all(NDarray a) + public static bool all(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -161,7 +161,7 @@ public static bool all(NDarray a) /// A new boolean or ndarray is returned unless out is specified, /// in which case a reference to out is returned. /// - public static NDarray any(NDarray a, Axis axis, NDarray @out = null, bool? keepdims = null) + public static NDarray any(this NDarray a, Axis axis, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -194,7 +194,7 @@ public static NDarray any(NDarray a, Axis axis, NDarray @out = null, bool? /// A new boolean or ndarray is returned unless out is specified, /// in which case a reference to out is returned. /// - public static bool any(NDarray a) + public static bool any(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -250,7 +250,7 @@ public static bool any(NDarray a) /// /// This is a scalar if x is a scalar. /// - public static NDarray isfinite(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray isfinite(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -301,7 +301,7 @@ public static NDarray isfinite(NDarray x, NDarray @out = null, NDarray @where = /// /// This is a scalar if x is a scalar. /// - public static NDarray isinf(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray isinf(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -346,7 +346,7 @@ public static NDarray isinf(NDarray x, NDarray @out = null, NDarray @where /// /// This is a scalar if x is a scalar. /// - public static NDarray isnan(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray isnan(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -385,7 +385,7 @@ public static NDarray isnan(NDarray x, NDarray @out = null, NDarray @where = nul /// /// This is a scalar if x is a scalar. /// - public static NDarray isnat(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray isnat(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -434,7 +434,7 @@ public static NDarray isnat(NDarray x, NDarray @out = null, NDarray @where = nul /// The /// return value out is then a reference to that array. /// - public static NDarray isneginf(NDarray x, NDarray @out = null) + public static NDarray isneginf(this NDarray x, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -481,7 +481,7 @@ public static NDarray isneginf(NDarray x, NDarray @out = null) /// /// The return value out is then a reference to that array. /// - public static NDarray isposinf(NDarray x, NDarray y = null) + public static NDarray isposinf(this NDarray x, NDarray y = null) { //auto-generated code, do not change var __self__=self; @@ -507,7 +507,7 @@ public static NDarray isposinf(NDarray x, NDarray y = null) /// /// Output array. /// - public static NDarray iscomplex(NDarray x) + public static NDarray iscomplex(this NDarray x) { //auto-generated code, do not change var __self__=self; @@ -559,7 +559,7 @@ public static bool iscomplexobj(object x) /// /// Input array. /// - public static bool isfortran(NDarray a) + public static bool isfortran(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -584,7 +584,7 @@ public static bool isfortran(NDarray a) /// /// Boolean array of same shape as x. /// - public static NDarray isreal(NDarray x) + public static NDarray isreal(this NDarray x) { //auto-generated code, do not change var __self__=self; @@ -684,7 +684,7 @@ public static bool isscalar(object num) /// AND operation on corresponding elements of x1 and x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray logical_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray logical_and(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -729,7 +729,7 @@ public static NDarray logical_and(NDarray x2, NDarray x1, NDarray @out = null, N /// OR operation on elements of x1 and x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray logical_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray logical_or(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -770,7 +770,7 @@ public static NDarray logical_or(NDarray x2, NDarray x1, NDarray @out = null, ND /// /// This is a scalar if x is a scalar. /// - public static NDarray logical_not(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray logical_not(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -816,7 +816,7 @@ public static NDarray logical_not(NDarray x, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray logical_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray logical_xor(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -882,7 +882,7 @@ public static NDarray logical_xor(NDarray x2, NDarray x1, NDarray @out = n /// Returns True if the two arrays are equal within the given /// tolerance; False otherwise. /// - public static bool allclose(NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) + public static bool allclose(this NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) { //auto-generated code, do not change var __self__=self; @@ -951,7 +951,7 @@ public static bool allclose(NDarray b, NDarray a, float rtol = 1e-05f, float ato /// If both a and b are scalars, returns a single /// boolean value. /// - public static NDarray isclose(NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) + public static NDarray isclose(this NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) { //auto-generated code, do not change var __self__=self; @@ -980,7 +980,7 @@ public static NDarray isclose(NDarray b, NDarray a, float rtol = 1e-05f, float a /// /// Returns True if the arrays are equal. /// - public static bool array_equal(NDarray a2, NDarray a1) + public static bool array_equal(this NDarray a2, NDarray a1) { //auto-generated code, do not change var __self__=self; @@ -1009,7 +1009,7 @@ public static bool array_equal(NDarray a2, NDarray a1) /// /// True if equivalent, False otherwise. /// - public static bool array_equiv(NDarray a2, NDarray a1) + public static bool array_equiv(this NDarray a2, NDarray a1) { //auto-generated code, do not change var __self__=self; @@ -1057,7 +1057,7 @@ public static bool array_equiv(NDarray a2, NDarray a1) /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray greater(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray greater(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1107,7 +1107,7 @@ public static NDarray greater(NDarray x2, NDarray x1, NDarray @out = null, NDarr /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray greater_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray greater_equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1157,7 +1157,7 @@ public static NDarray greater_equal(NDarray x2, NDarray x1, NDarray @out = /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray less(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray less(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1207,7 +1207,7 @@ public static NDarray less(NDarray x2, NDarray x1, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray less_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray less_equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1251,7 +1251,7 @@ public static NDarray less_equal(NDarray x2, NDarray x1, NDarray @out = null, ND /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1295,7 +1295,7 @@ public static NDarray equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray not_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray not_equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.math.gen.cs b/src/Numpy/np.math.gen.cs index e7d1c92..84dbded 100644 --- a/src/Numpy/np.math.gen.cs +++ b/src/Numpy/np.math.gen.cs @@ -62,7 +62,7 @@ public static partial class np /// /// This is a scalar if x is a scalar. /// - public static NDarray sin(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray sin(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -116,7 +116,7 @@ public static NDarray sin(NDarray x, NDarray @out = null, NDarray @where = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray cos(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray cos(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -172,7 +172,7 @@ public static NDarray cos(NDarray x, NDarray @out = null, NDarray @where = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray tan(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray tan(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -239,7 +239,7 @@ public static NDarray tan(NDarray x, NDarray @out = null, NDarray @where = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray arcsin(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray arcsin(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -309,7 +309,7 @@ public static NDarray arcsin(NDarray x, NDarray @out = null, NDarray @where = nu /// /// This is a scalar if x is a scalar. /// - public static NDarray arccos(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray arccos(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -376,7 +376,7 @@ public static NDarray arccos(NDarray x, NDarray @out = null, NDarray @where = nu /// /// This is a scalar if x is a scalar. /// - public static NDarray arctan(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray arctan(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -425,7 +425,7 @@ public static NDarray arctan(NDarray x, NDarray @out = null, NDarray @where = nu /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray hypot(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray hypot(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -495,7 +495,7 @@ public static NDarray hypot(NDarray x2, NDarray x1, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray arctan2(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray arctan2(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -536,7 +536,7 @@ public static NDarray arctan2(NDarray x1, NDarray x2, NDarray @out = null, NDarr /// /// This is a scalar if x is a scalar. /// - public static NDarray degrees(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray degrees(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -575,7 +575,7 @@ public static NDarray degrees(NDarray x, NDarray @out = null, NDarray @where = n /// /// This is a scalar if x is a scalar. /// - public static NDarray radians(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray radians(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -614,7 +614,7 @@ public static NDarray radians(NDarray x, NDarray @out = null, NDarray @where = n /// /// Output array. /// - public static NDarray unwrap(NDarray p, float? discont = 3.141592653589793f, int? axis = -1) + public static NDarray unwrap(this NDarray p, float? discont = 3.141592653589793f, int? axis = -1) { //auto-generated code, do not change var __self__=self; @@ -657,7 +657,7 @@ public static NDarray unwrap(NDarray p, float? discont = 3.141592653589793f, int /// /// This is a scalar if x is a scalar. /// - public static NDarray deg2rad(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray deg2rad(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -700,7 +700,7 @@ public static NDarray deg2rad(NDarray x, NDarray @out = null, NDarray @where = n /// /// This is a scalar if x is a scalar. /// - public static NDarray rad2deg(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray rad2deg(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -758,7 +758,7 @@ public static NDarray rad2deg(NDarray x, NDarray @out = null, NDarray @where = n /// /// This is a scalar if x is a scalar. /// - public static NDarray sinh(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray sinh(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -799,7 +799,7 @@ public static NDarray sinh(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray cosh(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray cosh(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -848,7 +848,7 @@ public static NDarray cosh(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray tanh(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray tanh(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -907,7 +907,7 @@ public static NDarray tanh(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray arcsinh(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray arcsinh(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -964,7 +964,7 @@ public static NDarray arcsinh(NDarray x, NDarray @out = null, NDarray @where = n /// /// This is a scalar if x is a scalar. /// - public static NDarray arccosh(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray arccosh(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1023,7 +1023,7 @@ public static NDarray arccosh(NDarray x, NDarray @out = null, NDarray @where = n /// /// This is a scalar if x is a scalar. /// - public static NDarray arctanh(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray arctanh(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1082,7 +1082,7 @@ public static NDarray arctanh(NDarray x, NDarray @out = null, NDarray @where = n /// separately.

/// The result of rounding a float is a float. /// - public static NDarray around(NDarray a, int? decimals = 0, NDarray @out = null) + public static NDarray around(this NDarray a, int? decimals = 0, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -1121,7 +1121,7 @@ public static NDarray around(NDarray a, int? decimals = 0, NDarray @out = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray rint(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray rint(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1152,7 +1152,7 @@ public static NDarray rint(NDarray x, NDarray @out = null, NDarray @where = null /// /// The array of rounded numbers /// - public static NDarray fix(NDarray x, NDarray y = null) + public static NDarray fix(this NDarray x, NDarray y = null) { //auto-generated code, do not change var __self__=self; @@ -1200,7 +1200,7 @@ public static NDarray fix(NDarray x, NDarray y = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray floor(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray floor(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1243,7 +1243,7 @@ public static NDarray floor(NDarray x, NDarray @out = null, NDarray @where = nul /// /// This is a scalar if x is a scalar. /// - public static NDarray ceil(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray ceil(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1289,7 +1289,7 @@ public static NDarray ceil(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray trunc(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray trunc(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -1368,7 +1368,7 @@ public static NDarray trunc(NDarray x, NDarray @out = null, NDarray @where = nul /// /// Returns a reference to out if specified. /// - public static NDarray prod(NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + public static NDarray prod(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) { //auto-generated code, do not change var __self__=self; @@ -1451,7 +1451,7 @@ public static NDarray prod(NDarray a, Axis axis = null, Dtype dtype = null, NDar /// If an output array is specified, a reference to /// out is returned. /// - public static NDarray sum(NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + public static NDarray sum(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) { //auto-generated code, do not change var __self__=self; @@ -1518,7 +1518,7 @@ public static NDarray sum(NDarray a, Axis axis = null, Dtype dtype = null, NDarr /// A new array holding the result is returned unless out is /// specified, in which case it is returned. /// - public static NDarray nanprod(NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + public static NDarray nanprod(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -1600,7 +1600,7 @@ public static NDarray nanprod(NDarray a, Axis axis = null, Dtype dtype = null, N /// size as a, and the same shape as a if axis is not None /// or a is a 1-d array. /// - public static NDarray nansum(NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + public static NDarray nansum(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -1652,7 +1652,7 @@ public static NDarray nansum(NDarray a, Axis axis = null, Dtype dtype = null, ND /// A new array holding the result is returned unless out is /// specified, in which case a reference to out is returned. /// - public static NDarray cumprod(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + public static NDarray cumprod(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -1708,7 +1708,7 @@ public static NDarray cumprod(NDarray a, int? axis = null, Dtype dtype = null, N /// result has the same size as a, and the same shape as a if /// axis is not None or a is a 1-d array. /// - public static NDarray cumsum(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + public static NDarray cumsum(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -1759,7 +1759,7 @@ public static NDarray cumsum(NDarray a, int? axis = null, Dtype dtype = null, ND /// A new array holding the result is returned unless out is /// specified, in which case it is returned. /// - public static NDarray nancumprod(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + public static NDarray nancumprod(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -1815,7 +1815,7 @@ public static NDarray nancumprod(NDarray a, int? axis = null, Dtype dtype = null /// size as a, and the same shape as a if axis is not None /// or a is a 1-d array. /// - public static NDarray nancumsum(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + public static NDarray nancumsum(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -1894,7 +1894,7 @@ public static NDarray nancumsum(NDarray a, int? axis = null, Dtype dtype = null, /// A notable exception is datetime64, which /// results in a timedelta64 output array. /// - public static NDarray diff(NDarray a, int? n = 1, int? axis = -1, NDarray append = null, NDarray prepend = null) + public static NDarray diff(this NDarray a, int? n = 1, int? axis = -1, NDarray append = null, NDarray prepend = null) { //auto-generated code, do not change var __self__=self; @@ -1932,7 +1932,7 @@ public static NDarray diff(NDarray a, int? n = 1, int? axis = -1, NDarray append /// The differences.

/// Loosely, this is ary.flat[1:] - ary.flat[:-1]. /// - public static NDarray ediff1d(NDarray ary, NDarray to_end = null, NDarray to_begin = null) + public static NDarray ediff1d(this NDarray ary, NDarray to_end = null, NDarray to_begin = null) { //auto-generated code, do not change var __self__=self; @@ -1994,7 +1994,7 @@ public static NDarray ediff1d(NDarray ary, NDarray to_end = null, NDarray to_beg /// /// Vector cross product(s). /// - public static NDarray cross(NDarray a, NDarray b, int? axisa = -1, int? axisb = -1, int? axisc = -1, int? axis = null) + public static NDarray cross(this NDarray a, NDarray b, int? axisa = -1, int? axisb = -1, int? axisc = -1, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -2048,7 +2048,7 @@ public static NDarray cross(NDarray a, NDarray b, int? axisa = -1, int? axisb = /// /// Definite integral as approximated by trapezoidal rule. /// - public static float trapz(NDarray y, NDarray x = null, float? dx = 1.0f, int? axis = -1) + public static float trapz(this NDarray y, NDarray x = null, float? dx = 1.0f, int? axis = -1) { //auto-generated code, do not change var __self__=self; @@ -2105,7 +2105,7 @@ public static float trapz(NDarray y, NDarray x = null, float? dx = 1.0f, int? ax /// /// This is a scalar if x is a scalar. /// - public static NDarray exp(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray exp(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2149,7 +2149,7 @@ public static NDarray exp(NDarray x, NDarray @out = null, NDarray @where = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray expm1(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray expm1(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2190,7 +2190,7 @@ public static NDarray expm1(NDarray x, NDarray @out = null, NDarray @where = nul /// /// This is a scalar if x is a scalar. /// - public static NDarray exp2(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray exp2(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2254,7 +2254,7 @@ public static NDarray exp2(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray log(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray log(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2315,7 +2315,7 @@ public static NDarray log(NDarray x, NDarray @out = null, NDarray @where = null) /// /// This is a scalar if x is a scalar. /// - public static NDarray log10(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray log10(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2372,7 +2372,7 @@ public static NDarray log10(NDarray x, NDarray @out = null, NDarray @where = nul /// /// This is a scalar if x is a scalar. /// - public static NDarray log2(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray log2(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2436,7 +2436,7 @@ public static NDarray log2(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray log1p(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray log1p(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2489,7 +2489,7 @@ public static NDarray log1p(NDarray x, NDarray @out = null, NDarray @where = nul /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray logaddexp(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray logaddexp(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2542,7 +2542,7 @@ public static NDarray logaddexp(NDarray x2, NDarray x1, NDarray @out = null, NDa /// Base-2 logarithm of 2**x1 + 2**x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray logaddexp2(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray logaddexp2(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2585,7 +2585,7 @@ public static NDarray logaddexp2(NDarray x2, NDarray x1, NDarray @out = null, ND /// /// sinc(x), which has the same shape as the input. /// - public static NDarray sinc(NDarray x) + public static NDarray sinc(this NDarray x) { //auto-generated code, do not change var __self__=self; @@ -2622,7 +2622,7 @@ public static NDarray sinc(NDarray x) /// /// This is a scalar if x is a scalar. /// - public static NDarray signbit(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray signbit(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2668,7 +2668,7 @@ public static NDarray signbit(NDarray x, NDarray @out = null, NDarray @where = n /// The values of x1 with the sign of x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray copysign(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray copysign(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2728,7 +2728,7 @@ public static NDarray copysign(NDarray x1, NDarray x2, NDarray @out = null, NDar /// Integer exponents of 2. /// This is a scalar if x is a scalar. /// - public static (NDarray, NDarray) frexp(NDarray x, NDarray out1 = null, NDarray out2 = null, NDarray @out = null, NDarray @where = null) + public static (NDarray, NDarray) frexp(this NDarray x, NDarray out1 = null, NDarray out2 = null, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2781,7 +2781,7 @@ public static (NDarray, NDarray) frexp(NDarray x, NDarray out1 = null, NDarray o /// The result of x1 * 2**x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray ldexp(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray ldexp(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2823,7 +2823,7 @@ public static NDarray ldexp(NDarray x1, NDarray x2, NDarray @out = null, NDarray /// The next representable values of x1 in the direction of x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray nextafter(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray nextafter(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2872,7 +2872,7 @@ public static NDarray nextafter(NDarray x1, NDarray x2, NDarray @out = null, NDa /// /// This is a scalar if x is a scalar. /// - public static NDarray spacing(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray spacing(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -2900,7 +2900,7 @@ public static NDarray spacing(NDarray x, NDarray @out = null, NDarray @where = n /// The lowest common multiple of the absolute value of the inputs /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray lcm(NDarray x2, NDarray x1) + public static NDarray lcm(this NDarray x2, NDarray x1) { //auto-generated code, do not change var __self__=self; @@ -2927,7 +2927,7 @@ public static NDarray lcm(NDarray x2, NDarray x1) /// The greatest common divisor of the absolute value of the inputs /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray gcd(NDarray x2, NDarray x1) + public static NDarray gcd(this NDarray x2, NDarray x1) { //auto-generated code, do not change var __self__=self; @@ -2978,7 +2978,7 @@ public static NDarray gcd(NDarray x2, NDarray x1) /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray @add(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray @add(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3027,7 +3027,7 @@ public static NDarray @add(NDarray x2, NDarray x1, NDarray @out = null, NDarray /// /// This is a scalar if x is a scalar. /// - public static NDarray reciprocal(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray reciprocal(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3058,7 +3058,7 @@ public static NDarray reciprocal(NDarray x, NDarray @out = null, NDarray @where /// /// This is a scalar if x is a scalar. /// - public static NDarray positive(NDarray x) + public static NDarray positive(this NDarray x) { //auto-generated code, do not change var __self__=self; @@ -3095,7 +3095,7 @@ public static NDarray positive(NDarray x) /// /// This is a scalar if x is a scalar. /// - public static NDarray negative(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray negative(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3141,7 +3141,7 @@ public static NDarray negative(NDarray x, NDarray @out = null, NDarray @where = /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray multiply(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray multiply(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3200,7 +3200,7 @@ public static NDarray multiply(NDarray x2, NDarray x1, NDarray @out = null, NDar /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray divide(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3247,7 +3247,7 @@ public static NDarray divide(NDarray x1, NDarray x2, NDarray @out = null, NDarra /// The bases in x1 raised to the exponents in x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray power(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray power(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3294,7 +3294,7 @@ public static NDarray power(NDarray x1, NDarray x2, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray subtract(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray subtract(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3353,7 +3353,7 @@ public static NDarray subtract(NDarray x2, NDarray x1, NDarray @out = null, NDar /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray true_divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray true_divide(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3399,7 +3399,7 @@ public static NDarray true_divide(NDarray x1, NDarray x2, NDarray @out = null, N /// y = floor(x1/x2) /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray floor_divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray floor_divide(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3450,7 +3450,7 @@ public static NDarray floor_divide(NDarray x1, NDarray x2, NDarray @out = null, /// The bases in x1 raised to the exponents in x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray float_power(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray float_power(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3507,7 +3507,7 @@ public static NDarray float_power(NDarray x1, NDarray x2, NDarray @out = null, N /// The remainder of the division of x1 by x2. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray fmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray fmod(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3561,7 +3561,7 @@ public static NDarray fmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray mod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray mod(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3612,7 +3612,7 @@ public static NDarray mod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @ /// Integral part of x. /// This is a scalar if x is a scalar. /// - public static (NDarray, NDarray) modf(NDarray x, NDarray @out = null, NDarray @where = null) + public static (NDarray, NDarray) modf(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3665,7 +3665,7 @@ public static (NDarray, NDarray) modf(NDarray x, NDarray @out = null, NDarray @w /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray remainder(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray remainder(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3717,7 +3717,7 @@ public static NDarray remainder(NDarray x1, NDarray x2, NDarray @out = null, NDa /// Element-wise remainder from floor division. /// This is a scalar if both x1 and x2 are scalars. /// - public static (NDarray, NDarray) divmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static (NDarray, NDarray) divmod(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3746,7 +3746,7 @@ public static (NDarray, NDarray) divmod(NDarray x1, NDarray x2, NDarray @out = n /// The counterclockwise angle from the positive real axis on /// the complex plane, with dtype as numpy.float64. /// - public static NDarray angle(NDarray z, bool? deg = false) + public static NDarray angle(this NDarray z, bool? deg = false) { //auto-generated code, do not change var __self__=self; @@ -3773,7 +3773,7 @@ public static NDarray angle(NDarray z, bool? deg = false) /// If val has complex elements, the /// returned type is float. /// - public static NDarray real(NDarray val) + public static NDarray real(this NDarray val) { //auto-generated code, do not change var __self__=self; @@ -3799,7 +3799,7 @@ public static NDarray real(NDarray val) /// If val has complex /// elements, the returned type is float. /// - public static NDarray imag(NDarray val) + public static NDarray imag(this NDarray val) { //auto-generated code, do not change var __self__=self; @@ -3839,7 +3839,7 @@ public static NDarray imag(NDarray val) /// /// This is a scalar if x is a scalar. /// - public static NDarray conj(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray conj(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -3889,7 +3889,7 @@ public static NDarray conj(NDarray x, NDarray @out = null, NDarray @where = null /// /// Discrete, linear convolution of a and v. /// - public static NDarray convolve(NDarray a, NDarray v, string mode = "full") + public static NDarray convolve(this NDarray a, NDarray v, string mode = "full") { //auto-generated code, do not change var __self__=self; @@ -3945,7 +3945,7 @@ public static NDarray convolve(NDarray a, NDarray v, string mode = "full") /// < a_min are replaced with a_min, and those > a_max /// with a_max. /// - public static NDarray clip(NDarray a, NDarray a_min, NDarray a_max, NDarray @out = null) + public static NDarray clip(this NDarray a, NDarray a_min, NDarray a_max, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -4001,7 +4001,7 @@ public static NDarray clip(NDarray a, NDarray a_min, NDarray a_max, NDarray @out /// /// This is a scalar if x is a scalar. /// - public static NDarray sqrt(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray sqrt(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4043,7 +4043,7 @@ public static NDarray sqrt(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray cbrt(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray cbrt(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4082,7 +4082,7 @@ public static NDarray cbrt(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray square(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray square(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4125,7 +4125,7 @@ public static NDarray square(NDarray x, NDarray @out = null, NDarray @where = nu /// absolute value is . /// This is a scalar if x is a scalar. /// - public static NDarray absolute(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray absolute(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4171,7 +4171,7 @@ public static NDarray absolute(NDarray x, NDarray @out = null, NDarray @where = /// /// This is a scalar if x is a scalar. /// - public static NDarray fabs(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray fabs(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4226,7 +4226,7 @@ public static NDarray fabs(NDarray x, NDarray @out = null, NDarray @where = null /// /// This is a scalar if x is a scalar. /// - public static NDarray sign(NDarray x, NDarray @out = null, NDarray @where = null) + public static NDarray sign(this NDarray x, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4275,7 +4275,7 @@ public static NDarray sign(NDarray x, NDarray @out = null, NDarray @where = null /// The output array, element-wise Heaviside step function of x1. /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray heaviside(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + public static NDarray heaviside(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4339,7 +4339,7 @@ public static NDarray heaviside(NDarray x1, NDarray x2, NDarray @out = null, NDa /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray maximum(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray maximum(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4403,7 +4403,7 @@ public static NDarray maximum(NDarray x2, NDarray x1, NDarray @out = null, NDarr /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray minimum(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray minimum(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4466,7 +4466,7 @@ public static NDarray minimum(NDarray x2, NDarray x1, NDarray @out = null, NDarr /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray fmax(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray fmax(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4529,7 +4529,7 @@ public static NDarray fmax(NDarray x2, NDarray x1, NDarray @out = null, NDarray /// /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray fmin(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + public static NDarray fmin(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) { //auto-generated code, do not change var __self__=self; @@ -4579,7 +4579,7 @@ public static NDarray fmin(NDarray x2, NDarray x1, NDarray @out = null, NDarray /// If copy is False, this may /// be x itself. /// - public static NDarray nan_to_num(NDarray x, bool? copy = true) + public static NDarray nan_to_num(this NDarray x, bool? copy = true) { //auto-generated code, do not change var __self__=self; @@ -4618,7 +4618,7 @@ public static NDarray nan_to_num(NDarray x, bool? copy = true) /// If a /// has complex elements, the returned type is float. /// - public static NDarray real_if_close(NDarray a, float tol = 100) + public static NDarray real_if_close(this NDarray a, float tol = 100) { //auto-generated code, do not change var __self__=self; @@ -4675,7 +4675,7 @@ public static NDarray real_if_close(NDarray a, float tol = 100) /// /// The interpolated values, same shape as x. /// - public static float or complex (corresponding to fp) or ndarray interp(NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) + public static float or complex (corresponding to fp) or ndarray interp(this NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.other.gen.cs b/src/Numpy/np.other.gen.cs index 7ad2fa1..3e4fbdf 100644 --- a/src/Numpy/np.other.gen.cs +++ b/src/Numpy/np.other.gen.cs @@ -39,7 +39,7 @@ public static partial class np /// /// An array containing the roots of the polynomial. /// - public static NDarray roots(NDarray p) + public static NDarray roots(this NDarray p) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.padding.gen.cs b/src/Numpy/np.padding.gen.cs index f27ecf0..dd5083b 100644 --- a/src/Numpy/np.padding.gen.cs +++ b/src/Numpy/np.padding.gen.cs @@ -110,7 +110,7 @@ public static partial class np /// Padded array of rank equal to array with shape increased /// according to pad_width. /// - public static NDarray pad(NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) + public static NDarray pad(this NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.set.gen.cs b/src/Numpy/np.set.gen.cs index 3970eff..4620157 100644 --- a/src/Numpy/np.set.gen.cs +++ b/src/Numpy/np.set.gen.cs @@ -61,7 +61,7 @@ public static partial class np /// /// The values ar1[in1d] are in ar2. /// - public static NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) + public static NDarray in1d(this NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) { //auto-generated code, do not change var __self__=self; @@ -113,7 +113,7 @@ public static NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false /// The indices of the first occurrences of the common values in ar2. /// Only provided if return_indices is True. /// - public static (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) + public static (NDarray, NDarray, NDarray) intersect1d(this NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) { //auto-generated code, do not change var __self__=self; @@ -180,7 +180,7 @@ public static (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, /// The values element[isin] /// are in test_elements. /// - public static NDarray isin(NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) + public static NDarray isin(this NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) { //auto-generated code, do not change var __self__=self; @@ -217,7 +217,7 @@ public static NDarray isin(NDarray element, NDarray test_elements, bool? assume_ /// is sorted when assume_unique=False, but otherwise only sorted /// if the input is sorted. /// - public static NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = false) + public static NDarray setdiff1d(this NDarray ar1, NDarray ar2, bool assume_unique = false) { //auto-generated code, do not change var __self__=self; @@ -253,7 +253,7 @@ public static NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = f /// Sorted 1D array of unique values that are in only one of the input /// arrays. /// - public static NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = false) + public static NDarray setxor1d(this NDarray ar2, NDarray ar1, bool assume_unique = false) { //auto-generated code, do not change var __self__=self; @@ -285,7 +285,7 @@ public static NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = fa /// /// Unique, sorted union of the input arrays. /// - public static NDarray union1d(NDarray ar2, NDarray ar1) + public static NDarray union1d(this NDarray ar2, NDarray ar1) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.sorting.gen.cs b/src/Numpy/np.sorting.gen.cs index 88ef4a9..1cc4cf2 100644 --- a/src/Numpy/np.sorting.gen.cs +++ b/src/Numpy/np.sorting.gen.cs @@ -90,7 +90,7 @@ public static partial class np /// /// Array of the same type and shape as a. /// - public static NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) + public static NDarray sort(this NDarray a, int? axis = -1, string kind = "quicksort", string order = null) { //auto-generated code, do not change var __self__=self; @@ -133,7 +133,7 @@ public static NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", /// /// Array of indices that sort the keys along the specified axis. /// - public static NDarray lexsort(NDarray keys, int? axis = -1) + public static NDarray lexsort(this NDarray keys, int? axis = -1) { //auto-generated code, do not change var __self__=self; @@ -191,7 +191,7 @@ public static NDarray lexsort(NDarray keys, int? axis = -1) /// More generally, np.take_along_axis(a, index_array, axis=a) always /// yields the sorted a, irrespective of dimensionality. /// - public static NDarray argsort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) + public static NDarray argsort(this NDarray a, int? axis = -1, string kind = "quicksort", string order = null) { //auto-generated code, do not change var __self__=self; @@ -258,7 +258,7 @@ public static void sort(int? axis = -1, string kind = null, string order = null) /// /// Array of the same type and shape as a. /// - public static NDarray msort(NDarray a) + public static NDarray msort(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -280,7 +280,7 @@ public static NDarray msort(NDarray a) /// /// Always returns a sorted complex array. /// - public static NDarray sort_complex(NDarray a) + public static NDarray sort_complex(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -363,7 +363,7 @@ public static NDarray sort_complex(NDarray a) /// /// Array of the same type and shape as a. /// - public static NDarray partition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) + public static NDarray partition(this NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) { //auto-generated code, do not change var __self__=self; @@ -431,7 +431,7 @@ public static NDarray partition(NDarray a, int[] kth, int? axis = -1, string kin /// More generally, np.take_along_axis(a, index_array, axis=a) always /// yields the partitioned a, irrespective of dimensionality. /// - public static NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) + public static NDarray argpartition(this NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) { //auto-generated code, do not change var __self__=self; @@ -473,7 +473,7 @@ public static NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string /// It has the same shape as a.shape /// with the dimension along axis removed. /// - public static NDarray argmax(NDarray a, int? axis = null, NDarray @out = null) + public static NDarray argmax(this NDarray a, int? axis = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -505,7 +505,7 @@ public static NDarray argmax(NDarray a, int? axis = null, NDarray @out = null) /// /// An array of indices or a single index value. /// - public static NDarray nanargmax(NDarray a, int? axis = null) + public static NDarray nanargmax(this NDarray a, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -544,7 +544,7 @@ public static NDarray nanargmax(NDarray a, int? axis = null) /// It has the same shape as a.shape /// with the dimension along axis removed. /// - public static NDarray argmin(NDarray a, int? axis = null, NDarray @out = null) + public static NDarray argmin(this NDarray a, int? axis = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -576,7 +576,7 @@ public static NDarray argmin(NDarray a, int? axis = null, NDarray @out = null) /// /// An array of indices or a single index value. /// - public static NDarray nanargmin(NDarray a, int? axis = null) + public static NDarray nanargmin(this NDarray a, int? axis = null) { //auto-generated code, do not change var __self__=self; @@ -608,7 +608,7 @@ public static NDarray nanargmin(NDarray a, int? axis = null) /// Indices of elements that are non-zero.

/// Indices are grouped by element. /// - public static NDarray argwhere(NDarray a) + public static NDarray argwhere(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -633,7 +633,7 @@ public static NDarray argwhere(NDarray a) /// Output array, containing the indices of the elements of a.ravel() /// that are non-zero. /// - public static NDarray flatnonzero(NDarray a) + public static NDarray flatnonzero(this NDarray a) { //auto-generated code, do not change var __self__=self; @@ -691,7 +691,7 @@ public static NDarray flatnonzero(NDarray a) /// /// Array of insertion points with the same shape as v. /// - public static NDarray searchsorted(NDarray a, NDarray v, string side = "left", NDarray sorter = null) + public static NDarray searchsorted(this NDarray a, NDarray v, string side = "left", NDarray sorter = null) { //auto-generated code, do not change var __self__=self; @@ -726,7 +726,7 @@ public static NDarray searchsorted(NDarray a, NDarray v, string side = "lef /// /// Rank 1 array of values from arr where condition is True. /// - public static NDarray extract(NDarray condition, NDarray arr) + public static NDarray extract(this NDarray condition, NDarray arr) { //auto-generated code, do not change var __self__=self; @@ -769,7 +769,7 @@ public static NDarray extract(NDarray condition, NDarray arr) /// Otherwise, the total number of non-zero values in the array /// is returned. /// - public static NDarray count_nonzero(NDarray a, Axis axis) + public static NDarray count_nonzero(this NDarray a, Axis axis) { //auto-generated code, do not change var __self__=self; @@ -806,7 +806,7 @@ public static NDarray count_nonzero(NDarray a, Axis axis) /// Otherwise, the total number of non-zero values in the array /// is returned. /// - public static int count_nonzero(NDarray a) + public static int count_nonzero(this NDarray a) { //auto-generated code, do not change var __self__=self; diff --git a/src/Numpy/np.staticstics.gen.cs b/src/Numpy/np.staticstics.gen.cs index 94b0410..eac91eb 100644 --- a/src/Numpy/np.staticstics.gen.cs +++ b/src/Numpy/np.staticstics.gen.cs @@ -77,7 +77,7 @@ public static partial class np /// If axis is given, the result is an array of dimension /// a.ndim - 1. /// - public static NDarray amin(NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + public static NDarray amin(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) { //auto-generated code, do not change var __self__=self; @@ -152,7 +152,7 @@ public static NDarray amin(NDarray a, Axis axis = null, NDarray @out = null, boo /// If axis is given, the result is an array of dimension /// a.ndim - 1. /// - public static NDarray amax(NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + public static NDarray amax(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) { //auto-generated code, do not change var __self__=self; @@ -224,7 +224,7 @@ public static NDarray amax(NDarray a, Axis axis = null, NDarray @out = null, boo /// scalar is returned.

/// The same dtype as a is returned. /// - public static NDarray nanmin(NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) + public static NDarray nanmin(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -295,7 +295,7 @@ public static NDarray nanmin(NDarray a, Axis axis = null, NDarray @out = null, b /// returned.

/// The same dtype as a is returned. /// - public static NDarray nanmax(NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) + public static NDarray nanmax(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -352,7 +352,7 @@ public static NDarray nanmax(NDarray a, Axis axis = null, NDarray @out = null, b /// A new array holding the result, unless out was /// specified, in which case a reference to out is returned. /// - public static NDarray ptp(NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) + public static NDarray ptp(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -436,7 +436,7 @@ public static NDarray ptp(NDarray a, Axis axis = null, NDarray @out = null, bool /// If out is specified, that array is /// returned instead. /// - public static NDarray percentile(NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) + public static NDarray percentile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) { //auto-generated code, do not change var __self__=self; @@ -511,7 +511,7 @@ public static NDarray percentile(NDarray a, NDarray q, Axis axis, /// If out is specified, that array is /// returned instead. /// - public static double percentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + public static double percentile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") { //auto-generated code, do not change var __self__=self; @@ -605,7 +605,7 @@ public static double percentile(NDarray a, NDarray q, NDarray @out = null /// If out is specified, that array is /// returned instead. /// - public static NDarray nanpercentile(NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) + public static NDarray nanpercentile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -682,7 +682,7 @@ public static NDarray nanpercentile(NDarray a, NDarray q, Axis ax /// If out is specified, that array is /// returned instead. /// - public static double nanpercentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + public static double nanpercentile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") { //auto-generated code, do not change var __self__=self; @@ -767,7 +767,7 @@ public static double nanpercentile(NDarray a, NDarray q, NDarray @out = n /// If out is specified, that array is /// returned instead. /// - public static NDarray quantile(NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) + public static NDarray quantile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) { //auto-generated code, do not change var __self__=self; @@ -842,7 +842,7 @@ public static NDarray quantile(NDarray a, NDarray q, Axis axis, N /// If out is specified, that array is /// returned instead. /// - public static double quantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + public static double quantile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") { //auto-generated code, do not change var __self__=self; @@ -925,7 +925,7 @@ public static double quantile(NDarray a, NDarray q, NDarray @out = null, /// If out is specified, that array is /// returned instead. /// - public static NDarray nanquantile(NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) + public static NDarray nanquantile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -991,7 +991,7 @@ public static NDarray nanquantile(NDarray a, NDarray q, Axis axis /// If out is specified, that array is /// returned instead. /// - public static double nanquantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + public static double nanquantile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") { //auto-generated code, do not change var __self__=self; @@ -1065,7 +1065,7 @@ public static double nanquantile(NDarray a, NDarray q, NDarray @out = nul /// If out is specified, that array is /// returned instead. /// - public static NDarray median(NDarray a, Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) + public static NDarray median(this NDarray a, Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) { //auto-generated code, do not change var __self__=self; @@ -1126,7 +1126,7 @@ public static NDarray median(NDarray a, Axis axis, NDarray @out = null, /// If out is specified, that array is /// returned instead. /// - public static double median(NDarray a, NDarray @out = null, bool? overwrite_input = false) + public static double median(this NDarray a, NDarray @out = null, bool? overwrite_input = false) { //auto-generated code, do not change var __self__=self; @@ -1197,7 +1197,7 @@ public static double median(NDarray a, NDarray @out = null, bool? overwrite_inpu /// integral, the previous rules still applies but the result dtype will /// at least be float64. /// - public static NDarray average(NDarray a, Axis axis, NDarray weights = null, bool? returned = false) + public static NDarray average(this NDarray a, Axis axis, NDarray weights = null, bool? returned = false) { //auto-generated code, do not change var __self__=self; @@ -1258,7 +1258,7 @@ public static NDarray average(NDarray a, Axis axis, NDarray weights = nu /// integral, the previous rules still applies but the result dtype will /// at least be float64. /// - public static double average(NDarray a, NDarray weights = null, bool? returned = false) + public static double average(this NDarray a, NDarray weights = null, bool? returned = false) { //auto-generated code, do not change var __self__=self; @@ -1342,7 +1342,7 @@ public static double average(NDarray a, NDarray weights = null, bool? returned = /// If out=None, returns a new array containing the mean values, /// otherwise a reference to the output array is returned. /// - public static NDarray mean(NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + public static NDarray mean(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -1407,7 +1407,7 @@ public static NDarray mean(NDarray a, Axis axis, Dtype dtype = null, NDa /// If out=None, returns a new array containing the mean values, /// otherwise a reference to the output array is returned. /// - public static double mean(NDarray a, Dtype dtype = null, NDarray @out = null) + public static double mean(this NDarray a, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -1507,7 +1507,7 @@ public static double mean(NDarray a, Dtype dtype = null, NDarray @out = null) /// If out is None, return a new array containing the standard deviation, /// otherwise return a reference to the output array. /// - public static NDarray std(NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + public static NDarray std(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -1589,7 +1589,7 @@ public static NDarray std(NDarray a, Axis axis, Dtype dtype = null, NDar /// If out is None, return a new array containing the standard deviation, /// otherwise return a reference to the output array. /// - public static double std(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + public static double std(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) { //auto-generated code, do not change var __self__=self; @@ -1687,7 +1687,7 @@ public static double std(NDarray a, Dtype dtype = null, NDarray @out = null, int /// If out=None, returns a new array containing the variance; /// otherwise, a reference to the output array is returned. /// - public static NDarray @var(NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + public static NDarray @var(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -1766,7 +1766,7 @@ public static NDarray @var(NDarray a, Axis axis, Dtype dtype = null, NDa /// If out=None, returns a new array containing the variance; /// otherwise, a reference to the output array is returned. /// - public static double @var(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + public static double @var(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) { //auto-generated code, do not change var __self__=self; @@ -1846,7 +1846,7 @@ public static double @var(NDarray a, Dtype dtype = null, NDarray @out = null, in /// If out is specified, that array is /// returned instead. /// - public static NDarray nanmedian(NDarray a, Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) + public static NDarray nanmedian(this NDarray a, Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -1907,7 +1907,7 @@ public static NDarray nanmedian(NDarray a, Axis axis, NDarray @out = nul /// If out is specified, that array is /// returned instead. /// - public static double nanmedian(NDarray a, NDarray @out = null, bool? overwrite_input = false) + public static double nanmedian(this NDarray a, NDarray @out = null, bool? overwrite_input = false) { //auto-generated code, do not change var __self__=self; @@ -1987,7 +1987,7 @@ public static double nanmedian(NDarray a, NDarray @out = null, bool? overwrite_i /// Nan is /// returned for slices that contain only NaNs. /// - public static NDarray nanmean(NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + public static NDarray nanmean(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -2052,7 +2052,7 @@ public static NDarray nanmean(NDarray a, Axis axis, Dtype dtype = null, /// Nan is /// returned for slices that contain only NaNs. /// - public static double nanmean(NDarray a, Dtype dtype = null, NDarray @out = null) + public static double nanmean(this NDarray a, Dtype dtype = null, NDarray @out = null) { //auto-generated code, do not change var __self__=self; @@ -2156,7 +2156,7 @@ public static double nanmean(NDarray a, Dtype dtype = null, NDarray @out = null) /// ddof is >= the number of non-NaN elements in a slice or the slice /// contains only NaNs, then the result for that slice is NaN. /// - public static NDarray nanstd(NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + public static NDarray nanstd(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -2246,7 +2246,7 @@ public static NDarray nanstd(NDarray a, Axis axis, Dtype dtype = null, N /// ddof is >= the number of non-NaN elements in a slice or the slice /// contains only NaNs, then the result for that slice is NaN. /// - public static double nanstd(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + public static double nanstd(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) { //auto-generated code, do not change var __self__=self; @@ -2343,7 +2343,7 @@ public static double nanstd(NDarray a, Dtype dtype = null, NDarray @out = null, /// number of non-NaN elements in a slice or the slice contains only /// NaNs, then the result for that slice is NaN. /// - public static NDarray nanvar(NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + public static NDarray nanvar(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) { //auto-generated code, do not change var __self__=self; @@ -2431,7 +2431,7 @@ public static NDarray nanvar(NDarray a, Axis axis, Dtype dtype = null, N /// number of non-NaN elements in a slice or the slice contains only /// NaNs, then the result for that slice is NaN. /// - public static double nanvar(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + public static double nanvar(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) { //auto-generated code, do not change var __self__=self; @@ -2495,7 +2495,7 @@ public static double nanvar(NDarray a, Dtype dtype = null, NDarray @out = null, /// /// The correlation coefficient matrix of the variables. /// - public static NDarray corrcoef(NDarray x, NDarray y = null, bool? rowvar = true) + public static NDarray corrcoef(this NDarray x, NDarray y = null, bool? rowvar = true) { //auto-generated code, do not change var __self__=self; @@ -2541,7 +2541,7 @@ public static NDarray corrcoef(NDarray x, NDarray y = null, bool? rowvar = true) /// /// Discrete cross-correlation of a and v. /// - public static NDarray correlate(NDarray v, NDarray a, string mode = "valid") + public static NDarray correlate(this NDarray v, NDarray a, string mode = "valid") { //auto-generated code, do not change var __self__=self; @@ -2630,7 +2630,7 @@ public static NDarray correlate(NDarray v, NDarray a, string mode = "valid") /// /// The covariance matrix of the variables. /// - public static NDarray cov(NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) + public static NDarray cov(this NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) { //auto-generated code, do not change var __self__=self; @@ -2725,7 +2725,7 @@ public static NDarray cov(NDarray m, NDarray y = null, bool? rowvar = true, bool /// bin_edges /// Return the bin edges (length(hist)+1). /// - public static (NDarray, NDarray) histogram(NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) + public static (NDarray, NDarray) histogram(this NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) { //auto-generated code, do not change var __self__=self; @@ -2819,7 +2819,7 @@ public static (NDarray, NDarray) histogram(NDarray a, int? bins = null, (float, /// bin_edges /// Return the bin edges (length(hist)+1). /// - public static (NDarray, NDarray) histogram(NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) + public static (NDarray, NDarray) histogram(this NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) { //auto-generated code, do not change var __self__=self; @@ -2913,7 +2913,7 @@ public static (NDarray, NDarray) histogram(NDarray a, NDarray bins = null, (floa /// bin_edges /// Return the bin edges (length(hist)+1). /// - public static (NDarray, NDarray) histogram(NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) + public static (NDarray, NDarray) histogram(this NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) { //auto-generated code, do not change var __self__=self; @@ -2997,7 +2997,7 @@ public static (NDarray, NDarray) histogram(NDarray a, List bins = null, /// yedges /// The bin edges along the second dimension. /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + public static (NDarray, NDarray, NDarray) histogram2d(this NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3082,7 +3082,7 @@ public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, int? /// yedges /// The bin edges along the second dimension. /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + public static (NDarray, NDarray, NDarray) histogram2d(this NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3167,7 +3167,7 @@ public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, NDar /// yedges /// The bin edges along the second dimension. /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + public static (NDarray, NDarray, NDarray) histogram2d(this NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3237,7 +3237,7 @@ public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, List /// edges /// A list of D arrays describing the bin edges for each dimension. /// - public static (NDarray, NDarray) histogramdd(NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + public static (NDarray, NDarray) histogramdd(this NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3306,7 +3306,7 @@ public static (NDarray, NDarray) histogramdd(NDarray sample, int? bins = null, ( /// edges /// A list of D arrays describing the bin edges for each dimension. /// - public static (NDarray, NDarray) histogramdd(NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + public static (NDarray, NDarray) histogramdd(this NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3375,7 +3375,7 @@ public static (NDarray, NDarray) histogramdd(NDarray sample, NDarray bins = null /// edges /// A list of D arrays describing the bin edges for each dimension. /// - public static (NDarray, NDarray) histogramdd(NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + public static (NDarray, NDarray) histogramdd(this NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3423,7 +3423,7 @@ public static (NDarray, NDarray) histogramdd(NDarray sample, List bins = /// /// The length of out is equal to np.amax(x)+1. /// - public static NDarray bincount(NDarray x, NDarray weights = null, int? minlength = 0) + public static NDarray bincount(this NDarray x, NDarray weights = null, int? minlength = 0) { //auto-generated code, do not change var __self__=self; @@ -3508,7 +3508,7 @@ public static NDarray bincount(NDarray x, NDarray weights = null, int? minlength /// /// The edges to pass into histogram /// - public static NDarray histogram_bin_edges(NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) + public static NDarray histogram_bin_edges(this NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3594,7 +3594,7 @@ public static NDarray histogram_bin_edges(NDarray a, int? bins = null, (f /// /// The edges to pass into histogram /// - public static NDarray histogram_bin_edges(NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) + public static NDarray histogram_bin_edges(this NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3680,7 +3680,7 @@ public static NDarray histogram_bin_edges(NDarray a, NDarray bins = null, /// /// The edges to pass into histogram /// - public static NDarray histogram_bin_edges(NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) + public static NDarray histogram_bin_edges(this NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) { //auto-generated code, do not change var __self__=self; @@ -3744,7 +3744,7 @@ public static NDarray histogram_bin_edges(NDarray a, List bins = /// /// Output array of indices, of same shape as x. /// - public static NDarray digitize(NDarray x, NDarray bins, bool? right = false) + public static NDarray digitize(this NDarray x, NDarray bins, bool? right = false) { //auto-generated code, do not change var __self__=self; diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index ab7502e..4fca875 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -1001,6 +1001,7 @@ public async Task IssueByMartinDevans() var b = np.split(x, 3).repr(); var a = "(array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]))"; Assert.AreEqual(a, b); + Assert.AreEqual(a, x.split(3, axis: -1).repr()); //>>> x = np.arange(8.0) //>>> np.split(x, [3, 5, 6, 10]) //[array([0., 1., 2.]), @@ -1012,6 +1013,7 @@ public async Task IssueByMartinDevans() b = np.split(x, new[] { 3, 5, 6, 10 }).repr(); a = "(array([0, 1, 2]), array([3, 4]), array([5]), array([6, 7]), array([], dtype=int32))"; Assert.AreEqual(a, b); + Assert.AreEqual(a, x.split(new[] { 3, 5, 6, 10 }).repr()); } // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools From e1d7094bee8c226690776169c4b3e3a8ce8e6ac6 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 11 Feb 2023 19:08:39 +0100 Subject: [PATCH 07/17] v1.33 --- src/ReleaseBot/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ReleaseBot/Program.cs b/src/ReleaseBot/Program.cs index f394ab7..7d25aeb 100644 --- a/src/ReleaseBot/Program.cs +++ b/src/ReleaseBot/Program.cs @@ -13,7 +13,7 @@ namespace ReleaseBot { class Program { - private const string V = "1.32"; // <--- numpy.net version! + private const string V = "1.33"; // <--- numpy.net version! private const string PythonNetVersion = "3.0.1"; private const string PythonVersion = "3.11"; // relevant only for Numpy with included binaries private const string NumpyVersion = "1.23.5"; From f1f8e84638d12537924fe4c634c69d8164c50bb2 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Tue, 14 Feb 2023 21:51:43 +0100 Subject: [PATCH 08/17] Add float16 workaround test case (#115) --- src/Numpy/Manual/np.array.cs | 1 + test/Numpy.UnitTest/NumpyTest.cs | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Numpy/Manual/np.array.cs b/src/Numpy/Manual/np.array.cs index c0388ff..b4348b6 100644 --- a/src/Numpy/Manual/np.array.cs +++ b/src/Numpy/Manual/np.array.cs @@ -62,6 +62,7 @@ public static NDarray array(T[] @object, Dtype dtype = null, bool? copy = case short[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; case int[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; case long[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; + //case Half[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; case float[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; case double[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; case bool[] a: diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 4fca875..d7d616e 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Drawing; using System.IO; @@ -1016,6 +1016,36 @@ public async Task IssueByMartinDevans() Assert.AreEqual(a, x.split(new[] { 3, 5, 6, 10 }).repr()); } + + [TestMethod] + public async Task F16Workaround() + { + // use byte array to create float16 array + + // numbers in float16: + // 0 01111 0000000000 = 2^0 * (1 + 0/1024) = 1 + // 1 01111 0000000000 = -1 * 2 ^ 0 * (1 + 0 / 1024) = -1 + // 0 11110 1111111111 = -1^(0) * 2^(15) * (1 + 1023/1024) ≈ 65504 + // see: https://devblogs.microsoft.com/dotnet/introducing-the-half-type/ + + // these bytes in binary notation correspond to f16 numbers 1, -1 and 65504 (float16 max value) + // note, the bytes are in reversed order to the bits shown above + var bytes = new byte[] { + 0b00000000, 0b00111100, // 1 + 0b00000000, 0b10111100, // -1 + 0b11111111, 0b01111011, // 65504 + }; + var floats = np.zeros(new Shape(3), np.float16); + Console.WriteLine(floats.repr); + // note, the using prevents a mem-leak with ctypes + using (var ctypes = floats.PyObject.ctypes) { + long ptr = ctypes.data; + Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); + } + Console.WriteLine(floats.repr); + Assert.AreEqual("array([ 1.00e+00, -1.00e+00, 6.55e+04], dtype=float16)", floats.repr); + } + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs From bb3666716a3679060ca8e8622195aec8cd9063d4 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Mon, 20 Mar 2023 14:37:43 +0100 Subject: [PATCH 09/17] Proof that fft2 works. (#117) --- test/Numpy.UnitTest/NumpyTest.cs | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index d7d616e..4d43850 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -1046,6 +1046,53 @@ public async Task F16Workaround() Assert.AreEqual("array([ 1.00e+00, -1.00e+00, 6.55e+04], dtype=float16)", floats.repr); } + + [TestMethod] + public async Task IssueByTimiil() + { + //>>> img = np.arange(27).reshape(3, 3, 3) + //>>> img + //array([[[0, 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]]]) + //>>> fft_img = np.fft.fft2(img) + //>>> fft_img = np.fft.fftshift(fft_img) + //>>> fft_img + //array([[[0. + 0.j, -13.5 - 7.79422863j, 0. + 0.j], + // [ -4.5 - 2.59807621j, 198. + 0.j , -4.5 + 2.59807621j], + // [ 0. + 0.j , -13.5 + 7.79422863j, 0. + 0.j ]], + + // [[ 0. + 0.j , -13.5 - 7.79422863j, 0. + 0.j ], + // [ -4.5 - 2.59807621j, 36. + 0.j , -4.5 + 2.59807621j], + // [ 0. + 0.j , -13.5 + 7.79422863j, 0. + 0.j ]], + + // [[ 0. + 0.j , -13.5 - 7.79422863j, 0. + 0.j ], + // [ -4.5 - 2.59807621j, 117. + 0.j , -4.5 + 2.59807621j], + // [ 0. + 0.j , -13.5 + 7.79422863j, 0. + 0.j ]]]) + var img = np.arange(27).reshape(3, 3, 3); + var fft_img = np.fft.fft2(img); + fft_img = np.fft.fftshift(fft_img); + Console.WriteLine(fft_img.repr); + Assert.AreEqual(@"array([[[ 0. +0.j , -13.5-7.79422863j, 0. +0.j ], + [ -4.5-2.59807621j, 198. +0.j , -4.5+2.59807621j], + [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]], + + [[ 0. +0.j , -13.5-7.79422863j, 0. +0.j ], + [ -4.5-2.59807621j, 36. +0.j , -4.5+2.59807621j], + [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]], + + [[ 0. +0.j , -13.5-7.79422863j, 0. +0.j ], + [ -4.5-2.59807621j, 117. +0.j , -4.5+2.59807621j], + [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]]])".Replace("\r", ""), fft_img.repr); + } // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs From b416875891a4fd8f45b8ac45979fd8a61a51251d Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 22 Apr 2023 20:03:54 +0200 Subject: [PATCH 10/17] Numpy.Bare: Upgrade Pythonnet to v3.0.1 --- src/Numpy.Bare/Numpy.Bare.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Numpy.Bare/Numpy.Bare.csproj b/src/Numpy.Bare/Numpy.Bare.csproj index e0f2068..b1c5c8f 100644 --- a/src/Numpy.Bare/Numpy.Bare.csproj +++ b/src/Numpy.Bare/Numpy.Bare.csproj @@ -14,7 +14,7 @@ https://github.com/SciSharp/Numpy.NET Data science, Machine Learning, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 3.7.1.28 + 3.11.1.33 https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true 3.7.1.4 @@ -86,8 +86,8 @@ - - + + From c6391ca9498da887e6efe347bd770b3fb659a7b2 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 22 Jun 2024 20:01:36 +0200 Subject: [PATCH 11/17] Demonstrate use of `np.where` #128 --- test/Numpy.UnitTest/NumpyTest.cs | 60 ++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 4d43850..bd4f947 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -351,14 +351,14 @@ public void ndarray_masking1() " [[15, 16, 17, 18, 19],\n" + " [20, 21, 22, 23, 24],\n" + " [25, 26, 27, 28, 29]]])", - x.repr); + x.repr); var b = np.array(new[,] { { true, true, false }, { false, true, true } }); Assert.AreEqual( "array([[ 0, 1, 2, 3, 4],\n" + " [ 5, 6, 7, 8, 9],\n" + " [20, 21, 22, 23, 24],\n" + " [25, 26, 27, 28, 29]])", - x[b].repr); + x[b].repr); } [TestMethod] @@ -641,12 +641,11 @@ public void ComplexNumbers() public void IssueByXlient() { var points = new Point[] { new Point(0, 0), new Point(17, 4), new Point(2, 22), new Point(10, 7), }; - int[,] Pts = new int[,] - { - {points[0].X, points[0].Y }, - {points[1].X, points[1].Y }, - {points[2].X, points[2].Y } , - {points[3].X, points[3].Y } + int[,] Pts = new int[,] { + { points[0].X, points[0].Y }, + { points[1].X, points[1].Y }, + { points[2].X, points[2].Y }, + { points[3].X, points[3].Y } }; // exception here / deadlock @@ -674,7 +673,7 @@ public void IssueByVolgaone() Assert.AreEqual("1,2,3", string.Join(",", row0Data)); var col1 = n[":,1"]; //extract 1st column - NDarray is [2 5 8] as expected Assert.AreEqual("array([2., 5., 8.], dtype=float32)", col1.repr); - var col1Data = col1.GetData();//this is wrong - {2,3,4} + var col1Data = col1.GetData(); //this is wrong - {2,3,4} Assert.AreEqual("2,5,8", string.Join(",", col1Data)); } @@ -951,8 +950,8 @@ public async Task IssueByMrCOrrupted() np.savez_compressed(filename, null, arrays); var archive = np.load(filename); Console.WriteLine(archive.repr); - var a = new NDarray( archive.PyObject["a"]); - var b = new NDarray( archive.PyObject["b"]); + var a = new NDarray(archive.PyObject["a"]); + var b = new NDarray(archive.PyObject["b"]); Console.WriteLine(a.repr); Console.WriteLine(b.repr); Assert.AreEqual("array([[0, 1, 2],\n [3, 4, 5]])", a.repr); @@ -962,8 +961,8 @@ public async Task IssueByMrCOrrupted() [TestMethod] public async Task AsscalarRemovedInNumpyV1_23() { - Assert.AreEqual(143, new NDarray(new int[]{143}).asscalar()); - Assert.AreEqual(143d, new NDarray(new [] { 143d }).asscalar()); + Assert.AreEqual(143, new NDarray(new int[] { 143 }).asscalar()); + Assert.AreEqual(143d, new NDarray(new[] { 143d }).asscalar()); Assert.AreEqual(143d, new NDarray(new[] { 143d }).item()); } @@ -972,7 +971,7 @@ public async Task IssueByMaLichtenegger() { // byte array als uint32 array var bytes = new byte[] { 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0 }; - var uints =np.zeros(new Shape(3), np.uint32); + var uints = np.zeros(new Shape(3), np.uint32); Console.WriteLine(uints.repr); var ctypes = uints.PyObject.ctypes; long ptr = ctypes.data; @@ -1030,7 +1029,7 @@ public async Task F16Workaround() // these bytes in binary notation correspond to f16 numbers 1, -1 and 65504 (float16 max value) // note, the bytes are in reversed order to the bits shown above - var bytes = new byte[] { + var bytes = new byte[] { 0b00000000, 0b00111100, // 1 0b00000000, 0b10111100, // -1 0b11111111, 0b01111011, // 65504 @@ -1038,7 +1037,7 @@ public async Task F16Workaround() var floats = np.zeros(new Shape(3), np.float16); Console.WriteLine(floats.repr); // note, the using prevents a mem-leak with ctypes - using (var ctypes = floats.PyObject.ctypes) { + using (var ctypes = floats.PyObject.ctypes) { long ptr = ctypes.data; Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); } @@ -1093,8 +1092,31 @@ public async Task IssueByTimiil() [ -4.5-2.59807621j, 117. +0.j , -4.5+2.59807621j], [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]]])".Replace("\r", ""), fft_img.repr); } - // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools - // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays - // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs + + [TestMethod] + public void IssueByPandath() + { + //>>> grid = np.array([[1, 2, 3, 0, 0, 4], [5, 6, 7, 0, 0, 8]]) + //>>> xs, ys = np.where(grid == 0) + //>>> xs + //array([0, 0, 1, 1], dtype = int64) + //>>> ys + //array([3, 4, 3, 4], dtype = int64) + + var grid = np.array(new[,] {{ 1, 2, 3, 0, 0, 4 }, { 5, 6, 7, 0, 0, 8 } }); + var result = np.where(grid.equals(0)); + Console.WriteLine(result[0].repr); + Console.WriteLine(result[1].repr); + Assert.AreEqual("array([0, 0, 1, 1], dtype=int64)", result[0].repr); + Assert.AreEqual("array([3, 4, 3, 4], dtype=int64)", result[1].repr); + } } + + + + + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs + } From 2751553b4ddc49702e6aa79ef00f657d0a609b72 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sun, 1 Sep 2024 10:58:14 +0200 Subject: [PATCH 12/17] Fix boolean operators & | and ^ between NDarrays (#129) --- src/Numpy/Models/NDarray.Operators.cs | 24 ++++++++++++++++++++++++ test/Numpy.UnitTest/NumpyTest.cs | 19 ++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/Numpy/Models/NDarray.Operators.cs b/src/Numpy/Models/NDarray.Operators.cs index ad67654..b54d4e7 100644 --- a/src/Numpy/Models/NDarray.Operators.cs +++ b/src/Numpy/Models/NDarray.Operators.cs @@ -289,6 +289,14 @@ public NDarray pow(ValueType obj) return new NDarray(a.self.InvokeMethod("__and__", obj.ToPython())); } + /// + /// Return self&value. + /// + public static NDarray operator &(NDarray a, NDarray b) + { + return new NDarray(a.self.InvokeMethod("__and__", b.self)); + } + /// /// Return self|value. /// @@ -297,6 +305,14 @@ public NDarray pow(ValueType obj) return new NDarray(a.self.InvokeMethod("__or__", obj.ToPython())); } + /// + /// Return self|value. + /// + public static NDarray operator |(NDarray a, NDarray b) + { + return new NDarray(a.self.InvokeMethod("__or__", b.self)); + } + /// /// Return self^value. /// @@ -305,6 +321,14 @@ public NDarray pow(ValueType obj) return new NDarray(a.self.InvokeMethod("__xor__", obj.ToPython())); } + /// + /// Return self^value. + /// + public static NDarray operator ^(NDarray a, NDarray b) + { + return new NDarray(a.self.InvokeMethod("__xor__", b.self)); + } + //------------------------------ // Arithmetic, in-place: //------------------------------ diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index bd4f947..13eb64d 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -1103,13 +1103,30 @@ public void IssueByPandath() //>>> ys //array([3, 4, 3, 4], dtype = int64) - var grid = np.array(new[,] {{ 1, 2, 3, 0, 0, 4 }, { 5, 6, 7, 0, 0, 8 } }); + var grid = np.array(new[,] { { 1, 2, 3, 0, 0, 4 }, { 5, 6, 7, 0, 0, 8 } }); var result = np.where(grid.equals(0)); Console.WriteLine(result[0].repr); Console.WriteLine(result[1].repr); Assert.AreEqual("array([0, 0, 1, 1], dtype=int64)", result[0].repr); Assert.AreEqual("array([3, 4, 3, 4], dtype=int64)", result[1].repr); } + + [TestMethod] + public void IssueByXiaozhu1988() + { + //>>> data = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) + //>>> (data >= 50) & (data < 100) + //array([False, False, False, False, True, True, True, True, True, + // False, False, False]) + + var data = np.array(new[] { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 }); + Console.WriteLine(((data >= 50) & (data < 100)).repr); + Assert.AreEqual("array([False, False, False, False, True, True, True, True, True,\n False, False, False])", ((data >= 50) & (data < 100)).repr); + Console.WriteLine(((data >= 50) | (data < 100)).repr); + Assert.AreEqual("array([ True, True, True, True, True, True, True, True, True,\n True, True, True])", ((data >= 50) | (data < 100)).repr); + Console.WriteLine(((data >= 50) ^ (data < 100)).repr); + Assert.AreEqual("array([ True, True, True, True, False, False, False, False, False,\n True, True, True])", ((data >= 50) ^ (data < 100)).repr); + } } From 5955d0cfd79ccba5e82ddaf04eab8a95a6c51b68 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sun, 1 Sep 2024 11:12:33 +0200 Subject: [PATCH 13/17] v1.34 --- src/Numpy/Numpy.csproj | 2 +- src/ReleaseBot/Program.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Numpy/Numpy.csproj b/src/Numpy/Numpy.csproj index 0c95d06..09d19b5 100644 --- a/src/Numpy/Numpy.csproj +++ b/src/Numpy/Numpy.csproj @@ -14,7 +14,7 @@ https://github.com/SciSharp/Numpy.NET Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 3.11.1.33 + 3.11.1.34 https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true 3.10.0.0 3.10.0.0 diff --git a/src/ReleaseBot/Program.cs b/src/ReleaseBot/Program.cs index 7d25aeb..eee2d8d 100644 --- a/src/ReleaseBot/Program.cs +++ b/src/ReleaseBot/Program.cs @@ -13,7 +13,7 @@ namespace ReleaseBot { class Program { - private const string V = "1.33"; // <--- numpy.net version! + private const string V = "1.34"; // <--- numpy.net version! private const string PythonNetVersion = "3.0.1"; private const string PythonVersion = "3.11"; // relevant only for Numpy with included binaries private const string NumpyVersion = "1.23.5"; From 1bfe3300715aacdf139fa25993b3817555c3e8b3 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 22 Mar 2025 16:58:45 +0100 Subject: [PATCH 14/17] Implement np.interp --- src/Numpy/Manual/np.math.cs | 93 ++ test/Numpy.UnitTest/NumPy_math.tests.cs | 1529 +++++++++++------------ 2 files changed, 839 insertions(+), 783 deletions(-) diff --git a/src/Numpy/Manual/np.math.cs b/src/Numpy/Manual/np.math.cs index f19412e..9c75d80 100644 --- a/src/Numpy/Manual/np.math.cs +++ b/src/Numpy/Manual/np.math.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using System.Runtime.InteropServices; using System.Text; using Numpy; @@ -165,5 +166,97 @@ public static NDarray gradient(NDarray f, List varargs, int? edge_order return ToCsharp(py); } + /// + /// One-dimensional linear interpolation.

+ /// + /// Returns the one-dimensional piecewise linear interpolant to a function + /// with given discrete data points (xp, fp), evaluated at x.

+ /// + /// Notes + /// + /// Does not check that the x-coordinate sequence xp is increasing.

+ /// + /// If xp is not increasing, the results are nonsense.

+ /// + /// A simple check for increasing is: + ///
+ /// + /// The x-coordinates at which to evaluate the interpolated values. + /// + /// + /// The x-coordinates of the data points, must be increasing if argument + /// period is not specified.

+ /// Otherwise, xp is internally sorted after + /// normalizing the periodic boundaries with xp = xp % period. + /// + /// + /// The y-coordinates of the data points, same length as xp. + /// + /// + /// Value to return for x < xp[0], default is fp[0]. + /// + /// + /// Value to return for x > xp[-1], default is fp[-1]. + /// + /// + /// A period for the x-coordinates.

+ /// This parameter allows the proper + /// interpolation of angular x-coordinates.

+ /// Parameters left and right + /// are ignored if period is specified. + /// + /// + /// The interpolated values, same shape as x. + /// + public static NDarray interp(this NDarray x, IReadOnlyCollection xp, IReadOnlyCollection fp, float? left = null, float? right = null, float? period = null) + { + var __self__ = self; + var pyargs = ToTuple(new object[] + { + x, + xp, + fp, + }); + var kwargs = new PyDict(); + if (left != null) kwargs["left"] = ToPython(left); + if (right != null) kwargs["right"] = ToPython(right); + if (period != null) kwargs["period"] = ToPython(period); + dynamic py = __self__.InvokeMethod("interp", pyargs, kwargs); + return ToCsharp(py); + } + + public static float interp(float x, IReadOnlyCollection xp, IReadOnlyCollection fp, float? left = null, float? right = null, float? period = null) + { + var __self__ = self; + var pyargs = ToTuple(new object[] + { + x, + xp, + fp, + }); + var kwargs = new PyDict(); + if (left != null) kwargs["left"] = ToPython(left); + if (right != null) kwargs["right"] = ToPython(right); + if (period != null) kwargs["period"] = ToPython(period); + dynamic py = __self__.InvokeMethod("interp", pyargs, kwargs); + return ToCsharp(py); + } + + public static NDarray interp(this NDarray x, IReadOnlyCollection xp, Complex[] fp, Complex? left = null, Complex? right = null, float? period = null) + { + var __self__ = self; + var pyargs = ToTuple(new object[] + { + x, + xp, + np.array(fp), + }); + var kwargs = new PyDict(); + if (left != null) kwargs["left"] = ToPython(left); + if (right != null) kwargs["right"] = ToPython(right); + if (period != null) kwargs["period"] = ToPython(period); + dynamic py = __self__.InvokeMethod("interp", pyargs, kwargs); + return ToCsharp(py); + } } } diff --git a/test/Numpy.UnitTest/NumPy_math.tests.cs b/test/Numpy.UnitTest/NumPy_math.tests.cs index 44035ac..4dfad8b 100644 --- a/test/Numpy.UnitTest/NumPy_math.tests.cs +++ b/test/Numpy.UnitTest/NumPy_math.tests.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Numerics; using System.Runtime.InteropServices; using System.Text; using Numpy.Models; @@ -18,36 +19,36 @@ namespace Numpy.UnitTest [TestClass] public class NumPy_mathTest : BaseTestCase { - + [TestMethod] public void sinTest() { // Print sine of one angle: - + // >>> np.sin(np.pi/2.) // 1.0 // - - #if TODO + +#if TODO var given= np.sin(np.pi/2.); var expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Print sines of an array of angles given in degrees: - + // >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) // array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) // - - #if TODO + +#if TODO given= np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ); expected= "array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot the sine function: - + // >>> import matplotlib.pylab as plt // >>> x = np.linspace(-np.pi, np.pi, 201) // >>> plt.plot(x, np.sin(x)) @@ -56,8 +57,8 @@ public void sinTest() // >>> plt.axis('tight') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pylab as plt; given= x = np.linspace(-np.pi, np.pi, 201); given= plt.plot(x, np.sin(x)); @@ -65,10 +66,10 @@ public void sinTest() given= plt.ylabel('sin(x)'); given= plt.axis('tight'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void cosTest() { @@ -86,8 +87,8 @@ public void cosTest() // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO var given= np.cos(np.array({0, np.pi/2, np.pi})); var expected= "array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00])"; @@ -107,10 +108,10 @@ public void cosTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void tanTest() { @@ -130,8 +131,8 @@ public void tanTest() // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO var given= from math import pi; given= np.tan(np.array({-pi,pi/2,pi})); var expected= @@ -153,10 +154,10 @@ public void tanTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arcsinTest() { @@ -167,8 +168,8 @@ public void arcsinTest() // >>> np.arcsin(0) // 0.0 // - - #if TODO + +#if TODO var given= np.arcsin(1) # pi/2; var expected= "1.5707963267948966"; @@ -181,88 +182,88 @@ public void arcsinTest() expected= "0.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arccosTest() { // We expect the arccos of 1 to be 0, and of -1 to be pi: - + // >>> np.arccos([1, -1]) // array([ 0. , 3.14159265]) // - - #if TODO + +#if TODO var given= np.arccos({1, -1}); var expected= "array([ 0. , 3.14159265])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot arccos: - + // >>> import matplotlib.pyplot as plt // >>> x = np.linspace(-1, 1, num=100) // >>> plt.plot(x, np.arccos(x)) // >>> plt.axis('tight') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= x = np.linspace(-1, 1, num=100); given= plt.plot(x, np.arccos(x)); given= plt.axis('tight'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void arctanTest() { // We expect the arctan of 0 to be 0, and of 1 to be pi/4: - + // >>> np.arctan([0, 1]) // array([ 0. , 0.78539816]) // - - #if TODO + +#if TODO var given= np.arctan({0, 1}); var expected= "array([ 0. , 0.78539816])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.pi/4 // 0.78539816339744828 // - - #if TODO + +#if TODO given= np.pi/4; expected= "0.78539816339744828"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot arctan: - + // >>> import matplotlib.pyplot as plt // >>> x = np.linspace(-10, 10) // >>> plt.plot(x, np.arctan(x)) // >>> plt.axis('tight') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= x = np.linspace(-10, 10); given= plt.plot(x, np.arctan(x)); given= plt.axis('tight'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void hypotTest() { @@ -271,64 +272,64 @@ public void hypotTest() // [ 5., 5., 5.], // [ 5., 5., 5.]]) // - - #if TODO + +#if TODO var given= np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))); var expected= "array([[ 5., 5., 5.],\n" + " [ 5., 5., 5.],\n" + " [ 5., 5., 5.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Example showing broadcast of scalar_like argument: - + // >>> np.hypot(3*np.ones((3, 3)), [4]) // array([[ 5., 5., 5.], // [ 5., 5., 5.], // [ 5., 5., 5.]]) // - - #if TODO + +#if TODO given= np.hypot(3*np.ones((3, 3)), {4}); expected= "array([[ 5., 5., 5.],\n" + " [ 5., 5., 5.],\n" + " [ 5., 5., 5.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arctan2Test() { // Consider four points in different quadrants: - + // >>> x = np.array([-1, +1, +1, -1]) // >>> y = np.array([-1, -1, +1, +1]) // >>> np.arctan2(y, x) * 180 / np.pi // array([-135., -45., 45., 135.]) // - - #if TODO + +#if TODO var given= x = np.array({-1, +1, +1, -1}); given= y = np.array({-1, -1, +1, +1}); given= np.arctan2(y, x) * 180 / np.pi; var expected= "array([-135., -45., 45., 135.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note the order of the parameters. arctan2 is defined also when x2 = 0 // and at several other special points, obtaining values in // the range [-pi, pi]: - + // >>> np.arctan2([1., -1.], [0., 0.]) // array([ 1.57079633, -1.57079633]) // >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) // array([ 0. , 3.14159265, 0.78539816]) // - - #if TODO + +#if TODO given= np.arctan2({1., -1.}, {0., 0.}); expected= "array([ 1.57079633, -1.57079633])"; @@ -337,59 +338,59 @@ public void arctan2Test() expected= "array([ 0. , 3.14159265, 0.78539816])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void degreesTest() { // Convert a radian array to degrees - + // >>> rad = np.arange(12.)*np.pi/6 // >>> np.degrees(rad) // array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., // 270., 300., 330.]) // - - #if TODO + +#if TODO var given= rad = np.arange(12.)*np.pi/6; given= np.degrees(rad); var expected= "array([ 0., 30., 60., 90., 120., 150., 180., 210., 240.,\n" + " 270., 300., 330.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> out = np.zeros((rad.shape)) // >>> r = degrees(rad, out) // >>> np.all(r == out) // True // - - #if TODO + +#if TODO given= out = np.zeros((rad.shape)); given= r = degrees(rad, out); given= np.all(r == out); expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void radiansTest() { // Convert a degree array to radians - + // >>> deg = np.arange(12.) * 30. // >>> np.radians(deg) // array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , // 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, // 5.23598776, 5.75958653]) // - - #if TODO + +#if TODO var given= deg = np.arange(12.) * 30.; given= np.radians(deg); var expected= @@ -397,24 +398,24 @@ public void radiansTest() " 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898,\n" + " 5.23598776, 5.75958653])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> out = np.zeros((deg.shape)) // >>> ret = np.radians(deg, out) // >>> ret is out // True // - - #if TODO + +#if TODO given= out = np.zeros((deg.shape)); given= ret = np.radians(deg, out); given= ret is out; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void unwrapTest() { @@ -425,8 +426,8 @@ public void unwrapTest() // >>> np.unwrap(phase) // array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) // - - #if TODO + +#if TODO var given= phase = np.linspace(0, np.pi, num=5); given= phase{3:} += np.pi; given= phase; @@ -437,42 +438,42 @@ public void unwrapTest() expected= "array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void deg2radTest() { // >>> np.deg2rad(180) // 3.1415926535897931 // - - #if TODO + +#if TODO var given= np.deg2rad(180); var expected= "3.1415926535897931"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rad2degTest() { // >>> np.rad2deg(np.pi/2) // 90.0 // - - #if TODO + +#if TODO var given= np.rad2deg(np.pi/2); var expected= "90.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void sinhTest() { @@ -484,8 +485,8 @@ public void sinhTest() // 1.2246063538223773e-016j // >>> # Discrepancy due to vagaries of floating point arithmetic. // - - #if TODO + +#if TODO var given= np.sinh(0); var expected= "0.0"; @@ -499,29 +500,29 @@ public void sinhTest() "1.2246063538223773e-016j"; Assert.AreEqual(expected, given.repr); given= # Discrepancy due to vagaries of floating point arithmetic.; - #endif +#endif // >>> # Example of providing the optional output parameter // >>> out2 = np.sinh([0.1], out1) // >>> out2 is out1 // True // - - #if TODO + +#if TODO given= # Example of providing the optional output parameter; given= out2 = np.sinh({0.1}, out1); given= out2 is out1; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> # Example of ValueError due to provision of shape mis-matched `out` // >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) // Traceback (most recent call last): // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO given= # Example of ValueError due to provision of shape mis-matched `out`; given= np.sinh(np.zeros((3,3)),np.zeros((2,2))); expected= @@ -529,61 +530,61 @@ public void sinhTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void coshTest() { // >>> np.cosh(0) // 1.0 // - - #if TODO + +#if TODO var given= np.cosh(0); var expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The hyperbolic cosine describes the shape of a hanging cable: - + // >>> import matplotlib.pyplot as plt // >>> x = np.linspace(-4, 4, 1000) // >>> plt.plot(x, np.cosh(x)) // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= x = np.linspace(-4, 4, 1000); given= plt.plot(x, np.cosh(x)); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void tanhTest() { // >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) // array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) // - - #if TODO + +#if TODO var given= np.tanh((0, np.pi*1j, np.pi*1j/2)); var expected= "array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> # Example of providing the optional output parameter illustrating // >>> # that what is returned is a reference to said parameter // >>> out2 = np.tanh([0.1], out1) // >>> out2 is out1 // True // - - #if TODO + +#if TODO given= # Example of providing the optional output parameter illustrating; given= # that what is returned is a reference to said parameter; given= out2 = np.tanh({0.1}, out1); @@ -591,15 +592,15 @@ public void tanhTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> # Example of ValueError due to provision of shape mis-matched `out` // >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) // Traceback (most recent call last): // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO given= # Example of ValueError due to provision of shape mis-matched `out`; given= np.tanh(np.zeros((3,3)),np.zeros((2,2))); expected= @@ -607,26 +608,26 @@ public void tanhTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arcsinhTest() { // >>> np.arcsinh(np.array([np.e, 10.0])) // array([ 1.72538256, 2.99822295]) // - - #if TODO + +#if TODO var given= np.arcsinh(np.array({np.e, 10.0})); var expected= "array([ 1.72538256, 2.99822295])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arccoshTest() { @@ -635,8 +636,8 @@ public void arccoshTest() // >>> np.arccosh(1) // 0.0 // - - #if TODO + +#if TODO var given= np.arccosh({np.e, 10.0}); var expected= "array([ 1.65745445, 2.99322285])"; @@ -645,26 +646,26 @@ public void arccoshTest() expected= "0.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arctanhTest() { // >>> np.arctanh([0, -0.5]) // array([ 0. , -0.54930614]) // - - #if TODO + +#if TODO var given= np.arctanh({0, -0.5}); var expected= "array([ 0. , -0.54930614])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void aroundTest() { @@ -679,8 +680,8 @@ public void aroundTest() // >>> np.around([1,2,3,11], decimals=-1) // array([ 0, 0, 0, 10]) // - - #if TODO + +#if TODO var given= np.around({0.37, 1.64}); var expected= "array([ 0., 2.])"; @@ -701,10 +702,10 @@ public void aroundTest() expected= "array([ 0, 0, 0, 10])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rintTest() { @@ -712,17 +713,17 @@ public void rintTest() // >>> np.rint(a) // array([-2., -2., -0., 0., 2., 2., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.rint(a); var expected= "array([-2., -2., -0., 0., 2., 2., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fixTest() { @@ -733,8 +734,8 @@ public void fixTest() // >>> np.fix([2.1, 2.9, -2.1, -2.9]) // array([ 2., 2., -2., -2.]) // - - #if TODO + +#if TODO var given= np.fix(3.14); var expected= "3.0"; @@ -747,10 +748,10 @@ public void fixTest() expected= "array([ 2., 2., -2., -2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void floorTest() { @@ -758,17 +759,17 @@ public void floorTest() // >>> np.floor(a) // array([-2., -2., -1., 0., 1., 1., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.floor(a); var expected= "array([-2., -2., -1., 0., 1., 1., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ceilTest() { @@ -776,17 +777,17 @@ public void ceilTest() // >>> np.ceil(a) // array([-1., -1., -0., 1., 2., 2., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.ceil(a); var expected= "array([-1., -1., -0., 1., 2., 2., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void truncTest() { @@ -794,14 +795,14 @@ public void truncTest() // >>> np.trunc(a) // array([-1., -1., -0., 0., 1., 1., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.trunc(a); var expected= "array([-1., -1., -0., 0., 1., 1., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } @@ -870,55 +871,55 @@ public void sumTest() // >>> np.sum([[0, 1], [0, 5]], axis=1) // array([1, 5]) // - - var given= np.sum(new[]{0.5, 1.5}); - var expected= + + var given = np.sum(new[] { 0.5, 1.5 }); + var expected = "2.0"; Assert.AreEqual(expected, given.repr); - given= np.sum(new[] { 0.5, 0.7, 0.2, 1.5}, dtype:np.int32); - expected= - "1"; + given = np.sum(new[] { 0.5, 0.7, 0.2, 1.5 }, dtype: np.int32); + expected = + "1"; Assert.AreEqual(expected, given.repr); - given= np.sum(new[,] { {0, 1}, {0, 5}}); - expected= - "6"; + given = np.sum(new[,] { { 0, 1 }, { 0, 5 } }); + expected = + "6"; Assert.AreEqual(expected, given.repr); - given= np.sum(new[,] { {0, 1}, {0, 5}}, axis:0); - expected= - "array([0, 6])"; + given = np.sum(new[,] { { 0, 1 }, { 0, 5 } }, axis: 0); + expected = + "array([0, 6])"; Assert.AreEqual(expected, given.repr); - given= np.sum(new[,] { {0, 1}, {0, 5}}, axis: 1); - expected= - "array([1, 5])"; + given = np.sum(new[,] { { 0, 1 }, { 0, 5 } }, axis: 1); + expected = + "array([1, 5])"; Assert.AreEqual(expected, given.repr); // If the accumulator is too small, overflow occurs: - + // >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) // -128 // - - #if TODO + +#if TODO given= np.ones(128, dtype=np.int8).sum(dtype=np.int8); expected= "-128"; Assert.AreEqual(expected, given.repr); - #endif +#endif // You can also start the sum with a value other than zero: - + // >>> np.sum([10], initial=5) // 15 // - - #if TODO + +#if TODO given= np.sum({10}, initial=5); expected= "15"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nanprodTest() { @@ -934,8 +935,8 @@ public void nanprodTest() // >>> np.nanprod(a, axis=0) // array([ 3., 2.]) // - - #if TODO + +#if TODO var given= np.nanprod(1); var expected= "1"; @@ -957,10 +958,10 @@ public void nanprodTest() expected= "array([ 3., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nansumTest() { @@ -982,8 +983,8 @@ public void nansumTest() // >>> np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present // nan // - - #if TODO + +#if TODO var given= np.nansum(1); var expected= "1"; @@ -1017,10 +1018,10 @@ public void nansumTest() expected= "nan"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void cumprodTest() { @@ -1032,8 +1033,8 @@ public void cumprodTest() // >>> np.cumprod(a, dtype=float) # specify type of output // array([ 1., 2., 6., 24., 120., 720.]) // - - #if TODO + +#if TODO var given= a = np.array({1,2,3}); given= np.cumprod(a) # intermediate results 1, 1*2; var expected= @@ -1045,38 +1046,38 @@ public void cumprodTest() expected= "array([ 1., 2., 6., 24., 120., 720.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The cumulative product for each column (i.e., over the rows) of a: - + // >>> np.cumprod(a, axis=0) // array([[ 1, 2, 3], // [ 4, 10, 18]]) // - - #if TODO + +#if TODO given= np.cumprod(a, axis=0); expected= "array([[ 1, 2, 3],\n" + " [ 4, 10, 18]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The cumulative product for each row (i.e. over the columns) of a: - + // >>> np.cumprod(a,axis=1) // array([[ 1, 2, 6], // [ 4, 20, 120]]) // - - #if TODO + +#if TODO given= np.cumprod(a,axis=1); expected= "array([[ 1, 2, 6],\n" + " [ 4, 20, 120]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void cumsumTest() { @@ -1089,8 +1090,8 @@ public void cumsumTest() // >>> np.cumsum(a, dtype=float) # specifies type of output value(s) // array([ 1., 3., 6., 10., 15., 21.]) // - - #if TODO + +#if TODO var given= a = np.array({{1,2,3}, {4,5,6}}); given= a; var expected= @@ -1105,7 +1106,7 @@ public void cumsumTest() expected= "array([ 1., 3., 6., 10., 15., 21.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns // array([[1, 2, 3], // [5, 7, 9]]) @@ -1113,8 +1114,8 @@ public void cumsumTest() // array([[ 1, 3, 6], // [ 4, 9, 15]]) // - - #if TODO + +#if TODO given= np.cumsum(a,axis=0) # sum over rows for each of the 3 columns; expected= "array([[1, 2, 3],\n" + @@ -1125,10 +1126,10 @@ public void cumsumTest() "array([[ 1, 3, 6],\n" + " [ 4, 9, 15]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nancumprodTest() { @@ -1148,8 +1149,8 @@ public void nancumprodTest() // array([[ 1., 2.], // [ 3., 3.]]) // - - #if TODO + +#if TODO var given= np.nancumprod(1); var expected= "array([1])"; @@ -1177,10 +1178,10 @@ public void nancumprodTest() "array([[ 1., 2.],\n" + " [ 3., 3.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nancumsumTest() { @@ -1200,8 +1201,8 @@ public void nancumsumTest() // array([[ 1., 3.], // [ 3., 3.]]) // - - #if TODO + +#if TODO var given= np.nancumsum(1); var expected= "array([1])"; @@ -1229,10 +1230,10 @@ public void nancumsumTest() "array([[ 1., 3.],\n" + " [ 3., 3.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void diffTest() { @@ -1242,8 +1243,8 @@ public void diffTest() // >>> np.diff(x, n=2) // array([ 1, 1, -10]) // - - #if TODO + +#if TODO var given= x = np.array({1, 2, 4, 7, 0}); given= np.diff(x); var expected= @@ -1253,7 +1254,7 @@ public void diffTest() expected= "array([ 1, 1, -10])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) // >>> np.diff(x) // array([[2, 3, 4], @@ -1261,8 +1262,8 @@ public void diffTest() // >>> np.diff(x, axis=0) // array([[-1, 2, 0, -2]]) // - - #if TODO + +#if TODO given= x = np.array({{1, 3, 6, 10}, {0, 5, 6, 8}}); given= np.diff(x); expected= @@ -1273,22 +1274,22 @@ public void diffTest() expected= "array([[-1, 2, 0, -2]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) // >>> np.diff(x) // array([1, 1], dtype='timedelta64[D]') // - - #if TODO + +#if TODO given= x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64); given= np.diff(x); expected= "array([1, 1], dtype='timedelta64[D]')"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ediff1dTest() { @@ -1296,41 +1297,41 @@ public void ediff1dTest() // >>> np.ediff1d(x) // array([ 1, 2, 3, -7]) // - - #if TODO + +#if TODO var given= x = np.array({1, 2, 4, 7, 0}); given= np.ediff1d(x); var expected= "array([ 1, 2, 3, -7])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) // array([-99, 1, 2, 3, -7, 88, 99]) // - - #if TODO + +#if TODO given= np.ediff1d(x, to_begin=-99, to_end=np.array({88, 99})); expected= "array([-99, 1, 2, 3, -7, 88, 99])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The returned array is always 1D. - + // >>> y = [[1, 2, 4], [1, 6, 24]] // >>> np.ediff1d(y) // array([ 1, 2, -3, 5, 18]) // - - #if TODO + +#if TODO given= y = [[1, 2, 4], [1, 6, 24]]; given= np.ediff1d(y); expected= "array([ 1, 2, -3, 5, 18])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void gradientTest() { @@ -1340,8 +1341,8 @@ public void gradientTest() // >>> np.gradient(f, 2) // array([ 0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) // - - #if TODO + +#if TODO var given= f = np.array({1, 2, 4, 7, 11, 16}, dtype=float); given= np.gradient(f); var expected= @@ -1351,58 +1352,58 @@ public void gradientTest() expected= "array([ 0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Spacing can be also specified with an array that represents the coordinates // of the values F along the dimensions. // For instance a uniform spacing: - + // >>> x = np.arange(f.size) // >>> np.gradient(f, x) // array([ 1. , 1.5, 2.5, 3.5, 4.5, 5. ]) // - - #if TODO + +#if TODO given= x = np.arange(f.size); given= np.gradient(f, x); expected= "array([ 1. , 1.5, 2.5, 3.5, 4.5, 5. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Or a non uniform one: - + // >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) // >>> np.gradient(f, x) // array([ 1. , 3. , 3.5, 6.7, 6.9, 2.5]) // - - #if TODO + +#if TODO given= x = np.array({0., 1., 1.5, 3.5, 4., 6.}, dtype=float); given= np.gradient(f, x); expected= "array([ 1. , 3. , 3.5, 6.7, 6.9, 2.5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // For two dimensional arrays, the return will be two arrays ordered by // axis. In this example the first array stands for the gradient in // rows and the second one in columns direction: - + // >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) // [array([[ 2., 2., -1.], // [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ], // [ 1. , 1. , 1. ]])] // - - #if TODO + +#if TODO given= np.gradient(np.array({{1, 2, 6}, {3, 4, 5}}, dtype=float)); expected= "[array([[ 2., 2., -1.],\n" + " [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ],\n" + " [ 1. , 1. , 1. ]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // In this example the spacing is also specified: // uniform for axis=0 and non uniform for axis=1 - + // >>> dx = 2. // >>> y = [1., 1.5, 3.5] // >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) @@ -1410,8 +1411,8 @@ public void gradientTest() // [ 1. , 1. , -0.5]]), array([[ 2. , 2. , 2. ], // [ 2. , 1.7, 0.5]])] // - - #if TODO + +#if TODO given= dx = 2.; given= y = [1., 1.5, 3.5]; given= np.gradient(np.array({{1, 2, 6}, {3, 4, 5}}, dtype=float), dx, y); @@ -1420,9 +1421,9 @@ public void gradientTest() " [ 1. , 1. , -0.5]]), array([[ 2. , 2. , 2. ],\n" + " [ 2. , 1.7, 0.5]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // It is possible to specify how boundaries are treated using edge_order - + // >>> x = np.array([0, 1, 2, 3, 4]) // >>> f = x**2 // >>> np.gradient(f, edge_order=1) @@ -1430,8 +1431,8 @@ public void gradientTest() // >>> np.gradient(f, edge_order=2) // array([-0., 2., 4., 6., 8.]) // - - #if TODO + +#if TODO given= x = np.array({0, 1, 2, 3, 4}); given= f = x**2; given= np.gradient(f, edge_order=1); @@ -1442,103 +1443,103 @@ public void gradientTest() expected= "array([-0., 2., 4., 6., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The axis keyword can be used to specify a subset of axes of which the // gradient is calculated - + // >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) // array([[ 2., 2., -1.], // [ 2., 2., -1.]]) // - - #if TODO + +#if TODO given= np.gradient(np.array({{1, 2, 6}, {3, 4, 5}}, dtype=float), axis=0); expected= "array([[ 2., 2., -1.],\n" + " [ 2., 2., -1.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void crossTest() { // Vector cross-product. - + // >>> x = [1, 2, 3] // >>> y = [4, 5, 6] // >>> np.cross(x, y) // array([-3, 6, -3]) // - - #if TODO + +#if TODO var given= x = [1, 2, 3]; given= y = [4, 5, 6]; given= np.cross(x, y); var expected= "array([-3, 6, -3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // One vector with dimension 2. - + // >>> x = [1, 2] // >>> y = [4, 5, 6] // >>> np.cross(x, y) // array([12, -6, -3]) // - - #if TODO + +#if TODO given= x = [1, 2]; given= y = [4, 5, 6]; given= np.cross(x, y); expected= "array([12, -6, -3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Equivalently: - + // >>> x = [1, 2, 0] // >>> y = [4, 5, 6] // >>> np.cross(x, y) // array([12, -6, -3]) // - - #if TODO + +#if TODO given= x = [1, 2, 0]; given= y = [4, 5, 6]; given= np.cross(x, y); expected= "array([12, -6, -3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Both vectors with dimension 2. - + // >>> x = [1,2] // >>> y = [4,5] // >>> np.cross(x, y) // -3 // - - #if TODO + +#if TODO given= x = [1,2]; given= y = [4,5]; given= np.cross(x, y); expected= "-3"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Multiple vector cross-products. Note that the direction of the cross // product vector is defined by the right-hand rule. - + // >>> x = np.array([[1,2,3], [4,5,6]]) // >>> y = np.array([[4,5,6], [1,2,3]]) // >>> np.cross(x, y) // array([[-3, 6, -3], // [ 3, -6, 3]]) // - - #if TODO + +#if TODO given= x = np.array({{1,2,3}, {4,5,6}}); given= y = np.array({{4,5,6}, {1,2,3}}); given= np.cross(x, y); @@ -1546,25 +1547,25 @@ public void crossTest() "array([[-3, 6, -3],\n" + " [ 3, -6, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The orientation of c can be changed using the axisc keyword. - + // >>> np.cross(x, y, axisc=0) // array([[-3, 3], // [ 6, -6], // [-3, 3]]) // - - #if TODO + +#if TODO given= np.cross(x, y, axisc=0); expected= "array([[-3, 3],\n" + " [ 6, -6],\n" + " [-3, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Change the vector definition of x and y using axisa and axisb. - + // >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) // >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) // >>> np.cross(x, y) @@ -1576,8 +1577,8 @@ public void crossTest() // [-30, 60, -30], // [-36, 72, -36]]) // - - #if TODO + +#if TODO given= x = np.array({{1,2,3}, {4,5,6}, {7, 8, 9}}); given= y = np.array({{7, 8, 9}, {4,5,6}, {1,2,3}}); given= np.cross(x, y); @@ -1592,10 +1593,10 @@ public void crossTest() " [-30, 60, -30],\n" + " [-36, 72, -36]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void trapzTest() { @@ -1614,8 +1615,8 @@ public void trapzTest() // >>> np.trapz(a, axis=1) // array([ 2., 8.]) // - - #if TODO + +#if TODO var given= np.trapz({1,2,3}); var expected= "4.0"; @@ -1642,53 +1643,53 @@ public void trapzTest() expected= "array([ 2., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void expTest() { // Plot the magnitude and phase of exp(x) in the complex plane: - + // >>> import matplotlib.pyplot as plt // - - #if TODO + +#if TODO var given= import matplotlib.pyplot as plt; - #endif +#endif // >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) // >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane // >>> out = np.exp(xx) // - - #if TODO + +#if TODO given= x = np.linspace(-2*np.pi, 2*np.pi, 100); given= xx = x + 1j * x{:, np.newaxis} # a + ib over complex plane; given= out = np.exp(xx); - #endif +#endif // >>> plt.subplot(121) // >>> plt.imshow(np.abs(out), // ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') // >>> plt.title('Magnitude of exp(x)') // - - #if TODO + +#if TODO given= plt.subplot(121); given= plt.imshow(np.abs(out),; var expected= "... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray')"; Assert.AreEqual(expected, given.repr); given= plt.title('Magnitude of exp(x)'); - #endif +#endif // >>> plt.subplot(122) // >>> plt.imshow(np.angle(out), // ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') // >>> plt.title('Phase (angle) of exp(x)') // >>> plt.show() // - - #if TODO + +#if TODO given= plt.subplot(122); given= plt.imshow(np.angle(out),; expected= @@ -1696,24 +1697,24 @@ public void expTest() Assert.AreEqual(expected, given.repr); given= plt.title('Phase (angle) of exp(x)'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void expm1Test() { // The true value of exp(1e-10) - 1 is 1.00000000005e-10 to // about 32 significant digits. This example shows the superiority of // expm1 in this case. - + // >>> np.expm1(1e-10) // 1.00000000005e-10 // >>> np.exp(1e-10) - 1 // 1.000000082740371e-10 // - - #if TODO + +#if TODO var given= np.expm1(1e-10); var expected= "1.00000000005e-10"; @@ -1722,58 +1723,58 @@ public void expm1Test() expected= "1.000000082740371e-10"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void exp2Test() { // >>> np.exp2([2, 3]) // array([ 4., 8.]) // - - #if TODO + +#if TODO var given= np.exp2({2, 3}); var expected= "array([ 4., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void logTest() { // >>> np.log([1, np.e, np.e**2, 0]) // array([ 0., 1., 2., -Inf]) // - - #if TODO + +#if TODO var given= np.log({1, np.e, np.e**2, 0}); var expected= "array([ 0., 1., 2., -Inf])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void log10Test() { // >>> np.log10([1e-15, -3.]) // array([-15., NaN]) // - - #if TODO + +#if TODO var given= np.log10({1e-15, -3.}); var expected= "array([-15., NaN])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void log2Test() { @@ -1781,29 +1782,29 @@ public void log2Test() // >>> np.log2(x) // array([-Inf, 0., 1., 4.]) // - - #if TODO + +#if TODO var given= x = np.array({0, 1, 2, 2**4}); given= np.log2(x); var expected= "array([-Inf, 0., 1., 4.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) // >>> np.log2(xi) // array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) // - - #if TODO + +#if TODO given= xi = np.array({0+1.j, 1, 2+0.j, 4.j}); given= np.log2(xi); expected= "array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void log1pTest() { @@ -1812,8 +1813,8 @@ public void log1pTest() // >>> np.log(1 + 1e-99) // 0.0 // - - #if TODO + +#if TODO var given= np.log1p(1e-99); var expected= "1e-99"; @@ -1822,10 +1823,10 @@ public void log1pTest() expected= "0.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void logaddexpTest() { @@ -1837,8 +1838,8 @@ public void logaddexpTest() // >>> np.exp(prob12) // 3.5000000000000057e-50 // - - #if TODO + +#if TODO var given= prob1 = np.log(1e-50); given= prob2 = np.log(2.5e-50); given= prob12 = np.logaddexp(prob1, prob2); @@ -1850,10 +1851,10 @@ public void logaddexpTest() expected= "3.5000000000000057e-50"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void logaddexp2Test() { @@ -1865,8 +1866,8 @@ public void logaddexp2Test() // >>> 2**prob12 // 3.4999999999999914e-50 // - - #if TODO + +#if TODO var given= prob1 = np.log2(1e-50); given= prob2 = np.log2(2.5e-50); given= prob12 = np.logaddexp2(prob1, prob2); @@ -1878,10 +1879,10 @@ public void logaddexp2Test() expected= "3.4999999999999914e-50"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void sincTest() { @@ -1903,8 +1904,8 @@ public void sincTest() // -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, // -4.92362781e-02, -3.89804309e-17]) // - - #if TODO + +#if TODO var given= import matplotlib.pyplot as plt; given= x = np.linspace(-4, 4, 41); given= np.sinc(x); @@ -1924,7 +1925,7 @@ public void sincTest() " -5.84680802e-02, -8.90384387e-02, -8.40918587e-02,\n" + " -4.92362781e-02, -3.89804309e-17])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> plt.plot(x, np.sinc(x)) // [] // >>> plt.title("Sinc Function") @@ -1935,8 +1936,8 @@ public void sincTest() // // >>> plt.show() // - - #if TODO + +#if TODO given= plt.plot(x, np.sinc(x)); expected= "[]"; @@ -1954,26 +1955,26 @@ public void sincTest() ""; Assert.AreEqual(expected, given.repr); given= plt.show(); - #endif +#endif // It works in 2-D as well: - + // >>> x = np.linspace(-4, 4, 401) // >>> xx = np.outer(x, x) // >>> plt.imshow(np.sinc(xx)) // // - - #if TODO + +#if TODO given= x = np.linspace(-4, 4, 401); given= xx = np.outer(x, x); given= plt.imshow(np.sinc(xx)); expected= ""; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void signbitTest() { @@ -1982,8 +1983,8 @@ public void signbitTest() // >>> np.signbit(np.array([1, -2.3, 2.1])) // array([False, True, False]) // - - #if TODO + +#if TODO var given= np.signbit(-1.2); var expected= "True"; @@ -1992,10 +1993,10 @@ public void signbitTest() expected= "array([False, True, False])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void copysignTest() { @@ -2006,8 +2007,8 @@ public void copysignTest() // >>> 1/np.copysign(0, -1) // -inf // - - #if TODO + +#if TODO var given= np.copysign(1.3, -1); var expected= "-1.3"; @@ -2020,14 +2021,14 @@ public void copysignTest() expected= "-inf"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.copysign([-1, 0, 1], -1.1) // array([-1., -0., -1.]) // >>> np.copysign([-1, 0, 1], np.arange(3)-1) // array([-1., 0., 1.]) // - - #if TODO + +#if TODO given= np.copysign({-1, 0, 1}, -1.1); expected= "array([-1., -0., -1.])"; @@ -2036,10 +2037,10 @@ public void copysignTest() expected= "array([-1., 0., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void frexpTest() { @@ -2053,8 +2054,8 @@ public void frexpTest() // >>> y1 * 2**y2 // array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) // - - #if TODO + +#if TODO var given= x = np.arange(9); given= y1, y2 = np.frexp(x); given= y1; @@ -2070,38 +2071,38 @@ public void frexpTest() expected= "array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ldexpTest() { // >>> np.ldexp(5, np.arange(4)) // array([ 5., 10., 20., 40.], dtype=float32) // - - #if TODO + +#if TODO var given= np.ldexp(5, np.arange(4)); var expected= "array([ 5., 10., 20., 40.], dtype=float32)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(6) // >>> np.ldexp(*np.frexp(x)) // array([ 0., 1., 2., 3., 4., 5.]) // - - #if TODO + +#if TODO given= x = np.arange(6); given= np.ldexp(*np.frexp(x)); expected= "array([ 0., 1., 2., 3., 4., 5.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nextafterTest() { @@ -2111,8 +2112,8 @@ public void nextafterTest() // >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] // array([ True, True]) // - - #if TODO + +#if TODO var given= eps = np.finfo(np.float64).eps; given= np.nextafter(1, 2) == eps + 1; var expected= @@ -2122,26 +2123,26 @@ public void nextafterTest() expected= "array([ True, True])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void spacingTest() { // >>> np.spacing(1) == np.finfo(np.float64).eps // True // - - #if TODO + +#if TODO var given= np.spacing(1) == np.finfo(np.float64).eps; var expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void lcmTest() { @@ -2154,8 +2155,8 @@ public void lcmTest() // >>> np.lcm(np.arange(6), 20) // array([ 0, 20, 20, 60, 20, 20]) // - - #if TODO + +#if TODO var given= np.lcm(12, 20); var expected= "60"; @@ -2172,10 +2173,10 @@ public void lcmTest() expected= "array([ 0, 20, 20, 60, 20, 20])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void gcdTest() { @@ -2186,8 +2187,8 @@ public void gcdTest() // >>> np.gcd(np.arange(6), 20) // array([20, 1, 2, 1, 4, 5]) // - - #if TODO + +#if TODO var given= np.gcd(12, 20); var expected= "4"; @@ -2200,10 +2201,10 @@ public void gcdTest() expected= "array([20, 1, 2, 1, 4, 5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void addTest() { @@ -2216,8 +2217,8 @@ public void addTest() // [ 3., 5., 7.], // [ 6., 8., 10.]]) // - - #if TODO + +#if TODO var given= np.add(1.0, 4.0); var expected= "5.0"; @@ -2230,10 +2231,10 @@ public void addTest() " [ 3., 5., 7.],\n" + " [ 6., 8., 10.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void reciprocalTest() { @@ -2242,8 +2243,8 @@ public void reciprocalTest() // >>> np.reciprocal([1, 2., 3.33]) // array([ 1. , 0.5 , 0.3003003]) // - - #if TODO + +#if TODO var given= np.reciprocal(2.); var expected= "0.5"; @@ -2252,39 +2253,39 @@ public void reciprocalTest() expected= "array([ 1. , 0.5 , 0.3003003])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void negativeTest() { // >>> np.negative([1.,-1.]) // array([-1., 1.]) // - - #if TODO + +#if TODO var given= np.negative({1.,-1.}); var expected= "array([-1., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void multiplyTest() { // >>> np.multiply(2.0, 4.0) // 8.0 // - - #if TODO + +#if TODO var given= np.multiply(2.0, 4.0); var expected= "8.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x1 = np.arange(9.0).reshape((3, 3)) // >>> x2 = np.arange(3.0) // >>> np.multiply(x1, x2) @@ -2292,8 +2293,8 @@ public void multiplyTest() // [ 0., 4., 10.], // [ 0., 7., 16.]]) // - - #if TODO + +#if TODO given= x1 = np.arange(9.0).reshape((3, 3)); given= x2 = np.arange(3.0); given= np.multiply(x1, x2); @@ -2302,10 +2303,10 @@ public void multiplyTest() " [ 0., 4., 10.],\n" + " [ 0., 7., 16.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void divideTest() { @@ -2313,21 +2314,21 @@ public void divideTest() // >>> np.true_divide(x, 4) // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // - - #if TODO + +#if TODO var given= x = np.arange(5); given= np.true_divide(x, 4); var expected= "array([ 0. , 0.25, 0.5 , 0.75, 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x/4 // array([0, 0, 0, 0, 1]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= x/4; expected= "array([0, 0, 0, 0, 1])"; @@ -2336,15 +2337,15 @@ public void divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> from __future__ import division // >>> x/4 // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= from __future__ import division; given= x/4; expected= @@ -2354,23 +2355,23 @@ public void divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void powerTest() { // Cube each element in a list. - + // >>> x1 = range(6) // >>> x1 // [0, 1, 2, 3, 4, 5] // >>> np.power(x1, 3) // array([ 0, 1, 8, 27, 64, 125]) // - - #if TODO + +#if TODO var given= x1 = range(6); given= x1; var expected= @@ -2380,23 +2381,23 @@ public void powerTest() expected= "array([ 0, 1, 8, 27, 64, 125])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Raise the bases to different exponents. - + // >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] // >>> np.power(x1, x2) // array([ 0., 1., 8., 27., 16., 5.]) // - - #if TODO + +#if TODO given= x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0]; given= np.power(x1, x2); expected= "array([ 0., 1., 8., 27., 16., 5.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The effect of broadcasting. - + // >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) // >>> x2 // array([[1, 2, 3, 3, 2, 1], @@ -2405,8 +2406,8 @@ public void powerTest() // array([[ 0, 1, 8, 27, 16, 5], // [ 0, 1, 8, 27, 16, 5]]) // - - #if TODO + +#if TODO given= x2 = np.array({{1, 2, 3, 3, 2, 1}, {1, 2, 3, 3, 2, 1}}); given= x2; expected= @@ -2418,23 +2419,23 @@ public void powerTest() "array([[ 0, 1, 8, 27, 16, 5],\n" + " [ 0, 1, 8, 27, 16, 5]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void subtractTest() { // >>> np.subtract(1.0, 4.0) // -3.0 // - - #if TODO + +#if TODO var given= np.subtract(1.0, 4.0); var expected= "-3.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x1 = np.arange(9.0).reshape((3, 3)) // >>> x2 = np.arange(3.0) // >>> np.subtract(x1, x2) @@ -2442,8 +2443,8 @@ public void subtractTest() // [ 3., 3., 3.], // [ 6., 6., 6.]]) // - - #if TODO + +#if TODO given= x1 = np.arange(9.0).reshape((3, 3)); given= x2 = np.arange(3.0); given= np.subtract(x1, x2); @@ -2452,10 +2453,10 @@ public void subtractTest() " [ 3., 3., 3.],\n" + " [ 6., 6., 6.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void true_divideTest() { @@ -2463,21 +2464,21 @@ public void true_divideTest() // >>> np.true_divide(x, 4) // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // - - #if TODO + +#if TODO var given= x = np.arange(5); given= np.true_divide(x, 4); var expected= "array([ 0. , 0.25, 0.5 , 0.75, 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x/4 // array([0, 0, 0, 0, 1]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= x/4; expected= "array([0, 0, 0, 0, 1])"; @@ -2486,15 +2487,15 @@ public void true_divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> from __future__ import division // >>> x/4 // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= from __future__ import division; given= x/4; expected= @@ -2504,10 +2505,10 @@ public void true_divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void floor_divideTest() { @@ -2516,8 +2517,8 @@ public void floor_divideTest() // >>> np.floor_divide([1., 2., 3., 4.], 2.5) // array([ 0., 0., 1., 1.]) // - - #if TODO + +#if TODO var given= np.floor_divide(7,3); var expected= "2"; @@ -2526,23 +2527,23 @@ public void floor_divideTest() expected= "array([ 0., 0., 1., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void float_powerTest() { // Cube each element in a list. - + // >>> x1 = range(6) // >>> x1 // [0, 1, 2, 3, 4, 5] // >>> np.float_power(x1, 3) // array([ 0., 1., 8., 27., 64., 125.]) // - - #if TODO + +#if TODO var given= x1 = range(6); given= x1; var expected= @@ -2552,23 +2553,23 @@ public void float_powerTest() expected= "array([ 0., 1., 8., 27., 64., 125.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Raise the bases to different exponents. - + // >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] // >>> np.float_power(x1, x2) // array([ 0., 1., 8., 27., 16., 5.]) // - - #if TODO + +#if TODO given= x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0]; given= np.float_power(x1, x2); expected= "array([ 0., 1., 8., 27., 16., 5.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The effect of broadcasting. - + // >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) // >>> x2 // array([[1, 2, 3, 3, 2, 1], @@ -2577,8 +2578,8 @@ public void float_powerTest() // array([[ 0., 1., 8., 27., 16., 5.], // [ 0., 1., 8., 27., 16., 5.]]) // - - #if TODO + +#if TODO given= x2 = np.array({{1, 2, 3, 3, 2, 1}, {1, 2, 3, 3, 2, 1}}); given= x2; expected= @@ -2590,10 +2591,10 @@ public void float_powerTest() "array([[ 0., 1., 8., 27., 16., 5.],\n" + " [ 0., 1., 8., 27., 16., 5.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fmodTest() { @@ -2602,8 +2603,8 @@ public void fmodTest() // >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) // array([1, 0, 1, 1, 0, 1]) // - - #if TODO + +#if TODO var given= np.fmod({-3, -2, -1, 1, 2, 3}, 2); var expected= "array([-1, 0, -1, 1, 0, 1])"; @@ -2612,7 +2613,7 @@ public void fmodTest() expected= "array([1, 0, 1, 1, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmod([5, 3], [2, 2.]) // array([ 1., 1.]) // >>> a = np.arange(-3, 3).reshape(3, 2) @@ -2625,8 +2626,8 @@ public void fmodTest() // [-1, 0], // [ 1, 0]]) // - - #if TODO + +#if TODO given= np.fmod({5, 3}, {2, 2.}); expected= "array([ 1., 1.])"; @@ -2644,10 +2645,10 @@ public void fmodTest() " [-1, 0],\n" + " [ 1, 0]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void modTest() { @@ -2656,8 +2657,8 @@ public void modTest() // >>> np.remainder(np.arange(7), 5) // array([0, 1, 2, 3, 4, 0, 1]) // - - #if TODO + +#if TODO var given= np.remainder({4, 7}, {2, 3}); var expected= "array([0, 1])"; @@ -2666,10 +2667,10 @@ public void modTest() expected= "array([0, 1, 2, 3, 4, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void modfTest() { @@ -2678,8 +2679,8 @@ public void modfTest() // >>> np.modf(-0.5) // (-0.5, -0) // - - #if TODO + +#if TODO var given= np.modf({0, 3.5}); var expected= "(array([ 0. , 0.5]), array([ 0., 3.]))"; @@ -2688,10 +2689,10 @@ public void modfTest() expected= "(-0.5, -0)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void remainderTest() { @@ -2700,8 +2701,8 @@ public void remainderTest() // >>> np.remainder(np.arange(7), 5) // array([0, 1, 2, 3, 4, 0, 1]) // - - #if TODO + +#if TODO var given= np.remainder({4, 7}, {2, 3}); var expected= "array([0, 1])"; @@ -2710,26 +2711,26 @@ public void remainderTest() expected= "array([0, 1, 2, 3, 4, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void divmodTest() { // >>> np.divmod(np.arange(5), 3) // (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) // - - #if TODO + +#if TODO var given= np.divmod(np.arange(5), 3); var expected= "(array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1]))"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void angleTest() { @@ -2738,8 +2739,8 @@ public void angleTest() // >>> np.angle(1+1j, deg=True) # in degrees // 45.0 // - - #if TODO + +#if TODO var given= np.angle({1.0, 1.0j, 1+1j}) # in radians; var expected= "array([ 0. , 1.57079633, 0.78539816])"; @@ -2748,10 +2749,10 @@ public void angleTest() expected= "45.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void realTest() { @@ -2767,8 +2768,8 @@ public void realTest() // >>> np.real(1 + 1j) // 1.0 // - - #if TODO + +#if TODO var given= a = np.array({1+2j, 3+4j, 5+6j}); given= a.real; var expected= @@ -2788,10 +2789,10 @@ public void realTest() expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void imagTest() { @@ -2804,8 +2805,8 @@ public void imagTest() // >>> np.imag(1 + 1j) // 1.0 // - - #if TODO + +#if TODO var given= a = np.array({1+2j, 3+4j, 5+6j}); given= a.imag; var expected= @@ -2820,86 +2821,86 @@ public void imagTest() expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void conjTest() { // >>> np.conjugate(1+2j) // (1-2j) // - - #if TODO + +#if TODO var given= np.conjugate(1+2j); var expected= "(1-2j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.eye(2) + 1j * np.eye(2) // >>> np.conjugate(x) // array([[ 1.-1.j, 0.-0.j], // [ 0.-0.j, 1.-1.j]]) // - - #if TODO + +#if TODO given= x = np.eye(2) + 1j * np.eye(2); given= np.conjugate(x); expected= "array([[ 1.-1.j, 0.-0.j],\n" + " [ 0.-0.j, 1.-1.j]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void convolveTest() { // Note how the convolution operator flips the second array // before “sliding” the two across one another: - + // >>> np.convolve([1, 2, 3], [0, 1, 0.5]) // array([ 0. , 1. , 2.5, 4. , 1.5]) // - - #if TODO + +#if TODO var given= np.convolve({1, 2, 3}, {0, 1, 0.5}); var expected= "array([ 0. , 1. , 2.5, 4. , 1.5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Only return the middle values of the convolution. // Contains boundary effects, where zeros are taken // into account: - + // >>> np.convolve([1,2,3],[0,1,0.5], 'same') // array([ 1. , 2.5, 4. ]) // - - #if TODO + +#if TODO given= np.convolve({1,2,3},{0,1,0.5}, 'same'); expected= "array([ 1. , 2.5, 4. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The two arrays are of the same length, so there // is only one position where they completely overlap: - + // >>> np.convolve([1,2,3],[0,1,0.5], 'valid') // array([ 2.5]) // - - #if TODO + +#if TODO given= np.convolve({1,2,3},{0,1,0.5}, 'valid'); expected= "array([ 2.5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void clipTest() { @@ -2916,8 +2917,8 @@ public void clipTest() // >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) // array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) // - - #if TODO + +#if TODO var given= a = np.arange(10); given= np.clip(a, 1, 8); var expected= @@ -2940,78 +2941,78 @@ public void clipTest() expected= "array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void sqrtTest() { // >>> np.sqrt([1,4,9]) // array([ 1., 2., 3.]) // - - #if TODO + +#if TODO var given= np.sqrt({1,4,9}); var expected= "array([ 1., 2., 3.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.sqrt([4, -1, -3+4J]) // array([ 2.+0.j, 0.+1.j, 1.+2.j]) // - - #if TODO + +#if TODO given= np.sqrt({4, -1, -3+4J}); expected= "array([ 2.+0.j, 0.+1.j, 1.+2.j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.sqrt([4, -1, numpy.inf]) // array([ 2., NaN, Inf]) // - - #if TODO + +#if TODO given= np.sqrt({4, -1, numpy.inf}); expected= "array([ 2., NaN, Inf])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void cbrtTest() { // >>> np.cbrt([1,8,27]) // array([ 1., 2., 3.]) // - - #if TODO + +#if TODO var given= np.cbrt({1,8,27}); var expected= "array([ 1., 2., 3.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void squareTest() { // >>> np.square([-1j, 1]) // array([-1.-0.j, 1.+0.j]) // - - #if TODO + +#if TODO var given= np.square({-1j, 1}); var expected= "array([-1.-0.j, 1.+0.j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void absoluteTest() { @@ -3021,8 +3022,8 @@ public void absoluteTest() // >>> np.absolute(1.2 + 1j) // 1.5620499351813308 // - - #if TODO + +#if TODO var given= x = np.array({-1.2, 1.2}); given= np.absolute(x); var expected= @@ -3032,40 +3033,40 @@ public void absoluteTest() expected= "1.5620499351813308"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot the function over [-10, 10]: - + // >>> import matplotlib.pyplot as plt // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; - #endif +#endif // >>> x = np.linspace(start=-10, stop=10, num=101) // >>> plt.plot(x, np.absolute(x)) // >>> plt.show() // - - #if TODO + +#if TODO given= x = np.linspace(start=-10, stop=10, num=101); given= plt.plot(x, np.absolute(x)); given= plt.show(); - #endif +#endif // Plot the function over the complex plane: - + // >>> xx = x + 1j * x[:, np.newaxis] // >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') // >>> plt.show() // - - #if TODO + +#if TODO given= xx = x + 1j * x{:, np.newaxis}; given= plt.imshow(np.abs(xx), extent={-10, 10, -10, 10}, cmap='gray'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void fabsTest() { @@ -3074,8 +3075,8 @@ public void fabsTest() // >>> np.fabs([-1.2, 1.2]) // array([ 1.2, 1.2]) // - - #if TODO + +#if TODO var given= np.fabs(-1); var expected= "1.0"; @@ -3084,10 +3085,10 @@ public void fabsTest() expected= "array([ 1.2, 1.2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void signTest() { @@ -3098,8 +3099,8 @@ public void signTest() // >>> np.sign(5-2j) // (1+0j) // - - #if TODO + +#if TODO var given= np.sign({-5., 4.5}); var expected= "array([-1., 1.])"; @@ -3112,10 +3113,10 @@ public void signTest() expected= "(1+0j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void heavisideTest() { @@ -3124,8 +3125,8 @@ public void heavisideTest() // >>> np.heaviside([-1.5, 0, 2.0], 1) // array([ 0., 1., 1.]) // - - #if TODO + +#if TODO var given= np.heaviside({-1.5, 0, 2.0}, 0.5); var expected= "array([ 0. , 0.5, 1. ])"; @@ -3134,42 +3135,42 @@ public void heavisideTest() expected= "array([ 0., 1., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void maximumTest() { // >>> np.maximum([2, 3, 4], [1, 5, 2]) // array([2, 5, 4]) // - - #if TODO + +#if TODO var given= np.maximum({2, 3, 4}, {1, 5, 2}); var expected= "array([2, 5, 4])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting // array([[ 1. , 2. ], // [ 0.5, 2. ]]) // - - #if TODO + +#if TODO given= np.maximum(np.eye(2), {0.5, 2}) # broadcasting; expected= "array([[ 1. , 2. ],\n" + " [ 0.5, 2. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) // array([ NaN, NaN, NaN]) // >>> np.maximum(np.Inf, 1) // inf // - - #if TODO + +#if TODO given= np.maximum({np.nan, 0, np.nan}, {0, np.nan, np.nan}); expected= "array([ NaN, NaN, NaN])"; @@ -3178,42 +3179,42 @@ public void maximumTest() expected= "inf"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void minimumTest() { // >>> np.minimum([2, 3, 4], [1, 5, 2]) // array([1, 3, 2]) // - - #if TODO + +#if TODO var given= np.minimum({2, 3, 4}, {1, 5, 2}); var expected= "array([1, 3, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting // array([[ 0.5, 0. ], // [ 0. , 1. ]]) // - - #if TODO + +#if TODO given= np.minimum(np.eye(2), {0.5, 2}) # broadcasting; expected= "array([[ 0.5, 0. ],\n" + " [ 0. , 1. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) // array([ NaN, NaN, NaN]) // >>> np.minimum(-np.Inf, 1) // -inf // - - #if TODO + +#if TODO given= np.minimum({np.nan, 0, np.nan},{0, np.nan, np.nan}); expected= "array([ NaN, NaN, NaN])"; @@ -3222,86 +3223,86 @@ public void minimumTest() expected= "-inf"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fmaxTest() { // >>> np.fmax([2, 3, 4], [1, 5, 2]) // array([ 2., 5., 4.]) // - - #if TODO + +#if TODO var given= np.fmax({2, 3, 4}, {1, 5, 2}); var expected= "array([ 2., 5., 4.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmax(np.eye(2), [0.5, 2]) // array([[ 1. , 2. ], // [ 0.5, 2. ]]) // - - #if TODO + +#if TODO given= np.fmax(np.eye(2), {0.5, 2}); expected= "array([[ 1. , 2. ],\n" + " [ 0.5, 2. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) // array([ 0., 0., NaN]) // - - #if TODO + +#if TODO given= np.fmax({np.nan, 0, np.nan},{0, np.nan, np.nan}); expected= "array([ 0., 0., NaN])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fminTest() { // >>> np.fmin([2, 3, 4], [1, 5, 2]) // array([1, 3, 2]) // - - #if TODO + +#if TODO var given= np.fmin({2, 3, 4}, {1, 5, 2}); var expected= "array([1, 3, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmin(np.eye(2), [0.5, 2]) // array([[ 0.5, 0. ], // [ 0. , 1. ]]) // - - #if TODO + +#if TODO given= np.fmin(np.eye(2), {0.5, 2}); expected= "array([[ 0.5, 0. ],\n" + " [ 0. , 1. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) // array([ 0., 0., NaN]) // - - #if TODO + +#if TODO given= np.fmin({np.nan, 0, np.nan},{0, np.nan, np.nan}); expected= "array([ 0., 0., NaN])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nan_to_numTest() { @@ -3321,8 +3322,8 @@ public void nan_to_numTest() // 0.00000000e+000 +0.00000000e+000j, // 0.00000000e+000 +1.79769313e+308j]) // - - #if TODO + +#if TODO var given= np.nan_to_num(np.inf); var expected= "1.7976931348623157e+308"; @@ -3348,30 +3349,30 @@ public void nan_to_numTest() " 0.00000000e+000 +0.00000000e+000j,\n" + " 0.00000000e+000 +1.79769313e+308j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void real_if_closeTest() { // >>> np.finfo(float).eps // 2.2204460492503131e-16 // - - #if TODO + +#if TODO var given= np.finfo(float).eps; var expected= "2.2204460492503131e-16"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.real_if_close([2.1 + 4e-14j], tol=1000) // array([ 2.1]) // >>> np.real_if_close([2.1 + 4e-13j], tol=1000) // array([ 2.1 +4.00000000e-13j]) // - - #if TODO + +#if TODO given= np.real_if_close({2.1 + 4e-14j}, tol=1000); expected= "array([ 2.1])"; @@ -3380,10 +3381,10 @@ public void real_if_closeTest() expected= "array([ 2.1 +4.00000000e-13j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void interpTest() { @@ -3397,91 +3398,53 @@ public void interpTest() // >>> np.interp(3.14, xp, fp, right=UNDEF) // -99.0 // - - #if TODO - var given= xp = [1, 2, 3]; - given= fp = [3, 2, 0]; - given= np.interp(2.5, xp, fp); - var expected= - "1.0"; - Assert.AreEqual(expected, given.repr); - given= np.interp({0, 1, 1.5, 2.72, 3.14}, xp, fp); - expected= - "array([ 3. , 3. , 2.5 , 0.56, 0. ])"; - Assert.AreEqual(expected, given.repr); - given= UNDEF = -99.0; - given= np.interp(3.14, xp, fp, right=UNDEF); - expected= - "-99.0"; - Assert.AreEqual(expected, given.repr); - #endif - // Plot an interpolant to the sine function: - - // >>> x = np.linspace(0, 2*np.pi, 10) - // >>> y = np.sin(x) - // >>> xvals = np.linspace(0, 2*np.pi, 50) - // >>> yinterp = np.interp(xvals, x, y) - // >>> import matplotlib.pyplot as plt - // >>> plt.plot(x, y, 'o') - // [] - // >>> plt.plot(xvals, yinterp, '-x') - // [] - // >>> plt.show() - // - - #if TODO - given= x = np.linspace(0, 2*np.pi, 10); - given= y = np.sin(x); - given= xvals = np.linspace(0, 2*np.pi, 50); - given= yinterp = np.interp(xvals, x, y); - given= import matplotlib.pyplot as plt; - given= plt.plot(x, y, 'o'); - expected= - "[]"; - Assert.AreEqual(expected, given.repr); - given= plt.plot(xvals, yinterp, '-x'); - expected= - "[]"; + + var xp = new float[] { 1, 2, 3 }; + var fp = new float[] { 3, 2, 0 }; + Assert.AreEqual(1.0f, np.interp(2.5f, xp, fp)); + + var given = np.interp(new float[] { 0, 1, 1.5f, 2.72f, 3.14f }, xp, fp); + var expected = + "array([3. , 3. , 2.5 , 0.55999994, 0. ])"; Assert.AreEqual(expected, given.repr); - given= plt.show(); - #endif + + var UNDEF = -99.0f; + Assert.AreEqual(-99.0f, np.interp(3.14f, xp, fp, right: UNDEF)); + // Interpolation with periodic x-coordinates: - + // >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] // >>> xp = [190, -190, 350, -350] // >>> fp = [5, 10, 3, 4] // >>> np.interp(x, xp, fp, period=360) // array([7.5, 5., 8.75, 6.25, 3., 3.25, 3.5, 3.75]) // - - #if TODO - given= x = [-180, -170, -185, 185, -10, -5, 0, 365]; - given= xp = [190, -190, 350, -350]; - given= fp = [5, 10, 3, 4]; - given= np.interp(x, xp, fp, period=360); - expected= - "array([7.5, 5., 8.75, 6.25, 3., 3.25, 3.5, 3.75])"; + + //var x = [-180, -170, -185, 185, -10, -5, 0, 365]; + var x = new float[] { -180, -170, -185, 185, -10, -5, 0, 365 }; + xp = new float[] { 190, -190, 350, -350 }; + fp = new float[] { 5, 10, 3, 4 }; + given = np.interp(x, xp, fp, period: 360); + expected = + "array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75])"; Assert.AreEqual(expected, given.repr); - #endif + // Complex interpolation: - + // >>> x = [1.5, 4.0] // >>> xp = [2,3,5] // >>> fp = [1.0j, 0, 2+3j] // >>> np.interp(x, xp, fp) // array([ 0.+1.j , 1.+1.5j]) - // - - #if TODO - given= x = [1.5, 4.0]; - given= xp = [2,3,5]; - given= fp = [1.0j, 0, 2+3j]; - given= np.interp(x, xp, fp); - expected= - "array([ 0.+1.j , 1.+1.5j])"; + + x = new float[] { 1.5f, 4.0f }; + xp = new float[] { 2, 3, 5 }; + var fp2 = new [] { new Complex(0, 1), new Complex(0, 0), new Complex(2, 3) }; + given = np.interp(x, xp, fp2); + expected = + "array([0.+1.j , 1.+1.5j])"; Assert.AreEqual(expected, given.repr); - #endif } - + } } From 1f351736346cdf1d3436780fe75a659d49e4766f Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sat, 22 Mar 2025 16:59:00 +0100 Subject: [PATCH 15/17] v1.35 --- src/Numpy/Numpy.csproj | 2 +- src/ReleaseBot/Program.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Numpy/Numpy.csproj b/src/Numpy/Numpy.csproj index 09d19b5..fd803e2 100644 --- a/src/Numpy/Numpy.csproj +++ b/src/Numpy/Numpy.csproj @@ -14,7 +14,7 @@ https://github.com/SciSharp/Numpy.NET Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 3.11.1.34 + 3.11.1.35 https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true 3.10.0.0 3.10.0.0 diff --git a/src/ReleaseBot/Program.cs b/src/ReleaseBot/Program.cs index eee2d8d..69a61f8 100644 --- a/src/ReleaseBot/Program.cs +++ b/src/ReleaseBot/Program.cs @@ -13,7 +13,7 @@ namespace ReleaseBot { class Program { - private const string V = "1.34"; // <--- numpy.net version! + private const string V = "1.35"; // <--- numpy.net version! private const string PythonNetVersion = "3.0.1"; private const string PythonVersion = "3.11"; // relevant only for Numpy with included binaries private const string NumpyVersion = "1.23.5"; From cf21fae785e6ee4e4f2dcd24904bf66ba774828e Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Mon, 24 Mar 2025 07:50:51 +0100 Subject: [PATCH 16/17] Update MatmulExample to use latest Numpy nuget (#132) --- src/Examples/MatmulExample/MatmulExample.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Examples/MatmulExample/MatmulExample.csproj b/src/Examples/MatmulExample/MatmulExample.csproj index 29065e7..0e842bf 100644 --- a/src/Examples/MatmulExample/MatmulExample.csproj +++ b/src/Examples/MatmulExample/MatmulExample.csproj @@ -6,7 +6,7 @@ - + From 2d34156053a0fae8b514bec70e9098f2dd0b1662 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Fri, 24 Oct 2025 18:47:53 +0200 Subject: [PATCH 17/17] Add testcase for #139 --- test/Numpy.UnitTest/NumpyTest.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 13eb64d..e65c58c 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Globalization; using System.IO; using System.Linq; using System.Numerics; @@ -1127,6 +1128,15 @@ public void IssueByXiaozhu1988() Console.WriteLine(((data >= 50) ^ (data < 100)).repr); Assert.AreEqual("array([ True, True, True, True, False, False, False, False, False,\n True, True, True])", ((data >= 50) ^ (data < 100)).repr); } + + [TestMethod] + public void IssueByElinLiu0() + { + var x = np.array(new float[,] { { 1.1f, 2.2f }, { 3.141596f, 4.4f } }); + var y = string.Join(',', x.GetData().Select(z => z.ToString(CultureInfo.InvariantCulture))); + Console.WriteLine("Proof: " + y); + Assert.AreEqual("1.1,2.2,3.141596,4.4", y); + } }