diff --git a/Numpy.NET.sln b/Numpy.NET.sln
index 660a54d..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
@@ -33,7 +33,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numpy.Bare.Dotnet", "src\Nu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApiExample_netcore3.1", "src\Examples\WebApiExample_netcore3.1\WebApiExample_netcore3.1.csproj", "{53C73261-DD84-47D1-A9BA-E553D34FF0A3}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomInstallLocationExample", "src\Examples\CustomInstallLocationExample\CustomInstallLocationExample.csproj", "{BB0A367A-8A36-454F-9F92-2FD6DA665A39}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomInstallLocationExample", "src\Examples\CustomInstallLocationExample\CustomInstallLocationExample.csproj", "{BB0A367A-8A36-454F-9F92-2FD6DA665A39}"
+EndProject
+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
@@ -101,6 +105,14 @@ Global
{BB0A367A-8A36-454F-9F92-2FD6DA665A39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB0A367A-8A36-454F-9F92-2FD6DA665A39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB0A367A-8A36-454F-9F92-2FD6DA665A39}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FB116716-8C1F-4926-86F9-03AE46C7FA58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {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
@@ -112,6 +124,8 @@ Global
{84BCB8CA-6B29-48D8-BEEE-751C7547419E} = {25D84E98-E107-45C9-A0EC-0B25E24DA607}
{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/README.md b/README.md
index 9a5e69b..9fb44ef 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ In other cases, you might want to control the install location of the Python ins
## How does it work?
-Numpy.NET uses [Python for .NET](http://pythonnet.github.io/) to call into the Python module `numpy`. However, this does not mean that it depends on a local Python installation! Numpy.NET.dll uses [Python.Included](https://github.com/henon/Python.Included) which packages embedded Python 3.7 and automatically deploys it in the user's home directory upon first execution. On subsequent runs, it will find Python already deployed and therefor doesn't install it again. Numpy.NET also packages the NumPy wheel and installs it into the embedded Python installation when not yet installed.
+Numpy.NET uses [Python for .NET](http://pythonnet.github.io/) to call into the Python module `numpy`. However, this does not mean that it depends on a local Python installation! Numpy.NET.dll uses [Python.Included](https://github.com/henon/Python.Included) which packages embedded Python 3.7 and automatically deploys it in the user's home directory upon first execution. On subsequent runs, it will find Python already deployed and therefore doesn't install it again. Numpy.NET also packages the NumPy wheel and installs it into the embedded Python installation when not yet installed.
Long story short: as a .NET Developer **you don't need to worry about Python** at all. You just reference Numpy.NET, use it and **it will just work**, no matter if you have local Python installations or not.
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 @@
+
+
+ Multiply on GUI thread (blocking)
+ Multiply on background thread (non-blocking)
+
+ 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/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs
index 3e7aff8..5709388 100644
--- a/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs
+++ b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs
@@ -252,6 +252,15 @@ public string Generate()
var window_api = new StaticApi() { PartialName = "window", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", };
_generator.StaticApis.Add(window_api);
ParseNumpyApi(window_api, "routines.window.html");
+ // ----------------------------------------------------
+ // Other functions
+ // ----------------------------------------------------
+ var other_api = new StaticApi() { PartialName = "other", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", };
+ _generator.StaticApis.Add(other_api);
+ var links = new[]{
+ "numpy.roots.html"
+ };
+ ParseSinglePages(other_api, links);
// ----------------------------------------------------
// generate Numpy
@@ -357,71 +366,89 @@ private void ParseNumpyApi(StaticApi api, string link)
_generator.TestFiles.Add(testfile);
foreach (var html_doc in docs)
{
- var doc = html_doc.Doc;
- // declaration
- var h1 = doc.DocumentNode.Descendants("h1").FirstOrDefault();
- if (h1 == null)
- continue;
- var dl = doc.DocumentNode.Descendants("dl").FirstOrDefault();
- //if (dl == null || dl.Attributes["class"]?.Value != "function") continue;
- var class_name = doc.DocumentNode.Descendants("code").FirstOrDefault(x => x.Attributes["class"]?.Value == "descclassname")?.InnerText;
- if (class_name == null)
- continue;
- var func_name = doc.DocumentNode.Descendants("code")
- .First(x => x.Attributes["class"]?.Value == "descname").InnerText;
- if (parsed_api_functions.Contains(class_name + "." + func_name))
- continue;
- parsed_api_functions.Add(class_name + "." + func_name);
- var decl = new Function() { Tag = link, Name = func_name, ClassName = class_name.TrimEnd('.') };
- // function description
- var dd = dl.Descendants("dd").FirstOrDefault();
- decl.Description = ParseDescription(dd);
- var table = doc.DocumentNode.Descendants("table")
- .FirstOrDefault(x => x.Attributes["class"]?.Value == "docutils field-list");
- if (table == null)
- continue;
- //if (decl.Name == "copyto")
- // Debugger.Break();
- // arguments
- ParseArguments(html_doc, table, decl);
+ ParseNumpyDocPage(api, link, html_doc, testfile);
+ }
+ }
- // return type(s)
- ParseReturnTypes(html_doc, table, decl);
+ private void ParseSinglePages(StaticApi api, params string[] links)
+ {
+ var docs = links.Select(x=>GetHtml("generated/"+x));
+ var testfile = new TestFile() { Name = $"{api.ImplName}_{api.PartialName}" };
+ _generator.TestFiles.Add(testfile);
+ foreach (var html_doc in docs)
+ {
+ ParseNumpyDocPage(api, "single pages", html_doc, testfile);
+ }
+ }
- PostProcess(decl);
- if (!decl.CommentOut)
- _function_count++;
+ private void ParseNumpyDocPage(StaticApi api, string link, HtmlDoc html_doc, TestFile testfile)
+ {
+ var doc = html_doc.Doc;
+ // declaration
+ var h1 = doc.DocumentNode.Descendants("h1").FirstOrDefault();
+ if (h1 == null)
+ return;
+ var dl = doc.DocumentNode.Descendants("dl").FirstOrDefault();
+ //if (dl == null || dl.Attributes["class"]?.Value != "function") continue;
+ var class_name = doc.DocumentNode.Descendants("code")
+ .FirstOrDefault(x => x.Attributes["class"]?.Value == "descclassname")?.InnerText;
+ if (class_name == null)
+ return;
+ var func_name = doc.DocumentNode.Descendants("code")
+ .First(x => x.Attributes["class"]?.Value == "descname").InnerText;
+ if (parsed_api_functions.Contains(class_name + "." + func_name))
+ return;
+ parsed_api_functions.Add(class_name + "." + func_name);
+ var decl = new Function() { Tag = link, Name = func_name, ClassName = class_name.TrimEnd('.') };
+ // function description
+ var dd = dl.Descendants("dd").FirstOrDefault();
+ decl.Description = ParseDescription(dd);
+ var table = doc.DocumentNode.Descendants("table")
+ .FirstOrDefault(x => x.Attributes["class"]?.Value == "docutils field-list");
+ if (table == null)
+ return;
+ //if (decl.Name == "copyto")
+ // Debugger.Break();
+ // arguments
+ ParseArguments(html_doc, table, decl);
- // if necessary create overloads
- foreach (var d in InferOverloads(decl))
+ // return type(s)
+ ParseReturnTypes(html_doc, table, decl);
+
+ PostProcess(decl);
+ if (!decl.CommentOut)
+ _function_count++;
+
+ // if necessary create overloads
+ foreach (var d in InferOverloads(decl))
+ {
+ PostProcessOverloads(d);
+ api.Declarations.Add(d);
+ // if this is an ndarray member, add it to the dynamic api also
+ if (ndarray_api != null && d.Arguments.FirstOrDefault()?.Type == "NDarray" && class_name == "numpy.")
{
- PostProcessOverloads(d);
- api.Declarations.Add(d);
- // if this is an ndarray member, add it to the dynamic api also
- if (ndarray_api != null && d.Arguments.FirstOrDefault()?.Type == "NDarray" && class_name == "numpy.")
+ switch (decl.Name)
{
- switch (decl.Name)
- {
- // do not add to NDArray instance methods
- case "copyto":
- 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);
+ // do not add to NDArray instance methods
+ case "copyto":
+ //case "transpose":
+ //case "amax":
+ //case "amin":
+ //case "real":
+ //case "imag":
+ continue;
}
+ decl.IsExtensionFunction = true;
+ //var dc = d.Clone();
+ //dc.Arguments.RemoveAt(0);
+ //ndarray_api.Declarations.Add(dc);
}
- // see if there are any examples which we can convert to test cases
- var testcase = ParseTests(doc, decl);
- if (testcase != null)
- testfile.TestCases.Add(testcase);
}
+
+ // see if there are any examples which we can convert to test cases
+ var testcase = ParseTests(doc, decl);
+ if (testcase != null)
+ testfile.TestCases.Add(testcase);
}
private TestCase ParseTests(HtmlDocument doc, Function decl)
@@ -655,6 +682,8 @@ private void PostProcess(Function decl)
case "tobytes":
case "view":
case "resize":
+ case "insert":
+ case "einsum":
decl.ManualOverride = true; // do not generate an implementation
break;
case "arange":
@@ -718,23 +747,11 @@ private void PostProcess(Function decl)
case "correlate":
decl.Arguments.Remove(decl.Arguments.FirstOrDefault(x => x.Name == "old_behavior"));
break;
- case "einsum":
- var optimize = decl.Arguments.First(x => x.Name == "optimize");
- optimize.Type = "object";
- optimize.DefaultValue = "null";
- optimize.DefaultIfNull = "false";
- break;
case "rot90":
var axes = decl.Arguments.First(x => x.Name == "axes");
axes.DefaultValue = "null";
axes.DefaultIfNull = "new int[] {0, 1}";
break;
- case "insert":
- var obj = decl.Arguments.First(x => x.Name == "obj");
- obj.DefaultValue = "0";
- var values = decl.Arguments.First(x => x.Name == "values");
- values.DefaultValue = "null";
- break;
case "trapz":
var dx = decl.Arguments.First(x => x.Name == "dx");
dx.Type = "float";
@@ -894,6 +911,7 @@ private IEnumerable InferOverloads(Function decl)
{
switch (decl.Name)
{
+ case "qr":
case "norm":
case "asscalar":
case "normal":
@@ -1119,16 +1137,12 @@ private IEnumerable InferOverloads(Function decl)
else
yield return decl;
yield break;
- //case "meshgrid":
- // yield return decl;
- // yield return decl.Clone(f =>
- // {
- // f.Arguments[0].Type = "params NDarray[]";
- // f.Arguments.RemoveAt(1);
- // f.Arguments.RemoveAt(1);
- // f.Arguments.RemoveAt(1);
- // });
- // 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
@@ -1542,7 +1556,8 @@ HtmlDoc GetHtml(string relative_url)
doc.Doc = new HtmlDocument();
doc.Doc.Load(doc.Filename);
doc.Text = doc.Doc.Text;
- return doc;
+ if (!doc.Text.Contains("404 Not Found"))
+ return doc;
}
var web = new HtmlWeb();
doc.Doc = web.Load(BaseUrl + relative_url);
diff --git a/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs b/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs
index d44b3b1..c020112 100644
--- a/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs
+++ b/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs
@@ -8,7 +8,7 @@ public static class SpecialGenerators
public static void InitNumpyGenerator(CodeWriter s)
{
s.Out("#if PYTHON_INCLUDED");
- s.Out("Installer.InstallWheel(typeof(np).Assembly, \"numpy-1.16.3-cp37-cp37m-win_amd64.whl\").Wait();");
+ s.Out("Installer.InstallWheel(typeof(np).Assembly, \"numpy-1.23.5-cp311-cp311-win_amd64.whl\", force).Wait();");
s.Out("#endif");
}
diff --git a/src/CodeMinion.Core/CodeGenerator.cs b/src/CodeMinion.Core/CodeGenerator.cs
index 71913c9..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)
{
@@ -900,10 +901,15 @@ private void GenerateStaticModuleHead(CodeWriter s)
{
s.Out($"public static partial class {StaticModuleName}", () =>
{
+ s.Out("static np()", () =>
+ {
+ s.Out("ReInitializeLazySelf();");
+ });
s.Break();
s.Out("public static PyObject self => _lazy_self.Value;");
s.Break();
- s.Out($"private static Lazy _lazy_self = new Lazy(() => ", () =>
+ s.Out($"private static Lazy _lazy_self = default;");
+ s.Out($"private static void ReInitializeLazySelf() => _lazy_self = new Lazy(() => ", () =>
{
s.Out("try", () =>
{
@@ -925,6 +931,7 @@ private void GenerateStaticModuleHead(CodeWriter s)
s.Out(@"#endif");
foreach (var generator in InitializationGenerators)
generator(s);
+ s.Out("PythonEngine.AddShutdownHandler(() => ReInitializeLazySelf());");
s.Out("PythonEngine.Initialize();");
s.Out($"var mod = Py.Import(\"{PythonModuleName}\");");
s.Out("return mod;");
@@ -987,7 +994,7 @@ private void GenToCsharp(CodeWriter s, bool @static = false)
{
s.Break();
s.Out("//auto-generated");
- s.Out($"{(@static?"private static":"public")} T ToCsharp(dynamic pyobj)", () =>
+ s.Out($"{(@static?"internal static":"public")} T ToCsharp(dynamic pyobj)", () =>
{
s.Out("switch (typeof(T).Name)", () =>
{
@@ -997,11 +1004,13 @@ private void GenToCsharp(CodeWriter s, bool @static = false)
s.Out(@case);
}
s.Out("default:");
+ s.Out("var pyClass = $\"{pyobj.__class__}\";");
+ s.Out("if (pyClass == \"\")", () => s.Out("return (T)(object)pyobj.ToString();"));
+ s.Out("if (pyClass.StartsWith(\" s.Out("return (pyobj.item() as PyObject).As();"));
s.Out("try", () => s.Out("return pyobj.As();"));
s.Out("catch (Exception e)", () =>
{
- s.Out(
- "throw new NotImplementedException($\"conversion from {typeof(T).Name} to {pyobj.__class__} not implemented\", e);");
+ s.Out("throw new NotImplementedException($\"conversion from {pyobj.__class__} to {typeof(T).Name} not implemented\", e);");
s.Out("return default(T);");
});
});
@@ -1014,14 +1023,14 @@ private void GenToPython(CodeWriter s, bool @static=false)
{
s.Break();
s.Out("//auto-generated");
- s.Out($"{(@static?"private static":"public")} PyObject ToPython(object obj)", () =>
+ s.Out($"{(@static?"internal static":"public")} PyObject ToPython(object obj)", () =>
{
s.Out("if (obj == null) return Runtime.None;");
s.Out("switch (obj)", () =>
{
s.Out("// basic types");
s.Out("case int o: return new PyInt(o);");
- s.Out("case long o: return new PyLong(o);");
+ s.Out("case long o: return new PyInt(o);");
s.Out("case float o: return new PyFloat(o);");
s.Out("case double o: return new PyFloat(o);");
s.Out("case string o: return new PyString(o);");
@@ -1045,7 +1054,7 @@ private void GenSharpToSharp(CodeWriter s, bool @static=false)
{
s.Break();
s.Out("//auto-generated");
- s.Out($"{(@static ? "private static" : "public")} T SharpToSharp(object obj)", () =>
+ s.Out($"{(@static ? "internal static" : "public")} T SharpToSharp(object obj)", () =>
{
s.Out("if (obj == null) return default(T);");
s.Out("switch (obj)", () =>
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/Examples/MatmulExample/MatmulExample.csproj b/src/Examples/MatmulExample/MatmulExample.csproj
index 8b979d5..0e842bf 100644
--- a/src/Examples/MatmulExample/MatmulExample.csproj
+++ b/src/Examples/MatmulExample/MatmulExample.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/Examples/SlicingExample/Program.cs b/src/Examples/SlicingExample/Program.cs
new file mode 100644
index 0000000..ef5073e
--- /dev/null
+++ b/src/Examples/SlicingExample/Program.cs
@@ -0,0 +1,17 @@
+using System;
+using Numpy;
+
+namespace SlicingExample
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var a = np.arange(20).reshape(4,5);
+ Console.WriteLine(a);
+ var b = a["2:4"];
+ Console.WriteLine("\n sliced with 2:4");
+ Console.WriteLine(b );
+ }
+ }
+}
diff --git a/src/Examples/SlicingExample/SlicingExample.csproj b/src/Examples/SlicingExample/SlicingExample.csproj
new file mode 100644
index 0000000..3520e25
--- /dev/null
+++ b/src/Examples/SlicingExample/SlicingExample.csproj
@@ -0,0 +1,12 @@
+
+
+
+ Exe
+ net5.0
+
+
+
+
+
+
+
diff --git a/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj b/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj
index b815654..3146206 100644
--- a/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj
+++ b/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj
@@ -70,12 +70,21 @@
Manual\np.delete.cs
+
+ Manual\np.einsum.cs
+
+
+ Manual\np.insert.cs
+
Manual\np.linalg.norm.cs
Manual\np.linspace.cs
+
+ Manual\np.math.cs
+
Manual\np.meshgrid.cs
diff --git a/src/Numpy.Bare/Numpy.Bare.csproj b/src/Numpy.Bare/Numpy.Bare.csproj
index fa3edc2..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.25
+ 3.11.1.33
https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true
3.7.1.4
@@ -37,8 +37,11 @@
+
+
+
@@ -83,8 +86,8 @@
-
-
+
+
diff --git a/src/Numpy/Manual/np.array.cs b/src/Numpy/Manual/np.array.cs
index 11441ee..b4348b6 100644
--- a/src/Numpy/Manual/np.array.cs
+++ b/src/Numpy/Manual/np.array.cs
@@ -42,6 +42,7 @@ public static NDarray array(NDarray @object, Dtype dtype = null, bool? copy = nu
if (subok != null) kwargs["subok"] = ToPython(subok);
if (ndmin != null) kwargs["ndmin"] = ToPython(ndmin);
dynamic py = self.InvokeMethod("array", args, kwargs);
+ args.Dispose();
return ToCsharp(py);
}
@@ -52,7 +53,8 @@ public static NDarray array(T[] @object, Dtype dtype = null, bool? copy =
var ndarray = np.empty(new Shape(@object.Length), dtype: type, order: order);
if (@object.Length == 0)
return new NDarray(ndarray);
- long ptr = ndarray.PyObject.ctypes.data;
+ var ctypes = ndarray.PyObject.ctypes;
+ long ptr = ctypes.data;
switch ((object)@object)
{
case char[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break;
@@ -60,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:
@@ -80,8 +83,13 @@ public static NDarray array(T[] @object, Dtype dtype = null, bool? copy =
ndarray.imag = ndimag;
break;
}
- if (dtype !=null || subok != null || ndmin != null)
- return new NDarray(np.array(ndarray, dtype:dtype, copy: false, subok: subok, ndmin: ndmin));
+ ctypes.Dispose();
+ if (dtype != null || subok != null || ndmin != null)
+ {
+ var converted = np.array(ndarray, dtype: dtype, copy: false, subok: subok, ndmin: ndmin);
+ ndarray.Dispose();
+ return new NDarray(converted);
+ }
return new NDarray(ndarray);
}
@@ -193,12 +201,7 @@ public static NDarray asarray(ValueType scalar, Dtype dtype = null)
/// Scalar representation of a. The output data type is the same type
/// returned by the input’s item method.
///
- public static T asscalar(NDarray a)
- {
- if (typeof(T) == typeof(Complex))
- return (T)(object) new Complex(a.real.asscalar(), a.imag.asscalar());
- return self.InvokeMethod("asscalar", a.PyObject).As();
- }
+ public static T asscalar(NDarray a) => new NDarray(a).item(); // <--- asscalar has been removed as of numpy 1.23
}
}
diff --git a/src/Numpy/Manual/np.einsum.cs b/src/Numpy/Manual/np.einsum.cs
new file mode 100644
index 0000000..29ae966
--- /dev/null
+++ b/src/Numpy/Manual/np.einsum.cs
@@ -0,0 +1,392 @@
+// Copyright (c) 2021 by Meinrad Recheis (meinrad.recheis@gmail.com)
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using Python.Runtime;
+using Numpy.Models;
+#if PYTHON_INCLUDED
+using Python.Included;
+#endif
+
+namespace Numpy
+{
+ public static partial class np
+ {
+
+ ///
+ /// Evaluates the Einstein summation convention on the operands.
+ ///
+ /// Using the Einstein summation convention, many common multi-dimensional,
+ /// linear algebraic array operations can be represented in a simple fashion.
+ ///
+ /// In implicit mode einsum computes these values.
+ ///
+ /// In explicit mode, einsum provides further flexibility to compute
+ /// other array operations that might not be considered classical Einstein
+ /// summation operations, by disabling, or forcing summation over specified
+ /// subscript labels.
+ ///
+ /// See the notes and examples for clarification.
+ ///
+ /// Notes
+ ///
+ /// The Einstein summation convention can be used to compute
+ /// many multi-dimensional, linear algebraic array operations.
+ /// einsum
+ /// provides a succinct way of representing these.
+ ///
+ /// A non-exhaustive list of these operations,
+ /// which can be computed by einsum, is shown below along with examples:
+ ///
+ /// The subscripts string is a comma-separated list of subscript labels,
+ /// where each label refers to a dimension of the corresponding operand.
+ ///
+ /// Whenever a label is repeated it is summed, so np.einsum('i,i', a, b)
+ /// is equivalent to np.inner(a,b).
+ /// If a label
+ /// appears only once, it is not summed, so np.einsum('i', a) produces a
+ /// view of a with no changes.
+ /// A further example np.einsum('ij,jk', a, b)
+ /// describes traditional matrix multiplication and is equivalent to
+ /// np.matmul(a,b).
+ /// Repeated subscript labels in one
+ /// operand take the diagonal.
+ /// For example, np.einsum('ii', a) is equivalent
+ /// to np.trace(a).
+ ///
+ /// In implicit mode, the chosen subscripts are important
+ /// since the axes of the output are reordered alphabetically.
+ /// This
+ /// means that np.einsum('ij', a) doesn’t affect a 2D array, while
+ /// np.einsum('ji', a) takes its transpose.
+ /// Additionally,
+ /// np.einsum('ij,jk', a, b) returns a matrix multiplication, while,
+ /// np.einsum('ij,jh', a, b) returns the transpose of the
+ /// multiplication since subscript ‘h’ precedes subscript ‘i’.
+ ///
+ /// In explicit mode the output can be directly controlled by
+ /// specifying output subscript labels.
+ /// This requires the
+ /// identifier ‘->’ as well as the list of output subscript labels.
+ ///
+ /// This feature increases the flexibility of the function since
+ /// summing can be disabled or forced when required.
+ /// The call
+ /// np.einsum('i->', a) is like np.sum(a, axis=-1),
+ /// and np.einsum('ii->i', a) is like np.diag(a).
+ ///
+ /// The difference is that einsum does not allow broadcasting by default.
+ ///
+ /// Additionally np.einsum('ij,jh->ih', a, b) directly specifies the
+ /// order of the output subscript labels and therefore returns matrix
+ /// multiplication, unlike the example above in implicit mode.
+ ///
+ /// To enable and control broadcasting, use an ellipsis.
+ /// Default
+ /// NumPy-style broadcasting is done by adding an ellipsis
+ /// to the left of each term, like np.einsum('...ii->...i', a).
+ ///
+ /// To take the trace along the first and last axes,
+ /// you can do np.einsum('i...i', a), or to do a matrix-matrix
+ /// product with the left-most indices instead of rightmost, one can do
+ /// np.einsum('ij...,jk...->ik...', a, b).
+ ///
+ /// When there is only one operand, no axes are summed, and no output
+ /// parameter is provided, a view into the operand is returned instead
+ /// of a new array.
+ /// Thus, taking the diagonal as np.einsum('ii->i', a)
+ /// produces a view (changed in version 1.10.0).
+ ///
+ /// einsum also provides an alternative way to provide the subscripts
+ /// and operands as einsum(op0, sublist0, op1, sublist1, ..., [sublistout]).
+ ///
+ /// If the output shape is not provided in this format einsum will be
+ /// calculated in implicit mode, otherwise it will be performed explicitly.
+ ///
+ /// The examples below have corresponding einsum calls with the two
+ /// parameter methods.
+ ///
+ /// Views returned from einsum are now writeable whenever the input array
+ /// is writeable.
+ /// For example, np.einsum('ijk...->kji...', a) will now
+ /// have the same effect as np.swapaxes(a, 0, 2)
+ /// and np.einsum('ii->i', a) will return a writeable view of the diagonal
+ /// of a 2D array.
+ ///
+ /// Added the optimize argument which will optimize the contraction order
+ /// of an einsum expression.
+ /// For a contraction with three or more operands this
+ /// can greatly increase the computational efficiency at the cost of a larger
+ /// memory footprint during computation.
+ ///
+ /// Typically a ‘greedy’ algorithm is applied which empirical tests have shown
+ /// returns the optimal path in the majority of cases.
+ /// In some cases ‘optimal’
+ /// will return the superlative path through a more expensive, exhaustive search.
+ ///
+ /// For iterative calculations it may be advisable to calculate the optimal path
+ /// once and reuse that path by supplying it as an argument.
+ /// An example is given
+ /// below.
+ ///
+ /// See numpy.einsum_path for more details.
+ ///
+ ///
+ /// Specifies the subscripts for summation as comma separated list of
+ /// subscript labels.
+ /// An implicit (classical Einstein summation)
+ /// calculation is performed unless the explicit indicator ‘->’ is
+ /// included as well as subscript labels of the precise output form.
+ ///
+ ///
+ /// These are the arrays for the operation.
+ ///
+ ///
+ /// If provided, the calculation is done into this array.
+ ///
+ ///
+ /// If provided, forces the calculation to use the data type specified.
+ ///
+ /// Note that you may have to also give a more liberal casting
+ /// parameter to allow the conversions.
+ /// Default is None.
+ ///
+ ///
+ /// Controls the memory layout of the output.
+ /// ‘C’ means it should
+ /// be C contiguous.
+ /// ‘F’ means it should be Fortran contiguous,
+ /// ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise.
+ ///
+ /// ‘K’ means it should be as close to the layout as the inputs as
+ /// is possible, including arbitrarily permuted axes.
+ ///
+ /// Default is ‘K’.
+ ///
+ ///
+ /// Controls what kind of data casting may occur.
+ /// Setting this to
+ /// ‘unsafe’ is not recommended, as it can adversely affect accumulations.
+ ///
+ /// Default is ‘safe’.
+ ///
+ ///
+ /// Controls if intermediate optimization should occur.
+ /// No optimization
+ /// will occur if False and True will default to the ‘greedy’ algorithm.
+ ///
+ /// Also accepts an explicit contraction list from the np.einsum_path
+ /// function.
+ /// See np.einsum_path for more details.
+ /// Defaults to False.
+ ///
+ ///
+ /// The calculation based on the Einstein summation convention.
+ ///
+ public static NDarray einsum(string subscripts, NDarray[] operands, NDarray @out = null, Dtype dtype = null, string order = null, string casting = "safe", object optimize = null)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+ var pyargs = ToTuple(new object[]
+ {
+ subscripts,
+ }.Concat(operands.OfType()).ToArray());
+ var kwargs = new PyDict();
+ if (@out != null) kwargs["out"] = ToPython(@out);
+ if (dtype != null) kwargs["dtype"] = ToPython(dtype);
+ if (order != null) kwargs["order"] = ToPython(order);
+ if (casting != "safe") kwargs["casting"] = ToPython(casting);
+ if (optimize != null) kwargs["optimize"] = ToPython(optimize);
+ dynamic py = __self__.InvokeMethod("einsum", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ ///
+ /// Evaluates the Einstein summation convention on the operands.
+ ///
+ /// Using the Einstein summation convention, many common multi-dimensional,
+ /// linear algebraic array operations can be represented in a simple fashion.
+ ///
+ /// In implicit mode einsum computes these values.
+ ///
+ /// In explicit mode, einsum provides further flexibility to compute
+ /// other array operations that might not be considered classical Einstein
+ /// summation operations, by disabling, or forcing summation over specified
+ /// subscript labels.
+ ///
+ /// See the notes and examples for clarification.
+ ///
+ /// Notes
+ ///
+ /// The Einstein summation convention can be used to compute
+ /// many multi-dimensional, linear algebraic array operations.
+ /// einsum
+ /// provides a succinct way of representing these.
+ ///
+ /// A non-exhaustive list of these operations,
+ /// which can be computed by einsum, is shown below along with examples:
+ ///
+ /// The subscripts string is a comma-separated list of subscript labels,
+ /// where each label refers to a dimension of the corresponding operand.
+ ///
+ /// Whenever a label is repeated it is summed, so np.einsum('i,i', a, b)
+ /// is equivalent to np.inner(a,b).
+ /// If a label
+ /// appears only once, it is not summed, so np.einsum('i', a) produces a
+ /// view of a with no changes.
+ /// A further example np.einsum('ij,jk', a, b)
+ /// describes traditional matrix multiplication and is equivalent to
+ /// np.matmul(a,b).
+ /// Repeated subscript labels in one
+ /// operand take the diagonal.
+ /// For example, np.einsum('ii', a) is equivalent
+ /// to np.trace(a).
+ ///
+ /// In implicit mode, the chosen subscripts are important
+ /// since the axes of the output are reordered alphabetically.
+ /// This
+ /// means that np.einsum('ij', a) doesn’t affect a 2D array, while
+ /// np.einsum('ji', a) takes its transpose.
+ /// Additionally,
+ /// np.einsum('ij,jk', a, b) returns a matrix multiplication, while,
+ /// np.einsum('ij,jh', a, b) returns the transpose of the
+ /// multiplication since subscript ‘h’ precedes subscript ‘i’.
+ ///
+ /// In explicit mode the output can be directly controlled by
+ /// specifying output subscript labels.
+ /// This requires the
+ /// identifier ‘->’ as well as the list of output subscript labels.
+ ///
+ /// This feature increases the flexibility of the function since
+ /// summing can be disabled or forced when required.
+ /// The call
+ /// np.einsum('i->', a) is like np.sum(a, axis=-1),
+ /// and np.einsum('ii->i', a) is like np.diag(a).
+ ///
+ /// The difference is that einsum does not allow broadcasting by default.
+ ///
+ /// Additionally np.einsum('ij,jh->ih', a, b) directly specifies the
+ /// order of the output subscript labels and therefore returns matrix
+ /// multiplication, unlike the example above in implicit mode.
+ ///
+ /// To enable and control broadcasting, use an ellipsis.
+ /// Default
+ /// NumPy-style broadcasting is done by adding an ellipsis
+ /// to the left of each term, like np.einsum('...ii->...i', a).
+ ///
+ /// To take the trace along the first and last axes,
+ /// you can do np.einsum('i...i', a), or to do a matrix-matrix
+ /// product with the left-most indices instead of rightmost, one can do
+ /// np.einsum('ij...,jk...->ik...', a, b).
+ ///
+ /// When there is only one operand, no axes are summed, and no output
+ /// parameter is provided, a view into the operand is returned instead
+ /// of a new array.
+ /// Thus, taking the diagonal as np.einsum('ii->i', a)
+ /// produces a view (changed in version 1.10.0).
+ ///
+ /// einsum also provides an alternative way to provide the subscripts
+ /// and operands as einsum(op0, sublist0, op1, sublist1, ..., [sublistout]).
+ ///
+ /// If the output shape is not provided in this format einsum will be
+ /// calculated in implicit mode, otherwise it will be performed explicitly.
+ ///
+ /// The examples below have corresponding einsum calls with the two
+ /// parameter methods.
+ ///
+ /// Views returned from einsum are now writeable whenever the input array
+ /// is writeable.
+ /// For example, np.einsum('ijk...->kji...', a) will now
+ /// have the same effect as np.swapaxes(a, 0, 2)
+ /// and np.einsum('ii->i', a) will return a writeable view of the diagonal
+ /// of a 2D array.
+ ///
+ /// Added the optimize argument which will optimize the contraction order
+ /// of an einsum expression.
+ /// For a contraction with three or more operands this
+ /// can greatly increase the computational efficiency at the cost of a larger
+ /// memory footprint during computation.
+ ///
+ /// Typically a ‘greedy’ algorithm is applied which empirical tests have shown
+ /// returns the optimal path in the majority of cases.
+ /// In some cases ‘optimal’
+ /// will return the superlative path through a more expensive, exhaustive search.
+ ///
+ /// For iterative calculations it may be advisable to calculate the optimal path
+ /// once and reuse that path by supplying it as an argument.
+ /// An example is given
+ /// below.
+ ///
+ /// See numpy.einsum_path for more details.
+ ///
+ ///
+ /// Specifies the subscripts for summation as comma separated list of
+ /// subscript labels.
+ /// An implicit (classical Einstein summation)
+ /// calculation is performed unless the explicit indicator ‘->’ is
+ /// included as well as subscript labels of the precise output form.
+ ///
+ ///
+ /// These are the arrays for the operation.
+ ///
+ ///
+ /// If provided, the calculation is done into this array.
+ ///
+ ///
+ /// If provided, forces the calculation to use the data type specified.
+ ///
+ /// Note that you may have to also give a more liberal casting
+ /// parameter to allow the conversions.
+ /// Default is None.
+ ///
+ ///
+ /// Controls the memory layout of the output.
+ /// ‘C’ means it should
+ /// be C contiguous.
+ /// ‘F’ means it should be Fortran contiguous,
+ /// ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise.
+ ///
+ /// ‘K’ means it should be as close to the layout as the inputs as
+ /// is possible, including arbitrarily permuted axes.
+ ///
+ /// Default is ‘K’.
+ ///
+ ///
+ /// Controls what kind of data casting may occur.
+ /// Setting this to
+ /// ‘unsafe’ is not recommended, as it can adversely affect accumulations.
+ ///
+ /// Default is ‘safe’.
+ ///
+ ///
+ /// Controls if intermediate optimization should occur.
+ /// No optimization
+ /// will occur if False and True will default to the ‘greedy’ algorithm.
+ ///
+ /// Also accepts an explicit contraction list from the np.einsum_path
+ /// function.
+ /// See np.einsum_path for more details.
+ /// Defaults to False.
+ ///
+ ///
+ /// The calculation based on the Einstein summation convention.
+ ///
+ public static NDarray einsum(string subscripts, params NDarray[] operands)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+ var pyargs = ToTuple(new object[]
+ {
+ subscripts,
+ }.Concat(operands.OfType()).ToArray());
+ var kwargs = new PyDict();
+ dynamic py = __self__.InvokeMethod("einsum", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ }
+}
diff --git a/src/Numpy/Manual/np.insert.cs b/src/Numpy/Manual/np.insert.cs
new file mode 100644
index 0000000..18f6a10
--- /dev/null
+++ b/src/Numpy/Manual/np.insert.cs
@@ -0,0 +1,243 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using Numpy;
+using Numpy.Models;
+using Python.Runtime;
+
+namespace Numpy
+{
+ ///
+ /// Manual type conversions
+ ///
+ public static partial class np
+ {
+
+ ///
+ /// Insert values along the given axis before the given indices.
+ ///
+ /// Notes
+ ///
+ /// Note that for higher dimensional inserts obj=0 behaves very different
+ /// from obj=[0] just like arr[:,0,:] = values is different from
+ /// arr[:,[0],:] = values.
+ ///
+ ///
+ /// Input array.
+ ///
+ ///
+ /// Object that defines the index or indices before which values is
+ /// inserted.
+ ///
+ /// Support for multiple insertions when obj is a single scalar or a
+ /// sequence with one element (similar to calling insert multiple
+ /// times).
+ ///
+ ///
+ /// Values to insert into arr.
+ /// If the type of values is different
+ /// from that of arr, values is converted to the type of arr.
+ ///
+ /// values should be shaped so that arr[...,obj,...] = values
+ /// is legal.
+ ///
+ ///
+ /// Axis along which to insert values.
+ /// If axis is None then arr
+ /// is flattened first.
+ ///
+ ///
+ /// A copy of arr with values inserted.
+ /// Note that insert
+ /// does not occur in-place: a new array is returned.
+ /// If
+ /// axis is None, out is a flattened array.
+ ///
+ public static NDarray insert(NDarray arr, int obj, NDarray values = null, int? axis = null)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+ var pyargs = ToTuple(new object[]
+ {
+ arr,
+ ToPython(obj),
+ });
+ var kwargs = new PyDict();
+ if (values != null) kwargs["values"] = ToPython(values);
+ if (axis != null) kwargs["axis"] = ToPython(axis);
+ dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ ///
+ /// Insert values along the given axis before the given indices.
+ ///
+ /// Notes
+ ///
+ /// Note that for higher dimensional inserts obj=0 behaves very different
+ /// from obj=[0] just like arr[:,0,:] = values is different from
+ /// arr[:,[0],:] = values.
+ ///
+ ///
+ /// Input array.
+ ///
+ ///
+ /// Object that defines the index or indices before which values is
+ /// inserted.
+ ///
+ /// Support for multiple insertions when obj is a single scalar or a
+ /// sequence with one element (similar to calling insert multiple
+ /// times).
+ ///
+ ///
+ /// Values to insert into arr.
+ /// If the type of values is different
+ /// from that of arr, values is converted to the type of arr.
+ ///
+ /// values should be shaped so that arr[...,obj,...] = values
+ /// is legal.
+ ///
+ ///
+ /// Axis along which to insert values.
+ /// If axis is None then arr
+ /// is flattened first.
+ ///
+ ///
+ /// A copy of arr with values inserted.
+ /// Note that insert
+ /// does not occur in-place: a new array is returned.
+ /// If
+ /// axis is None, out is a flattened array.
+ ///
+ public static NDarray insert(NDarray arr, NDarray obj, NDarray values = null, int? axis = null)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+ var pyargs = ToTuple(new object[]
+ {
+ arr,
+ obj,
+ });
+ var kwargs = new PyDict();
+ if (values != null) kwargs["values"] = ToPython(values);
+ if (axis != null) kwargs["axis"] = ToPython(axis);
+ dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ ///
+ /// Insert values along the given axis before the given indices.
+ ///
+ /// Notes
+ ///
+ /// Note that for higher dimensional inserts obj=0 behaves very different
+ /// from obj=[0] just like arr[:,0,:] = values is different from
+ /// arr[:,[0],:] = values.
+ ///
+ ///
+ /// Input array.
+ ///
+ ///
+ /// Object that defines the index or indices before which values is
+ /// inserted.
+ ///
+ /// Support for multiple insertions when obj is a single scalar or a
+ /// sequence with one element (similar to calling insert multiple
+ /// times).
+ ///
+ ///
+ /// Values to insert into arr.
+ /// If the type of values is different
+ /// from that of arr, values is converted to the type of arr.
+ ///
+ /// values should be shaped so that arr[...,obj,...] = values
+ /// is legal.
+ ///
+ ///
+ /// Axis along which to insert values.
+ /// If axis is None then arr
+ /// is flattened first.
+ ///
+ ///
+ /// A copy of arr with values inserted.
+ /// Note that insert
+ /// does not occur in-place: a new array is returned.
+ /// If
+ /// axis is None, out is a flattened array.
+ ///
+ public static NDarray insert(NDarray arr, Slice obj, NDarray values = null, int? axis = null)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+ var pyargs = ToTuple(new object[]
+ {
+ arr,
+ obj.ToPython(),
+ });
+ var kwargs = new PyDict();
+ if (values != null) kwargs["values"] = ToPython(values);
+ if (axis != null) kwargs["axis"] = ToPython(axis);
+ dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ ///
+ /// Insert values along the given axis before the given indices.
+ ///
+ /// Notes
+ ///
+ /// Note that for higher dimensional inserts obj=0 behaves very different
+ /// from obj=[0] just like arr[:,0,:] = values is different from
+ /// arr[:,[0],:] = values.
+ ///
+ ///
+ /// Input array.
+ ///
+ ///
+ /// Object that defines the index or indices before which values is
+ /// inserted.
+ ///
+ /// Support for multiple insertions when obj is a single scalar or a
+ /// sequence with one element (similar to calling insert multiple
+ /// times).
+ ///
+ ///
+ /// Values to insert into arr.
+ /// If the type of values is different
+ /// from that of arr, values is converted to the type of arr.
+ ///
+ /// values should be shaped so that arr[...,obj,...] = values
+ /// is legal.
+ ///
+ ///
+ /// Axis along which to insert values.
+ /// If axis is None then arr
+ /// is flattened first.
+ ///
+ ///
+ /// A copy of arr with values inserted.
+ /// Note that insert
+ /// does not occur in-place: a new array is returned.
+ /// If
+ /// axis is None, out is a flattened array.
+ ///
+ public static NDarray insert(NDarray arr, int obj, T values, int? axis = null) where T : struct
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+ var pyargs = ToTuple(new object[]
+ {
+ arr,
+ ToPython(obj),
+ });
+ var kwargs = new PyDict();
+ kwargs["values"] = ToPython(values);
+ if (axis != null) kwargs["axis"] = ToPython(axis);
+ dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ }
+}
diff --git a/src/Numpy/Manual/np.linalg.norm.cs b/src/Numpy/Manual/np.linalg.norm.cs
index 64f3dce..98b0580 100644
--- a/src/Numpy/Manual/np.linalg.norm.cs
+++ b/src/Numpy/Manual/np.linalg.norm.cs
@@ -114,6 +114,99 @@ public static float norm(NDarray x, Constants ord)
dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs);
return ToCsharp(py);
}
+
+ ///
+ /// Compute the qr factorization of a matrix.
+ ///
+ /// Factor the matrix a as qr, where q is orthonormal and r is
+ /// upper-triangular.
+ ///
+ /// Notes
+ ///
+ /// This is an interface to the LAPACK routines dgeqrf, zgeqrf,
+ /// dorgqr, and zungqr.
+ ///
+ /// For more information on the qr factorization, see for example:
+ /// https://en.wikipedia.org/wiki/QR_factorization
+ ///
+ /// Subclasses of ndarray are preserved except for the ‘raw’ mode.
+ /// So if
+ /// a is of type matrix, all the return values will be matrices too.
+ ///
+ /// New ‘reduced’, ‘complete’, and ‘raw’ options for mode were added in
+ /// NumPy 1.8.0 and the old option ‘full’ was made an alias of ‘reduced’. In
+ /// addition the options ‘full’ and ‘economic’ were deprecated.
+ /// Because
+ /// ‘full’ was the previous default and ‘reduced’ is the new default,
+ /// backward compatibility can be maintained by letting mode default.
+ ///
+ /// The ‘raw’ option was added so that LAPACK routines that can multiply
+ /// arrays by q using the Householder reflectors can be used.
+ /// Note that in
+ /// this case the returned arrays are of type np.double or np.cdouble and
+ /// the h array is transposed to be FORTRAN compatible.
+ /// No routines using
+ /// the ‘raw’ return are currently exposed by numpy, but some are available
+ /// in lapack_lite and just await the necessary work.
+ ///
+ ///
+ /// Matrix to be factored.
+ ///
+ ///
+ /// If K = min(M, N), then
+ ///
+ /// The options ‘reduced’, ‘complete, and ‘raw’ are new in numpy 1.8,
+ /// see the notes for more information.
+ /// The default is ‘reduced’, and to
+ /// maintain backward compatibility with earlier versions of numpy both
+ /// it and the old default ‘full’ can be omitted.
+ /// Note that array h
+ /// returned in ‘raw’ mode is transposed for calling Fortran.
+ /// The
+ /// ‘economic’ mode is deprecated.
+ /// The modes ‘full’ and ‘economic’ may
+ /// be passed using only the first letter for backwards compatibility,
+ /// but all others must be spelled out.
+ /// See the Notes for more
+ /// explanation.
+ ///
+ ///
+ /// A tuple of:
+ /// q
+ /// A matrix with orthonormal columns. When mode = ‘complete’ the
+ /// result is an orthogonal/unitary matrix depending on whether or not
+ /// a is real/complex. The determinant may be either +/- 1 in that
+ /// case.
+ /// r
+ /// The upper-triangular matrix.
+ /// (h, tau)
+ /// The array h contains the Householder reflectors that generate q
+ /// along with r. The tau array contains scaling factors for the
+ /// reflectors. In the deprecated ‘economic’ mode only h is returned.
+ ///
+ public static (NDarray, NDarray, NDarray) qr(NDarray a, string mode = "reduced")
+ {
+ //auto-generated code, do not change
+ var linalg = self.GetAttr("linalg");
+ var __self__ = linalg;
+ var pyargs = ToTuple(new object[]
+ {
+ a,
+ });
+ var kwargs = new PyDict();
+ if (mode != "reduced") kwargs["mode"] = ToPython(mode);
+ dynamic py = __self__.InvokeMethod("qr", pyargs, kwargs);
+ if (PythonObject.IsNDarray(py))
+ return (ToCsharp(py), null, null);
+ if (PythonObject.IsTuple(py))
+ {
+ if (ToCsharp(py.__len__()) == 2)
+ return (ToCsharp(py[0]), ToCsharp(py[1]), null);
+ return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2]));
+ }
+ throw new NotSupportedException("Unexpected return type: " +
+ ToCsharp(py.__class__.__name__));
+ }
}
}
}
diff --git a/src/Numpy/Manual/np.math.cs b/src/Numpy/Manual/np.math.cs
new file mode 100644
index 0000000..9c75d80
--- /dev/null
+++ b/src/Numpy/Manual/np.math.cs
@@ -0,0 +1,262 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Numerics;
+using System.Runtime.InteropServices;
+using System.Text;
+using Numpy;
+using Numpy.Models;
+using Python.Runtime;
+
+namespace Numpy
+{
+ ///
+ /// Manual type conversions
+ ///
+ public static partial class np
+ {
+
+ ///
+ /// Return the gradient of an N-dimensional array.
+ ///
+ /// The gradient is computed using second order accurate central differences
+ /// in the interior points and either first or second order accurate one-sides
+ /// (forward or backwards) differences at the boundaries.
+ ///
+ /// The returned gradient hence has the same shape as the input array.
+ ///
+ /// Notes
+ ///
+ /// Assuming that (i.e., has at least 3 continuous
+ /// derivatives) and let be a non-homogeneous stepsize, we
+ /// minimize the “consistency error” between the true gradient
+ /// and its estimate from a linear combination of the neighboring grid-points:
+ ///
+ /// By substituting and
+ /// with their Taylor series expansion, this translates into solving
+ /// the following the linear system:
+ ///
+ /// The resulting approximation of is the following:
+ ///
+ /// It is worth noting that if
+ /// (i.e., data are evenly spaced)
+ /// we find the standard second order approximation:
+ ///
+ /// With a similar procedure the forward/backward approximations used for
+ /// boundaries can be derived.
+ ///
+ /// References
+ ///
+ ///
+ /// An N-dimensional array containing samples of a scalar function.
+ ///
+ ///
+ /// Spacing between f values.
+ /// Default unitary spacing for all dimensions.
+ ///
+ /// Spacing can be specified using:
+ ///
+ /// If axis is given, the number of varargs must equal the number of axes.
+ ///
+ /// Default: 1.
+ ///
+ ///
+ /// Gradient is calculated using N-th order accurate differences
+ /// at the boundaries.
+ /// Default: 1.
+ ///
+ ///
+ /// Gradient is calculated only along the given axis or axes
+ /// The default (axis = None) is to calculate the gradient for all the axes
+ /// of the input array.
+ /// axis may be negative, in which case it counts from
+ /// the last to the first axis.
+ ///
+ ///
+ /// A set of ndarrays (or a single ndarray if there is only one dimension)
+ /// corresponding to the derivatives of f with respect to each dimension.
+ ///
+ /// Each derivative has the same shape as f.
+ ///
+ public static NDarray gradient(NDarray f, int? edge_order = null, Axis axis = null)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+
+ var pyargs = new PyObject[] { f.PyObject };
+ var kwargs = new PyDict();
+ if (edge_order != null) kwargs["edge_order"] = ToPython(edge_order);
+ if (axis != null) kwargs["axis"] = ToPython(axis);
+ dynamic py = __self__.InvokeMethod("gradient", pyargs, kwargs);
+ return ToCsharp(py);
+ }
+
+ ///
+ /// Return the gradient of an N-dimensional array.
+ ///
+ /// The gradient is computed using second order accurate central differences
+ /// in the interior points and either first or second order accurate one-sides
+ /// (forward or backwards) differences at the boundaries.
+ ///
+ /// The returned gradient hence has the same shape as the input array.
+ ///
+ /// Notes
+ ///
+ /// Assuming that (i.e., has at least 3 continuous
+ /// derivatives) and let be a non-homogeneous stepsize, we
+ /// minimize the “consistency error” between the true gradient
+ /// and its estimate from a linear combination of the neighboring grid-points:
+ ///
+ /// By substituting and
+ /// with their Taylor series expansion, this translates into solving
+ /// the following the linear system:
+ ///
+ /// The resulting approximation of is the following:
+ ///
+ /// It is worth noting that if
+ /// (i.e., data are evenly spaced)
+ /// we find the standard second order approximation:
+ ///
+ /// With a similar procedure the forward/backward approximations used for
+ /// boundaries can be derived.
+ ///
+ /// References
+ ///
+ ///
+ /// An N-dimensional array containing samples of a scalar function.
+ ///
+ ///
+ /// Spacing between f values.
+ /// Default unitary spacing for all dimensions.
+ ///
+ /// Spacing can be specified using:
+ ///
+ /// If axis is given, the number of varargs must equal the number of axes.
+ ///
+ /// Default: 1.
+ ///
+ ///
+ /// Gradient is calculated using N-th order accurate differences
+ /// at the boundaries.
+ /// Default: 1.
+ ///
+ ///
+ /// Gradient is calculated only along the given axis or axes
+ /// The default (axis = None) is to calculate the gradient for all the axes
+ /// of the input array.
+ /// axis may be negative, in which case it counts from
+ /// the last to the first axis.
+ ///
+ ///
+ /// A set of ndarrays (or a single ndarray if there is only one dimension)
+ /// corresponding to the derivatives of f with respect to each dimension.
+ ///
+ /// Each derivative has the same shape as f.
+ ///
+ public static NDarray gradient(NDarray f, List varargs, int? edge_order = null, Axis axis = null)
+ {
+ //auto-generated code, do not change
+ var __self__ = self;
+
+ var pyargs = new PyObject[] { f.PyObject }.Concat(varargs.Select(x => new PyFloat(x))).ToArray();
+ var kwargs = new PyDict();
+ if (edge_order != null) kwargs["edge_order"] = ToPython(edge_order);
+ if (axis != null) kwargs["axis"] = ToPython(axis);
+ dynamic py = __self__.InvokeMethod("gradient", 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 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/src/Numpy/Models/NDarray.Operators.cs b/src/Numpy/Models/NDarray.Operators.cs
index 9c12033..b54d4e7 100644
--- a/src/Numpy/Models/NDarray.Operators.cs
+++ b/src/Numpy/Models/NDarray.Operators.cs
@@ -199,7 +199,7 @@ public static NDarray nonzero(NDarray a)
public static NDarray operator /(ValueType obj, NDarray a)
{
if (operator_module == null)
- operator_module = PythonEngine.ImportModule("operator");
+ operator_module = Py.Import("operator");
return new NDarray(operator_module.InvokeMethod("__truediv__", obj.ToPython(), a.self));
}
@@ -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/src/Numpy/Models/NDarray.cs b/src/Numpy/Models/NDarray.cs
index d9624f6..e0fe058 100644
--- a/src/Numpy/Models/NDarray.cs
+++ b/src/Numpy/Models/NDarray.cs
@@ -671,5 +671,12 @@ public T[] GetData()
}
}
+ public T item()
+ {
+ if (typeof(T) == typeof(Complex))
+ return (T)(object)new Complex(real.asscalar(), imag.asscalar());
+ return self.InvokeMethod("item").As();
+ }
+
}
}
diff --git a/src/Numpy/Models/NDarray.gen.cs b/src/Numpy/Models/NDarray.gen.cs
index e0e9f06..2bd1fa4 100644
--- a/src/Numpy/Models/NDarray.gen.cs
+++ b/src/Numpy/Models/NDarray.gen.cs
@@ -456,12694 +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);
- }
-
- ///
- /// 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);
- }
-
- ///
- /// Insert values along the given axis before the given indices.
- ///
- /// Notes
- ///
- /// Note that for higher dimensional inserts obj=0 behaves very different
- /// from obj=[0] just like arr[:,0,:] = values is different from
- /// arr[:,[0],:] = values.
- ///
- ///
- /// Object that defines the index or indices before which values is
- /// inserted.
- ///
- /// Support for multiple insertions when obj is a single scalar or a
- /// sequence with one element (similar to calling insert multiple
- /// times).
- ///
- ///
- /// Values to insert into arr.
- /// If the type of values is different
- /// from that of arr, values is converted to the type of arr.
- ///
- /// values should be shaped so that arr[...,obj,...] = values
- /// is legal.
- ///
- ///
- /// Axis along which to insert values.
- /// If axis is None then arr
- /// is flattened first.
- ///
- ///
- /// A copy of arr with values inserted.
- /// Note that insert
- /// does not occur in-place: a new array is returned.
- /// If
- /// axis is None, out is a flattened array.
- ///
- public NDarray insert(int obj = 0, NDarray values = null, int? axis = null)
- {
- //auto-generated code, do not change
- var __self__=self;
- var pyargs=ToTuple(new object[]
- {
- });
- var kwargs=new PyDict();
- if (obj!=0) kwargs["obj"]=ToPython(obj);
- if (values!=null) kwargs["values"]=ToPython(values);
- if (axis!=null) kwargs["axis"]=ToPython(axis);
- dynamic py = __self__.InvokeMethod("insert", 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 gradient of an N-dimensional array.
- ///
- /// The gradient is computed using second order accurate central differences
- /// in the interior points and either first or second order accurate one-sides
- /// (forward or backwards) differences at the boundaries.
- ///
- /// The returned gradient hence has the same shape as the input array.
- ///
- /// Notes
- ///
- /// Assuming that (i.e., has at least 3 continuous
- /// derivatives) and let be a non-homogeneous stepsize, we
- /// minimize the “consistency error” between the true gradient
- /// and its estimate from a linear combination of the neighboring grid-points:
- ///
- /// By substituting and
- /// with their Taylor series expansion, this translates into solving
- /// the following the linear system:
- ///
- /// The resulting approximation of is the following:
- ///
- /// It is worth noting that if
- /// (i.e., data are evenly spaced)
- /// we find the standard second order approximation:
- ///
- /// With a similar procedure the forward/backward approximations used for
- /// boundaries can be derived.
- ///
- /// References
- ///
- ///
- /// Spacing between f values.
- /// Default unitary spacing for all dimensions.
- ///
- /// Spacing can be specified using:
- ///
- /// If axis is given, the number of varargs must equal the number of axes.
- ///
- /// Default: 1.
- ///
- ///
- /// Gradient is calculated using N-th order accurate differences
- /// at the boundaries.
- /// Default: 1.
- ///
- ///
- /// Gradient is calculated only along the given axis or axes
- /// The default (axis = None) is to calculate the gradient for all the axes
- /// of the input array.
- /// axis may be negative, in which case it counts from
- /// the last to the first axis.
- ///
- ///
- /// A set of ndarrays (or a single ndarray if there is only one dimension)
- /// corresponding to the derivatives of f with respect to each dimension.
- ///
- /// Each derivative has the same shape as f.
- ///
- public NDarray gradient(NDarray varargs = null, int? edge_order = null, Axis axis = null)
- {
- //auto-generated code, do not change
- var __self__=self;
- var pyargs=ToTuple(new object[]
- {
- });
- var kwargs=new PyDict();
- if (varargs!=null) kwargs["varargs"]=ToPython(varargs);
- if (edge_order!=null) kwargs["edge_order"]=ToPython(edge_order);
- if (axis!=null) kwargs["axis"]=ToPython(axis);
- dynamic py = __self__.InvokeMethod("gradient", 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.