diff --git a/.gitignore b/.gitignore index 3e759b7..9ee9bbb 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,4 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ +*.key diff --git a/Numpy.NET.sln b/Numpy.NET.sln index a11bc36..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 15 -VisualStudioVersion = 15.0.28307.645 +# 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 @@ -15,6 +15,30 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Numpy.Bare", "src\Numpy.Bar EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Numpy.Bare.UnitTest", "test\Numpy.UnitTest\Numpy.Bare.UnitTest.csproj", "{3E69A902-0C8F-4FF4-BA27-EAB9D2E08FEA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReleaseBot", "src\ReleaseBot\ReleaseBot.csproj", "{2BAEA60C-88A2-45DC-8044-2C9571E1B8CF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeMinion.ApiGenerator", "src\CodeMinion.ApiGenerator\CodeMinion.ApiGenerator.csproj", "{FDE7E8A2-011A-47D5-B35B-F52ABFE5D5A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeMinion.Core", "src\CodeMinion.Core\CodeMinion.Core.csproj", "{72369115-A8B9-4BD6-BF55-CAB06A575EE0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeMinion.Parser", "src\CodeMinion.DocsParser\CodeMinion.Parser.csproj", "{C7768F3C-7218-409A-8626-009D5C448C0C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NeuralNetworkExample", "src\Examples\NeuralNetworkExample\NeuralNetworkExample.csproj", "{53CD5C07-7902-4761-B00B-0171AB6C7620}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApiExample_netcore2.2", "src\Examples\WebApiExample\WebApiExample_netcore2.2.csproj", "{445655A8-E4FC-4257-9CA2-63D67D84F2A2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreTest", "src\Examples\NetCoreTest\NetCoreTest.csproj", "{84BCB8CA-6B29-48D8-BEEE-751C7547419E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numpy.Bare.Dotnet", "src\Numpy.Bare.Dotnet\Numpy.Bare.Dotnet.csproj", "{8E1BD94E-6AE4-46D9-B0BA-6AC0515AF0D0}" +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("{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 Debug|Any CPU = Debug|Any CPU @@ -41,12 +65,67 @@ Global {3E69A902-0C8F-4FF4-BA27-EAB9D2E08FEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E69A902-0C8F-4FF4-BA27-EAB9D2E08FEA}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E69A902-0C8F-4FF4-BA27-EAB9D2E08FEA}.Release|Any CPU.Build.0 = Release|Any CPU + {2BAEA60C-88A2-45DC-8044-2C9571E1B8CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BAEA60C-88A2-45DC-8044-2C9571E1B8CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BAEA60C-88A2-45DC-8044-2C9571E1B8CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BAEA60C-88A2-45DC-8044-2C9571E1B8CF}.Release|Any CPU.Build.0 = Release|Any CPU + {FDE7E8A2-011A-47D5-B35B-F52ABFE5D5A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDE7E8A2-011A-47D5-B35B-F52ABFE5D5A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDE7E8A2-011A-47D5-B35B-F52ABFE5D5A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDE7E8A2-011A-47D5-B35B-F52ABFE5D5A8}.Release|Any CPU.Build.0 = Release|Any CPU + {72369115-A8B9-4BD6-BF55-CAB06A575EE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72369115-A8B9-4BD6-BF55-CAB06A575EE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72369115-A8B9-4BD6-BF55-CAB06A575EE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72369115-A8B9-4BD6-BF55-CAB06A575EE0}.Release|Any CPU.Build.0 = Release|Any CPU + {C7768F3C-7218-409A-8626-009D5C448C0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7768F3C-7218-409A-8626-009D5C448C0C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7768F3C-7218-409A-8626-009D5C448C0C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7768F3C-7218-409A-8626-009D5C448C0C}.Release|Any CPU.Build.0 = Release|Any CPU + {53CD5C07-7902-4761-B00B-0171AB6C7620}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53CD5C07-7902-4761-B00B-0171AB6C7620}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53CD5C07-7902-4761-B00B-0171AB6C7620}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53CD5C07-7902-4761-B00B-0171AB6C7620}.Release|Any CPU.Build.0 = Release|Any CPU + {445655A8-E4FC-4257-9CA2-63D67D84F2A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {445655A8-E4FC-4257-9CA2-63D67D84F2A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {445655A8-E4FC-4257-9CA2-63D67D84F2A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {445655A8-E4FC-4257-9CA2-63D67D84F2A2}.Release|Any CPU.Build.0 = Release|Any CPU + {84BCB8CA-6B29-48D8-BEEE-751C7547419E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84BCB8CA-6B29-48D8-BEEE-751C7547419E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84BCB8CA-6B29-48D8-BEEE-751C7547419E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84BCB8CA-6B29-48D8-BEEE-751C7547419E}.Release|Any CPU.Build.0 = Release|Any CPU + {8E1BD94E-6AE4-46D9-B0BA-6AC0515AF0D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1BD94E-6AE4-46D9-B0BA-6AC0515AF0D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1BD94E-6AE4-46D9-B0BA-6AC0515AF0D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1BD94E-6AE4-46D9-B0BA-6AC0515AF0D0}.Release|Any CPU.Build.0 = Release|Any CPU + {53C73261-DD84-47D1-A9BA-E553D34FF0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53C73261-DD84-47D1-A9BA-E553D34FF0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53C73261-DD84-47D1-A9BA-E553D34FF0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53C73261-DD84-47D1-A9BA-E553D34FF0A3}.Release|Any CPU.Build.0 = Release|Any CPU + {BB0A367A-8A36-454F-9F92-2FD6DA665A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 EndGlobalSection GlobalSection(NestedProjects) = preSolution {A92C1287-BF2B-4FDC-8BBA-A17F410CD41F} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} + {53CD5C07-7902-4761-B00B-0171AB6C7620} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} + {445655A8-E4FC-4257-9CA2-63D67D84F2A2} = {25D84E98-E107-45C9-A0EC-0B25E24DA607} + {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 1983b67..9fb44ef 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,12 @@ -# Numpy.NET -Numpy.NET brings the awesome Python package [NumPy](https://www.numpy.org/) to the .NET world. NumPy is THE fundamental library for scientific computing, machine learning and AI in Python. Numpy.NET empowers .NET developers to leverage NumPy's extensive functionality including multi-dimensional arrays and matrices, linear algebra, FFT and many more via a compatible strong typed API. +![logo](doc/img/numpy.net.logo512.png) + +**Numpy.NET** is the most complete .NET binding for [NumPy](https://www.numpy.org/), which is a fundamental library for scientific computing, machine learning and AI in Python. Numpy.NET empowers .NET developers with extensive functionality including multi-dimensional arrays and matrices, linear algebra, FFT and many more via a compatible strong typed API. Several other SciSharp projects like [Keras.NET](https://github.com/SciSharp/Keras.NET) and [Torch.NET](https://github.com/SciSharp/Torch.NET) depend on Numpy.NET. ## Example -Python: -```python -import numpy as np -a1=np.arange(60000).reshape(300, 200) -a2=np.arange(80000).reshape(200, 400) -result=np.matmul(a1, a2) -``` +Check out this example which uses `numpy` operations to fit a two-layer neural network to random data by manually implementing the forward and backward passes through the network. -C#: -```csharp -using Numpy; -// ... -var a1 = np.arange(60000).reshape(300, 200); -var a2 = np.arange(80000).reshape(200, 400); -var result = np.matmul(a1, a2); -``` +![Numpy Neural Network in C# and in Python](doc/img/cs_vs_py2.png) Numpy and Intellisense: a developer-friendly combination: @@ -28,37 +16,24 @@ Numpy and Intellisense: a developer-friendly combination: If you want to use Numpy.NET you have two options: ### Numpy.dll -Just reference [Numpy](https://www.nuget.org/packages/Numpy/1.0.0) via Nuget and you are good to go. Thanks to [Python.Included](https://github.com/henon/Python.Included) it doesn't require a local Python installation or will not clash with existing installations. +Just reference [Numpy.dll](https://www.nuget.org/packages/Numpy/) via Nuget, set your **build configuration to x64** and you are good to go. Thanks to [Python.Included](https://github.com/henon/Python.Included) it doesn't require a local Python installation or will not clash with existing installations. ### Numpy.Bare.dll -In certain use cases you might not want the packaged Python and NumPy packages. In that case you reference [Numpy.Bare](https://www.nuget.org/packages/Numpy.Bare/1.0.0) via Nuget. You will need Python 3.7 and Numpy 1.16 installed for it to work. +In certain use cases you might not want the packaged Python and NumPy packages. In that case you reference [Numpy.Bare.dll](https://www.nuget.org/packages/Numpy.Bare/) via Nuget. Depending on the Numpy.Bare nuget version will need Python 3.5, 3.6 or 3.7 and Numpy 1.16 installed for it to work. The first two digits of the Numpy.Bare version indicate which Python version is needed for it to run (i.e. Numpy.Bare v3.6.1.1 needs Python 3.6 installed). If you are getting BadImageFormatException switch between x86 and x64 build settings. + +In other cases, you might want to control the install location of the Python installation or even set it up yourself instead of having the Numpy library do it. For those cases Numpy.Bare is also great. Check out the [custom installation example](https://github.com/SciSharp/Numpy.NET/tree/master/src/Examples/CustomInstallLocationExample) if you want to know how. ## 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. -## Performance considerations +## Multi-threading (Must read!) -You might ask how calling into Python affects performance. As always, it depends on your usage. Don't forget that `numpy`'s number crunching algorithms are written in `C` so the thin `pythonnet` and `Python` layers on top won't have a significant impact if you are working with larger amounds of data. +**Beware: Not following these steps can result in deadlocks or access violation exceptions!** -In my experience, calling `numpy` from C# is about 4 times slower than calling it directly in `Python` while the execution time of the called operation is of course equal. So if you have an algorithm that needs to call into `numpy` in a nested loop, Numpy.NET may not be for you due to the call overhead. - -All of `numpy` is centered around the `ndarray` class which allows you to pass a huge chunk of data into the `C` routines and let them execute all kinds of operations on the elements efficiently without the need for looping over the data. So if you are manipulating arrays or matrices with thousands or hundreds of thousands of elements, the call overhead will be neglegible. - -The most performance sensitive aspect is creating an `NDarray` from a `C#` array, since the data has to be moved from the `CLR` into the `Python` interpreter. `pythonnet` does not optimize for passing large arrays from `C#` to `Python` but we still found a way to do that very efficiently. When creating an array with `np.array( ... )` we internally use `Marshal.Copy` to copy the entiry `C#`-array's memory into the `numpy`-array's storage. And to efficiently retrieve computation results from `numpy` there is a method called `GetData` which will copy the data back to `C#` in the same way: - -```csharp -// create a 2D-shaped NDarray from an int[] -var m = np.array(new int[] {1, 2, 3, 4}); -// calculate the cosine of each element -var result = np.cos(m); -// get the floating point data of the result NDarray back to C# -var data = result.GetData(); // double[] { 0.54030231, -0.41614684, -0.9899925 , -0.65364362 } -``` -## Multi-threading -Python/NumPy doesn't have real multi-threading support. There is no advantage to calling `numpy` functions from different threads because `pythonnet` requires you to use the Global Interpreter Lock (GIL) when doing so. If you must call Python from a thread other than the main thread you first must release the main thread's mutex by calling `PythonEngine.BeginAllowThreads()` or you'll have a deadlock: +Python/NumPy doesn't have real multi-threading support. There is no advantage in "simultaneously" executing `numpy` functions on multiple threads because `pythonnet` requires you to use the Global Interpreter Lock (GIL) to lock access to the Python engine exclusively for only one thread at a time. If you have to call Python from a thread other than the main thread you first must release the main thread's mutex by calling `PythonEngine.BeginAllowThreads()` or you'll have a deadlock: ```csharp var a = np.arange(1000); @@ -75,23 +50,40 @@ Task.Run(()=> { } }).Wait(); ``` +Above example only serves as a reference on how to call `numpy` from a different thread than the main thread. As said before, having multiple background threads that call into Python doesn't give you multi-core processing because of the requirement to lock the GIL. Not doing so will result in **access violation exceptions** and/or **deadlocks**. + +Note that you must call a method of `np` before calling `PythonEngine.BeginAllowThreads()` in order for the PythonEngine to be initialized. So, for instance, if you want to initialize an inherently multi-threaded .Net Core Web API at startup, do something like this: + +```csharp +np.arange(1); +PythonEngine.BeginAllowThreads(); +``` +Also, if you do this, be sure to wrap any calls to Numpy in `using (Py.GIL()) { ... }` or else you'll get AccessViolationExceptions. + +## Performance considerations -Above example only serves as a reference how to call `numpy` from a different thread than the main thread. Having multiple background threads that call into Python doesn't give you multi-core processing though because of the requirement to lock the GIL. Not doing so will result in access violation exceptions. +You might ask how calling into Python affects performance. As always, it depends on your usage. Don't forget that `numpy`'s number crunching algorithms are written in `C` so the thin `pythonnet` and `Python` layers on top won't have a significant impact if you are working with larger amounts of data. + +In my experience, calling `numpy` from C# is about 4 times slower than calling it directly in `Python` while the execution time of the called operation is of course equal. So if you have an algorithm that needs to call into `numpy` in a nested loop, Numpy.NET may not be for you due to the call overhead. + +All of `numpy` is centered around the `ndarray` class which allows you to pass a huge chunk of data into the `C` routines and let them execute all kinds of operations on the elements efficiently without the need for looping over the data. So if you are manipulating arrays or matrices with thousands or hundreds of thousands of elements, the call overhead will be negligible. + +The most performance sensitive aspect is creating an `NDarray` from a `C#` array, since the data has to be moved from the `CLR` into the `Python` interpreter. `pythonnet` does not optimize for passing large arrays from `C#` to `Python` but we still found a way to do that very efficiently. When creating an array with `np.array( ... )` we internally use `Marshal.Copy` to copy the entire `C#`-array's memory into the `numpy`-array's storage. And to efficiently retrieve computation results from `numpy` there is a method called `GetData` which will copy the data back to `C#` in the same way: + +```csharp +// create a 2D-shaped NDarray from an int[] +var m = np.array(new int[] {1, 2, 3, 4}); +// calculate the cosine of each element +var result = np.cos(m); +// get the floating point data of the result NDarray back to C# +var data = result.GetData(); // double[] { 0.54030231, -0.41614684, -0.9899925 , -0.65364362 } +``` ## Numpy.NET vs NumSharp -The SciSharp team is also developing a pure C# port of NumPy called [NumSharp](https://github.com/SciSharp/NumSharp) which is quite popular albeit incomplete. To help you decide which one to use we compare the advantages and disadvantages of both libraries here: +The SciSharp team is also developing a pure C# port of NumPy called [NumSharp](https://github.com/SciSharp/NumSharp) which is quite popular albeit being not quite complete. -| Aspect | Numpy.NET | NumSharp | -| ------------- | ------------------------------------- | ------------- | -| Dependencies | CPython / NumPy | C++ dlls for certain operations | -| Setup | Reference Nuget-Package | Reference Nuget-Package | -| Completeness | Large parts are wrapped | A small subset of most important functions is ported | -| Development | Fast, due to automated API generation | Slow, due to lack of manpower | -| Correctness | Same results as in Python guaranteed | There are subtle differences | -| Actuality | Can easily keep up with `numpy` dev | Will trail behind, due to lack of manpower | -| GPU support | None | Using a GPU backend for calculatons possible, per design | -| Performance | TODO: measure | TODO: measure | +There are a couple of other NumPy ports out there featuring subsets of the original library. The only one that matches Numpy.NET in terms of completeness is the IronPython package `numpy` which is out of date though. The SciSharp team is committed to keeping Numpy.NET up to date with the original library and to feature as much of the original functionality as possible. ## Code generation @@ -141,6 +133,33 @@ Getting more unit tests to run is very easy though, and a good portion have alre Since we have taken great care to make Numpy.NET as similar to NumPy itself, you can, for the most part, rely on the official [NumPy manual](https://docs.scipy.org/doc/numpy/). +### Create a Numpy array from a C# array and vice versa + +To work with data from C# in Numpy it has to be copied into the Python engine by using `np.array(...)`. You get an NDarray that you can use for further processing of the data. Here we calculate the square root: + +```csharp +// create an NDarray from a C# array +var a = np.array(new[] { 2, 4, 9, 25 }); +Console.WriteLine("a: "+ a.repr); +// a: array([ 2, 4, 9, 25]) +// apply the square root to each element +var roots = np.sqrt(a); +Console.WriteLine(roots.repr); +// array([1.41421356, 2. , 3. , 5. ]) +``` + +After processing the data you can copy it back into a C# array use `a.GetData()`, but be aware of the datatype of the NDarray in order to get correct values back: + +```csharp +// Copy the NDarray roots into a C# array from NDarray (incorrect datatype) +Console.WriteLine(string.Join(", ", roots.GetData())); +// 1719614413, 1073127582, 0, 1073741824 +Console.WriteLine("roots.dtype: " + roots.dtype); +// roots.dtype: float64 +Console.WriteLine(string.Join(", ", roots.GetData())); +// 1.4142135623731, 2, 3, 5 +``` + ### Creating multi-dimensional NDarrays from C# arrays Creating an `NDarray` from data is easy. Just pass the C# array into `np.array(...)`. You can pass 1D, 2D and 3D C# arrays into it. @@ -216,18 +235,28 @@ var roots = np.sqrt(a); // => { 0.0, 1.0, 1.414, ..., 9.899, 9.950 } ``` #### Complex numbers -Python has native support of complex numbers, something the C# language is lacking as well. Converting complex results to and from NumPy is not implemented at all (yet). Please step forward if you want to work on this. +Numpy.NET supports complex numbers even though the notation in Python and C# is very different: +```python +>>> a = np.array([1+2j, 3+4j, 5+6j]) +``` +looks like this in C# +```c# +var a = np.array(new Complex[] { new Complex(1, 2), new Complex(3,4), new Complex(5,6), }); +``` +Access the real and imaginary components of a complex array via `a.real` and `a.imag` or copy the complex values of an ndarray into C# with `Complex[] c=a.GetData();`. #### Functions clashing with their class name The function fft(...) in numpy.fft and random(...) in numpy.random had to be renamed because C# doesn't allow a member to have the same name as its enclosing class. That's why in Numpy.NET these functions have been renamed with a trailing underscore like this: `np.fft.fft_(...)` ## Versions and Compatibility -Currently, Numpy.NET is targeting .NET Standard (on Windows) and packages the following binaries: +Currently, Numpy.dll is targeting .NET Standard (on Windows) and packages the following binaries: * Python 3.7: (python-3.7.3-embed-amd64.zip) * NumPy 1.16 (numpy-1.16.3-cp37-cp37m-win_amd64.whl) -To make Numpy.NET support Linux a separate version of [Python.Included](https://github.com/henon/Python.Included) packaging linux binaries of Python needs to be made and a version of Numpy.NET that packages a linux-compatible NumPy wheel. If you are interested, you may work on this issue. +Numpy.Bare.dll is available for the Python versions 2.7, 3.5, 3.6 and 3.7 on Windows, Linux and MacOS on Nuget. + +To make Numpy.dll support Linux a separate version of [Python.Included](https://github.com/henon/Python.Included) packaging linux binaries of Python needs to be made and a version of Numpy.dll that packages a linux-compatible NumPy wheel. If you are interested, you may work on this issue. ## License @@ -238,4 +267,11 @@ Numpy.NET packages and distributes `Python`, `pythonnet` as well as `numpy`. All * NumPy: [BSD License](https://www.numpy.org/license.html#license) * Numpy.NET: [MIT License](./LICENSE) +## Common Mistakes +* If you check `Prefer 32-bit` in your build config or build with `x86` instead of `Any CPU` Numpy.NET will crash with `BadFormatException` +* If you have insufficient folder permissions in AppData Numpy.NET might crash. You can specify a different installpath by setting `Installer.INSTALL_PATH = "";` +* If you get deadlocks (program hangs indefinitely) you should read the secton about multi-threading above! +* If you get AccessViolationExceptions you should read the secton about multi-threading above! +## Project Sponsors +* [JetBrains](https://www.jetbrains.com/?from=Numpy.NET) diff --git a/WpfExample/App.xaml b/WpfExample/App.xaml new file mode 100644 index 0000000..8bcbf4d --- /dev/null +++ b/WpfExample/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WpfExample/App.xaml.cs b/WpfExample/App.xaml.cs new file mode 100644 index 0000000..66421cb --- /dev/null +++ b/WpfExample/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfExample +{ + + public partial class App : Application + { + + } +} diff --git a/WpfExample/AssemblyInfo.cs b/WpfExample/AssemblyInfo.cs new file mode 100644 index 0000000..74087a1 --- /dev/null +++ b/WpfExample/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WpfExample/MainWindow.xaml b/WpfExample/MainWindow.xaml new file mode 100644 index 0000000..82bf2e4 --- /dev/null +++ b/WpfExample/MainWindow.xaml @@ -0,0 +1,17 @@ + + + + + + Run the blocking example first, then the non-blocking example will be activated. + + + + diff --git a/WpfExample/MainWindow.xaml.cs b/WpfExample/MainWindow.xaml.cs new file mode 100644 index 0000000..a5e2290 --- /dev/null +++ b/WpfExample/MainWindow.xaml.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Numpy; +using Python.Runtime; + +namespace WpfExample +{ + + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + + private bool _allowThreads = false; + + private void WriteLine(string text) + { + TextBox.AppendText(text + "\n"); + TextBox.ScrollToEnd(); + } + + private void OnBlockingClick(object sender, RoutedEventArgs e) + { + WriteLine("Example 1: Matrix multiplication with NumPy on the GUI thread (blocking):"); + // before starting the measurement, let us call numpy once to get the setup checks done. + np.arange(1); + var stopwatch = Stopwatch.StartNew(); + + var a1 = np.arange(60000).reshape(300, 200); + var a2 = np.arange(80000).reshape(200, 400); + + var result = np.matmul(a1, a2); + stopwatch.Stop(); + + WriteLine($"execution time with NumPy: {stopwatch.Elapsed.TotalMilliseconds}ms\n"); + WriteLine("Result:\n" + result.repr); + WriteLine("\nNote: blocking usage is not recommended. "); + WriteLine("\nIf you close the program without runnning example 2 it will hang indefinitely. "); + Button1.IsEnabled = false; + Button2.IsEnabled = true; + } + + private async void OnNonBlockingClick(object sender, RoutedEventArgs e) + { + WriteLine("Example 2: Matrix multiplication with NumPy on a background thread (non-blocking):"); + + if (!_allowThreads) { + // https://github.com/pythonnet/pythonnet/issues/109 + PythonEngine.BeginAllowThreads(); + _allowThreads=true; + } + var stopwatch = Stopwatch.StartNew(); + var resultString = ""; + await Task.Run(() => { + using (Py.GIL()) { + + + var a1 = np.arange(60000).reshape(300, 200); + var a2 = np.arange(80000).reshape(200, 400); + + var result = np.matmul(a1, a2); + stopwatch.Stop(); + resultString = result.repr; + } + }); + await this.Dispatcher.BeginInvoke(() => { + WriteLine($"execution time with NumPy: {stopwatch.Elapsed.TotalMilliseconds}ms\n"); + WriteLine("Result:\n" + resultString); + }); + WriteLine("\nNote: if you close the program now it will not hang because of PythonEngine.BeginAllowThreads();\nWe only have to make sure to enclose all calculations in using(Py.GIL()) { }"); + } + } +} diff --git a/WpfExample/WpfExample.csproj b/WpfExample/WpfExample.csproj new file mode 100644 index 0000000..475c825 --- /dev/null +++ b/WpfExample/WpfExample.csproj @@ -0,0 +1,14 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + diff --git a/doc/img/Logo.md b/doc/img/Logo.md new file mode 100644 index 0000000..10b7a5a --- /dev/null +++ b/doc/img/Logo.md @@ -0,0 +1 @@ +Numpy.NET logo (c) 2019 by Meinrad Recheis. \ No newline at end of file diff --git a/doc/img/cs_vs_py.png b/doc/img/cs_vs_py.png new file mode 100644 index 0000000..a3d5e7f Binary files /dev/null and b/doc/img/cs_vs_py.png differ diff --git a/doc/img/cs_vs_py.svg b/doc/img/cs_vs_py.svg new file mode 100644 index 0000000..53fbad8 --- /dev/null +++ b/doc/img/cs_vs_py.svg @@ -0,0 +1,2058 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + C# + Python + + + diff --git a/doc/img/cs_vs_py2.png b/doc/img/cs_vs_py2.png new file mode 100644 index 0000000..d2c135f Binary files /dev/null and b/doc/img/cs_vs_py2.png differ diff --git a/doc/img/numpy.net.icon.purple.png b/doc/img/numpy.net.icon.purple.png new file mode 100644 index 0000000..d37713d Binary files /dev/null and b/doc/img/numpy.net.icon.purple.png differ diff --git a/doc/img/numpy.net.icon.purple.svg b/doc/img/numpy.net.icon.purple.svg new file mode 100644 index 0000000..cdd8a23 --- /dev/null +++ b/doc/img/numpy.net.icon.purple.svg @@ -0,0 +1,755 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Numpy.NET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Numpy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .NET + + diff --git a/doc/img/numpy.net.icon.svg b/doc/img/numpy.net.icon.svg new file mode 100644 index 0000000..9689c37 --- /dev/null +++ b/doc/img/numpy.net.icon.svg @@ -0,0 +1,2057 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/img/numpy.net.icon128.png b/doc/img/numpy.net.icon128.png new file mode 100644 index 0000000..51fe4bd Binary files /dev/null and b/doc/img/numpy.net.icon128.png differ diff --git a/doc/img/numpy.net.icon512.png b/doc/img/numpy.net.icon512.png new file mode 100644 index 0000000..196d2e6 Binary files /dev/null and b/doc/img/numpy.net.icon512.png differ diff --git a/doc/img/numpy.net.logo.quadratic.svg b/doc/img/numpy.net.logo.quadratic.svg new file mode 100644 index 0000000..8a8d948 --- /dev/null +++ b/doc/img/numpy.net.logo.quadratic.svg @@ -0,0 +1,983 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + Numpy.NET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Numpy.NET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Numpy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .NET + + + diff --git a/doc/img/numpy.net.logo.quadratic512.png b/doc/img/numpy.net.logo.quadratic512.png new file mode 100644 index 0000000..1ae1dc0 Binary files /dev/null and b/doc/img/numpy.net.logo.quadratic512.png differ diff --git a/doc/img/numpy.net.logo.svg b/doc/img/numpy.net.logo.svg new file mode 100644 index 0000000..3493316 --- /dev/null +++ b/doc/img/numpy.net.logo.svg @@ -0,0 +1,983 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + Numpy.NET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Numpy.NET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Numpy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .NET + + + diff --git a/doc/img/numpy.net.logo512.png b/doc/img/numpy.net.logo512.png new file mode 100644 index 0000000..0fb524a Binary files /dev/null and b/doc/img/numpy.net.logo512.png differ diff --git a/src/CodeMinion.ApiGenerator/CodeMinion.ApiGenerator.csproj b/src/CodeMinion.ApiGenerator/CodeMinion.ApiGenerator.csproj new file mode 100644 index 0000000..8515051 --- /dev/null +++ b/src/CodeMinion.ApiGenerator/CodeMinion.ApiGenerator.csproj @@ -0,0 +1,44 @@ + + + + Exe + netcoreapp2.1 + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + diff --git a/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs new file mode 100644 index 0000000..5709388 --- /dev/null +++ b/src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs @@ -0,0 +1,1613 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading; +using CodeMinion.Core; +using CodeMinion.Core.Helpers; +using CodeMinion.Core.Models; +using CodeMinion.Parser; +using HtmlAgilityPack; +using Torch.ApiGenerator; + +namespace CodeMinion.ApiGenerator.NumPy +{ + // Routines: [x] means generated + // ==================== + // [x] Array creation routines + // [x] Array manipulation routines + // [x] Binary operations + // [x] String operations + // [x] Datetime Support Functions + // [x] Data type routines + // [x] Optionally Scipy-accelerated routines(numpy.dual) + // [ ] Floating point error handling + // [x] Discrete Fourier Transform(numpy.fft) + // [x] Financial functions + // [ ] Functional programming + // [x] Indexing routines + // [x] Input and output + // [x] Linear algebra(numpy.linalg) + // [x] Logic functions + // [ ] Masked array operations + // [x] Mathematical functions + // [ ] Matrix library(numpy.matlib) + // [ ] Miscellaneous routines + // [x] Padding Arrays + // [ ] Polynomials + // [x] Random sampling(numpy.random) + // [x] Set routines + // [x] Sorting, searching, and counting + // [x] Statistics + // [x] Window functions + + + public class ApiGenerator : ICodeGenerator + { + private CodeGenerator _generator; + public ApiGenerator() + { + var dir = Directory.GetCurrentDirectory(); + var src_dir = dir.Substring(0, dir.LastIndexOf("\\src\\")) + "\\src\\"; + var test_dir = dir.Substring(0, dir.LastIndexOf("\\src\\")) + "\\test\\"; + + _generator = new CodeGenerator + { + CopyrightNotice = "Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp)", + NameSpace = "Numpy", + StaticModuleName = "np", + PythonModuleName="numpy", + TestFilesPath = Path.Combine(test_dir, "Numpy.UnitTest"), + Usings = { "using Numpy.Models;" }, + ToPythonConversions = { + "case Axis o: return o.Axes==null ? null : ToTuple(o.Axes);", + "case Shape o: return ToTuple(o.Dimensions);", + "case Slice o: return o.ToPython();", + "case PythonObject o: return o.PyObject;", + "case Dictionary o: return ToDict(o);", + }, + ToCsharpConversions = + { + "case \"Dtype\": return (T)(object)new Dtype(pyobj);", + "case \"NDarray\": return (T)(object)new NDarray(pyobj);", + "case \"NDarray`1\":", + "switch (typeof(T).GenericTypeArguments[0].Name)", + "{", + " case \"Byte\": return (T)(object)new NDarray(pyobj);", + " case \"Short\": return (T)(object)new NDarray(pyobj);", + " case \"Boolean\": return (T)(object)new NDarray(pyobj);", + " case \"Int32\": return (T)(object)new NDarray(pyobj);", + " case \"Int64\": return (T)(object)new NDarray(pyobj); ", + " case \"Single\": return (T)(object)new NDarray(pyobj); ", + " case \"Double\": return (T)(object)new NDarray(pyobj); ", + " default: throw new NotImplementedException($\"Type NDarray<{typeof(T).GenericTypeArguments[0].Name}> missing. Add it to 'ToCsharpConversions'\");", + "}", + "break;", + "case \"NDarray[]\":", + " var po = pyobj as PyObject;", + " var len = po.Length();", + " var rv = new NDarray[len];", + " for (int i = 0; i < len; i++)", + " rv[i] = ToCsharp(po[i]);", + " return (T) (object) rv;", + "case \"Matrix\": return (T)(object)new Matrix(pyobj);", + }, + SpecialConversionGenerators = { SpecialGenerators.ConvertArrayToNDarray, SpecialGenerators.ConvertDict }, + SharpToSharpConversions = + { + SpecialGenerators.ArrayToNDarrayConversion, + }, + InitializationGenerators = { SpecialGenerators.InitNumpyGenerator }, + }; + } + + // use this to avoid duplicates + HashSet parsed_api_functions = new HashSet(); + private DynamicApi ndarray_api; + + public string Generate() + { + var dir = Directory.GetCurrentDirectory(); + var src_dir = dir.Substring(0, dir.LastIndexOf("\\src\\")) + "\\src\\"; + // ---------------------------------------------------- + // array creation + // ---------------------------------------------------- + var array_creation_api = new StaticApi() + { + PartialName = "array_creation", // name-part of the partial class file + StaticName = "np", // name of the static API class + ImplName = "NumPy", // name of the singleton that implements the static API behind the scenes + PythonModule = "numpy", // name of the Python module that the static api wraps + }; + _generator.StaticApis.Add(array_creation_api); + ParseNumpyApi(array_creation_api, "routines.array-creation.html"); + // ---------------------------------------------------- + // ndarray + // ---------------------------------------------------- + ndarray_api = new DynamicApi() + { + ClassName = "NDarray", + }; + _generator.DynamicApis.Add(ndarray_api); + ParseNdarrayApi(ndarray_api); + // ---------------------------------------------------- + // array manipulation + // ---------------------------------------------------- + var array_manipulation_api = new StaticApi() { PartialName = "array_manipulation", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(array_manipulation_api); + ParseNumpyApi(array_manipulation_api, "routines.array-manipulation.html"); + // ---------------------------------------------------- + // dtype + // ---------------------------------------------------- + var dtype_api = new StaticApi() { PartialName = "dtype", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(dtype_api); + ParseDtypeApi(dtype_api); + // ---------------------------------------------------- + // bitwise api + // ---------------------------------------------------- + var bitwise_api = new StaticApi() { PartialName = "bitwise", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(bitwise_api); + ParseNumpyApi(bitwise_api, "routines.bitwise.html"); + // ---------------------------------------------------- + // String operations + // ---------------------------------------------------- + var string_api = new StaticApi() { PartialName = "string", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(string_api); + ParseNumpyApi(string_api, "routines.char.html"); + // ---------------------------------------------------- + // Datetime Support Functions + // ---------------------------------------------------- + var datetime_api = new StaticApi() { PartialName = "datetime", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(datetime_api); + ParseNumpyApi(datetime_api, "routines.datetime.html"); + // ---------------------------------------------------- + // Data type routines + // ---------------------------------------------------- + var dtype_routines_api = new StaticApi() { PartialName = "dtype.routines", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(dtype_routines_api); + ParseNumpyApi(dtype_routines_api, "routines.dtype.html"); + // ---------------------------------------------------- + // Optionally Scipy-accelerated routines (linalg, fft, ...) + // ---------------------------------------------------- + var linalg_fft_api = new StaticApi() { PartialName = "linalg_fft", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(linalg_fft_api); + ParseNumpyApi(linalg_fft_api, "routines.dual.html"); + // ---------------------------------------------------- + // Discrete Fourier Transform (numpy.fft) + // ---------------------------------------------------- + var fft_api = new StaticApi() { PartialName = "fft", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(fft_api); + ParseNumpyApi(fft_api, "routines.fft.html"); + // ---------------------------------------------------- + // Financial functions + // ---------------------------------------------------- + var financial_api = new StaticApi() { PartialName = "financial", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(financial_api); + ParseNumpyApi(financial_api, "routines.financial.html"); + // ---------------------------------------------------- + // Indexing routines + // ---------------------------------------------------- + var indexing_api = new StaticApi() { PartialName = "indexing", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(indexing_api); + ParseNumpyApi(indexing_api, "routines.indexing.html"); + // ---------------------------------------------------- + // Input and output + // ---------------------------------------------------- + var io_api = new StaticApi() { PartialName = "io", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(io_api); + ParseNumpyApi(io_api, "routines.io.html"); + // ---------------------------------------------------- + // Linear Algebra + // ---------------------------------------------------- + var linalg_api = new StaticApi() { PartialName = "linalg", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(linalg_api); + ParseNumpyApi(linalg_api, "routines.linalg.html"); + // ---------------------------------------------------- + // Logic functions + // ---------------------------------------------------- + var logic_api = new StaticApi() { PartialName = "logic", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(logic_api); + ParseNumpyApi(logic_api, "routines.logic.html"); + // ---------------------------------------------------- + // Mathematical functions + // ---------------------------------------------------- + var math_api = new StaticApi() { PartialName = "math", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(math_api); + ParseNumpyApi(math_api, "routines.math.html"); + // ---------------------------------------------------- + // Padding Arrays + // ---------------------------------------------------- + var padding_api = new StaticApi() { PartialName = "padding", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(padding_api); + ParseNumpyApi(padding_api, "routines.padding.html"); + // ---------------------------------------------------- + // Random sampling + // ---------------------------------------------------- + var random_api = new StaticApi() { PartialName = "random", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(random_api); + ParseNumpyApi(random_api, "routines.random.html"); + // ---------------------------------------------------- + // Set routines + // ---------------------------------------------------- + var set_api = new StaticApi() { PartialName = "set", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(set_api); + ParseNumpyApi(set_api, "routines.set.html"); + // ---------------------------------------------------- + // Sorting, searching, and counting + // ---------------------------------------------------- + var sorting_api = new StaticApi() { PartialName = "sorting", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(sorting_api); + ParseNumpyApi(sorting_api, "routines.sort.html"); + // ---------------------------------------------------- + // Statistics + // ---------------------------------------------------- + var staticstics_api = new StaticApi() { PartialName = "staticstics", StaticName = "np", ImplName = "NumPy", PythonModule = "numpy", }; + _generator.StaticApis.Add(staticstics_api); + ParseNumpyApi(staticstics_api, "routines.statistics.html"); + // ---------------------------------------------------- + // Window functions + // ---------------------------------------------------- + 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 + // it is based on Python.Included and packs the Numpy wheel + // ---------------------------------------------------- + ndarray_api.OutputPath = Path.Combine(src_dir, "Numpy/Models"); + _generator.ModelsPath = Path.Combine(src_dir, "Numpy/Models"); + _generator.StaticApiFilesPath = Path.Combine(src_dir, "Numpy"); + _generator.DynamicApiFilesPath = Path.Combine(src_dir, "Numpy"); + _generator.Generate(); + ApiStatistics(); + Console.WriteLine($"Number of generated functions: {parsed_api_functions.Count} / {all_api_functions.Count}"); + + Thread.Sleep(2000); + + return "DONE"; + } + + private void ParseNdarrayApi(DynamicApi api) + { + var docs = LoadDocs("arrays.ndarray.html"); + 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 != "method") continue; + var class_name = doc.DocumentNode.Descendants("code") + .First(x => x.Attributes["class"]?.Value == "descclassname").InnerText; + var func_name = doc.DocumentNode.Descendants("code") + .First(x => x.Attributes["class"]?.Value == "descname").InnerText; + // do not generate the following: + switch (func_name) + { + case "sort": + case "partition": + case "transpose": + continue; + } + var decl = new Function() { 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; + // arguments + ParseArguments(html_doc, table, decl); + + // return type(s) + ParseReturnTypes(html_doc, table, decl); + + PostProcess(decl); + // if necessary create overloads + foreach (var d in InferOverloads(decl)) + { + PostProcessOverloads(d); + api.Declarations.Add(d); + } + } + } + + private void PostProcessOverloads(Function function) + { + foreach (var arg in function.Arguments) + { + if (arg.Name == "axis") + { + if (arg.Type!="int[]") + continue; + if (arg.DefaultValue == null || arg.DefaultValue == "null") + arg.Type = "Axis"; + } + } + } + + private int _function_count = 0; + + private void ParseDtypeApi(StaticApi api) + { + var doc = GetHtml("arrays.scalars.html"); + foreach (var tr in doc.Doc.DocumentNode.Descendants("tr")) + { + if (tr.Descendants("td").Count() != 3) + continue; + var span = tr.Descendants("span").FirstOrDefault(); + if (span == null) + continue; + var td = tr.Descendants("td").Skip(1).FirstOrDefault(); + _function_count++; + api.Declarations.Add(new Property() { Name = span.InnerText, Description = td?.InnerText, Type = "Dtype", HasSetter = false }); + } + } + + private void ParseNumpyApi(StaticApi api, string link) + { + var docs = LoadDocs(link); + var testfile = new TestFile() { Name = $"{api.ImplName}_{api.PartialName}" }; + _generator.TestFiles.Add(testfile); + foreach (var html_doc in docs) + { + ParseNumpyDocPage(api, link, html_doc, testfile); + } + } + + 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); + } + } + + 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); + + // 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.") + { + switch (decl.Name) + { + // 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); + } + + private TestCase ParseTests(HtmlDocument doc, Function decl) + { + int i = 0; + var dd = doc.DocumentNode.Descendants("dd").FirstOrDefault(); + if (dd == null) + return null; + var iter = dd.ChildNodes.SkipWhile(x => + !(x.Name == "p" && x.Attributes["class"]?.Value == "rubric" && x.InnerText == "Examples")); + var nodes = iter.Skip(1).ToArray(); + if (nodes.Length == 0) + return null; + var testcase = new TestCase() { Name = $"{decl.Name}Test" }; + foreach (var element in nodes) + { + if (element.Name == "p") + { + var text = HtmlEntity.DeEntitize(element.InnerText ?? "").Trim(); + if (!string.IsNullOrWhiteSpace(text)) + testcase.TestParts.Add(new Comment() { Text = text }); + continue; + } + var pre = element.Descendants("pre").FirstOrDefault(); + if (pre == null) + { + //Debugger.Break(); + continue; + } + var part = new ExampleCode() { Text = HtmlEntity.DeEntitize(pre.InnerText) }; + //> > > np.eye(2, dtype = int) + //array([[1, 0], + // [0, 1]]) + //>>> np.eye(3, k=1) + //array([[ 0., 1., 0.], + // [ 0., 0., 1.], + // [ 0., 0., 0.]]) + var lines = new Queue(Regex.Split(part.Text.Trim(), @"\r?\n")); + foreach (var line in lines) + { + if (line.StartsWith(">>>")) + { + var cmd = line.Replace(">>>", ""); + if (cmd.Contains("np.")) + cmd = cmd.Replace('[', '{').Replace(']', '}'); + part.Lines.Add(new CodeLine() { Text = { cmd }, Type = "cmd" }); + continue; + } + if (line.StartsWith("#")) + { + part.Lines.Add(new CodeLine() { Text = { line.Replace("#", "//") }, Type = "comment" }); + continue; + } + if (part.Lines.Count == 0 || part.Lines.Last().Type != "output") + part.Lines.Add(new CodeLine() { Text = { line }, Type = "output" }); + else + part.Lines.Last().Text.Add(line); + } + testcase.TestParts.Add(part); + } + if (testcase.TestParts.Count == 0) + return null; + return testcase; + } + + private string ParseDescription(HtmlNode dd) + { + if (dd == null) + return null; + var desc = string.Join("\r\n\r\n", dd.ChildNodes.Where(n => n.Name == "p").Select(p => p.InnerText).TakeWhile(s => !s.StartsWith("Examples"))); + return desc; + } + + private void ParseArguments(HtmlDoc html_doc, HtmlNode table, Function decl) + { + var tr = table.Descendants("tr").FirstOrDefault(); + if (tr == null) + return; + foreach (var dt in tr.Descendants("dt")) + { + var arg = new Argument() { Tag = decl.Tag }; + var strong = dt.Descendants("strong").FirstOrDefault(); + if (strong == null) + continue; + arg.Name = strong.InnerText; + if (arg.Name.ToLower() == "none") + continue; // there are no arguments fro this method + string type_description = null; + if (arg.Name.Contains(":")) + { + var tuple = arg.Name.Split(":"); + arg.Name = tuple[0].Trim(); + type_description = tuple[1].Trim(); + } + else + { + type_description = dt.Descendants("span") + .FirstOrDefault(span => span.Attributes["class"]?.Value == "classifier")?.InnerText; + } + if (type_description == null) + type_description = "_NoValue"; + var type = type_description.Split(",").FirstOrDefault(); + arg.Type = InferType(type, arg); + if (type_description.Contains("optional")) + { + arg.IsNamedArg = true; + arg.IsNullable = true; + } + if (type_description.Contains("default:")) + arg.DefaultValue = InferDefaultValue(type_description.Split(",") + .First(x => x.Contains("default: ")).Replace("default: ", "")); + var dd = dt.NextSibling?.NextSibling; + arg.Description = ParseDescription(dd); + arg.Position = decl.Arguments.Count; + decl.Arguments.Add(arg); + } + ParseDefaultValues(html_doc, decl); + foreach (var arg in decl.Arguments) + PostProcess(arg); + } + + private void ParseDefaultValues(HtmlDoc htmlDoc, Function decl) + { + var dl = htmlDoc.Doc.DocumentNode.Descendants("dl").FirstOrDefault(x => x.Attributes["class"]?.Value == "function"); + if (dl == null) + return; + foreach (var em in dl.Descendants("em")) + { + var tokens = em.InnerText.Split("="); + if (tokens.Length >= 2) + { + var (attr_name, default_value) = (tokens[0], tokens[1]); + var attr = decl.Arguments.FirstOrDefault(x => x.Name == attr_name); + if (attr == null) + { + Console.WriteLine("ParseDefaultValues: Attr '{attr_name}' not found"); + continue; + } + attr.DefaultValue = InferDefaultValue(default_value); + } + } + } + + private void PostProcess(Argument arg) + { + switch (arg.Name) + { + case "order": + arg.DefaultValue = null; + break; + case "axes": + { + arg.Type = "int[]"; + arg.DefaultValue = "null"; + return; + } + case "where": + case "out": + { + arg.IsNullable = true; + arg.IsNamedArg = true; + arg.DefaultValue = null; + break; + } + case "requirements": + case "comments": + arg.DefaultValue = "null"; + break; + } + if (arg.Name.StartsWith("*")) + arg.Name = arg.Name.TrimStart('*'); + switch (arg.Type) + { + //case "int[]": + //case "Hashtable": + // arg.IsValueType = false; + // break; + case "Dtype": + arg.IsValueType = false; + if (!string.IsNullOrWhiteSpace(arg.DefaultValue)) + arg.DefaultValue = "null"; + break; + } + } + + private void PostProcess(Function decl) + { + if (decl.Arguments.Any(a => a.Type == "buffer_like")) + decl.CommentOut = true; + // iterable object + if (decl.Arguments.Any(a => a.Type.Contains(""))) + { + decl.Generics = new string[] { "T" }; + if (decl.Returns[0].Type == "NDarray") // TODO: this feels like a hack. make it more robust if necessary + decl.Returns[0].Type = "NDarray"; + } + if (decl.Returns.Any(a => a.Type == "T" || a.Type.Contains(""))) + { + decl.Generics = new string[] { "T" }; + } + // split combined arguments: NDarray x, y => NDarray x, NDarray y + for (int i = decl.Arguments.Count - 1; i >= 0; i--) + { + var arg = decl.Arguments[i]; + if (arg.Type == "_NoValue") + { + decl.Arguments.RemoveAt(i); + continue; + } + if (arg.Name.Contains(",")) + { + var names = arg.Name.Split(',').Select(x => x.Trim()).ToArray(); + arg.Name = names[0]; + decl.Arguments.Insert(i + 1, decl.Arguments[i].Clone()); + decl.Arguments[i].Name = names[1]; + continue; + } + } + switch (decl.Name) + { + case "fft": + case "random": + decl.SharpOnlyPostfix = "_"; + break; + case "array": + if (decl.ClassName == "numpy") + decl.ManualOverride = true; // do not generate an implementation + break; + case "itemset": + case "tostring": + case "tobytes": + case "view": + case "resize": + case "insert": + case "einsum": + decl.ManualOverride = true; // do not generate an implementation + break; + case "arange": + decl.Arguments[0].IsNullable = false; + decl.Arguments[0].DefaultValue = "0"; + decl.Arguments[2].DefaultValue = "1"; + decl.Arguments[2].IsNullable = false; + decl.Arguments[3].IsNullable = false; + decl.Arguments[3].IsNamedArg = true; + break; + case "logspace": + case "geomspace": + decl.Arguments.First(a => a.Type == "Dtype").IsNullable = false; + decl.Arguments.First(a => a.Type == "Dtype").DefaultValue = "null"; + decl.Arguments.First(a => a.Type == "Dtype").IsNamedArg = true; + break; + case "copy": + if (decl.Returns.Count==0) + decl.Returns.Add(new Argument(){Type = "NDarray"}); + break; + case "mat": + case "bmat": + case "block": + case "interp": + case "einsum_path": + case "cond": + case "get_state": + case "set_state": + case "genfromtxt": + case "array2string": + case "tolist": + case "format_float_positional": + case "format_float_scientific": + case "set_printoptions": + case "set_string_function": + case "ravel_multi_index": + case "nditer": + case "nested_iters": + case "result_type": + case "issubclass_": + case "find_common_type": + case "busdaycalendar": + case "is_busday": + case "busday_count": + case "busday_offset": + decl.CommentOut = true; + break; + case "require": + case "tensordot": + if (decl.Returns.Count == 0) + decl.Returns.Add(new Argument() { Type = "NDarray", Name = "array", IsReturnValue = true }); + break; + case "isfortran": + if (decl.Returns.Count == 0) + decl.Returns.Add(new Argument() { Type = "bool", Name = "retval", IsReturnValue = true }); + break; + case "matrix_rank": + if (decl.Returns.Count == 0) + decl.Returns.Add(new Argument() { Type = "int", Name = "retval", IsReturnValue = true }); + break; + case "correlate": + decl.Arguments.Remove(decl.Arguments.FirstOrDefault(x => x.Name == "old_behavior")); + break; + case "rot90": + var axes = decl.Arguments.First(x => x.Name == "axes"); + axes.DefaultValue = "null"; + axes.DefaultIfNull = "new int[] {0, 1}"; + break; + case "trapz": + var dx = decl.Arguments.First(x => x.Name == "dx"); + dx.Type = "float"; + break; + case "lstsq": + { + var rcond = decl.Arguments.First(x => x.Name == "rcond"); + rcond.DefaultValue = "null"; + break; + } + case "pinv": + { + var rcond = decl.Arguments.First(x => x.Name == "rcond"); + rcond.Type = "float"; + break; + } + case "histogram": + case "histogram2d": + case "histogramdd": + case "histogram_bin_edges": + { + var bins = decl.Arguments.First(x => x.Name == "bins"); + bins.DefaultValue = "null"; + break; + } + case "exponential": + decl.Arguments[0].DefaultValue = "null"; + break; + case "gamma": + decl.Arguments.First(x => x.Name == "scale").DefaultValue = "null"; + break; + case "gumbel": + case "laplace": + case "logistic": + case "lognormal": + case "normal": + case "poisson": + case "rayleigh": + case "uniform": + decl.Arguments.ForEach(x => + { + x.DefaultValue = "null"; + x.IsNamedArg = true; + }); + break; + case "RandomState": + { + decl.Arguments[0].Type = "int"; + decl.Arguments[0].DefaultValue = "null"; + decl.Arguments[0].IsNullable = true; + decl.Arguments[0].IsNamedArg = true; + } + break; + case "fftfreq": + case "rfftfreq": + decl.Arguments[1].Type = "float"; + break; + case "load": + decl.Arguments.First(x => x.Name == "mmap_mode").Type = "MemMapMode"; + // allow_pickle was changed in Numpy version 1.16.3: Made default False in response to CVE-2019-6446. + decl.Arguments.First(x => x.Name == "allow_pickle").DefaultValue = "false"; + break; + case "save": + case "savez": + case "savez_compressed": + // decl.Arguments.First(x => x.Name == "args").Type = "NDarray[]"; + // decl.Arguments.First(x => x.Name == "kwds").Type = "Dictionary"; + decl.ManualOverride = true; // do not generate an implementation + break; + case "savetxt": + decl.Arguments.First(x => x.Name == "fmt").DefaultValue = "null"; + decl.Arguments.First(x => x.Name == "encoding").Type = "string"; + break; + case "mask_indices": + decl.Arguments.First(x => x.Name == "k").Type = "int"; + break; + case "select": + decl.Arguments.First(x => x.Name == "default").Type = "object"; + decl.Arguments.First(x => x.Name == "default").DefaultValue = "null"; + break; + case "pv": + case "pmt": + case "ppmt": + case "ipmt": + case "nper": + decl.Arguments.First(x => x.Name == "fv").DefaultValue = "null"; + var when = decl.Arguments.FirstOrDefault(x => x.Name == "when"); + if (when != null) + when.IsNamedArg = true; + break; + case "format_parser": + decl.Arguments.First(x => x.Name == "titles").Type = "string[]"; + break; + case "mintypecode": + decl.Arguments.First(x => x.Name == "typeset").DefaultValue = "null"; + break; + case "rand": + case "randn": + decl.Arguments.Clear(); + decl.Arguments.Add(new Argument(){ Name = "shape", Type = "int[]"}); + decl.ManualOverride = true; + break; + case "take_along_axis": + decl.Arguments[2].IsNullable = true; + decl.Returns.Clear(); + decl.Returns.Add(new Argument() { Type = "NDarray", Name = "array", IsReturnValue = true }); + break; + case "column_stack": + decl.ManualOverride = true; + break; + case "meshgrid": + decl.ReturnType = "NDarray[]"; + decl.Arguments[0].Type = "NDarray[]"; + decl.Arguments[0].Name = "xi"; + decl.Arguments.RemoveAt(1); + decl.Arguments[1].DefaultValue = "\"xy\""; + break; + case "mgrid": + decl.ReturnType = "NDarray[]"; + break; + case "ogrid": + decl.ReturnType = "NDarray[]"; + decl.Arguments.Clear(); + break; + case "fromfile": + decl.ReturnType = "NDarray"; + break; + } + } + + private void ParseReturnTypes(HtmlDoc html_doc, HtmlNode table, Declaration decl) + { + var tr = table.Descendants("tr").FirstOrDefault(x => x.InnerText.StartsWith("Returns:")); + if (tr == null) + return; + foreach (var dt in tr.Descendants("dt")) + { + var arg = new Argument() { IsReturnValue = true }; + var strong = dt.Descendants("strong").FirstOrDefault(); + if (strong != null) + arg.Name = strong.InnerText; + if (arg.Name == null || arg.Name.ToLower() == "none") + continue; + var type_description = dt.Descendants("span") + .FirstOrDefault(span => span.Attributes["class"]?.Value == "classifier")?.InnerText; + if (type_description == null) + continue; + var type = type_description.Split(",").FirstOrDefault(); + arg.Type = InferType(type, arg); + var dd = dt.NextSibling?.NextSibling; + arg.Description = ParseDescription(dd); + decl.Returns.Add(arg); + } + } + + private IEnumerable InferOverloads(Function decl) + { + switch (decl.Name) + { + case "qr": + case "norm": + case "asscalar": + case "normal": + case "meshgrid": + // don't generate at all + yield break; + case "all": + case "any": + { + decl.Arguments[0].Type = "NDarray"; + decl.Returns[0].Type = "NDarray"; + decl.Arguments.FirstOrDefault(x => x.Name == "axis").IsNullable = false; // make axis mandatory + yield return decl; + var clone = decl.Clone(); + clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "axis")); + clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "out")); + clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "keepdims")); + clone.Returns[0].Type = "bool"; + yield return clone; + yield break; + } + case "count_nonzero": + { + decl.Arguments[0].Type = "NDarray"; + decl.Returns[0].Type = "NDarray"; + decl.Arguments.FirstOrDefault(x => x.Name == "axis").IsNullable = false; // make axis mandatory + yield return decl; + var clone = decl.Clone(); + clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "axis")); + clone.Returns[0].Type = "int"; + yield return clone; + yield break; + } + case "sort": + decl.Arguments.FirstOrDefault(x => x.Name == "axis").DefaultValue = "-1"; + break; + case "percentile": + case "nanpercentile": + case "quantile": + case "nanquantile": + case "median": + case "average": + case "mean": + case "std": + case "var": + case "nanmedian": + case "nanmean": + case "nanstd": + case "nanvar": + { + decl.Arguments[0].Type = "NDarray"; + decl.Returns[0].Type = "NDarray"; + var interpol = decl.Arguments.FirstOrDefault(x => x.Name == "interpolation"); + if (interpol != null) + { + interpol.DefaultValue = "\"linear\""; + interpol.IsNamedArg = true; + } + var weights = decl.Arguments.FirstOrDefault(x => x.Name == "weights"); + if (weights != null) + { + weights.Type = "NDarray"; + weights.IsNamedArg = true; + weights.IsNullable = true; + } + //decl.Generics=new string[]{"T"}; + decl.Arguments.FirstOrDefault(x => x.Name == "axis").IsNullable = false; // make axis mandatory + yield return decl; + var clone = decl.Clone(); + clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "axis")); + //clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "out")); + clone.Arguments.Remove(clone.Arguments.FirstOrDefault(x => x.Name == "keepdims")); + clone.Returns[0].Type = "double"; + yield return clone; + yield break; + } + break; + case "histogram": + case "histogram2d": + case "histogramdd": + case "histogram_bin_edges": + { + decl.Arguments[0].Type = "NDarray"; + if (decl.Returns.Count > 1) + { + decl.Returns[1].Type = "NDarray"; + decl.Generics = null; + } + var bins = decl.Arguments.FirstOrDefault(x => x.Name == "bins"); + if (bins != null) + { + bins.Type = "int"; + bins.IsNamedArg = true; + } + var range = decl.Arguments.FirstOrDefault(x => x.Name == "range"); + if (range != null) + { + range.Type = "(float, float)"; + range.IsNamedArg = true; + range.IsValueType = true; + range.IsNullable = true; + } + var weights = decl.Arguments.FirstOrDefault(x => x.Name == "weights"); + if (weights != null) + { + weights.Type = "NDarray"; + weights.IsNamedArg = true; + weights.IsNullable = true; + } + var y = decl.Arguments.FirstOrDefault(x => x.Name == "y"); + if (y != null) + y.Type = "NDarray"; + yield return decl; + var clone1 = decl.Clone(); + clone1.Arguments.First(x => x.Name == "bins").Type = "NDarray"; + yield return clone1; + var clone2 = decl.Clone(); + clone2.Arguments.First(x => x.Name == "bins").Type = "List"; + yield return clone2; + yield break; + } + break; + case "choice": + case "permutation": + case "binomial": + { + if (!decl.Arguments[0].Type.StartsWith("NDarray")) + decl.Arguments[0].Type = "NDarray"; + yield return decl; + var clone = decl.Clone(); + clone.Arguments[0].Type = "int"; + yield return clone; + yield break; + } + break; + case "seed": + case "RandomState": + { + decl.Arguments[0].Type = "int"; + decl.Arguments[0].DefaultValue = "null"; + decl.Arguments[0].IsNullable = true; + yield return decl; + var clone = decl.Clone(); + clone.Arguments[0].Type = "NDarray"; + yield return clone; + yield break; + } + break; + case "unique": + { + decl["ar"].Type = "NDarray"; + decl.Arguments.ForEach(a => + { + if (a.Name != "axis") + { + a.IsNullable = false; + a.DefaultValue = null; + } + }); + decl.Returns.RemoveAt(3); + decl.Returns.RemoveAt(2); + decl.Returns.RemoveAt(1); + // without return_index, return_inverse and return_counts we return just an NDarray + yield return decl.Clone(f => + { + f.Arguments.RemoveAt(3); + f.Arguments.RemoveAt(2); + f.Arguments.RemoveAt(1); + }); + // if all parameters are specified we return NDarray[] + decl.Returns[0].Type = "NDarray[]"; + yield return decl; + } + yield break; + case "linspace": + { + decl["retstep"].Ignore = true; + decl["start"].Type = "NDarray"; + decl["stop"].Type = "NDarray"; + decl["num"].DefaultValue="50"; + decl["endpoint"].DefaultValue="true"; + //decl["retstep"].MakeMandatory(); + yield return decl; + yield return decl.Clone(f => + { + f.Returns.RemoveAt(1); + f["start"].Type = "double"; + f["stop"].Type = "double"; + }); + } + yield break; + case "rand": + case "randn": + yield return decl; + yield return decl.Clone(f => + { + f.Arguments.Clear(); + f.ManualOverride = false; + f.Returns[0].Type = "float"; + }); + yield break; + case "where": + { + decl["condition"].Type = "NDarray"; + decl["x"].Type = "NDarray"; + decl["y"].Type = "NDarray"; + yield return decl; + yield return decl.Clone(f => + { + f.Arguments.RemoveAt(2); + f.Arguments.RemoveAt(1); + f.ReturnType = "NDarray[]"; + }); + } + yield break; + case "transpose": + if (decl.Arguments[0].Type == "array_like") + { + decl.Arguments[0].Type = "NDarray"; + yield return decl; + yield return decl.Clone(f => { f.Arguments[0].Type = "NDarray[]"; }); + } + else + yield return decl; + yield break; + case "gradient": // don't generate. + yield break; + case "split": + yield return decl; + yield return decl.Clone(f => { f.Arguments[1].Type = "int"; }); + yield break; + } + + // without args we don't need to consider possible overloads + if (decl.Arguments.Count == 0) + { + yield return decl; + yield break; + } + if (decl.Name == "arange") + { + foreach (var d in ExpandArange(decl)) + yield return d; + yield break; + } + if (decl.Name == "bmat") + { + decl.Arguments[0].Type = "string"; + yield return decl; + var clone_decl = decl.Clone(); + clone_decl.Arguments[0].Type = "T[]"; + clone_decl.Arguments[0].ConvertToSharpType = "NDarray"; + clone_decl.Generics = new[] { "T" }; + clone_decl.Returns[0].Type = "Matrix"; + yield return clone_decl; + yield break; + } + HashSet overloads = new HashSet() { decl }; + int i = -1; + foreach (var arg in decl.Arguments) + { + i++; + // array_like + if (arg.Type == "array_like") + { + arg.Type = "NDarray"; + if (arg.Tag != "routines.array-creation.html") + continue; + switch (decl.Name) + { + case "insert": + case "append": + case "resize": + case "flip": + case "flipud": + case "fliplr": + case "squeeze": + case "expand_dims": + case "broadcast_to": + case "transpose": + case "swapaxes": + case "ravel": + case "reshape": + case "copyto": + if (i == 0) + continue; + break; + case "logspace": + case "linspace": + case "geomspace": + case "tile": + case "delete": + case "repeat": + case "roll": + case "rot90": + continue; + } + foreach (var overload in overloads.ToArray()) + { + foreach (var type in "T[] T[,]".Split()) + { + var clone = overload.Clone(); + clone.Arguments[i].Type = type; + clone.Generics = new string[] { "T" }; + clone.Arguments[i].ConvertToSharpType = "NDarray"; + if (clone.Returns.FirstOrDefault()?.Type == "NDarray" + ) // TODO: this feels like a hack. make it more robust if necessary + clone.Returns[0].Type = "NDarray"; + overloads.Add(clone); + } + } + } + // array_like of bool + else if (arg.Type == "array_like of bool") + { + foreach (var overload in overloads.ToArray()) + { + overload.Arguments[i].Type = "NDarray"; + var clone = overload.Clone(); + clone.Arguments[i].Type = "bool[]"; + clone.Arguments[i].ConvertToSharpType = "NDarray"; + overloads.Add(clone); + } + } + // number + else if (arg.Type == "number") + { + foreach (var overload in overloads.ToArray()) + { + overload.Arguments[i].Type = "float"; + foreach (var type in "byte short int long double".Split()) + { + var clone = overload.Clone(); + clone.Arguments[i].Type = type; + overloads.Add(clone); + } + } + } + } + foreach (var overload in overloads) + yield return overload; + } + + // special treatment for np.arange which is a "monster" + private IEnumerable ExpandArange(Function decl) + { + // numpy.arange([start, ]stop, [step, ]dtype=None) + var dtype = decl.Arguments.Last(); + dtype.IsNullable = true; + dtype.IsNamedArg = true; + if (decl.Arguments.Any(a => a.Type == "number")) + { + foreach (var type in "byte short int long float double".Split()) + { + // start, stop + var clone_decl = decl.Clone(); + clone_decl.Arguments.ForEach(a => + { + if (a.Type == "number") + a.Type = type; + }); + clone_decl.Arguments[0].IsNamedArg = false; + clone_decl.Arguments[0].IsNullable = false; + clone_decl.Arguments[0].DefaultValue = null; + yield return clone_decl; + // [start=0] <-- remove start from arg list + clone_decl = clone_decl.Clone(); // <---- clone from the clone, as it has the correct type + clone_decl.Arguments.RemoveAt(0); + yield return clone_decl; + } + yield break; + } + } + + private string InferDefaultValue(string default_value) + { + switch (default_value) + { + case "None": + case "<class 'float'>": + case "<class 'numpy.float64'>": + case "<no value>": + return null; + case "True": return "true"; + case "False": return "false"; + case "'C'": return "\"C\""; + } + if (default_value.StartsWith("'")) + return $"\"{default_value.Trim('\'')}\""; + if (Regex.IsMatch(default_value, @"[+-]?(\d+\.\d+)|(\d+(\.\d+)?e[+-]\d+)")) + return default_value + "f"; + return default_value; + } + + private string InferType(string type, Argument arg) + { + switch (arg.Name) + { + case "shape": return "Shape"; + case "newshape": return "Shape"; + case "new_shape": return "Shape"; + case "dtype": return "Dtype"; + case "order": return "string"; + case "slice": return "Slice"; + case "strides": return "int[]"; + case "arys1, arys2, …": + arg.Name = "arys"; + return "params NDarray[]"; + case "`*args`": + arg.Name = "args"; + break; + case "a1, a2, …": + arg.Name = "arys"; + break; + case "norm": + if (type == "{None") + return "string"; + break; + case "axis": + if (type == "{int") + return "int[]"; + break; + case "edge_order": return "int"; + } + switch (type) + { + // Dtype + case "dtype": + case "data-type": + case "dtype or dtype specifier": + case "data type code": + case "integer type": + case "dtype_like": + return "Dtype"; + case "matrix": return "Matrix"; + // NDarray + case "array": + case "ndarray": + case "np.ndarray": + case "2-D array": + case "1-D array or sequence": + case "(…": + case "(…) array_like": + case "{(…": + case "{ (…": + case "(M": + case "(N": + case "(k": + case "{(M": + case "{(N": + case "{(1": + case "(min(M": + case "list of scalar or array": + case "scalar or array_like or None": + case "scalar or array_like": + case "float or ndarray": + case "(…) array_like of float": + case "complex ndarray": + case "1-D array_like": + case "scalar or ndarray": + case "broadcast object": + case "array_like or scalar": + case "single item or ndarray": + case "1-D array-like": + case "2-D array_like": + case "array_like of rank N": + case "{sequence": + case "1D or 2D array_like": + case "1-D sequence": + case "scalar or array_like of shape(M": + case "array_like of values": + case "array-like": + return "NDarray"; + // NDarray + case "array of ints searchsorted(1-D array_like": + case "array of ints": + case "array of integer type": + case "array_like of integer type": + case "int or ndarray of ints": + case "int or array_like of ints": + case "int array": + return "NDarray"; + // NDarray + case "array_like of float": + case "array of dtype float": + case "float or ndarray of floats": + case "float or array_like of floats": + case "float or array_like of float": + case "sequence of floats": + return "NDarray"; + // NDarray + case "bool (scalar) or boolean ndarray": + case "bool or ndarray of bool": + case "1-D array of bools": + case "array of bool": + return "NDarray"; + // NDarray[] + case "list of bool ndarrays": + return "NDarray[]"; + case "scalar": + if (!arg.IsReturnValue) + return "ValueType"; + else + return "T"; + break; + // string + case "{ ‘warn’": + case "file": + case "str": + case "string or list": + case "file or str": + case "str or function": + case "file-like object": + case "str or file": + case "filename or file handle": + case "str or regexp": + case "str or None": + case "file-like": + case "{{‘begin’": + case "str or array_like of bool": + case "str or unicode": + case "{str": + case "str of length 256": + return "string"; + // string[] + case "str or sequence of str": + case "str or list of str": + case "array of str or unicode-like": + case "str or sequence of strs": + case "sequence of str": + case "str or list": + case "str or list/tuple of str": + case "list of str or array_like": + case "array_like of datetime64": + case "array_like of datetime64[D]": + case "array_like of str or unicode": + case "array-like of str or unicode": + return "string[]"; + // Delegate + case "callable": + case "function": + return "Delegate"; + case "any": return "object"; + case "iterable object": return "IEnumerable"; + case "dict": return "Hashtable"; + // int[] + case "int or tuple": + case "int or sequence": + case "int or sequence of int": + case "int or sequence of ints": + case "sequence of ints": + case "int or array of ints": + case "int or tuple of ints": + case "None or int or tuple of ints": + case "int or 1-D array": + case "sequence or int": + case "array_like of ints": + case "ints": + return "int[]"; + case "boolean": return "bool"; + case "integer": + return "int"; + case "int or None": + arg.IsNullable = true; + return "int"; + case "Standard Python scalar object": return "T"; + case "Arguments (variable number and type)": return "params int[]"; + case "list": return "List"; + // NDarray[] + case "list of arrays": + case "array_likes": + case "sequence of arrays": + case "sequence of ndarrays": + case "sequence of array_like": + case "sequence of 1-D or 2-D arrays.": + case "list of ndarrays": + case "tuple": + case "list of array_like": + case "tuple of ndarrays": + case "tuple of ndarray": + case "1-D sequences": + case "tuple of arrays.": + case "tuple of arrays": + case "array_like (Ni…": + case "array_like (Nj…)": + return "NDarray[]"; + case "slice": return "Slice"; + // double + case "Number": + return "double"; + // object + case "scalar dtype or object": + return "object"; + } + if (arg.IsReturnValue) + { + switch (type) + { + case "array": return "NDarray"; + case "array_like": return "NDarray"; + } + } + if (type.StartsWith("ndarray")) + return "NDarray"; + if (type.StartsWith("{‘")) + return "string"; + return type; + } + + string BaseUrl = "https://docs.scipy.org/doc/numpy-1.16.1/reference/"; + + public List LoadDocs(string overview_url) + { + var docs = new List(); + var doc = GetHtml(overview_url); + LoadDocsFromOverviewPage(doc.Doc, docs); + return docs; + } + + private void LoadDocsFromOverviewPage(HtmlDocument doc, List docs) + { + var nodes = doc.DocumentNode.Descendants("a") + .Where(x => x.Attributes["class"]?.Value == "reference internal") + .ToList(); + foreach (var node in nodes) + { + var relative_link = node.Attributes["href"].Value; + if (!relative_link.StartsWith("generated")) + continue; + var uri = relative_link.Split("#").First(); + docs.Add(GetHtml(uri)); + } + } + + HtmlDoc GetHtml(string relative_url) + { + Console.WriteLine("Loading: " + relative_url); + var doc = new HtmlDoc(); + doc.Filename = relative_url.Replace("/", "_"); + if (File.Exists(doc.Filename)) + { + doc.Doc = new HtmlDocument(); + doc.Doc.Load(doc.Filename); + doc.Text = doc.Doc.Text; + if (!doc.Text.Contains("404 Not Found")) + return doc; + } + var web = new HtmlWeb(); + doc.Doc = web.Load(BaseUrl + relative_url); + doc.Text = doc.Doc.Text; + File.WriteAllText(doc.Filename, doc.Text); + return doc; + } + + public void ApiStatistics() + { + var doc = GetNumpyReference(); + var li = doc.Doc.DocumentNode.DescendantsOfClass("li", "toctree-l1").FirstOrDefault(x => x.InnerText.StartsWith("NumPy Reference")); + var stack = new Stack(); + CollectApiFunctions(li, stack); + } + + HashSet all_api_functions = new HashSet(); + + private void CollectApiFunctions(HtmlNode li, Stack stack) + { + var a = li.ChildNodes.FirstOrDefault(x => x.Name == "a"); + var ul = li.ChildNodes.FirstOrDefault(x => x.Name == "ul"); + stack.Push(a.InnerText); + if (a.InnerText.StartsWith("numpy")) + all_api_functions.Add(a.InnerText); + if (ul != null) + foreach (var sub_li in ul.ChildNodes.Where(x => x.Name == "li")) + CollectApiFunctions(sub_li, stack); + stack.Pop(); + } + + public HtmlDoc GetNumpyReference() + { + var url = "https://docs.scipy.org/doc/numpy/contents.html"; + Console.WriteLine("Loading: " + url); + var doc = new HtmlDoc(); + doc.Filename = "contents.html"; + if (File.Exists(doc.Filename)) + { + doc.Doc = new HtmlDocument(); + doc.Doc.Load(doc.Filename); + doc.Text = doc.Doc.Text; + return doc; + } + var web = new HtmlWeb(); + doc.Doc = web.Load(url); + doc.Text = doc.Doc.Text; + File.WriteAllText(doc.Filename, doc.Text); + return doc; + } + } +} + diff --git a/src/CodeMinion.ApiGenerator/NumPy/README.md b/src/CodeMinion.ApiGenerator/NumPy/README.md new file mode 100644 index 0000000..39a1415 --- /dev/null +++ b/src/CodeMinion.ApiGenerator/NumPy/README.md @@ -0,0 +1,4 @@ +# NumPy +### NumPy is the fundamental package for scientific computing with Python. + +https://www.numpy.org \ No newline at end of file diff --git a/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs b/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs new file mode 100644 index 0000000..c020112 --- /dev/null +++ b/src/CodeMinion.ApiGenerator/NumPy/SpecialGenerators.cs @@ -0,0 +1,52 @@ +using CodeMinion.Core.Helpers; + +namespace CodeMinion.ApiGenerator.NumPy +{ + public static class SpecialGenerators + { + + public static void InitNumpyGenerator(CodeWriter s) + { + s.Out("#if PYTHON_INCLUDED"); + s.Out("Installer.InstallWheel(typeof(np).Assembly, \"numpy-1.23.5-cp311-cp311-win_amd64.whl\", force).Wait();"); + s.Out("#endif"); + } + + public static void ArrayToNDarrayConversion(CodeWriter s) + { + s.Out("case Array a:"); + s.Out("if (typeof(T)==typeof(NDarray)) return (T)(object)ConvertArrayToNDarray(a);"); + s.Out("break;"); + } + + public static void ConvertArrayToNDarray(CodeWriter s) + { + s.Out("private static NDarray ConvertArrayToNDarray(Array a)", () => + { + s.Out("switch(a)", () => + { + s.Out("case bool[] arr: return np.array(arr);"); + s.Out("case int[] arr: return np.array(arr);"); + s.Out("case float[] arr: return np.array(arr);"); + s.Out("case double[] arr: return np.array(arr);"); + s.Out("case int[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1));"); + s.Out("case float[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1));"); + s.Out("case double[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1));"); + s.Out("case bool[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1));"); + s.Out("default: throw new NotImplementedException($\"Type {a.GetType()} not supported yet in ConvertArrayToNDarray.\");"); + }); + }); + } + + public static void ConvertDict(CodeWriter s) + { + s.Out("private static PyDict ToDict(Dictionary d)", () => + { + s.Out("var dict = new PyDict();"); + s.Out("foreach (var pair in d)"); + s.Out(" dict[new PyString(pair.Key)] = pair.Value.self;"); + s.Out("return dict;"); + }); + } + } +} diff --git a/src/CodeMinion.ApiGenerator/Program.cs b/src/CodeMinion.ApiGenerator/Program.cs new file mode 100644 index 0000000..054396b --- /dev/null +++ b/src/CodeMinion.ApiGenerator/Program.cs @@ -0,0 +1,17 @@ +using System; +using Torch.ApiGenerator; + +namespace CodeMinion.ApiGenerator +{ + class Program + { + static void Main(string[] args) + { + ICodeGenerator generator = new NumPy.ApiGenerator(); + var result = generator.Generate(); + + Console.WriteLine(result); + //Console.ReadKey(); + } + } +} diff --git a/src/CodeMinion.Core/Attributes/PartialClassTemplateAttribute.cs b/src/CodeMinion.Core/Attributes/PartialClassTemplateAttribute.cs new file mode 100644 index 0000000..a31876f --- /dev/null +++ b/src/CodeMinion.Core/Attributes/PartialClassTemplateAttribute.cs @@ -0,0 +1,16 @@ +using System; + +namespace CodeMinion.Core.Attributes +{ + public class PartialClassTemplateAttribute : Attribute + { + public string ClassName { get; set; } + public string MemberName { get; set; } + + public PartialClassTemplateAttribute(string class_name, string member_name) + { + ClassName = class_name; + MemberName = member_name; + } + } +} \ No newline at end of file diff --git a/src/CodeMinion.Core/Attributes/TemplateAttribute.cs b/src/CodeMinion.Core/Attributes/TemplateAttribute.cs new file mode 100644 index 0000000..79635d4 --- /dev/null +++ b/src/CodeMinion.Core/Attributes/TemplateAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace CodeMinion.Core.Attributes +{ + + public class TemplateAttribute : Attribute + { + public string ApiFunction { get; set; } + + public TemplateAttribute(string api_function) + { + ApiFunction = api_function; + } + } +} diff --git a/src/CodeMinion.Core/CodeGenerator.cs b/src/CodeMinion.Core/CodeGenerator.cs new file mode 100644 index 0000000..ab2017a --- /dev/null +++ b/src/CodeMinion.Core/CodeGenerator.cs @@ -0,0 +1,1107 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using CodeMinion.Core.Attributes; +using CodeMinion.Core.Helpers; +using CodeMinion.Core.Models; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using SliceAndDice; + +namespace CodeMinion.Core +{ + public class CodeGenerator + { + public CodeGenerator() + { + LoadTemplates(); + } + + public string CopyrightNotice { get; set; } + public List StaticApis { get; set; } = new List(); + public List DynamicApis { get; set; } = new List(); + public List ApiClasses { get; set; } = new List(); + public bool PrintModelJson { get; set; } = false; + public string NameSpace { get; set; } = "Numpy"; + public string StaticModuleName { get; set; } = "np"; + public string PythonModuleName { get; set; } = "numpy"; + public List> InitializationGenerators { get; set; } = new List>(); + + //public bool UsePythonIncluded { get; set; } = true; + public HashSet Usings { get; set; } = new HashSet() + { + @"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;", + }; + public string StaticApiFilesPath { get; set; } + public string DynamicApiFilesPath { get; set; } + public string ModelsPath { get; set; } + public string TestFilesPath { get; set; } + public List TestFiles { get; set; } = new List(); + protected Dictionary _templates; + protected virtual void LoadTemplates() + { + _templates = Assembly.GetEntryAssembly().GetTypes() + .Where(x => x.GetCustomAttribute() != null) + .Select(x => (FunctionBodyTemplate)Activator.CreateInstance(x)).ToDictionary(x => + x.GetType().GetCustomAttribute().ApiFunction); + } + + // generate an entire API function declaration + protected virtual void GenerateApiFunction(Declaration decl, CodeWriter s, bool prefix = false, bool @static=false) + { + if (decl.ManualOverride) + return; + //if (decl.Name=="cholesky") + // Debugger.Break(); + decl.Sanitize(); + if (decl.CommentOut) + s.Out("/*"); + var class_names = (decl.GeneratedClassName ?? decl.ClassName ?? "no_name").Split('.'); + int levels = class_names.Length - 1; + if (levels > 0) + { + foreach (var name in class_names.Skip(1)) + { + s.Out($"public static partial class {EscapeName(name)} {{"); + s.Indent(); + } + } + GenerateDocString(decl, s); + var retval = GenerateReturnType(decl); + switch (decl) + { + case Function func: + var arguments = GenerateArguments(func); + //var passed_args = GeneratePassedArgs(func); + var generics = func.Generics == null ? "" : $"<{string.Join(",", func.Generics)}>"; + 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}({(@static && func.IsExtensionFunction ? "this " : "")}{arguments})"); + s.Block(() => + { + GenerateFunctionBody(func, s, prefix_str); + }); + break; + case Property prop: + s.Out($"public {(@static ? "static " : "")}{prop.Type} {EscapeName(prop.Name)}"); + s.Block(() => + { + s.Out("get", () => + { + GeneratePropertyGetter(prop, s); + }); + s.Out("set", () => + { + GeneratePropertySetter(prop, s); + }); + }); + break; + } + if (levels > 0) + { + foreach (var name in class_names.Skip(1)) + { + s.Outdent(); + s.Out("}"); + } + } + if (decl.CommentOut) + s.Out("*/"); + if (PrintModelJson) + { + s.Out("// the declaration model:"); + s.Out("/*"); + s.Out(JObject.FromObject(decl).ToString(Formatting.Indented)); + s.Out("*/"); + } + s.Break(); + } + + //protected virtual void GenerateStaticApiRedirection(StaticApi api, Declaration decl, CodeWriter s) + //{ + // if (decl.DebuggerBreak) + // Debugger.Break(); + // decl.Sanitize(); + // if (decl.CommentOut) + // s.Out("/*"); + // var class_names = (decl.GeneratedClassName ?? decl.ClassName ?? "no_name").Split('.'); + // int levels = class_names.Length - 1; + // if (levels > 0) + // { + // foreach (var name in class_names.Skip(1)) + // { + // s.Out($"public static partial class {EscapeName(name)} {{"); + // s.Indent(); + // } + // } + // GenerateDocString(decl, s); + // var retval = GenerateReturnType(decl); + // switch (decl) + // { + // case Function func: + // var arguments = GenerateArguments(func); + // var passed_args = GeneratePassedArgs(func); + // var generics = func.Generics == null ? "" : $"<{string.Join(",", func.Generics)}>"; + // s.Out($"public static {retval} {EscapeName(decl.Name)}{func.SharpOnlyPostfix}{generics}({arguments})"); + // var prefix = ""; + // if (levels > 0) + // prefix = string.Join("_", class_names.Skip(1)) + "_"; + // s.Indent(() => s.Out( + // $"=> {api.ImplName}.Instance.{EscapeName(prefix + decl.Name)}({passed_args});")); + // break; + // case Property prop: + // s.Out($"public static {retval} {EscapeName(decl.Name)}"); + // s.Indent(() => s.Out( + // $"=> {api.ImplName}.Instance.{EscapeName(decl.Name)};")); + // break; + // } + // if (levels > 0) + // { + // foreach (var name in class_names.Skip(1)) + // { + // s.Outdent(); + // s.Out("}"); + // } + // } + // if (decl.CommentOut) + // s.Out("*/"); + // s.Break(); + //} + + // generate the argument list between the parentheses of a generated API function + protected virtual string GenerateArguments(Function decl) + { + var s = new StringBuilder(); + int i = 0; + foreach (var arg in decl.Arguments) + { + if (arg.Type == "string") + arg.IsValueType = false; + // TODO modifier (if any) + // parameter type + CheckArgument(arg); + s.Append(arg.Type); + if (arg.IsNullable && arg.IsValueType) + s.Append("?"); + s.Append(" "); + // parameter name + s.Append(EscapeName(arg.Name)); + if (!string.IsNullOrWhiteSpace(arg.DefaultValue)) + s.Append($" = {MapDefaultValue(arg)}"); + else if (arg.IsNullable) + s.Append($" = null"); + i++; + if (i < decl.Arguments.Count) + s.Append(", "); + } + return s.ToString(); + } + + private string GeneratePassedArgs(Function decl) + { + var s = new StringBuilder(); + int i = 0; + foreach (var arg in decl.Arguments) + { + // TODO modifier (if any) + var argname = EscapeName(arg.Name); + if (arg.IsNamedArg) + s.Append($"{argname}:"); + s.Append(argname); + i++; + if (i < decl.Arguments.Count) + s.Append(", "); + } + return s.ToString(); + } + + // maps None to null, etc + protected virtual string MapDefaultValue(Argument arg) + { + switch (arg.DefaultValue) + { + case "None": return "null"; + case "True": return "true"; + case "False": return "false"; + } + return arg.DefaultValue; + } + + // list of c# keywords that are not allowed as variable names or parameter names + protected readonly HashSet _disallowed_names = new HashSet() + { + "abstract", "as", "base", "bool", "break", + "byte", "case", "catch", "char", "checked", + "class", "const", "continue", "decimal", "default", + "delegate", "do", "double", "else", "enum", + "event", "explicit", "extern", "false", "finally", + "fixed", "float", "for", "foreach", "goto", + "if", "implicit", "in", "int", "interface", + "internal", "is", "lock", "long", "namespace", + "new", "null", "object", "operator", "out", + "override", "params", "private", "protected", "public", + "readonly", "ref", "return", "sbyte", "sealed", + "short", "sizeof", "stackalloc", "static", "string", + "struct", "switch", "this", "throw", "true", + "try", "typeof", "uint", "ulong", "unchecked", + "unsafe", "ushort", "using", "var", "virtual", + "void", "volatile", "while", + "add", "alias", "async", "await", "dynamic", + "get", "global", "nameof", "partial", "remove", + "set", "value", "when", "where", "yield", + "ascending", "by", "descending", "equals", "from", + "group", "in", "into", "join", "let", + "on", "orderby", "select", "where" + }; + + // escape a varibale name if it violates C# syntax + protected virtual string EscapeName(string name) + { + if (_disallowed_names.Contains(name)) + return "@" + name; + return name; + } + + // generates the return type declaration of a generated API function declaration + protected virtual string GenerateReturnType(Declaration decl) + { + if (decl.Returns == null || decl.Returns.Count == 0) + return "void"; + else if (decl.Returns.Count == 1) + { + CheckArgument(decl.Returns[0]); + return decl.Returns[0].Type; + } + else + { + return "(" + string.Join(", ", decl.Returns.Select(x => x.Type).ToArray()) + ")"; + } + } + + // argument type consistency checks + protected virtual void CheckArgument(Argument arg) + { + switch (arg.Type) + { + // basic types + case "bool": + case "int": + case "long": + case "double": + case "float": + arg.IsValueType = true; + break; + case "object": + case "string": + arg.IsValueType = false; + break; + // sequence types + } + } + + /// + /// Generate the xml doc string from the description(s) + /// + /// + /// + protected virtual void GenerateDocString(Declaration decl, CodeWriter s) + { + if (string.IsNullOrWhiteSpace(decl.Description)) + return; + s.Out("/// "); + var docstring = ProcessDocString(decl.Description); + foreach (var line in Regex.Split(docstring, @"\r?\n")) + s.Out("///\t" + line); + s.Out("/// "); + if (decl is Function) + { + var func = decl as Function; + foreach (var arg in func.Arguments) + { + if (string.IsNullOrWhiteSpace(arg.Description)) + continue; + s.Out($"/// "); // note: docstring doesn't want parameters escaped with "@" + docstring = ProcessDocString(arg.Description); + foreach (var line in Regex.Split(docstring, @"\r?\n")) + s.Out("///\t" + line.TrimStart()); + s.Out("/// "); + } + } + if (decl.Returns.All(rv => string.IsNullOrWhiteSpace(rv.Description))) + return; + s.Out("/// "); + if (decl.Returns.Count == 1) + foreach (var line in Regex.Split(ProcessDocString(decl.Returns[0].Description), @"\r?\n")) + s.Out("///\t" + line); + else + { + s.Out("/// A tuple of:"); + foreach (var rv in decl.Returns) + { + s.Out("/// " + rv.Name); + foreach (var line in Regex.Split(rv.Description, @"\r?\n")) + s.Out("///\t" + line); + } + } + s.Out("/// "); + } + + protected virtual void GenerateDocString(ApiClass decl, CodeWriter s) + { + if (string.IsNullOrWhiteSpace(decl.DocString)) + return; + var docstring= ProcessDocString(decl.DocString); + s.Out("/// "); + foreach (var line in Regex.Split(docstring, @"\r?\n")) + s.Out("///\t" + line); + s.Out("/// "); + } + + protected string ProcessDocString(string docstring) + { + if (string.IsNullOrWhiteSpace(docstring)) + return docstring; + // insert linebreak after each sentence + var text= Regex.Replace(docstring, @"(?:(?<=\w|\)|\])(?
\n", RegexOptions.Multiline); + text = Regex.Replace(text, @"(\r?\n){2,}", "\n\n"); + text = Regex.Replace(text.Trim(), "

$", ""); + return text; + } + + // generates only the body of the API function declaration + protected virtual void GenerateFunctionBody(Function func, CodeWriter s, string prefix = "") + { + s.Out("//auto-generated code, do not change"); + if (_templates.ContainsKey(func.Name)) + { + // use generator template instead + _templates[func.Name].GenerateBody(func, s); + return; + } + + //if (func.Name=="norm") + // Debugger.Break(); + var class_names = (func.ClassName ?? "no_name").Split('.'); + int levels = class_names.Length - 1; + if (levels < 1) + { + s.Out("var __self__=self;"); + } + else + { + var last = "self"; + foreach (var name in class_names.Skip(1)) + { + s.Out($"var {EscapeName(name)} = {last}.GetAttr(\"{name}\");"); + last = name; + } + s.Out($"var __self__={last};"); + } + if (func.Arguments.Any()) + { + // first generate the positional args + s.Out($"var pyargs=ToTuple(new object[]"); + s.Block(() => + { + foreach (var arg in func.Arguments.Where(a => a.IsNamedArg == false)) + { + var name = EscapeName(arg.Name); + if (!string.IsNullOrWhiteSpace(arg.ConvertToSharpType)) + s.Out($"SharpToSharp<{arg.ConvertToSharpType}>({name}),"); + else + s.Out($"{name},"); + } + }, "{", "});"); + // then generate the named args + s.Out($"var kwargs=new PyDict();"); + foreach (var arg in func.Arguments.Where(a => a.IsNamedArg == true)) + { + var name = EscapeName(arg.Name); + if (!string.IsNullOrWhiteSpace(arg.DefaultValue)) + s.Out($"if ({name}!={arg.DefaultValue}) kwargs[\"{arg.Name}\"]=ToPython({name});"); + else if (string.IsNullOrWhiteSpace(arg.DefaultValue)) + { + if (string.IsNullOrWhiteSpace(arg.DefaultIfNull) || arg.DefaultValue == "null") + s.Out($"if ({name}!=null) kwargs[\"{arg.Name}\"]=ToPython({name});"); + else + s.Out($"kwargs[\"{arg.Name}\"]=ToPython({name} ?? {arg.DefaultIfNull});"); + } + else //if (arg.IsNullable) + s.Out($"if ({name}!=null) kwargs[\"{arg.Name}\"]=ToPython({name});"); + + } + // then call the function + s.Out($"dynamic py = __self__.InvokeMethod(\"{func.Name}\", pyargs, kwargs);"); + } + else + { + // call function with no arguments + s.Out($"dynamic py = __self__.InvokeMethod(\"{func.Name}\");"); + } + + if (func.IsConstructor) + { + s.Out("self=py as PyObject;"); + return; + } + // return the return value if any + if (func.Returns.Count == 0) + return; + if (func.Returns.Count == 1) + s.Out($"return ToCsharp<{func.Returns[0].Type}>(py);"); + else + { + var returns = func.Returns.Select((x, i) => $"ToCsharp<{x.Type}>(py[{i}])").ToArray(); + s.Out($"return ({string.Join(", ", returns)});"); + } + } + + //private void GenerateForwardingBody(Function member_func, CodeWriter s, string prefix = "") + //{ + // var func = member_func.Clone(); + // // inserting this at position 0 since this is a forwarding of a member function to a static implementation + // func.Arguments.Insert(0, new Argument() { Name = "this", Type = "irrelevant" }); + // var passed_args = GeneratePassedArgs(func); + // s.Out("var @this=this;"); + // var return_keyword = member_func.Returns.Count > 0 ? "return " : ""; + // s.Out($"{return_keyword}{func.ForwardToStaticImpl}.{EscapeName(prefix + func.Name)}({passed_args});"); + //} + + private void GeneratePropertyGetter(Property prop, CodeWriter s) + { + s.Out($"dynamic py = self.GetAttr(\"{prop.Name}\");"); + if (prop.Returns.Count==1 && prop.Type!=null) + s.Out($"return ToCsharp<{prop.Type}>(py);"); + else + { + throw new NotImplementedException("TODO: Property returns a tuple"); + } + } + + private void GeneratePropertySetter(Property prop, CodeWriter s) + { + s.Out($"self.SetAttr(\"{prop.Name}\", ToPython(value));"); + } + + public virtual void GenerateStaticApi(StaticApi api, CodeWriter s) + { + GenerateUsings(s); + s.Out($"namespace {NameSpace}"); + s.Block(() => + { + s.Out($"public static partial class {api.StaticName}"); + s.Block(() => + { + s.Break(); + foreach (var decl in api.Declarations) + { + try + { + if (decl.Ignore) + continue; + GenerateApiFunction(decl, s, @static:true); + } + catch (Exception e) + { + s.Out("// Error generating delaration: " + decl.Name); + s.Out("// Message: " + e.Message); + s.Out("/*"); + s.Out(e.StackTrace); + s.Out("----------------------------"); + s.Out("Declaration JSON:"); + s.Out(JObject.FromObject(decl).ToString(Formatting.Indented)); + s.Out("*/"); + + } + } + s.Break(); + }); + }); + } + + private void GenerateUsings(CodeWriter s) + { + foreach (var @using in Usings) + { + s.AppendLine(@using); + } + s.Out(@"#if PYTHON_INCLUDED"); + s.Out(@"using Python.Included;"); + s.Out(@"#endif"); + s.AppendLine(); + } + + public virtual void GenerateApiImpl(StaticApi api, CodeWriter s) + { + GenerateUsings(s); + s.AppendLine($"namespace {NameSpace}"); + s.Block(() => + { + s.Out($"public partial class {api.ImplName}"); + s.Block(() => + { + s.Break(); + foreach (var decl in api.Declarations) + { + try + { + if (decl.ManualOverride || decl.Ignore) + continue; + GenerateApiFunction(decl, s, prefix: true); + } + catch (Exception e) + { + s.Out("// Error generating delaration: " + decl.Name); + s.Out("// Message: " + e.Message); + s.Out("/*"); + s.Out(e.StackTrace); + s.Out("----------------------------"); + s.Out("Declaration JSON:"); + s.Out(JObject.FromObject(decl).ToString(Formatting.Indented)); + s.Out("*/"); + + } + } + }); + }); + } + + public virtual void GenerateDynamicApi(DynamicApi api, CodeWriter s) + { + GenerateUsings(s); + s.AppendLine($"namespace {NameSpace}"); + s.Block(() => + { + s.Out($"public partial class {api.ClassName}"); + s.Block(() => + { + s.Break(); + foreach (var decl in api.Declarations) + { + try + { + if (decl.ManualOverride || decl.Ignore) + continue; + if (decl is Function && !(decl as Function).IsExtensionFunction) + GenerateApiFunction(decl, s); + } + catch (Exception e) + { + s.Out("// Error generating delaration: " + decl.Name); + s.Out("// Message: " + e.Message); + s.Out("/*"); + s.Out(e.StackTrace); + s.Out("----------------------------"); + s.Out("Declaration JSON:"); + s.Out(JObject.FromObject(decl).ToString(Formatting.Indented)); + s.Out("*/"); + } + } + }); + }); + } + + public virtual void GenerateClass(ApiClass api, CodeWriter s) + { + GenerateUsings(s); + s.AppendLine($"namespace {NameSpace}"); + s.Block(() => + { + var names = new ArraySlice(api.ClassName.Split('.')); + var static_classes = names.GetSlice(new Slice(0, names.Length - 1)); + var class_name = names.Last(); + int levels = names.Length - 1; + if (levels > 0) + { + foreach (var name in static_classes) + { + s.Out($"public static partial class {EscapeName(name)} {{"); + s.Indent(); + } + } + GenerateDocString(api, s); + s.Out($"public partial class {EscapeName(class_name)} : {EscapeName(api.BaseClass)}"); + s.Block(() => + { + s.Out($"// auto-generated class"); + s.Break(); + s.Out($"public {EscapeName(class_name)}(PyObject pyobj) : base(pyobj) {{ }}"); + s.Break(); + s.Out($"public {EscapeName(class_name)}({EscapeName(api.BaseClass)} other) : base(other.PyObject as PyObject) {{ }}"); + s.Break(); + + // additional constructors + foreach (var func in api.Constructors) + { + try + { + if (func.ManualOverride || func.Ignore) + continue; + func.Sanitize(); + func.IsConstructor = true; + func.ClassName = string.Join(".", static_classes); + func.Name = class_name; + var arguments = GenerateArguments(func); + //var passed_args = GeneratePassedArgs(func); + s.Out($"public {EscapeName(class_name)}({arguments})"); + s.Block(() => + { + GenerateFunctionBody(func, s); + }); + } + catch (Exception e) + { + s.Out("// Error generating constructor"); + s.Out("// Message: " + e.Message); + s.Out("/*"); + s.Out(e.StackTrace); + s.Out("----------------------------"); + s.Out("Declaration JSON:"); + s.Out(JObject.FromObject(func).ToString(Formatting.Indented)); + s.Out("*/"); + } + } + // functions + s.Break(); + foreach (var decl in api.Declarations) + { + try + { + if (decl.ManualOverride || decl.Ignore) + continue; + GenerateApiFunction(decl, s); + } + catch (Exception e) + { + s.Out("// Error generating delaration: " + decl.Name); + s.Out("// Message: " + e.Message); + s.Out("/*"); + s.Out(e.StackTrace); + s.Out("----------------------------"); + s.Out("Declaration JSON:"); + s.Out(JObject.FromObject(decl).ToString(Formatting.Indented)); + s.Out("*/"); + } + } + }); + if (levels > 0) + { + foreach (var name in static_classes) + { + s.Outdent(); + s.Out("}"); + } + } + //if (decl.CommentOut) + // s.Out("*/"); + s.Break(); + }); + } + protected void WriteFile(string path, Action generate_action) + { + var s = new CodeWriter(); + try + { + if (!string.IsNullOrWhiteSpace(CopyrightNotice)) + s.Out("// " + CopyrightNotice); + s.Out("// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion"); + s.Break(); + generate_action(s); + } + catch (Exception e) + { + s.AppendLine("/*"); + s.AppendLine("\r\n --------------- generator exception ---------------------"); + s.AppendLine(e.Message); + s.AppendLine(e.StackTrace); + s.AppendLine("*/"); + } + + var dir = Path.GetDirectoryName(path); + if (!Directory.Exists(dir)) + Directory.CreateDirectory(dir); + File.WriteAllText(path, s.ToString()); + } + + public void Generate() + { + // generate all static apis that have been configured + var generated_implementations = new HashSet(); + var conv_file = Path.Combine(StaticApiFilesPath, $"{StaticModuleName}.module.gen.cs"); + WriteFile(conv_file, s => { GenerateStaticModuleHead( s); }); + + foreach (var api in StaticApis) + { + var outpath = api.OutputPath ?? StaticApiFilesPath; + if (string.IsNullOrWhiteSpace(outpath)) + throw new InvalidDataException("either set generators StaticApiFilesPath or static_api's OutputPath"); + // generate static apis + //if (!generated_implementations.Contains(api.ImplName)) + //{ + //} + + generated_implementations.Add(api.ImplName); + var partial = (api.PartialName == null ? "" : "." + api.PartialName); + var api_file = Path.Combine(outpath, $"{api.StaticName + partial}.gen.cs"); + //var impl_file = Path.Combine(outpath, $"{api.ImplName + partial}.gen.cs"); + WriteFile(api_file, s => { GenerateStaticApi(api, s); }); + //WriteFile(impl_file, s => { GenerateApiImpl(api, s); }); + } + // PythonObject functions: + var pyobj_file = Path.Combine(ModelsPath ?? DynamicApiFilesPath, $"PythonObject.gen.cs"); + WriteFile(pyobj_file, s => { GeneratePythonObjectConversions(s); }); + // Dynamic APIs + foreach (var api in DynamicApis) + { + var outpath = api.OutputPath ?? DynamicApiFilesPath; + // generate dynamic apis + var partial = (api.PartialName == null ? "" : "." + api.PartialName); + var api_file = Path.Combine(outpath, $"{api.ClassName + partial}.gen.cs"); + WriteFile(api_file, s => { GenerateDynamicApi(api, s); }); + } + // Classes + foreach (var api in ApiClasses) + { + if (api.Ignore) + continue; + var outpath = api.OutputPath ?? DynamicApiFilesPath; + if (api.SubDir != null) + outpath = Path.Combine(outpath, api.SubDir); + // generate dynamic apis + var partial = (api.PartialName == null ? "" : "." + api.PartialName); + var api_file = Path.Combine(outpath, $"{api.ClassName + partial}.gen.cs"); + WriteFile(api_file, s => { GenerateClass(api, s); }); + } + // generate missing tests + GenerateAllTests(); + } + + /// + /// Generate tests that probably have to be manually corrected, syntax wise. For that reason + /// We will not overwrite any existing files! + /// + public void GenerateAllTests() + { + foreach (var file in TestFiles) + { + if(file.TestCases.Count==0) + continue; + var path = TestFilesPath; + if (!string.IsNullOrWhiteSpace(file.SubDir)) + path = Path.Combine(path, file.SubDir); + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + var test_file = Path.Combine(path, $"{file.Name}.tests.cs"); + if (File.Exists(test_file)) + continue; // never overwrite already generated files! + WriteFile(test_file, s => { GenerateTests(file, s); }); + } + } + + private void GenerateTests(TestFile file, CodeWriter s) + { + GenerateUsings(s); + s.Out("using Microsoft.VisualStudio.TestTools.UnitTesting;"); + s.Out("using Assert = NUnit.Framework.Assert;"); + s.Break(); + s.Out($"namespace {NameSpace}.UnitTest", () => + { + s.Out("[TestClass]"); + s.Out($"public class {file.Name}Test : BaseTestCase", () => + { + foreach (var testcase in file.TestCases) + GenerateTestCase(testcase, s); + }); + }); + } + + private void GenerateTestCase(TestCase testcase, CodeWriter s) + { + s.Break(); + s.Out("[TestMethod]"); + s.Out($"public void {testcase.Name}()", () => + { + var given_var = false; + var expected_var = false; + foreach (var part in testcase.TestParts) + { + switch (part) + { + case Comment c: + foreach (var ln in Regex.Split(c.Text, @"\r?\n")) + s.Out(@"// " + ln); + s.Break(); + break; + case ExampleCode example: + var lines = Regex.Split(example.Text, @"\r?\n"); + foreach (var ln in lines) + s.Out(@"// " + ln); + s.Break(); + s.Out("#if TODO"); + foreach (var line in example.Lines) + { + if (line.Type == "comment") + { + s.Out(line.Text[0]); + continue; + } + if (line.Type == "cmd") + { + var cmd = line.Text[0]; + s.Out($"{(given_var ? "" : "var")} given= " + cmd + ";"); + given_var = true; + continue; + } + + if (line.Type == "output") + { + s.Out($"{(expected_var ? "" : "var")} expected="); + expected_var = true; + s.Indent(() => + { + int i = 0; + foreach (var output in line.Text) + { + var newline = i < line.Text.Count - 1 ? @"\n" : ""; + var delimiter = i < line.Text.Count - 1 ? @" +" : ";"; + s.Out($"\"{output}{newline}\"{delimiter}"); + i++; + } + }); + } + s.Out("Assert.AreEqual(expected, given.repr);"); + } + s.Out("#endif"); + break; + } + } + }); + s.Break(); + } + + private void GenerateStaticModuleHead(CodeWriter s) + { + GenerateUsings(s); + s.AppendLine($"namespace {NameSpace}"); + s.Block(() => + { + 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 = default;"); + s.Out($"private static void ReInitializeLazySelf() => _lazy_self = new Lazy(() => ", () => + { + s.Out("try", () => + { + s.Out("return InstallAndImport();"); + }); + s.Out("catch (Exception)", () => + { + s.Out("// retry to fix the installation by forcing a repair, if Python.Included is used."); + s.Out("return InstallAndImport(force: true);"); + }); + //s.Out("return instance;"); + }); + s.Out(");"); + s.Break(); + s.Out("private static PyObject InstallAndImport(bool force = false)", () => + { + s.Out(@"#if PYTHON_INCLUDED"); + s.Out("Installer.SetupPython(force).Wait();"); + 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;"); + }); + s.Break(); + s.Out("public static dynamic dynamic_self => self;"); + s.Out("private static bool IsInitialized => self != null;"); + s.Break(); + //s.Out($"private {api.ImplName}() {{ }}"); + s.Break(); + s.Out("public static void Dispose()", () => + { + s.Out("self?.Dispose();"); + }); + s.Break(); + GenToTuple(s, @static:true); + GenToPython(s, @static: true); + GenToCsharp(s, @static: true); + GenSharpToSharp(s, @static: true); + GenSpecialConversions(s, @static: true); + }); + }); + } + + private void GeneratePythonObjectConversions(CodeWriter s) + { + GenerateUsings(s); + s.Out($"namespace {NameSpace}", () => + { + s.Out($"public partial class PythonObject", () => + { + s.Break(); + GenToTuple(s); + GenToPython(s); + GenToCsharp(s); + GenSharpToSharp(s); + GenSpecialConversions(s); + }); + }); + } + + private void GenToTuple(CodeWriter s, bool @static=false) + { + s.Break(); + s.Out("//auto-generated"); + s.Out($"{(@static?"private static":"public")} PyTuple ToTuple(Array input)", () => + { + s.Out("var array = new PyObject[input.Length];"); + s.Out("for (int i = 0; i < input.Length; i++)", () => + { + s.Out("array[i]=ToPython(input.GetValue(i));"); + }); + s.Out("return new PyTuple(array);"); + }); + } + + public HashSet ToCsharpConversions { get; set; } = new HashSet(); + + private void GenToCsharp(CodeWriter s, bool @static = false) + { + s.Break(); + s.Out("//auto-generated"); + s.Out($"{(@static?"internal static":"public")} T ToCsharp(dynamic pyobj)", () => + { + s.Out("switch (typeof(T).Name)", () => + { + s.Out("// types from 'ToCsharpConversions'"); + foreach (var @case in ToCsharpConversions) + { + 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 {pyobj.__class__} to {typeof(T).Name} not implemented\", e);"); + s.Out("return default(T);"); + }); + }); + }); + } + + public HashSet ToPythonConversions { get; set; } = new HashSet(); + + private void GenToPython(CodeWriter s, bool @static=false) + { + s.Break(); + s.Out("//auto-generated"); + 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 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);"); + s.Out("case bool o: return ConverterExtension.ToPython(o);"); + s.Out("case PyObject o: return o;"); + s.Out("// sequence types"); + s.Out("case Array o: return ToTuple(o);"); + s.Out("// special types from 'ToPythonConversions'"); + foreach (var @case in ToPythonConversions) + { + s.Out(@case); + } + s.Out("default: throw new NotImplementedException($\"Type is not yet supported: { obj.GetType().Name}. Add it to 'ToPythonConversions'\");"); + }); + }); + } + + public List> SharpToSharpConversions { get; set; } = new List>(); + + private void GenSharpToSharp(CodeWriter s, bool @static=false) + { + s.Break(); + s.Out("//auto-generated"); + s.Out($"{(@static ? "internal static" : "public")} T SharpToSharp(object obj)", () => + { + s.Out("if (obj == null) return default(T);"); + s.Out("switch (obj)", () => + { + s.Out("// from 'SharpToSharpConversions':"); + foreach (var gen in SharpToSharpConversions) + { + gen(s); + } + }); + s.Out("throw new NotImplementedException($\"Type is not yet supported: { obj.GetType().Name}. Add it to 'SharpToSharpConversions'\");"); + }); + } + + + public List> SpecialConversionGenerators { get; set; } = new List>(); + + private void GenSpecialConversions(CodeWriter s, bool @static=false) + { + foreach (var generator in SpecialConversionGenerators) + { + s.Break(); + s.Out("//auto-generated: SpecialConversions"); + generator(s); + } + } + + public void GenerateIntermediateJson() + { + foreach (var api in StaticApis) + { + var outpath = api.OutputPath ?? StaticApiFilesPath; + if (string.IsNullOrWhiteSpace(outpath)) + throw new InvalidDataException("either set generators StaticApiFilesPath or static_api's OutputPath"); + // generate static apis + var partial = (api.PartialName == null ? "" : "." + api.PartialName); + var api_file = Path.Combine(outpath, $"{api.StaticName + partial}.gen.json"); + WriteFile(api_file, s => s.AppendLine(JObject.FromObject(api).ToString(Formatting.Indented))); + } + foreach (var api in DynamicApis) + { + var outpath = api.OutputPath ?? DynamicApiFilesPath; + // generate dynamic apis + var partial = (api.PartialName == null ? "" : "." + api.PartialName); + var api_file = Path.Combine(outpath, $"{api.ClassName + partial}.gen.json"); + WriteFile(api_file, s => s.AppendLine(JObject.FromObject(api).ToString(Formatting.Indented))); + } + } + } +} diff --git a/src/CodeMinion.Core/CodeMinion.Core.csproj b/src/CodeMinion.Core/CodeMinion.Core.csproj new file mode 100644 index 0000000..0222f53 --- /dev/null +++ b/src/CodeMinion.Core/CodeMinion.Core.csproj @@ -0,0 +1,18 @@ + + + + netstandard2.0 + + + + + + + + + + C:\Users\henon\.nuget\packages\sliceanddice\1.0.0\lib\netstandard2.0\SliceAndDice.dll + + + + diff --git a/src/CodeMinion.Core/FunctionBodyTemplate.cs b/src/CodeMinion.Core/FunctionBodyTemplate.cs new file mode 100644 index 0000000..281adc6 --- /dev/null +++ b/src/CodeMinion.Core/FunctionBodyTemplate.cs @@ -0,0 +1,12 @@ +using System.Text; +using CodeMinion.Core.Helpers; +using CodeMinion.Core.Models; + +namespace CodeMinion.Core +{ + + public abstract class FunctionBodyTemplate + { + public abstract void GenerateBody(Function decl, CodeWriter s); + } +} diff --git a/src/CodeMinion.Core/Helpers/CodeWriter.cs b/src/CodeMinion.Core/Helpers/CodeWriter.cs new file mode 100644 index 0000000..fcd0a5f --- /dev/null +++ b/src/CodeMinion.Core/Helpers/CodeWriter.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Helpers +{ + public class CodeWriter + { + + public CodeWriter() { } + + public CodeWriter(StringBuilder s) + { + StringBuilder = s; + } + + public StringBuilder StringBuilder { get; set; } = new StringBuilder(); + public int IndentSpaces { get; set; } = 4; + private int _level = 0; + + /// + /// Write a line (with automatic indentation), line break is appended + /// + public void Out(string line, Action block=null) + { + if (_level > 0) + StringBuilder.Append(new String(' ', IndentSpaces * _level)); + StringBuilder.AppendLine(line); + if (block==null) + return; + Block(block); + } + + /// + /// Alias of Out + /// + public void AppendLine(string s="") + { + Out(s); + } + + /// + /// Insert an empty line + /// + public void Break() + { + Out(""); + } + + /// + /// Increase the level of indentation + /// + public void Indent() + { + _level++; + } + + /// + /// Decrease the level of indentation + /// + public void Outdent() + { + _level--; + } + + /// + /// Increase the level of indentation for the generator action, then outdent + /// + public void Indent(Action a) + { + _level++; + try + { + a(); + } + finally + { + _level--; + } + } + + /// + /// Generate an indented code block + /// + /// + /// + /// + public void Block(Action a, string opening_brace = "{", string closing_brace = "}") + { + Out(opening_brace); + Indent(a); + Out(closing_brace); + } + + public override string ToString() + { + return StringBuilder.ToString(); + } + } +} diff --git a/src/CodeMinion.Core/ICodeGenerator.cs b/src/CodeMinion.Core/ICodeGenerator.cs new file mode 100644 index 0000000..6907df6 --- /dev/null +++ b/src/CodeMinion.Core/ICodeGenerator.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Torch.ApiGenerator +{ + public interface ICodeGenerator + { + string Generate(); + } +} diff --git a/src/CodeMinion.Core/Models/Argument.cs b/src/CodeMinion.Core/Models/Argument.cs new file mode 100644 index 0000000..e2fade4 --- /dev/null +++ b/src/CodeMinion.Core/Models/Argument.cs @@ -0,0 +1,58 @@ +using Newtonsoft.Json.Linq; + +namespace CodeMinion.Core.Models +{ + public class Argument + { + public bool IsNullable { get; set; } + public bool IsValueType { get; set; } + public string Name { get; set; } + public string Type { get; set; } + public string DefaultValue { get; set; } + public bool IsNamedArg { get; set; } + public string Description { get; set; } + + /// + /// Before sending to Python convert to the given C# Type, only then convert to Python type + /// + public string ConvertToSharpType { get; set; } + + public int Position { get; set; } + public bool IsReturnValue { get; set; } + public string Tag { get; set; } + + /// + /// This default value is not a compile time constant, so it can not be used as a C# default value in + /// the function declaration. So if the parameter is passed as null it will be initialized with the given value. + /// + public string DefaultIfNull { get; set; } + + public bool PassOnlyIfNotNull { get; set; } + public bool Ignore { get; set; } + + public Argument Clone() + { + return JObject.FromObject(this).ToObject(); + } + + public void SetNullableOptional(string type, string @default = null) + { + Type = type; + IsNullable = true; + IsNamedArg = true; + DefaultValue = @default; + } + + public void SetType(string type, string @default=null) + { + Type = type; + DefaultValue = @default; + } + + public void MakeMandatory() + { + DefaultValue = null; + IsNullable = false; + } + } +} \ No newline at end of file diff --git a/src/CodeMinion.Core/Models/Declaration.cs b/src/CodeMinion.Core/Models/Declaration.cs new file mode 100644 index 0000000..7bf5e45 --- /dev/null +++ b/src/CodeMinion.Core/Models/Declaration.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; + +namespace CodeMinion.Core.Models +{ + public class Declaration + { + /// + /// Function name + /// + public string Name { get; set; } + + /// + /// Class name is the name of the containing API class (i.e. "numpy"). + /// If it is a nested class the class name contains all nesting levels (i.e. "numpy.core.records") + /// + public string ClassName { get; set; } + public string GeneratedClassName { get; set; } + + public List Returns { get; set; } = new List(); + public bool IsDeprecated { get; set; } + public bool ManualOverride { get; set; } + public bool CommentOut { get; set; } + public string SharpOnlyPostfix { get; set; } + + /// + /// Do not generate if true + /// + public bool Ignore { get; set; } + + /// + /// Break into the Debugger when generating this declaration + /// + public bool DebuggerBreak { get; set; } + + public string Description { get; set; } + + public virtual Declaration Clone() + { + return Clone(); + } + + public virtual T Clone() + { + return JObject.FromObject(this).ToObject(); + } + + public string Tag { get; set; } + + public virtual void Sanitize() + { + + } + } +} diff --git a/src/CodeMinion.Core/Models/DynamicApi.cs b/src/CodeMinion.Core/Models/DynamicApi.cs new file mode 100644 index 0000000..1beb052 --- /dev/null +++ b/src/CodeMinion.Core/Models/DynamicApi.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; +using CodeMinion.Core.Helpers; + +namespace CodeMinion.Core.Models +{ + /// + /// Represents the methods of a non-static class which should be generated. + /// + /// Note: the class itself is set up manually, this only generates more methods into that class. + /// To generate a full class from scratch use ApiClass + /// + public class DynamicApi : Api + { + /// + /// Class name is the name of a non-static class, i.e. NDArray + /// + public string ClassName { get; set; } + } + + /// + /// Represents a non-static class which should be generated. + /// + public class ApiClass : Api + { + public string DocString; + + /// + /// Class name is the name of a non-static class, i.e. NDArray + /// + public string ClassName { get; set; } + + /// + /// Do not generate this class + /// + public bool Ignore { get; set; } + + public string BaseClass { get; set; } = "PythonObject"; + + public List Constructors = new List(); + } +} diff --git a/src/CodeMinion.Core/Models/Function.cs b/src/CodeMinion.Core/Models/Function.cs new file mode 100644 index 0000000..8525999 --- /dev/null +++ b/src/CodeMinion.Core/Models/Function.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; + +namespace CodeMinion.Core.Models +{ + public class Function : Declaration + { + public List Arguments { get; set; } = new List(); + + 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 + /// + public string[] Generics { get; set; } = null; + + public virtual Function Clone(Action a) + { + var clone= Clone(); + a(clone); + return clone; + } + + public void ChangeArg(string name, string Type=null, string DefaultValue = null, bool? IsNullable = null) + { + var arg = Arguments.First(a => a.Name == name); + if (Type != null) arg.Type = Type; + if (DefaultValue != null) arg.DefaultValue = DefaultValue; + if (IsNullable != null) arg.IsNullable = IsNullable.Value; + } + + public override void Sanitize() + { + base.Sanitize(); + SanitizeArguments(); + } + + public void SanitizeArguments() + { + var all_named = false; + foreach (var arg in Arguments.ToArray()) + { + if (arg.Ignore) + Arguments.Remove(arg); + if (arg.DefaultValue != null || arg.IsNamedArg) + all_named = true; + if (all_named) + arg.IsNamedArg = true; + if (arg.Name == "self") + arg.Name = "self_"; + if (arg.DefaultValue == "null" && !arg.IsNullable) + { + switch (arg.Type) + { + case "int": + case "long": + case "float": + case "double": + case "bool": + arg.IsNullable = true; + break; + } + } + + if (arg.Type == "float" && !string.IsNullOrWhiteSpace(arg.DefaultValue) && + arg.DefaultValue.Contains('.') && !arg.DefaultValue.EndsWith("f")) + arg.DefaultValue += "f"; + if (arg.DefaultValue != null && arg.DefaultValue.StartsWith("\"")) + arg.Type = "string"; + } + if (Arguments.Count == 1) + { + var arg = Arguments[0]; + if (arg.Type != null && arg.Type.EndsWith("[]") && !arg.Type.StartsWith("params")) + { + arg.Type = "params " + arg.Type; + arg.IsNullable = false; + arg.DefaultValue = null; + } + } + } + + public Argument this[string name] => Arguments.FirstOrDefault(x => x.Name == name); + + public void MakeGeneric(string type_param) + { + Generics = new[] {type_param}; + } + + [JsonIgnore] + public string ReturnType + { + get { return Returns.FirstOrDefault()?.Type; } + set + { + if (Returns.Count > 0) + Returns[0].Type = value; + else + Returns.Add(new Argument() { Type = value }); + } + } + } +} \ No newline at end of file diff --git a/src/CodeMinion.Core/Models/Library/PyClass.cs b/src/CodeMinion.Core/Models/Library/PyClass.cs new file mode 100644 index 0000000..14a6d6d --- /dev/null +++ b/src/CodeMinion.Core/Models/Library/PyClass.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Models +{ + /// + /// Information about python class + /// + public class PyClass + { + public PyClass() + { + Parameters = new List(); + } + + /// + /// Gets or sets the name. + /// + /// + /// The name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the functions. + /// + /// + /// The functions. + /// + public PyFunction[] Functions { get; set; } + + /// + /// Gets or sets the document string. + /// + /// + /// The document string. + /// + public string DocStr { get; set; } + + /// + /// Gets or sets the arguments. + /// + /// + /// The arguments. + /// + public string[] Args { get; set; } + + /// + /// Gets or sets the defaults. + /// + /// + /// The defaults. + /// + public string[] Defaults { get; set; } + + /// + /// Gets or sets the parameters. + /// + /// + /// The parameters. + /// + public List Parameters { get; set; } + } +} diff --git a/src/CodeMinion.Core/Models/Library/PyFuncArg.cs b/src/CodeMinion.Core/Models/Library/PyFuncArg.cs new file mode 100644 index 0000000..53824c2 --- /dev/null +++ b/src/CodeMinion.Core/Models/Library/PyFuncArg.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Models +{ + /// + /// Function argument for the method + /// + public class PyFuncArg + { + /// + /// Gets or sets the name. + /// + /// + /// The name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the type of the data. + /// + /// + /// The type of the data. + /// + public string DataType { get; set; } + + /// + /// Gets or sets the enums. + /// + /// + /// The enums. + /// + public string[] Enums { get; set; } + + /// + /// Gets or sets a value indicating whether [have default]. + /// + /// + /// true if [have default]; otherwise, false. + /// + public bool HaveDefault { get; set; } + + /// + /// Gets or sets the default value. + /// + /// + /// The default value. + /// + public object DefaultValue { get; set; } + + /// + /// Gets or sets the argument comment. + /// + /// + /// The argument comment. + /// + public string ArgComment { get; set; } + } +} diff --git a/src/CodeMinion.Core/Models/Library/PyFunction.cs b/src/CodeMinion.Core/Models/Library/PyFunction.cs new file mode 100644 index 0000000..166fae0 --- /dev/null +++ b/src/CodeMinion.Core/Models/Library/PyFunction.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Models +{ + /// + /// Information about Python function + /// + public class PyFunction + { + /// + /// Initializes a new instance of the class. + /// + public PyFunction() + { + Parameters = new List(); + } + + /// + /// Gets or sets the name. + /// + /// + /// The name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the arguments. + /// + /// + /// The arguments. + /// + public string[] Args { get; set; } + + /// + /// Gets or sets the defaults. + /// + /// + /// The defaults. + /// + public string[] Defaults { get; set; } + + /// + /// Gets or sets the type of the return. + /// + /// + /// The type of the return. + /// + public string ReturnType { get; set; } + + /// + /// Gets or sets the return argument. + /// + /// + /// The return argument. + /// + public string ReturnArg { get; set; } + + /// + /// Gets or sets the document string. + /// + /// + /// The document string. + /// + public string DocStr { get; set; } + + public bool Deprecated { get; set; } + + /// + /// Gets or sets the parameters. + /// + /// + /// The parameters. + /// + public List Parameters { get; set; } + } +} diff --git a/src/CodeMinion.Core/Models/Library/PyLibrary.cs b/src/CodeMinion.Core/Models/Library/PyLibrary.cs new file mode 100644 index 0000000..93ae449 --- /dev/null +++ b/src/CodeMinion.Core/Models/Library/PyLibrary.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Models +{ + /// + /// Instance of the python libray with modules and function + /// + public class PyLibrary + { + /// + /// Gets or sets the modules. + /// + /// + /// The modules. + /// + public List Modules { get; set; } + + /// + /// Loads the json. + /// + /// The json. + /// + public static PyLibrary LoadJson(string json) + { + PyLibrary lib = new PyLibrary(); + lib.Modules = Newtonsoft.Json.JsonConvert.DeserializeObject>(json); + //lib.Modules.ForEach(x => { x.InferArg(); }); + return lib; + } + } +} diff --git a/src/CodeMinion.Core/Models/Library/PyModule.cs b/src/CodeMinion.Core/Models/Library/PyModule.cs new file mode 100644 index 0000000..4bb82e8 --- /dev/null +++ b/src/CodeMinion.Core/Models/Library/PyModule.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Linq; + +namespace CodeMinion.Core.Models +{ + /// + /// Python module information + /// + public class PyModule + { + /// + /// Gets or sets the name. + /// + /// + /// The name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the classes. + /// + /// + /// The classes. + /// + public PyClass[] Classes { get; set; } + + /// + /// Gets or sets the functions. + /// + /// + /// The functions. + /// + public PyFunction[] Functions { get; set; } + + /// + /// Gets or sets the document string. + /// + /// + /// The document string. + /// + public string DocStr { get; set; } + + /// + /// Infers the argument. + /// + public void InferArg() + { + for (int i = 0; i < Functions.Length; i++) + { + var func = Functions[i]; + if (func.Args == null) + continue; + GetArgs(func); + + } + + foreach (var item in Classes) + { + for (int i = 0; i < item.Functions.Length; i++) + { + var func = Functions[i]; + if (func.Args == null) + continue; + + GetArgs(func); + } + + if (item.Args == null) + continue; + + GetArgs(item); + } + } + + private static void GetArgs(PyFunction func) + { + for (int j = func.Args.Length - 1; j >= 0; j--) + { + if (func.Args[j] == "self") + continue; + + PyFuncArg parameter = new PyFuncArg() + { + Name = func.Args[j] + }; + + if (func.Defaults != null) + { + if (func.Defaults.Length > j) + { + parameter.HaveDefault = true; + parameter.DefaultValue = func.Defaults[j].Trim().Replace("'", ""); + parameter.DefaultValue = parameter.DefaultValue.ToString() == "None" ? "null" : parameter.DefaultValue; + } + } + + func.Parameters.Add(parameter); + } + } + + private static void GetArgs(PyClass cls) + { + for (int j = cls.Args.Length - 1; j >= 0; j--) + { + if (cls.Args[j] == "self") + continue; + + PyFuncArg parameter = new PyFuncArg() + { + Name = cls.Args[j] + }; + + if (cls.Defaults != null) + { + if (cls.Defaults.Length > j) + { + parameter.HaveDefault = true; + parameter.DefaultValue = cls.Defaults[j].Trim().Replace("'", ""); + parameter.DefaultValue = parameter.DefaultValue.ToString() == "None" ? "null" : parameter.DefaultValue; + } + } + + cls.Parameters.Add(parameter); + } + + } + } +} diff --git a/src/CodeMinion.Core/Models/Property.cs b/src/CodeMinion.Core/Models/Property.cs new file mode 100644 index 0000000..9848016 --- /dev/null +++ b/src/CodeMinion.Core/Models/Property.cs @@ -0,0 +1,28 @@ +namespace CodeMinion.Core.Models +{ + public class Property : Declaration + { + public bool HasSetter { get; set; } = true; + + // shortcut for the type of the first return value. + // For a property that returns a tuple use Returns instead + public string Type + { + get + { + if (Returns.Count == 0) + return null; + return Returns[0].Type; + } + set + { + if (Returns.Count == 0) + Returns.Add(new Argument(){Type = value}); + Returns[0].Type=value; + } + } + + public string DefaultValue { get; set; } + + } +} \ No newline at end of file diff --git a/src/CodeMinion.Core/Models/StaticApi.cs b/src/CodeMinion.Core/Models/StaticApi.cs new file mode 100644 index 0000000..9649b94 --- /dev/null +++ b/src/CodeMinion.Core/Models/StaticApi.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; +using CodeMinion.Core.Helpers; + +namespace CodeMinion.Core.Models +{ + public class Api + { + /// + /// API declarations + /// + public List Declarations { get; set; } = new List(); + + /// + /// Target directory for the generated files + /// + public string OutputPath { get; set; } + + /// + /// Additional name of a partial API file (required for splitting the API into multiple partial class files) + /// + public string PartialName { get; set; } + + public string SubDir { get; set; } + + } + + /// + /// Represents a static API class that should be generated + /// + public class StaticApi : Api + { + /// + /// Static name is the name of a static class that forwards to a singleton instance of the API implementation + /// + public string StaticName { get; set; } = "torch"; + + /// + /// The static class forwards to this Singleton instance which is the API implementation + /// + public string ImplName { get; set; } = "PyTorch"; + + /// + /// The python module this API represents + /// + public string PythonModule { get; set; } = "torch"; + + + /// + /// These are generated into the constructor of the API implementation object + /// + public List> InitializationGenerators { get; set; } = new List>(); + + } +} diff --git a/src/CodeMinion.Core/Models/TestCase.cs b/src/CodeMinion.Core/Models/TestCase.cs new file mode 100644 index 0000000..d0a25c5 --- /dev/null +++ b/src/CodeMinion.Core/Models/TestCase.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Models +{ + public class TestCase + { + /// + /// Name of the test function, if Null the test cases are numbered through + /// + public string Name { get; set; } + + public List TestParts { get; set; } = new List(); + + } + + public class TestPart { } + + public class Comment : TestPart + { + public string Text { get; set; } + } + public class ExampleCode : TestPart + { + public string Text { get; set; } + public List Lines = new List(); + } + + public class CodeLine + { + public string Type { get; set; } + public List Text { get; set; }= new List(); + } + +} diff --git a/src/CodeMinion.Core/Models/TestFile.cs b/src/CodeMinion.Core/Models/TestFile.cs new file mode 100644 index 0000000..bea72e8 --- /dev/null +++ b/src/CodeMinion.Core/Models/TestFile.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CodeMinion.Core.Models +{ + public class TestFile + { + /// + /// Name of the test file without extension + /// + public string Name { get; set; } + + /// + /// The tests in that test file + /// + public List TestCases { get; set; } = new List(); + + public string SubDir { get; set; } + } +} diff --git a/src/CodeMinion.DocsParser/CodeMinion.Parser.csproj b/src/CodeMinion.DocsParser/CodeMinion.Parser.csproj new file mode 100644 index 0000000..1f02fa4 --- /dev/null +++ b/src/CodeMinion.DocsParser/CodeMinion.Parser.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/src/CodeMinion.DocsParser/DocumentExtensions.cs b/src/CodeMinion.DocsParser/DocumentExtensions.cs new file mode 100644 index 0000000..35bd37b --- /dev/null +++ b/src/CodeMinion.DocsParser/DocumentExtensions.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using HtmlAgilityPack; + +namespace CodeMinion.Parser +{ + public static class HtmlNodeExtensions + { + public static IEnumerable DescendantsOfClass(this HtmlNode self, string tag, string @class) + { + return self.Descendants(tag).Where(x => x.Attributes["class"]?.Value == @class); + } + } +} diff --git a/src/CodeMinion.DocsParser/HtmlDoc.cs b/src/CodeMinion.DocsParser/HtmlDoc.cs new file mode 100644 index 0000000..6d13f73 --- /dev/null +++ b/src/CodeMinion.DocsParser/HtmlDoc.cs @@ -0,0 +1,12 @@ +using HtmlAgilityPack; + +namespace CodeMinion.Parser +{ + public class HtmlDoc + { + public string Filename { get; set; } + //public string Url { get; set; } + public string Text { get; set; } + public HtmlDocument Doc { get; set; } + } +} diff --git a/src/CodeMinion.DocsParser/HtmlDocuParser.cs b/src/CodeMinion.DocsParser/HtmlDocuParser.cs new file mode 100644 index 0000000..2c1963d --- /dev/null +++ b/src/CodeMinion.DocsParser/HtmlDocuParser.cs @@ -0,0 +1,8 @@ +using System; + +namespace CodeMinion.DocsParser +{ + public class HtmlDocuParser + { + } +} diff --git a/src/CodeMinion.DocsParser/RegexExtensions.cs b/src/CodeMinion.DocsParser/RegexExtensions.cs new file mode 100644 index 0000000..7d63385 --- /dev/null +++ b/src/CodeMinion.DocsParser/RegexExtensions.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +namespace CodeMinion +{ + public static class RegexExtensions + { + /// + /// Returns the first explicit group or null if no match + /// + /// For example: if the regex is "ab(cd)ef" it will return cd + /// if the regex is "ab(cd(ef))" it will return cdef + /// + /// + /// + public static string FirstGroupOrNull(this Match self) + { + if (!self.Success || self.Groups.Count < 2) + return null; + return self.Groups[1].Value; + } + } +} diff --git a/src/Examples/CustomInstallLocationExample/CustomInstallLocationExample.csproj b/src/Examples/CustomInstallLocationExample/CustomInstallLocationExample.csproj new file mode 100644 index 0000000..b4c3e88 --- /dev/null +++ b/src/Examples/CustomInstallLocationExample/CustomInstallLocationExample.csproj @@ -0,0 +1,23 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + + + + + + + + + + + diff --git a/src/Examples/CustomInstallLocationExample/Program.cs b/src/Examples/CustomInstallLocationExample/Program.cs new file mode 100644 index 0000000..8deff26 --- /dev/null +++ b/src/Examples/CustomInstallLocationExample/Program.cs @@ -0,0 +1,48 @@ +using System; +using System.IO; +using Numpy; + +namespace CustomInstallLocationExample +{ + class Program + { + static void Main(string[] args) + { + // ================================================ + // This example demonstrates how to install Python and Numpy from the assembly's resources + // (build action 'Embedded resource') into a custom location (here the local execution directory ".") + // and then use Numpy.Bare with that installation. + // ================================================ + + // set the installation source to be the embedded python zip from our resources + Python.Deployment.Installer.Source = new Python.Deployment.Installer.EmbeddedResourceInstallationSource() + { + Assembly = typeof(Program).Assembly, + ResourceName = "python-3.7.3-embed-amd64.zip", + }; + + // install in local directory. if you don't set it will install in local app data of your user account + Python.Deployment.Installer.InstallPath = Path.GetFullPath("."); + + // see what the installer is doing + Python.Deployment.Installer.LogMessage += Console.WriteLine; + + // install from the given source + Python.Deployment.Installer.SetupPython(force: false).Wait(); + + Python.Deployment.Installer.InstallWheel(typeof(Program).Assembly, + "numpy-1.16.3-cp37-cp37m-win_amd64.whl").Wait(); + + // if the installation is local, you don't even need to set the path + //Environment.SetEnvironmentVariable("PATH", Path.GetFullPath(@"./python-3.7.3-embed-amd64"), EnvironmentVariableTarget.Process); + + // Now use Numpy.Bare + var a = np.arange(10); + Console.WriteLine("a: "+ a.repr); + var b = np.arange(10)["::-1"]; + Console.WriteLine("b: " + b.repr); + var a_x_b = np.matmul(a, b); + Console.WriteLine("a x b: " + a_x_b.repr); + } + } +} diff --git a/src/Numpy/Resources/numpy-1.16.3-cp37-cp37m-win_amd64.whl b/src/Examples/CustomInstallLocationExample/numpy-1.16.3-cp37-cp37m-win_amd64.whl similarity index 100% rename from src/Numpy/Resources/numpy-1.16.3-cp37-cp37m-win_amd64.whl rename to src/Examples/CustomInstallLocationExample/numpy-1.16.3-cp37-cp37m-win_amd64.whl diff --git a/src/Examples/CustomInstallLocationExample/python-3.7.3-embed-amd64.zip b/src/Examples/CustomInstallLocationExample/python-3.7.3-embed-amd64.zip new file mode 100644 index 0000000..597fa58 Binary files /dev/null and b/src/Examples/CustomInstallLocationExample/python-3.7.3-embed-amd64.zip differ diff --git a/src/Examples/MatmulExample/MatmulExample.csproj b/src/Examples/MatmulExample/MatmulExample.csproj index 679266a..0e842bf 100644 --- a/src/Examples/MatmulExample/MatmulExample.csproj +++ b/src/Examples/MatmulExample/MatmulExample.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Examples/MatmulExample/Program.cs b/src/Examples/MatmulExample/Program.cs index b4c5561..202d92f 100644 --- a/src/Examples/MatmulExample/Program.cs +++ b/src/Examples/MatmulExample/Program.cs @@ -10,40 +10,40 @@ class Program { static void Main(string[] args) { -Console.WriteLine("Efficient matrix multiplication with NumPy:"); -// before starting the measurement, let us call numpy once to get the setup checks done. -var stopwatch = Stopwatch.StartNew(); -np.arange(1); + Console.WriteLine("Efficient matrix multiplication with NumPy:"); + // 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 a1 = np.arange(60000).reshape(300, 200); + var a2 = np.arange(80000).reshape(200, 400); -var result = np.matmul(a1, a2); -stopwatch.Stop(); + var result = np.matmul(a1, a2); + stopwatch.Stop(); -Console.WriteLine($"execution time with NumPy: {stopwatch.Elapsed.TotalMilliseconds}ms\n"); -Console.WriteLine("Result:\n" + result.repr); + Console.WriteLine($"execution time with NumPy: {stopwatch.Elapsed.TotalMilliseconds}ms\n"); + Console.WriteLine("Result:\n" + result.repr); -Console.WriteLine("executing on bg thread"); + Console.WriteLine("executing on bg thread"); -var a = np.arange(1000); -var b = np.arange(1000); + var a = np.arange(1000); + var b = np.arange(1000); -// https://github.com/pythonnet/pythonnet/issues/109 -PythonEngine.BeginAllowThreads(); + // https://github.com/pythonnet/pythonnet/issues/109 + PythonEngine.BeginAllowThreads(); -Task.Run(() => -{ - using (Py.GIL()) - { - np.matmul(a, b); - Console.WriteLine("matmul on bg thread is done"); - } -}).Wait(); -Console.WriteLine("Press key"); + Task.Run(() => + { + using (Py.GIL()) + { + np.matmul(a, b); + Console.WriteLine("matmul on bg thread is done"); + } + }).Wait(); + Console.WriteLine("Press key"); -Console.ReadKey(); + Console.ReadKey(); } } } diff --git a/src/Examples/NetCoreTest/NetCoreTest.csproj b/src/Examples/NetCoreTest/NetCoreTest.csproj new file mode 100644 index 0000000..dafc95d --- /dev/null +++ b/src/Examples/NetCoreTest/NetCoreTest.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.2 + + + + + + + diff --git a/src/Examples/NetCoreTest/Program.cs b/src/Examples/NetCoreTest/Program.cs new file mode 100644 index 0000000..1b55a03 --- /dev/null +++ b/src/Examples/NetCoreTest/Program.cs @@ -0,0 +1,18 @@ +using System; +using Numpy; + +namespace NetCoreTest +{ + class Program + { + static void Main(string[] args) + { + var m = np.array(new int[] { 1, 2, 3, 4 }) * 2; + Console.WriteLine(m.repr); + + Console.WriteLine(""); + Console.WriteLine("Press any key to exit.."); + Console.ReadKey(); + } + } +} diff --git a/src/Examples/NeuralNetworkExample/NeuralNetworkExample.csproj b/src/Examples/NeuralNetworkExample/NeuralNetworkExample.csproj new file mode 100644 index 0000000..48497fd --- /dev/null +++ b/src/Examples/NeuralNetworkExample/NeuralNetworkExample.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.2 + + + + + + + diff --git a/src/Examples/NeuralNetworkExample/Program.cs b/src/Examples/NeuralNetworkExample/Program.cs new file mode 100644 index 0000000..a07e4f8 --- /dev/null +++ b/src/Examples/NeuralNetworkExample/Program.cs @@ -0,0 +1,59 @@ +using System; +using System.Diagnostics; +using Numpy; + +namespace NeuralNetworkExample +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Fitting random data with a two layer Neural Network ..."); + // N is batch size; D_in is input dimension; + // H is hidden dimension; D_out is output dimension. + var (N, D_in, H, D_out) = (64, 1000, 100, 10); + + // Create random input and output data + Console.WriteLine("\tcreating random data"); + var x = np.random.randn(N, D_in); + var y = np.random.randn(N, D_out); + + Console.WriteLine("\tlearning"); + var stopwatch = Stopwatch.StartNew(); + // Randomly initialize weights + var w1 = np.random.randn(D_in, H); + var w2 = np.random.randn(H, D_out); + + var learning_rate = 1.0e-6; + double loss=double.MaxValue; + for (int t = 0; t < 500; t++) + { + // Forward pass: compute predicted y + var h = x.dot(w1); + var h_relu = np.maximum(h, (NDarray)0); + var y_pred = h_relu.dot(w2); + + // Compute and print loss + loss = (double)(np.square(y_pred - y).sum()); + if (t%20==0) + Console.WriteLine($"\tstep: {t} loss: {loss}"); + + // Backprop to compute gradients of w1 and w2 with respect to loss + var grad_y_pred = 2.0 * (y_pred - y); + var grad_w2 = h_relu.T.dot(grad_y_pred); + var grad_h_relu = grad_y_pred.dot(w2.T); + var grad_h = grad_h_relu.copy(); + grad_h[h < 0] = (NDarray)0; + var grad_w1 = x.T.dot(grad_h); + + // Update weights + w1.isub( learning_rate * grad_w1); // inplace substraction is faster than -= + w2.isub( learning_rate * grad_w2); + } + stopwatch.Stop(); + Console.WriteLine($"\tstep: 500, final loss: {loss}, elapsed time: {stopwatch.Elapsed.TotalSeconds:F3} seconds\n"); + Console.WriteLine("Hit any key to exit."); + Console.ReadKey(); + } + } +} diff --git a/src/Examples/NeuralNetworkExample/numpy_nn.py b/src/Examples/NeuralNetworkExample/numpy_nn.py new file mode 100644 index 0000000..cd39c56 --- /dev/null +++ b/src/Examples/NeuralNetworkExample/numpy_nn.py @@ -0,0 +1,35 @@ +# N is batch size; D_in is input dimension; +# H is hidden dimension; D_out is output dimension. +N, D_in, H, D_out = 64, 1000, 100, 10 + +# Create random input and output data +x = np.random.randn(N, D_in) +y = np.random.randn(N, D_out) + +# Randomly initialize weights +w1 = np.random.randn(D_in, H) +w2 = np.random.randn(H, D_out) + +learning_rate = 1e-6 +for t in range(500): + + # Forward pass: compute predicted y + h = x.dot(w1) + h_relu = np.maximum(h, 0) + y_pred = h_relu.dot(w2) + + # Compute and print loss + loss = np.square(y_pred - y).sum() + print(t, loss) + + # Backprop to compute gradients of w1 and w2 with respect to loss + grad_y_pred = 2.0 * (y_pred - y) + grad_w2 = h_relu.T.dot(grad_y_pred) + grad_h_relu = grad_y_pred.dot(w2.T) + grad_h = grad_h_relu.copy() + grad_h[h < 0] = 0 + grad_w1 = x.T.dot(grad_h) + + # Update weights + w1 -= learning_rate * grad_w1 + w2 -= learning_rate * grad_w2 \ No newline at end of file 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/Examples/WebApiExample/Controllers/ValuesController.cs b/src/Examples/WebApiExample/Controllers/ValuesController.cs new file mode 100644 index 0000000..4424d58 --- /dev/null +++ b/src/Examples/WebApiExample/Controllers/ValuesController.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Numpy; +using Python.Runtime; + +namespace WebApiExample.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class ValuesController : ControllerBase + { + // GET api/values + [HttpGet] + public ActionResult Get() + { + using (Py.GIL()) { + var array = new float[2, 2] {{DateTime.Now.Minute, DateTime.Now.Second}, {DateTime.Now.Millisecond, (float)Math.PI}}; + var ndArray = new NDarray(array); + //return ndArray.ToString(); + return ndArray.repr; + } + } + + // GET api/values/5 + [HttpGet("{id}")] + public ActionResult Get(int id) + { + using (Py.GIL()) + { + var array = new float[2, 2] { { DateTime.Now.Minute, DateTime.Now.Second }, { DateTime.Now.Millisecond, (float)Math.PI } }; + var ndArray = new NDarray(array); + //return ndArray.ToString(); + return ndArray.repr; + } + } + + //// POST api/values + //[HttpPost] + //public void Post([FromBody] string value) + //{ + //} + + //// PUT api/values/5 + //[HttpPut("{id}")] + //public void Put(int id, [FromBody] string value) + //{ + //} + + //// DELETE api/values/5 + //[HttpDelete("{id}")] + //public void Delete(int id) + //{ + //} + } +} diff --git a/src/Examples/WebApiExample/Program.cs b/src/Examples/WebApiExample/Program.cs new file mode 100644 index 0000000..05a3a9c --- /dev/null +++ b/src/Examples/WebApiExample/Program.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Numpy; + +namespace WebApiExample +{ + public class Program + { + public static void Main(string[] args) + { + // this call initializes numpy. it is necessary to do that before PythonEngine.BeginAllowThreads() + np.arange(1); + Python.Runtime.PythonEngine.BeginAllowThreads(); // <--- this is very important for a web server since all requests are on different threads + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/src/Examples/WebApiExample/Startup.cs b/src/Examples/WebApiExample/Startup.cs new file mode 100644 index 0000000..8cd981c --- /dev/null +++ b/src/Examples/WebApiExample/Startup.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; + +namespace WebApiExample +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseMvc(); + } + } +} diff --git a/src/Examples/WebApiExample/WebApiExample_netcore2.2.csproj b/src/Examples/WebApiExample/WebApiExample_netcore2.2.csproj new file mode 100644 index 0000000..d777645 --- /dev/null +++ b/src/Examples/WebApiExample/WebApiExample_netcore2.2.csproj @@ -0,0 +1,21 @@ + + + + netcoreapp2.2 + InProcess + + + + x64 + + + + + + + + + + + + diff --git a/src/Examples/WebApiExample/appsettings.Development.json b/src/Examples/WebApiExample/appsettings.Development.json new file mode 100644 index 0000000..a2880cb --- /dev/null +++ b/src/Examples/WebApiExample/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/Examples/WebApiExample/appsettings.json b/src/Examples/WebApiExample/appsettings.json new file mode 100644 index 0000000..7376aad --- /dev/null +++ b/src/Examples/WebApiExample/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/Examples/WebApiExample_netcore3.1/Controllers/ValuesController.cs b/src/Examples/WebApiExample_netcore3.1/Controllers/ValuesController.cs new file mode 100644 index 0000000..4424d58 --- /dev/null +++ b/src/Examples/WebApiExample_netcore3.1/Controllers/ValuesController.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Numpy; +using Python.Runtime; + +namespace WebApiExample.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class ValuesController : ControllerBase + { + // GET api/values + [HttpGet] + public ActionResult Get() + { + using (Py.GIL()) { + var array = new float[2, 2] {{DateTime.Now.Minute, DateTime.Now.Second}, {DateTime.Now.Millisecond, (float)Math.PI}}; + var ndArray = new NDarray(array); + //return ndArray.ToString(); + return ndArray.repr; + } + } + + // GET api/values/5 + [HttpGet("{id}")] + public ActionResult Get(int id) + { + using (Py.GIL()) + { + var array = new float[2, 2] { { DateTime.Now.Minute, DateTime.Now.Second }, { DateTime.Now.Millisecond, (float)Math.PI } }; + var ndArray = new NDarray(array); + //return ndArray.ToString(); + return ndArray.repr; + } + } + + //// POST api/values + //[HttpPost] + //public void Post([FromBody] string value) + //{ + //} + + //// PUT api/values/5 + //[HttpPut("{id}")] + //public void Put(int id, [FromBody] string value) + //{ + //} + + //// DELETE api/values/5 + //[HttpDelete("{id}")] + //public void Delete(int id) + //{ + //} + } +} diff --git a/src/Examples/WebApiExample_netcore3.1/Program.cs b/src/Examples/WebApiExample_netcore3.1/Program.cs new file mode 100644 index 0000000..94645aa --- /dev/null +++ b/src/Examples/WebApiExample_netcore3.1/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Numpy; +using Python.Runtime; + +namespace WebApiExample_netcore3._1 +{ + public class Program + { + public static void Main(string[] args) + { + // this call initializes numpy. it is necessary to do that before PythonEngine.BeginAllowThreads() + np.arange(1); + PythonEngine.BeginAllowThreads(); // <--- this is very important for a web server since all requests are on different threads + + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/src/Examples/WebApiExample_netcore3.1/Startup.cs b/src/Examples/WebApiExample_netcore3.1/Startup.cs new file mode 100644 index 0000000..3891c6a --- /dev/null +++ b/src/Examples/WebApiExample_netcore3.1/Startup.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace WebApiExample_netcore3._1 +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddControllers(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/src/Examples/WebApiExample_netcore3.1/WebApiExample_netcore3.1.csproj b/src/Examples/WebApiExample_netcore3.1/WebApiExample_netcore3.1.csproj new file mode 100644 index 0000000..1d690d8 --- /dev/null +++ b/src/Examples/WebApiExample_netcore3.1/WebApiExample_netcore3.1.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp3.1 + WebApiExample_netcore3._1 + + + + + + + + diff --git a/src/Examples/WebApiExample_netcore3.1/appsettings.Development.json b/src/Examples/WebApiExample_netcore3.1/appsettings.Development.json new file mode 100644 index 0000000..dba68eb --- /dev/null +++ b/src/Examples/WebApiExample_netcore3.1/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/src/Examples/WebApiExample_netcore3.1/appsettings.json b/src/Examples/WebApiExample_netcore3.1/appsettings.json new file mode 100644 index 0000000..81ff877 --- /dev/null +++ b/src/Examples/WebApiExample_netcore3.1/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj b/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj new file mode 100644 index 0000000..3146206 --- /dev/null +++ b/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj @@ -0,0 +1,218 @@ + + + + + Debug + AnyCPU + {8E1BD94E-6AE4-46D9-B0BA-6AC0515AF0D0} + Library + Properties + Numpy.Bare.Dotnet + Numpy.Bare.Dotnet + v4.5 + 512 + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\pythonnet_py37_win.2.5.1\lib\net40\Python.Runtime.dll + + + + + + ..\..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll + + + + + + + + + + + Manual\ctypes.module.cs + + + Manual\np.aliases.cs + + + Manual\np.array.cs + + + Manual\np.column_stack.cs + + + Manual\np.concatenate.cs + + + Manual\np.constants.cs + + + 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 + + + Manual\np.random.cs + + + Manual\np.resize.cs + + + Manual\np.save.cs + + + Models\Axis.cs + + + Models\Constants.cs + + + Models\Dtype.cs + + + Models\Flags.cs + + + Models\Matrix.cs + + + Models\MemMapMode.cs + + + Models\NDarray.aliases.cs + + + Models\NDarray.CastOperators.cs + + + Models\NDarray.cs + + + Models\NDarray.gen.cs + + + Models\NDarray.Operators.cs + + + Models\PythonObject.cs + + + Models\PythonObject.gen.cs + + + Models\Shape.cs + + + Models\Slice.cs + + + np.array_creation.gen.cs + + + np.array_manipulation.gen.cs + + + np.bitwise.gen.cs + + + np.datetime.gen.cs + + + np.dtype.gen.cs + + + np.dtype.routines.gen.cs + + + np.fft.gen.cs + + + np.financial.gen.cs + + + np.indexing.gen.cs + + + np.io.gen.cs + + + np.linalg.gen.cs + + + np.linalg_fft.gen.cs + + + np.logic.gen.cs + + + np.math.gen.cs + + + np.module.gen.cs + + + np.padding.gen.cs + + + np.random.gen.cs + + + np.set.gen.cs + + + np.sorting.gen.cs + + + np.staticstics.gen.cs + + + np.string.gen.cs + + + np.window.gen.cs + + + + + + + + + \ No newline at end of file diff --git a/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.nuspec b/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.nuspec new file mode 100644 index 0000000..983b52d --- /dev/null +++ b/src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.nuspec @@ -0,0 +1,18 @@ + + + + Numpy.Bare.Dotnet + 3.7.1.14 + Numpy.Bare.Dotnet + Meinrad Recheis (SciSharp) + Meinrad Recheis + https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE + https://github.com/SciSharp/Numpy.NET + https://api.nuget.org/v3-flatcontainer/numpy.bare/3.7.1.14/icon + false + C# bindings for NumPy on Win64 - a fundamental library for scientific computing, machine learning and AI. Does require Python 3.7 with NumPy 1.16 installed! + This one is compiled against .NET Framework 4.0 + Copyright 2019-2020 Meinrad Recheis (SciSharp) + Data science Machine Learning AI Scientific Computing NumPy Linear Algebra FFT SVD Matrix Python + + \ No newline at end of file diff --git a/src/Numpy.Bare.Dotnet/Properties/AssemblyInfo.cs b/src/Numpy.Bare.Dotnet/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9cccc05 --- /dev/null +++ b/src/Numpy.Bare.Dotnet/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Numpy.Bare.Dotnet")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Numpy.Bare.Dotnet")] +[assembly: AssemblyCopyright("Copyright © 2020 Meinrad Recheis (SciSharp)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8e1bd94e-6ae4-46d9-b0ba-6ac0515af0d0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("3.7.1.14")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Numpy.Bare.Dotnet/packages.config b/src/Numpy.Bare.Dotnet/packages.config new file mode 100644 index 0000000..f5b2dbc --- /dev/null +++ b/src/Numpy.Bare.Dotnet/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Numpy.Bare/Manual/NumPy.array.cs b/src/Numpy.Bare/Manual/NumPy.array.cs deleted file mode 100644 index 159ce6c..0000000 --- a/src/Numpy.Bare/Manual/NumPy.array.cs +++ /dev/null @@ -1,147 +0,0 @@ -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 partial class NumPy - { - - public NDarray array(NDarray @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var args = ToTuple(new object[] - { - @object, - }); - var kwargs = new PyDict(); - if (dtype != null) kwargs["dtype"] = ToPython(dtype); - if (copy != null) kwargs["copy"] = ToPython(copy); - if (order != null) kwargs["order"] = ToPython(order); - if (subok != null) kwargs["subok"] = ToPython(subok); - if (ndmin != null) kwargs["ndmin"] = ToPython(ndmin); - dynamic py = self.InvokeMethod("array", args, kwargs); - return ToCsharp(py); - } - - public NDarray array(T[] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var type = @object.GetDtype(); - //if (dtype != null && !type.Equals( dtype)) - // throw new NotImplementedException("Type of the array is different from specified dtype. Data conversion is not supported (yet)"); - var ndarray = this.empty(new Shape(@object.Length), dtype: dtype??type, order:order); // todo: check out the other parameters - long ptr = ndarray.PyObject.ctypes.data; - switch ((object)@object) - { - case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; - 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 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: - var bytes = a.Select(x => (byte)(x ? 1 : 0)).ToArray(); - Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); - break; - } - return new NDarray(ndarray); - } - - public NDarray array(T[,] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var d1_array = @object.Cast().ToArray(); - var type = d1_array.GetDtype(); - //if (dtype != null && type != dtype) - // throw new NotImplementedException("Type of the array is different from specified dtype. Data conversion is not supported (yet)"); - var ndarray = this.empty(new Shape(@object.GetLength(0), @object.GetLength(1)), dtype: dtype??type, order: order); // todo: check out the other parameters - long ptr = ndarray.PyObject.ctypes.data; - switch ((object)d1_array) - { - case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; - 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 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: - var bytes = a.Select(x => (byte) (x ? 1 : 0)).ToArray(); - Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); - break; - } - return new NDarray(ndarray); - } - - public NDarray array(T[,,] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var d1_array = @object.Cast().ToArray(); - var type = d1_array.GetDtype(); - //if (dtype != null && type != dtype) - // throw new NotImplementedException("Type of the array is different from specified dtype. Data conversion is not supported (yet)"); - var ndarray = this.empty(new Shape(@object.GetLength(0), @object.GetLength(1), @object.GetLength(2)), dtype: dtype ?? type, order: order); // todo: check out the other parameters - long ptr = ndarray.PyObject.ctypes.data; - switch ((object)d1_array) - { - case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; - 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 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: - var bytes = a.Select(x => (byte)(x ? 1 : 0)).ToArray(); - Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); - break; - } - return new NDarray(ndarray); - } - - public NDarray array(string[] obj, int? itemsize = null, bool? copy = null, bool? unicode = null, string order = null) - { - var args = ToTuple(obj); - var kwargs = new PyDict(); - if (itemsize != null) kwargs["itemsize"] = ToPython(itemsize); - if (copy != null) kwargs["copy"] = ToPython(copy); - if (unicode != null) kwargs["unicode"] = ToPython(unicode); - if (order != null) kwargs["order"] = ToPython(order); - dynamic py = self.InvokeMethod("array", args, kwargs); - return ToCsharp(py); - } - - /// - /// Create a 0d array from scalar - /// - /// - /// - /// - public NDarray asarray(ValueType scalar, Dtype dtype = null) - { - var __self__ = self; - var pyargs = ToTuple(new object[] - { - scalar, - }); - var kwargs = new PyDict(); - if (dtype != null) kwargs["dtype"] = ToPython(dtype); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert an array of size 1 to its scalar equivalent. - /// - /// - /// Scalar representation of a. The output data type is the same type - /// returned by the input’s item method. - /// - public T asscalar(NDarray a) => self.InvokeMethod("asscalar", a.PyObject).As(); - - - } -} diff --git a/src/Numpy.Bare/Manual/NumPy.linalg.norm.cs b/src/Numpy.Bare/Manual/NumPy.linalg.norm.cs deleted file mode 100644 index 75c0d7d..0000000 --- a/src/Numpy.Bare/Manual/NumPy.linalg.norm.cs +++ /dev/null @@ -1,108 +0,0 @@ -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 partial class NumPy - { - - /// - /// Matrix or vector norm. - /// - /// This function is able to return one of eight different matrix norms, - /// or one of an infinite number of vector norms (described below), depending - /// on the value of the ord parameter. - /// - /// Notes - /// - /// For values of ord <= 0, the result is, strictly speaking, not a - /// mathematical ‘norm’, but it may still be useful for various numerical - /// purposes. - /// - /// The following norms can be calculated: - /// - /// The Frobenius norm is given by [1]: - /// - /// The nuclear norm is the sum of the singular values. - /// - /// References - /// - /// - /// Input array. If axis is None, x must be 1-D or 2-D. - /// - /// - /// Order of the norm (see table under Notes). inf means numpy’s - /// inf object. - /// - /// - /// If axis is an integer, it specifies the axis of x along which to - /// compute the vector norms. If axis is a 2-tuple, it specifies the - /// axes that hold 2-D matrices, and the matrix norms of these matrices - /// are computed. If axis is None then either a vector norm (when x - /// is 1-D) or a matrix norm (when x is 2-D) is returned. - /// - /// - /// If this is set to True, the axes which are normed over are left in the - /// result as dimensions with size one. With this option the result will - /// broadcast correctly against the original x. - /// - /// - /// Norm of the matrix or vector(s). - /// - public NDarray norm(NDarray x, int? ord = null, int[] axis = null, bool? keepdims = null) - { - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ToPython(ord); - if (axis != null) kwargs["axis"] = ToPython(axis); - if (keepdims != null) kwargs["keepdims"] = ToPython(keepdims); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - return ToCsharp (py); - } - - public float norm(NDarray x, int? ord = null) - { - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ToPython(ord); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - - return ToCsharp(py); - } - - public float norm(NDarray x, string ord) - { - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ToPython(ord); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - return ToCsharp(py); - } - - public float norm(NDarray x, Constants ord) - { - if (ord!=Constants.inf && ord!=Constants.neg_inf) - throw new ArgumentException("ord must be either inf or neg_inf"); - - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ord==Constants.inf ? self.inf : -(self.inf); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/Manual/NumPy.reshape.cs b/src/Numpy.Bare/Manual/NumPy.reshape.cs deleted file mode 100644 index dc4a659..0000000 --- a/src/Numpy.Bare/Manual/NumPy.reshape.cs +++ /dev/null @@ -1,52 +0,0 @@ -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 - { - /// - /// 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 array to reshape - /// - /// 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. - /// - /// - /// 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 static NDarray reshape(NDarray a, params int[] newshape) - { - return NumPy.Instance.reshape(a, new Shape(newshape)); - } - } -} diff --git a/src/Numpy.Bare/Manual/NumPy.resize.cs b/src/Numpy.Bare/Manual/NumPy.resize.cs deleted file mode 100644 index 1a770eb..0000000 --- a/src/Numpy.Bare/Manual/NumPy.resize.cs +++ /dev/null @@ -1,59 +0,0 @@ -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 partial class NumPy - { - - /// - /// Return a new array with the specified shape. - /// - /// If the new array is larger than the original array, then the new - /// array is filled with repeated copies of a. Note that this behavior - /// is different from a.resize(new_shape) which fills with zeros instead - /// of repeated copies of a. - /// - /// Notes - /// - /// Warning: This functionality does not consider axes separately, - /// i.e. it does not apply interpolation/extrapolation. - /// It fills the return array with the required number of elements, taken - /// from a as they are laid out in memory, disregarding strides and axes. - /// (This is in case the new shape is smaller. For larger, see above.) - /// This functionality is therefore not suitable to resize images, - /// or data where each axis represents a separate and distinct entity. - /// - /// - /// Array to be resized. - /// - /// - /// Shape of resized array. - /// - /// - /// The new array is formed from the data in the old array, repeated - /// if necessary to fill out the required number of elements. The - /// data are repeated in the order that they are stored in memory. - /// - public NDarray resize(NDarray a, Shape new_shape) - { - var pyargs = ToTuple(new object[] - { - a, - new_shape, - }); - dynamic py = self.InvokeMethod("resize", pyargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/Manual/np.aliases.cs b/src/Numpy.Bare/Manual/np.aliases.cs deleted file mode 100644 index a039cab..0000000 --- a/src/Numpy.Bare/Manual/np.aliases.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Calculate the absolute value element-wise. - /// - /// np.abs is a shorthand for this function. - /// - /// - /// Input 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. - /// - /// - /// 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 static NDarray abs(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.absolute(x, @out, @where); - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public static NDarray min(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amin(a, axis: axis, @out: @out, keepdims: keepdims, initial: initial); - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public static NDarray max(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amax(a, axis: axis, @out: @out, keepdims: keepdims, initial: initial); - - } -} diff --git a/src/Numpy.Bare/Manual/np.array.cs b/src/Numpy.Bare/Manual/np.array.cs deleted file mode 100644 index b76b8e8..0000000 --- a/src/Numpy.Bare/Manual/np.array.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Create an array. - /// - /// - /// The array to initialize the ndarray with - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(params T[] data) - { - return NumPy.Instance.array(data); - } - - public static NDarray array(T[,,] data, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - return NumPy.Instance.array(data, dtype, copy, order, subok, ndmin); - } - - public static NDarray asarray(ValueType a, Dtype dtype = null) - => NumPy.Instance.asarray(a, dtype: dtype); - - /// - /// Convert an array of size 1 to its scalar equivalent. - /// - /// - /// 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) => NumPy.Instance.asscalar(a); - - } -} diff --git a/src/Numpy.Bare/Manual/np.constants.cs b/src/Numpy.Bare/Manual/np.constants.cs deleted file mode 100644 index 403dc7f..0000000 --- a/src/Numpy.Bare/Manual/np.constants.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy -{ - public static partial class np - { - /// - /// IEEE 754 floating point representation of (positive) infinity. - /// - public static float inf => NumPy.Instance.self.GetAttr("inf").As(); - - /// - /// IEEE 754 floating point representation of (positive) infinity. - /// - /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. - /// - public static float Inf => NumPy.Instance.self.GetAttr("inf").As(); - - /// - /// IEEE 754 floating point representation of (positive) infinity. - /// - /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. - /// - public static float Infinity => NumPy.Instance.self.GetAttr("inf").As(); - - /// - /// IEEE 754 floating point representation of (positive) infinity. - /// - /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. - /// - public static float PINF => NumPy.Instance.self.GetAttr("inf").As(); - - /// - /// IEEE 754 floating point representation of (positive) infinity. - /// - /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. - /// - public static float infty => NumPy.Instance.self.GetAttr("inf").As(); - - /// - /// IEEE 754 floating point representation of (positive) infinity. - /// - public static float NINF => NumPy.Instance.self.GetAttr("NINF").As(); - - /// - /// IEEE 754 floating point representation of Not a Number(NaN). - /// - public static float nan => NumPy.Instance.self.GetAttr("nan").As(); - - /// - /// IEEE 754 floating point representation of Not a Number(NaN). - /// - /// NaN and NAN are equivalent definitions of nan.Please use nan instead of NAN. - /// - public static float NaN => NumPy.Instance.self.GetAttr("nan").As(); - - /// - /// IEEE 754 floating point representation of Not a Number(NaN). - /// - /// NaN and NAN are equivalent definitions of nan.Please use nan instead of NAN. - /// - public static float NAN => NumPy.Instance.self.GetAttr("nan").As(); - - /// - /// IEEE 754 floating point representation of negative zero. - /// - public static float NZERO => NumPy.Instance.self.GetAttr("NZERO").As(); - - /// - /// IEEE 754 floating point representation of positive zero. - /// - public static float PZERO => NumPy.Instance.self.GetAttr("PZERO").As(); - - /// - /// Euler’s constant, base of natural logarithms, Napier’s constant. - /// - public static float e => NumPy.Instance.self.GetAttr("e").As(); - - /// - /// γ = 0.5772156649015328606065120900824024310421... - /// https://en.wikipedia.org/wiki/Euler-Mascheroni_constant - /// - public static float euler_gamma => NumPy.Instance.self.GetAttr("e").As(); - - /// - /// A convenient alias for None, useful for indexing arrays. - /// - public static object newaxis => NumPy.Instance.self.GetAttr("newaxis"); - - /// - /// pi = 3.1415926535897932384626433... - /// - public static float pi => NumPy.Instance.self.GetAttr("pi").As(); - - } -} diff --git a/src/Numpy.Bare/Manual/np.empty.cs b/src/Numpy.Bare/Manual/np.empty.cs deleted file mode 100644 index efcb9e9..0000000 --- a/src/Numpy.Bare/Manual/np.empty.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Create an array. - /// - /// - /// The shape of the empty ndarray - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray empty(params int[] shape) - { - return NumPy.Instance.empty(new Shape(shape)); - } - } -} diff --git a/src/Numpy.Bare/Manual/np.linalg.norm.cs b/src/Numpy.Bare/Manual/np.linalg.norm.cs deleted file mode 100644 index 77b43ea..0000000 --- a/src/Numpy.Bare/Manual/np.linalg.norm.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - public static partial class linalg - { - /// - /// Matrix or vector norm. - /// - /// This function is able to return one of eight different matrix norms, - /// or one of an infinite number of vector norms (described below), depending - /// on the value of the ord parameter. - /// - /// Notes - /// - /// For values of ord <= 0, the result is, strictly speaking, not a - /// mathematical ‘norm’, but it may still be useful for various numerical - /// purposes. - /// - /// The following norms can be calculated: - /// - /// The Frobenius norm is given by [1]: - /// - /// The nuclear norm is the sum of the singular values. - /// - /// References - /// - /// - /// Input array. If axis is None, x must be 1-D or 2-D. - /// - /// - /// Order of the norm (see table under Notes). inf means numpy’s - /// inf object. - /// - /// - /// If axis is an integer, it specifies the axis of x along which to - /// compute the vector norms. If axis is a 2-tuple, it specifies the - /// axes that hold 2-D matrices, and the matrix norms of these matrices - /// are computed. If axis is None then either a vector norm (when x - /// is 1-D) or a matrix norm (when x is 2-D) is returned. - /// - /// - /// If this is set to True, the axes which are normed over are left in the - /// result as dimensions with size one. With this option the result will - /// broadcast correctly against the original x. - /// - /// - /// Norm of the matrix or vector(s). - /// - public static NDarray norm(NDarray x, int? ord, int[] axis, bool? keepdims = null) - => NumPy.Instance.norm(x, ord, axis, keepdims); - - public static float norm(NDarray x, int? ord=null) - => NumPy.Instance.norm(x, ord); - - public static float norm(NDarray x, string ord) - => NumPy.Instance.norm(x, ord); - - public static float norm(NDarray x, Constants ord) - => NumPy.Instance.norm(x, ord); - } - } -} diff --git a/src/Numpy.Bare/Manual/np.ones.cs b/src/Numpy.Bare/Manual/np.ones.cs deleted file mode 100644 index 6072b2c..0000000 --- a/src/Numpy.Bare/Manual/np.ones.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Return a new array of given shape and type, filled with ones. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of ones with the given shape, dtype, and order. - /// - public static NDarray ones(params int[] shape) - { - return NumPy.Instance.ones(new Shape(shape)); - } - } -} diff --git a/src/Numpy.Bare/Manual/np.zeros.cs b/src/Numpy.Bare/Manual/np.zeros.cs deleted file mode 100644 index cd359b2..0000000 --- a/src/Numpy.Bare/Manual/np.zeros.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Return a new array of given shape and type, filled with zeros. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of zeros with the given shape, dtype, and order. - /// - public static NDarray zeros(params int[] shape) - => NumPy.Instance.zeros(new Shape(shape)); - } -} diff --git a/src/Numpy.Bare/Models/Constants.cs b/src/Numpy.Bare/Models/Constants.cs deleted file mode 100644 index 6e325ec..0000000 --- a/src/Numpy.Bare/Models/Constants.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Numpy.Models -{ - public enum Constants - { - inf, neg_inf - } -} diff --git a/src/Numpy.Bare/Models/Dtype.cs b/src/Numpy.Bare/Models/Dtype.cs deleted file mode 100644 index 5d38921..0000000 --- a/src/Numpy.Bare/Models/Dtype.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy -{ - - public partial class Dtype : PythonObject - { - public Dtype(PyObject pyobj) : base(pyobj) - { - } - - public Dtype(Dtype t) : base((PyObject)t.PyObject) - { - } - - } - - - public static class DtypeExtensions - { - public static Dtype GetDtype(this object obj) - { - switch (obj) - { - case bool o: return np.bool8; - case sbyte o: return np.int8; - case byte o: return np.uint8; - case short o: return np.int16; - case ushort o: return np.uint16; - case int o: return np.int32; - case uint o: return np.uint32; - case long o: return np.int64; - case ulong o: return np.uint64; - case float o: return np.float32; - case double o: return np.float64; - case bool[] o: return np.bool8; - case byte[] o: return np.@byte; - case short[] o: return np.int16; - case int[] o: return np.int32; - case long[] o: return np.int64; - case float[] o: return np.float32; - case double[] o: return np.float64; - case bool[,] o: return np.bool8; - case byte[,] o: return np.uint8; - case short[,] o: return np.int16; - case int[,] o: return np.int32; - case long[,] o: return np.int64; - case float[,] o: return np.float32; - case double[,] o: return np.float64; - case bool[,,] o: return np.bool8; - case byte[,,] o: return np.uint8; - case short[,,] o: return np.int16; - case int[,,] o: return np.int32; - case long[,,] o: return np.int64; - case float[,,] o: return np.float32; - case double[,,] o: return np.float64; - default: throw new ArgumentException("Can not convert type of given object to dtype: " + obj.GetType()); - } - } - - //public static dtype ToDtype(this Type t) - //{ - // if (t == typeof(byte)) return dtype.UInt8; - // if (t == typeof(short)) return dtype.Int16; - // if (t == typeof(int)) return dtype.Int32; - // if (t == typeof(long)) return dtype.Int64; - // if (t == typeof(float)) return dtype.Float32; - // if (t == typeof(double)) return dtype.Float64; - // throw new ArgumentException("Can not convert given type to dtype: " + t); - //} - } -} diff --git a/src/Numpy.Bare/Models/Flags.cs b/src/Numpy.Bare/Models/Flags.cs deleted file mode 100644 index 161c987..0000000 --- a/src/Numpy.Bare/Models/Flags.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy.Models -{ - public class Flags : PythonObject - { - public Flags(PyObject pyobject) : base(pyobject) - { - } - - } -} diff --git a/src/Numpy.Bare/Models/Matrix.cs b/src/Numpy.Bare/Models/Matrix.cs deleted file mode 100644 index 1f99237..0000000 --- a/src/Numpy.Bare/Models/Matrix.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy.Models -{ - public class Matrix : PythonObject - { - public Matrix(PyObject pyobject) : base(pyobject) - { - } - - } -} diff --git a/src/Numpy.Bare/Models/MemMapMode.cs b/src/Numpy.Bare/Models/MemMapMode.cs deleted file mode 100644 index cf72a66..0000000 --- a/src/Numpy.Bare/Models/MemMapMode.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy.Models -{ - public class MemMapMode : PythonObject - { - public MemMapMode(PyObject pyobject) : base(pyobject) - { - } - - } -} diff --git a/src/Numpy.Bare/Models/NDarray.CastOperators.cs b/src/Numpy.Bare/Models/NDarray.CastOperators.cs deleted file mode 100644 index 758c69b..0000000 --- a/src/Numpy.Bare/Models/NDarray.CastOperators.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; - -namespace Numpy -{ - public partial class NDarray - { - public static implicit operator NDarray(Array array) - { - if (array == null) - return null; - switch (array) - { - case byte[] a: return np.array(a); - case bool[] a: return np.array(a); - case short[] a: return np.array(a); - case int[] a: return np.array(a); - case long[] a: return np.array(a); - case float[] a: return np.array(a); - case double[] a: return np.array(a); - case byte[,] a: return np.array(a); - case bool[,] a: return np.array(a); - case short[,] a: return np.array(a); - case int[,] a: return np.array(a); - case long[,] a: return np.array(a); - case float[,] a: return np.array(a); - case double[,] a: return np.array(a); - case byte[,,] a: return np.array(a); - case bool[,,] a: return np.array(a); - case short[,,] a: return np.array(a); - case int[,,] a: return np.array(a); - case long[,,] a: return np.array(a); - case float[,,] a: return np.array(a); - case double[,,] a: return np.array(a); - } - throw new InvalidOperationException($"Unable to cast {array.GetType()} to NDarray"); - } - - // these must be explicit or we have bad side effects - public static explicit operator NDarray(bool d) => np.asarray(d); - public static explicit operator NDarray(byte d) => np.asarray(d); - public static explicit operator NDarray(short d) => np.asarray(d); - public static explicit operator NDarray(int d) => np.asarray(d); - public static explicit operator NDarray(long d) => np.asarray(d); - public static explicit operator NDarray(float d) => np.asarray(d); - public static explicit operator NDarray(double d) => np.asarray(d); - - // these must be explicit or we have bad side effects - public static explicit operator bool(NDarray a) => np.asscalar(a); - public static explicit operator byte(NDarray a) => np.asscalar(a); - public static explicit operator short(NDarray a) => np.asscalar(a); - public static explicit operator int(NDarray a) => np.asscalar(a); - public static explicit operator long(NDarray a) => np.asscalar(a); - public static explicit operator float(NDarray a) => np.asscalar(a); - public static explicit operator double(NDarray a) => np.asscalar(a); - - - - } -} diff --git a/src/Numpy.Bare/Models/NDarray.Operators.cs b/src/Numpy.Bare/Models/NDarray.Operators.cs deleted file mode 100644 index 6c9b9da..0000000 --- a/src/Numpy.Bare/Models/NDarray.Operators.cs +++ /dev/null @@ -1,502 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy -{ - public partial class NDarray - { - //------------------------------ - // Comparison operators: - //------------------------------ - - // Return self operator <(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__lt__", obj.ToPython())); - } - - // Return self<=value. - public static NDarray operator <=(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__le__", obj.ToPython())); - } - - // Return self>value. - public static NDarray operator >(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__gt__", obj.ToPython())); - } - - // Return self>=value. - public static NDarray operator >=(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__ge__", obj.ToPython())); - } - - /// - /// Returns an array of bool where the elements of the array are == value - /// - public NDarray equals(ValueType obj) - { - return new NDarray(self.InvokeMethod("__eq__", obj.ToPython())); - } - - /// - /// Returns an array of bool where the elements of the array are != value - /// - public NDarray not_equals(ValueType obj) - { - return new NDarray(self.InvokeMethod("__ne__", obj.ToPython())); - } - - // Return element-wise self operator <(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__lt__", obj.self)); - } - - // Return element-wise self<=array. - public static NDarray operator <=(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__le__", obj.self)); - } - - // Return element-wise self>array. - public static NDarray operator >(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__gt__", obj.self)); - } - - // Return element-wise self>=array. - public static NDarray operator >=(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__ge__", obj.self)); - } - - /// - /// Returns an array of bool where the elements of the array are == array element-wise - /// - public NDarray equals(NDarray obj) - { - return new NDarray(self.InvokeMethod("__eq__", obj.self)); - } - - /// - /// Returns an array of bool where the elements of the array are != array element-wise - /// - public NDarray not_equals(NDarray obj) - { - return new NDarray(self.InvokeMethod("__ne__", obj.self)); - } - - //------------------------------ - // Truth value of an array(bool) : - //------------------------------ - - /// - /// Note - /// Truth-value testing of an array invokes ndarray.__nonzero__, which raises an error if the - /// number of elements in the array is larger than 1, because the truth value of such arrays is - /// ambiguous.Use.any() and.all() instead to be clear about what is meant in such cases. - /// (If the number of elements is 0, the array evaluates to False.) - /// - public static NDarray nonzero(NDarray a) - { - return new NDarray(a.self.InvokeMethod("__nonzero__")); - } - - //------------------------------ - // Unary operations: - //------------------------------ - - // Return -self - public static NDarray operator -(NDarray a) - { - return new NDarray(a.self.InvokeMethod("__neg__")); - } - - // Return +self - public static NDarray operator +(NDarray a) - { - return new NDarray(a.self.InvokeMethod("__pos__")); - } - - // ndarray.__abs__(self) // C# doesn't have an operator for that - - // Return ~self - public static NDarray operator ~(NDarray a) - { - return new NDarray(a.self.InvokeMethod("__invert__")); - } - - //------------------------------ - // Arithmetic operators: - //------------------------------ - - // Return self+value. - public static NDarray operator +(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__add__", obj.ToPython())); - } - - // Return value+self. - public static NDarray operator +(ValueType obj, NDarray a) - { - return new NDarray(a.self.InvokeMethod("__add__", obj.ToPython())); - } - - // Return self-value. - public static NDarray operator -(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__sub__", obj.ToPython())); - } - - // Return self*value. - public static NDarray operator *(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__mul__", obj.ToPython())); - } - - // Return value*self. - public static NDarray operator *(ValueType obj, NDarray a) - { - return new NDarray(a.self.InvokeMethod("__mul__", obj.ToPython())); - } - - // Return self/value. - public static NDarray operator /(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__truediv__", obj.ToPython())); - } - - // Return element-wise self+array. - public static NDarray operator +(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__add__", obj.self)); - } - - // Return element-wise self-array. - public static NDarray operator -(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__sub__", obj.self)); - } - - // Return element-wise self*array. - public static NDarray operator *(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__mul__", obj.self)); - } - - // Return element-wise self/array. - public static NDarray operator /(NDarray a, NDarray obj) - { - return new NDarray(a.self.InvokeMethod("__truediv__", obj.self)); - } - - ///// - ///// Return self/value. - ///// - //public static NDarray truediv(NDarray a, ValueType obj) - //{ - // return new NDarray(a.self.InvokeMethod("__truediv__", obj.ToPython())); - //} - - /// - /// Return self//value. - /// - public NDarray floordiv(NDarray a, ValueType obj) - { - return new NDarray(self.InvokeMethod("__floordiv__", obj.ToPython())); - } - - // Return self%value. - public static NDarray operator %(NDarray a, ValueType obj) - { - return new NDarray(a.self.InvokeMethod("__mod__", obj.ToPython())); - } - - /// - /// Return divmod(value). - /// - public NDarray divmod(ValueType obj) - { - return new NDarray(self.InvokeMethod("__divmod__", obj.ToPython())); - } - - /// - /// Return pow(value). - /// - public NDarray pow(ValueType obj) - { - return new NDarray(self.InvokeMethod("__pow__", obj.ToPython())); - } - - /// - /// Return self<<value. - /// - public static NDarray operator <<(NDarray a, int obj) - { - return new NDarray(a.self.InvokeMethod("__lshift__", obj.ToPython())); - } - - /// - /// Return self>>value. - /// - public static NDarray operator >>(NDarray a, int obj) - { - return new NDarray(a.self.InvokeMethod("__rshift__", obj.ToPython())); - } - - /// - /// Return self&value. - /// - public static NDarray operator &(NDarray a, int obj) - { - return new NDarray(a.self.InvokeMethod("__and__", obj.ToPython())); - } - - /// - /// Return self|value. - /// - public static NDarray operator |(NDarray a, int obj) - { - return new NDarray(a.self.InvokeMethod("__or__", obj.ToPython())); - } - - /// - /// Return self^value. - /// - public static NDarray operator ^(NDarray a, int obj) - { - return new NDarray(a.self.InvokeMethod("__xor__", obj.ToPython())); - } - - //------------------------------ - // Arithmetic, in-place: - //------------------------------ - - /// - /// Return self+=value. - /// - public NDarray iadd(ValueType obj) - { - return new NDarray(self.InvokeMethod("__iadd__", obj.ToPython())); - } - - /// - /// Return self-=value. - /// - public NDarray isub(ValueType obj) - { - return new NDarray(self.InvokeMethod("__isub__", obj.ToPython())); - } - - /// - /// Return self*=value. - /// - public NDarray imul(ValueType obj) - { - return new NDarray(self.InvokeMethod("__imul__", obj.ToPython())); - } - - /// - /// Return self/=value. - /// - public NDarray idiv(ValueType obj) - { - return new NDarray(self.InvokeMethod("__itruediv__", obj.ToPython())); - } - - /// - /// Return self/=value. - /// - public NDarray itruediv(ValueType obj) - { - return new NDarray(self.InvokeMethod("__itruediv__", obj.ToPython())); - } - - /// - /// Return self//=value. - /// - public NDarray ifloordiv(ValueType obj) - { - return new NDarray(self.InvokeMethod("__floordiv__", obj.ToPython())); - } - - /// - /// Return self%value. - /// - public NDarray imod(ValueType obj) - { - return new NDarray(self.InvokeMethod("__imod__", obj.ToPython())); - } - - /// - /// Return inplace pow(value). - /// - public NDarray ipow(ValueType obj) - { - return new NDarray(self.InvokeMethod("__ipow__", obj.ToPython())); - } - - /// - /// Return inplace self<<value. - /// - public NDarray ilshift(int obj) - { - return new NDarray(self.InvokeMethod("__ilshift__", obj.ToPython())); - } - - /// - /// Return inplace self>>value. - /// - public NDarray irshift(int obj) - { - return new NDarray(self.InvokeMethod("__irshift__", obj.ToPython())); - } - - /// - /// Return self&=value. - /// - public NDarray iand(ValueType obj) - { - return new NDarray(self.InvokeMethod("__iand__", obj.ToPython())); - } - - /// - /// Return self|=value. - /// - public NDarray ior(ValueType obj) - { - return new NDarray(self.InvokeMethod("__ior__", obj.ToPython())); - } - - /// - /// Return self^=value. - /// - public NDarray ixor(ValueType obj) - { - return new NDarray(self.InvokeMethod("__ixor__", obj.ToPython())); - } - - /// - /// Return self+=NDarray. - /// - public NDarray iadd(NDarray obj) - { - return new NDarray(self.InvokeMethod("__iadd__", obj.self)); - } - - /// - /// Return self-=NDarray. - /// - public NDarray isub(NDarray obj) - { - return new NDarray(self.InvokeMethod("__isub__", obj.self)); - } - - /// - /// Return self*=NDarray. - /// - public NDarray imul(NDarray obj) - { - return new NDarray(self.InvokeMethod("__imul__", obj.self)); - } - - /// - /// Return self/=NDarray. - /// - public NDarray idiv(NDarray obj) - { - return new NDarray(self.InvokeMethod("__idiv__", obj.self)); - } - - /// - /// Return self/=NDarray. - /// - public NDarray itruediv(NDarray obj) - { - return new NDarray(self.InvokeMethod("__itruediv__", obj.self)); - } - - /// - /// Return self//=NDarray. - /// - public NDarray ifloordiv(NDarray obj) - { - return new NDarray(self.InvokeMethod("__floordiv__", obj.self)); - } - - /// - /// Return self%NDarray. - /// - public NDarray imod(NDarray obj) - { - return new NDarray(self.InvokeMethod("__imod__", obj.self)); - } - - /// - /// Return inplace pow(NDarray). - /// - public NDarray ipow(NDarray obj) - { - return new NDarray(self.InvokeMethod("__ipow__", obj.self)); - } - - /// - /// Return inplace self<<NDarray. - /// - public NDarray ilshift(NDarray obj) - { - return new NDarray(self.InvokeMethod("__ilshift__", obj.self)); - } - - /// - /// Return inplace self>>NDarray. - /// - public NDarray irshift(NDarray obj) - { - return new NDarray(self.InvokeMethod("__irshift__", obj.self)); - } - - /// - /// Return self&=NDarray. - /// - public NDarray iand(NDarray obj) - { - return new NDarray(self.InvokeMethod("__iand__", obj.self)); - } - - /// - /// Return self|=NDarray. - /// - public NDarray ior(NDarray obj) - { - return new NDarray(self.InvokeMethod("__ior__", obj.self)); - } - - /// - /// Return self^=NDarray. - /// - public NDarray ixor(NDarray obj) - { - return new NDarray(self.InvokeMethod("__ixor__", obj.self)); - } - - // TODO: - // ndarray.__matmul__($self, value, /) Return self@value. - //ndarray.__copy__() Used if copy.copy is called on an array. - //ndarray.__deepcopy__(memo, /) Used if copy.deepcopy is called on an array. - //ndarray.__reduce__() For pickling. - //ndarray.__setstate__(state, /) For unpickling. - //ndarray.__contains__($self, key, /) Return key in self. - - //ndarray.__int__(self) - //ndarray.__long__ - //ndarray.__float__(self) - //ndarray.__oct__ - //ndarray.__hex__ - } -} diff --git a/src/Numpy.Bare/Models/NDarray.aliases.cs b/src/Numpy.Bare/Models/NDarray.aliases.cs deleted file mode 100644 index f84d614..0000000 --- a/src/Numpy.Bare/Models/NDarray.aliases.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Numpy -{ - public partial class NDarray - { - /// - /// 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 abs(NDarray @out = null, NDarray @where = null) - => this.absolute(@out, @where); - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray min(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => this.amin( axis: axis, @out: @out, keepdims: keepdims, initial: initial); - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray max(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - return this.amax( axis: axis, @out: @out, keepdims: keepdims, initial: initial); - } - } -} diff --git a/src/Numpy.Bare/Models/NDarray.cs b/src/Numpy.Bare/Models/NDarray.cs deleted file mode 100644 index d0fb8f9..0000000 --- a/src/Numpy.Bare/Models/NDarray.cs +++ /dev/null @@ -1,576 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using Numpy.Models; -using Python.Runtime; - - -namespace Numpy -{ - public partial class NDarray : PythonObject - { - // these are manual overrides of functions or properties that can not be automatically generated - - public NDarray(PyObject pyobj) : base(pyobj) - { - } - - public NDarray(NDarray t) : base((PyObject) t.PyObject) - { - } - - /// - /// Returns a copy of the array data - /// - public T[] GetData() - { - // note: this implementation works only for device CPU - long ptr = PyObject.ctypes.data; - int size = PyObject.size; - object array = null; - if (typeof(T) == typeof(byte)) array = new byte[size]; - else if (typeof(T) == typeof(short)) array = new short[size]; - else if (typeof(T) == typeof(int)) array = new int[size]; - else if (typeof(T) == typeof(long)) array = new long[size]; - else if (typeof(T) == typeof(float)) array = new float[size]; - else if (typeof(T) == typeof(double)) array = new double[size]; - else if (typeof(T) == typeof(bool)) array = new byte[size]; - else - throw new InvalidOperationException( - "Can not copy the data with data type due to limitations of Marshal.Copy: " + typeof(T).Name); - switch (array) - { - case byte[] a: - Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); - break; - case short[] a: - Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); - break; - case int[] a: - Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); - break; - case long[] a: - Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); - break; - case float[] a: - Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); - break; - case double[] a: - Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); - break; - } - // special handling for types that are not supported by Marshal.Copy: must be converted i.e. 1 => true, 0 => false - if (typeof(T) == typeof(bool)) return (T[])(object)((byte[])array).Select(x=>x>0).ToArray(); - return (T[]) array; - } - - /// - /// Information about the memory layout of the array. - /// - public Flags flags => new Flags(self.GetAttr("flags")); // TODO: implement Flags - - /// - /// Tuple of array dimensions. - /// - public Shape shape => new Shape( self.GetAttr("shape").As()); - - /// - /// Tuple of bytes to step in each dimension when traversing an array. - /// - public int[] strides => self.GetAttr("strides").As(); - - /// - /// Number of array dimensions. - /// - public int ndim => self.GetAttr("ndim").As(); - - /// - /// Python buffer object pointing to the start of the array’s data. - /// - public PyObject data => self.GetAttr("data"); - - /// - /// Number of elements in the array. - /// - public int size => self.GetAttr("size").As(); - - /// - /// Length of one array element in bytes. - /// - public int itemsize => self.GetAttr("itemsize").As(); - - /// - /// Total bytes consumed by the elements of the array. - /// - public int nbytes => self.GetAttr("nbytes").As(); - - /// - /// Base object if memory is from some other object. - /// - public NDarray @base - { - get - { - PyObject base_obj = self.GetAttr("base"); - if (base_obj.IsNone()) - return null; - return new NDarray(base_obj); - } - } - - /// - /// Data-type of the array’s elements. - /// - public Dtype dtype => new Dtype(self.GetAttr("dtype")); - - /// - /// Same as self.transpose(), except that self is returned if self.ndim < 2. - /// - public NDarray T => new NDarray(self.GetAttr("T")); - - ///// - ///// The real part of the array. - ///// - //public NDarray real => new NDarray(self.GetAttr("real")); - - ///// - ///// The imaginary part of the array. - ///// - //public NDarray imag => new NDarray(self.GetAttr("imag")); - - /// - /// A 1-D iterator over the array. - /// - public PyObject flat => self.GetAttr("flat"); // todo: wrap and support usecases - - /// - /// An object to simplify the interaction of the array with the ctypes module. - /// - public PyObject ctypes => self.GetAttr("ctypes"); // TODO: wrap ctypes - - - /// - /// Length of the array (same as size) - /// - public int len => self.InvokeMethod("__len__").As(); - - /// - /// Insert scalar into an array (scalar is cast to array’s dtype, if possible) - /// - /// There must be at least 1 argument, and define the last argument - /// as item. Then, a.itemset(*args) is equivalent to but faster - /// than a[args] = item. The item should be a scalar value and args - /// must select a single item in the array a. - /// - /// Notes - /// - /// Compared to indexing syntax, itemset provides some speed increase - /// for placing a scalar into a particular location in an ndarray, - /// if you must do this. However, generally this is discouraged: - /// among other problems, it complicates the appearance of the code. - /// Also, when using itemset (and item) inside a loop, be sure - /// to assign the methods to a local variable to avoid the attribute - /// look-up at each loop iteration. - /// - /// - /// If one argument: a scalar, only used in case a is of size 1. - /// If two arguments: the last argument is the value to be set - /// and must be a scalar, the first argument specifies a single array - /// element location. It is either an int or a tuple. - /// - public void itemset(params object[] args) - { - var pyargs = ToTuple(args); - var kwargs = new PyDict(); - dynamic py = self.InvokeMethod("itemset", pyargs, kwargs); - } - - /// - /// Construct Python bytes containing the raw data bytes in the array. - /// - /// Constructs Python bytes showing a copy of the raw contents of - /// data memory. The bytes object can be produced in either ‘C’ or ‘Fortran’, - /// or ‘Any’ order (the default is ‘C’-order). ‘Any’ order means C-order - /// unless the F_CONTIGUOUS flag in the array is set, in which case it - /// means ‘Fortran’ order. - /// - /// This function is a compatibility alias for tobytes. Despite its name it returns bytes not strings. - /// - /// - /// Order of the data for multidimensional arrays: - /// C, Fortran, or the same as for the original array. - /// - /// - /// Python bytes exhibiting a copy of a’s raw data. - /// - public byte[] tostring(string order = null) - { - return tobytes(); - } - - /// - /// Construct Python bytes containing the raw data bytes in the array. - /// - /// Constructs Python bytes showing a copy of the raw contents of - /// data memory. The bytes object can be produced in either ‘C’ or ‘Fortran’, - /// or ‘Any’ order (the default is ‘C’-order). ‘Any’ order means C-order - /// unless the F_CONTIGUOUS flag in the array is set, in which case it - /// means ‘Fortran’ order. - /// - /// - /// Order of the data for multidimensional arrays: - /// C, Fortran, or the same as for the original array. - /// - /// - /// Python bytes exhibiting a copy of a’s raw data. - /// - public byte[] tobytes(string order = null) - { - throw new NotImplementedException("TODO: this needs to be implemented with Marshal.Copy"); - var pyargs = ToTuple(new object[] - { - }); - var kwargs = new PyDict(); - if (order != null) kwargs["order"] = ToPython(order); - dynamic py = self.InvokeMethod("tobytes", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// New view of array with the same data. - /// - /// Notes - /// - /// a.view() is used two different ways: - /// - /// a.view(some_dtype) or a.view(dtype=some_dtype) constructs a view - /// of the array’s memory with a different data-type. This can cause a - /// reinterpretation of the bytes of memory. - /// - /// a.view(ndarray_subclass) or a.view(type=ndarray_subclass) just - /// returns an instance of ndarray_subclass that looks at the same array - /// (same shape, dtype, etc.) This does not cause a reinterpretation of the - /// memory. - /// - /// For a.view(some_dtype), if some_dtype has a different number of - /// bytes per entry than the previous dtype (for example, converting a - /// regular array to a structured array), then the behavior of the view - /// cannot be predicted just from the superficial appearance of a (shown - /// by print(a)). It also depends on exactly how a is stored in - /// memory. Therefore if a is C-ordered versus fortran-ordered, versus - /// defined as a slice or transpose, etc., the view may give different - /// results. - /// - /// - /// Data-type descriptor of the returned view, e.g., float32 or int16. The - /// default, None, results in the view having the same data-type as a. - /// This argument can also be specified as an ndarray sub-class, which - /// then specifies the type of the returned object (this is equivalent to - /// setting the type parameter). - /// - /// - /// Type of the returned view, e.g., ndarray or matrix. Again, the - /// default None results in type preservation. - /// - public void view(Dtype dtype = null, Type type = null) - { - throw new NotImplementedException("Get python type 'ndarray' and 'matrix' and substitute them for the given .NET type"); - var pyargs = ToTuple(new object[] - { - }); - var kwargs = new PyDict(); - if (dtype != null) kwargs["dtype"] = ToPython(dtype); - if (type != null) kwargs["type"] = ToPython(type); - dynamic py = self.InvokeMethod("view", pyargs, kwargs); - } - - /// - /// Change shape and size of array in-place. - /// - /// Notes - /// - /// This reallocates space for the data area if necessary. - /// - /// Only contiguous arrays (data elements consecutive in memory) can be - /// resized. - /// - /// The purpose of the reference count check is to make sure you - /// do not use this array as a buffer for another Python object and then - /// reallocate the memory. However, reference counts can increase in - /// other ways so if you are sure that you have not shared the memory - /// for this array with another Python object, then you may safely set - /// refcheck to False. - /// - /// - /// Shape of resized array. - /// - /// - /// If False, reference count will not be checked. Default is True. - /// - public void resize(Shape new_shape, bool? refcheck = null) - { - var pyargs = ToTuple(new object[] - { - new_shape, - }); - var kwargs = new PyDict(); - if (refcheck != null) kwargs["refcheck"] = ToPython(refcheck); - dynamic py = self.InvokeMethod("resize", 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. - /// - /// - /// 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(params int[] newshape) - { - //auto-generated code, do not change - var @this = this; - return NumPy.Instance.reshape(@this, new Shape(newshape)); - } - - /// - /// returns the 'array([ .... ])'-representation known from the console - /// - public string repr => self.InvokeMethod("__repr__").As(); - - /// - /// returns the '[ .... ]'-representation - /// - public string str => self.InvokeMethod("__str__").As(); - - public NDarray this[string slicing_notation] - { - get - { - var tuple=new PyTuple(Slice.ParseSlices(slicing_notation).Select(s => - { - if (s.IsIndex) - return new PyInt(s.Start.Value); - else - return s.ToPython(); - }).ToArray()); - return new NDarray(this.PyObject[tuple]); - } - set - { - var tuple = new PyTuple(Slice.ParseSlices(slicing_notation).Select(s => - { - if (s.IsIndex) - return new PyInt(s.Start.Value); - else - return s.ToPython(); - }).ToArray()); - self.SetItem(tuple, ToPython(value)); - } - } - - public NDarray this[params int[] coords] - { - get - { - var tuple = ToTuple(coords); - return new NDarray(this.PyObject[tuple]); - } - set - { - var tuple = ToTuple(coords); - self.SetItem(tuple, ToPython(value)); - } - } - - public NDarray this[params NDarray[] indices] - { - get - { - var tuple = new PyTuple(indices.Select(a => (PyObject)a.PyObject).ToArray()); - return new NDarray(this.PyObject[tuple]); - } - set - { - var tuple = new PyTuple(indices.Select(a => (PyObject)a.PyObject).ToArray()); - self.SetItem(tuple, ToPython(value)); - } - } - - public NDarray this[params object[] arrays_slices_or_indices] - { - get - { - var pyobjs = arrays_slices_or_indices.Select(x => - { - switch (x) - { - case int i: return new PyInt(i); - case NDarray a: return a.PyObject; - case string s: return new Slice(s).ToPython(); - default: return ToPython(x); - } - }).ToArray(); - var tuple = new PyTuple(pyobjs); - return new NDarray(this.PyObject[tuple]); - } - set - { - var pyobjs = arrays_slices_or_indices.Select(x => - { - switch (x) - { - case int i: return new PyInt(i); - case NDarray a: return a.PyObject; - case string s: return new Slice(s).ToPython(); - default: return ToPython(x); - } - }).ToArray(); - var tuple = new PyTuple(pyobjs); - self.SetItem(tuple, ToPython(value)); - } - } - - /// - /// Convert an array of size 1 to its scalar equivalent. - /// - /// - /// Scalar representation of a. The output data type is the same type - /// returned by the input’s item method. - /// - public T asscalar() - { - return NumPy.Instance.asscalar(this); - } - } - - public class NDarray : NDarray - { - public NDarray(NDarray t) : base(t) - { - } - - public NDarray(PyObject pyobject) : base(pyobject) - { - } - - /// - /// Returns a copy of the array data - /// - public T[] GetData() - { - return base.GetData(); - } - - public new NDarray this[string slicing_notation] - { - get - { - var tuple = new PyTuple(Slice.ParseSlices(slicing_notation).Select(s => - { - if (s.IsIndex) - return new PyInt(s.Start.Value); - else - return s.ToPython(); - }).ToArray()); - return new NDarray(this.PyObject[tuple]); - } - set - { - var tuple = new PyTuple(Slice.ParseSlices(slicing_notation).Select(s => - { - if (s.IsIndex) - return new PyInt(s.Start.Value); - else - return s.ToPython(); - }).ToArray()); - self.SetItem(tuple, ToPython(value)); - } - } - - public new NDarray this[params int[] coords] - { - get - { - var tuple = ToTuple(coords); - return new NDarray(this.PyObject[tuple]); - } - set - { - var tuple = ToTuple(coords); - self.SetItem(tuple, ToPython(value)); - } - } - - public new NDarray this[params NDarray[] indices] - { - get - { - var tuple = new PyTuple(indices.Select(a => (PyObject)a.PyObject).ToArray()); - return new NDarray(this.PyObject[tuple]); - } - set - { - var tuple = new PyTuple(indices.Select(a => (PyObject)a.PyObject).ToArray()); - self.SetItem(tuple, ToPython(value)); - } - } - - public new NDarray this[params object[] arrays_slices_or_indices] - { - get - { - var pyobjs = arrays_slices_or_indices.Select(x => - { - switch (x) - { - case int i: return new PyInt(i); - case NDarray a: return a.PyObject; - case string s: return new Slice(s).ToPython(); - default: return ToPython(x); - } - }).ToArray(); - var tuple = new PyTuple(pyobjs); - return new NDarray(this.PyObject[tuple]); - } - set - { - var pyobjs = arrays_slices_or_indices.Select(x => - { - switch (x) - { - case int i: return new PyInt(i); - case NDarray a: return a.PyObject; - case string s: return new Slice(s).ToPython(); - default: return ToPython(x); - } - }).ToArray(); - var tuple = new PyTuple(pyobjs); - self.SetItem(tuple, ToPython(value)); - } - } - } -} diff --git a/src/Numpy.Bare/Models/NDarray.gen.cs b/src/Numpy.Bare/Models/NDarray.gen.cs deleted file mode 100644 index 40ef182..0000000 --- a/src/Numpy.Bare/Models/NDarray.gen.cs +++ /dev/null @@ -1,9976 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NDarray - { - - /// - /// Copy an element of an array to a standard Python scalar and return it. - /// - /// Notes - /// - /// When the data type of a is longdouble or clongdouble, item() returns - /// a scalar array object because there is no available Python scalar that - /// would not lose information. Void arrays return a buffer object for item(), - /// unless fields are defined, in which case a tuple is returned. - /// - /// item is very similar to a[args], except, instead of an array scalar, - /// a standard Python scalar is returned. This can be useful for speeding up - /// access to elements of the array and doing arithmetic on elements of the - /// array using Python’s optimized math. - /// - /// - /// A copy of the specified element of the array as a suitable - /// Python scalar - /// - public T item(params int[] args) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("item", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Return the array as a (possibly nested) list. - /// - /// Return a copy of the array data as a (nested) Python list. - /// Data items are converted to the nearest compatible Python type. - /// - /// Notes - /// - /// The array may be recreated, a = np.array(a.tolist()). - /// - /// - /// The possibly nested list of array elements. - /// - public List tolist() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("tolist"); - return ToCsharp>(py); - } - */ - - /// - /// Write array to a file as text or binary (default). - /// - /// Data is always written in ‘C’ order, independent of the order of a. - /// The data produced by this method can be recovered using the function - /// fromfile(). - /// - /// Notes - /// - /// This is a convenience function for quick storage of array data. - /// Information on endianness and precision is lost, so this method is not a - /// good choice for files intended to archive data or transport data between - /// machines with different endianness. Some of these problems can be overcome - /// by outputting the data as text files, at the expense of speed and file - /// size. - /// - /// When fid is a file object, array contents are directly written to the - /// file, bypassing the file object’s write method. As a result, tofile - /// cannot be used with files objects supporting compression (e.g., GzipFile) - /// or file-like objects that do not support fileno() (e.g., BytesIO). - /// - /// - /// An open file object, or a string containing a filename. - /// - /// - /// Separator between array items for text output. - /// If “” (empty), a binary file is written, equivalent to - /// file.write(a.tobytes()). - /// - /// - /// Format string for text file output. - /// Each entry in the array is formatted to text by first converting - /// it to the closest Python type, and then using “format” % item. - /// - public void tofile(string fid, string sep, string format) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fid, - sep, - format, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tofile", pyargs, kwargs); - } - - /// - /// Dump a pickle of the array to the specified file. - /// The array can be read back with pickle.load or numpy.load. - /// - /// - /// A string naming the dump file. - /// - public void dump(string file) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("dump", pyargs, kwargs); - } - - /// - /// Returns the pickle of the array as a string. - /// pickle.loads or numpy.loads will convert the string back to an array. - /// - public void dumps() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("dumps"); - } - - /// - /// Copy of the array, cast to a specified type. - /// - /// Notes - /// - /// Starting in NumPy 1.9, astype method now returns an error if the string - /// dtype to cast to is not long enough in ‘safe’ casting mode to hold the max - /// value of integer/float array that is being casted. Previously the casting - /// was allowed even if the result was truncated. - /// - /// - /// Typecode or data-type to which the array is cast. - /// - /// - /// Controls the memory layout order of the result. - /// ‘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. - /// Default is ‘K’. - /// - /// - /// Controls what kind of data casting may occur. Defaults to ‘unsafe’ - /// for backwards compatibility. - /// - /// - /// If True, then sub-classes will be passed-through (default), otherwise - /// the returned array will be forced to be a base-class array. - /// - /// - /// By default, astype always returns a newly allocated array. If this - /// is set to false, and the dtype, order, and subok - /// requirements are satisfied, the input array is returned instead - /// of a copy. - /// - /// - /// Unless copy is False and the other conditions for returning the input - /// array are satisfied (see description for copy input parameter), arr_t - /// is a new array of the same shape as the input array, with dtype, order - /// given by dtype, order. - /// - public NDarray astype(Dtype dtype, string order = null, string casting = null, bool? subok = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - if (casting!=null) kwargs["casting"]=ToPython(casting); - if (subok!=null) kwargs["subok"]=ToPython(subok); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("astype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Swap the bytes of the array elements - /// - /// Toggle between low-endian and big-endian data representation by - /// returning a byteswapped array, optionally swapped in-place. - /// - /// - /// If True, swap bytes in-place, default is False. - /// - /// - /// The byteswapped array. If inplace is True, this is - /// a view to self. - /// - public NDarray byteswap(bool? inplace = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (inplace!=null) kwargs["inplace"]=ToPython(inplace); - dynamic py = __self__.InvokeMethod("byteswap", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of the array. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and numpy.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - public void copy(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("copy", pyargs, kwargs); - } - - /// - /// Returns a field of the given array as a certain type. - /// - /// A field is a view of the array data with a given data-type. The values in - /// the view are determined by the given type and the offset into the current - /// array in bytes. The offset needs to be such that the view dtype fits in the - /// array dtype; for example an array of dtype complex128 has 16-byte elements. - /// If taking a view with a 32-bit integer (4 bytes), the offset needs to be - /// between 0 and 12 bytes. - /// - /// - /// The data type of the view. The dtype size of the view can not be larger - /// than that of the array itself. - /// - /// - /// Number of bytes to skip before beginning the element view. - /// - public void getfield(Dtype dtype, int offset) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - offset, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("getfield", pyargs, kwargs); - } - - /// - /// Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY), - /// respectively. - /// - /// These Boolean-valued flags affect how numpy interprets the memory - /// area used by a (see Notes below). The ALIGNED flag can only - /// be set to True if the data is actually aligned according to the type. - /// The WRITEBACKIFCOPY and (deprecated) UPDATEIFCOPY flags can never be set - /// to True. The flag WRITEABLE can only be set to True if the array owns its - /// own memory, or the ultimate owner of the memory exposes a writeable buffer - /// interface, or is a string. (The exception for string is made so that - /// unpickling can be done without copying memory.) - /// - /// Notes - /// - /// Array flags provide information about how the memory area used - /// for the array is to be interpreted. There are 7 Boolean flags - /// in use, only four of which can be changed by the user: - /// WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED. - /// - /// WRITEABLE (W) the data area can be written to; - /// - /// ALIGNED (A) the data and strides are aligned appropriately for the hardware - /// (as determined by the compiler); - /// - /// UPDATEIFCOPY (U) (deprecated), replaced by WRITEBACKIFCOPY; - /// - /// WRITEBACKIFCOPY (X) this array is a copy of some other array (referenced - /// by .base). When the C-API function PyArray_ResolveWritebackIfCopy is - /// called, the base array will be updated with the contents of this array. - /// - /// All flags can be accessed using the single (upper case) letter as well - /// as the full name. - /// - /// - /// Describes whether or not a can be written to. - /// - /// - /// Describes whether or not a is aligned properly for its type. - /// - /// - /// Describes whether or not a is a copy of another “base” array. - /// - public void setflags(bool? write = null, bool? align = null, bool? uic = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (write!=null) kwargs["write"]=ToPython(write); - if (align!=null) kwargs["align"]=ToPython(align); - if (uic!=null) kwargs["uic"]=ToPython(uic); - dynamic py = __self__.InvokeMethod("setflags", pyargs, kwargs); - } - - /// - /// Fill the array with a scalar value. - /// - /// - /// All elements of a will be assigned this value. - /// - public void fill(ValueType @value) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - @value, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("fill", pyargs, kwargs); - } - - /// - /// Returns a view of the array with axes transposed. - /// - /// For a 1-D array, this has no effect. (To change between column and - /// row vectors, first cast the 1-D array into a matrix object.) - /// For a 2-D array, this is the usual matrix transpose. - /// For an n-D array, if axes are given, their order indicates how the - /// axes are permuted (see Examples). If axes are not provided and - /// a.shape = (i[0], i[1], ... i[n-2], i[n-1]), then - /// a.transpose().shape = (i[n-1], i[n-2], ... i[1], i[0]). - /// - /// - /// View of a, with axes suitably permuted. - /// - public NDarray transpose(int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("transpose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of the array collapsed into one dimension. - /// - /// - /// ‘C’ means to flatten in row-major (C-style) order. - /// ‘F’ means to flatten in column-major (Fortran- - /// style) order. ‘A’ means to flatten in column-major - /// order if a is Fortran contiguous in memory, - /// row-major order otherwise. ‘K’ means to flatten - /// a in the order the elements occur in memory. - /// The default is ‘C’. - /// - /// - /// A copy of the input array, flattened to one dimension. - /// - public NDarray flatten(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("flatten", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For unpickling. - /// - /// The state argument must be a sequence that contains the following - /// elements: - /// - /// - /// optional pickle version. If omitted defaults to 0. - /// - /// - /// a binary string with the data (or a list if ‘a’ is an object array) - /// - public void __setstate__(int version, Shape shape, Dtype dtype, bool isFortran, string rawdata) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - version, - shape, - dtype, - isFortran, - rawdata, - }); - var kwargs=new PyDict(); - 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 @this=this; - return NumPy.Instance.reshape(@this, newshape, order:order); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ravel(@this, order:order); - } - - /// - /// 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 @this=this; - return NumPy.Instance.moveaxis(@this, source, destination); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rollaxis(@this, axis, start:start); - } - - /// - /// 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 @this=this; - return NumPy.Instance.swapaxes(@this, axis1, axis2); - } - - /// - /// 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 @this=this; - return NumPy.Instance.broadcast(@this, in1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.broadcast_to(@this, shape, subok:subok); - } - - /// - /// 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 @this=this; - return NumPy.Instance.expand_dims(@this, axis); - } - - /// - /// 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(int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.squeeze(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.asfarray(@this, dtype:dtype); - } - - /// - /// 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 @this=this; - return NumPy.Instance.asfortranarray(@this, dtype:dtype); - } - - /// - /// 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 @this=this; - return NumPy.Instance.asarray_chkfinite(@this, dtype:dtype, order:order); - } - - /// - /// 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 @this=this; - return NumPy.Instance.require(@this, dtype, requirements); - } - - /// - /// 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 @this=this; - return NumPy.Instance.split(@this, indices_or_sections, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tile(@this, reps); - } - - /// - /// 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 @this=this; - return NumPy.Instance.repeat(@this, repeats, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.delete(@this, obj, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.insert(@this, obj, values, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.append(@this, values, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trim_zeros(@this, trim:trim); - } - - /// - /// 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. - /// - /// - /// A tuple of: - /// unique - /// The sorted unique values. - /// unique_indices - /// The indices of the first occurrences of the unique values in the - /// original array. Only provided if return_index is True. - /// unique_inverse - /// The indices to reconstruct the original array from the - /// unique array. Only provided if return_inverse is True. - /// unique_counts - /// The number of times each of the unique values comes up in the - /// original array. Only provided if return_counts is True. - /// - public (NDarray, NDarray, NDarray, NDarray) unique(bool? return_index = false, bool? return_inverse = false, bool? return_counts = false, int? axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.unique(@this, return_index:return_index, return_inverse:return_inverse, return_counts:return_counts, axis:axis); - } - - /// - /// 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(int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.flip(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fliplr(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.flipud(@this); - } - - /// - /// 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, int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.roll(@this, shift, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rot90(@this, k, axes); - } - - /// - /// 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 @this=this; - return NumPy.Instance.bitwise_and(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.bitwise_or(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.bitwise_xor(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.invert(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.right_shift(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.packbits(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.unpackbits(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.min_scalar_type(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.common_type(@this, array1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.i0(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fv(@this, nper, pmt, pv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.pv(@this, nper, pmt, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.pmt(@this, nper, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - NumPy.Instance.ppmt(@this, per, nper, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ipmt(@this, per, nper, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.irr(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.mirr(@this, finance_rate, reinvest_rate); - } - - /// - /// 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 @this=this; - NumPy.Instance.nper(@this, pmt, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - NumPy.Instance.rate(@this, pmt, pv, fv, @when:@when, guess:guess, tol:tol, maxiter:maxiter); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nonzero(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.@where(@this, y, x); - } - - /// - /// 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 @this=this; - return NumPy.Instance.unravel_index(@this, shape, order:order); - } - - /// - /// 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 @this=this; - NumPy.Instance.diag_indices_from(@this); - } - - /// - /// 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 @this=this; - NumPy.Instance.tril_indices_from(@this, k:k); - } - - /// - /// 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 @this=this; - return NumPy.Instance.triu_indices_from(@this, k:k); - } - - /// - /// 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 void take_along_axis(NDarray indices, int axis) - { - //auto-generated code, do not change - var @this=this; - NumPy.Instance.take_along_axis(@this, indices, axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.diagonal(@this, offset:offset, axis1:axis1, axis2:axis2); - } - - /// - /// 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 @this=this; - NumPy.Instance.place(@this, mask, vals); - } - - /// - /// 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 @this=this; - NumPy.Instance.put(@this, ind, v, mode:mode); - } - - /// - /// 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 @this=this; - NumPy.Instance.put_along_axis(@this, indices, values, axis); - } - - /// - /// 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 @this=this; - NumPy.Instance.putmask(@this, mask, values); - } - - /// - /// 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 @this=this; - NumPy.Instance.fill_diagonal(@this, val, wrap); - } - - /* - /// - /// 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 @this=this; - NumPy.Instance.nditer(@this, flags:flags, op_flags:op_flags, op_dtypes:op_dtypes, order:order, casting:casting, op_axes:op_axes, itershape:itershape, buffersize:buffersize); - } - */ - - /// - /// Multidimensional index iterator. - /// - /// Return an iterator yielding pairs of array coordinates and values. - /// - public void ndenumerate() - { - //auto-generated code, do not change - var @this=this; - NumPy.Instance.ndenumerate(@this); - } - - /* - /// - /// 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(int[] axes = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nested_iters(@this, axes); - } - */ - - /* - /// - /// 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 @this=this; - return NumPy.Instance.array2string(@this, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small, separator:separator, prefix:prefix, suffix:suffix, formatter:formatter, threshold:threshold, edgeitems:edgeitems, sign:sign, floatmode:floatmode, legacy:legacy); - } - */ - - /// - /// 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 @this=this; - return NumPy.Instance.array_repr(@this, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); - } - - /// - /// 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 @this=this; - NumPy.Instance.array_str(@this, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); - } - - /// - /// 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 @this=this; - return NumPy.Instance.dot(@this, b, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.vdot(@this, b); - } - - /// - /// 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 @this=this; - return NumPy.Instance.inner(@this, a); - } - - /// - /// 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 @this=this; - return NumPy.Instance.outer(@this, b, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.matmul(@this, x1, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tensordot(@this, a, axes); - } - - /// - /// 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 @this=this; - return NumPy.Instance.kron(@this, a); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trace(@this, offset:offset, axis2:axis2, axis1:axis1, dtype:dtype, @out:@out); - } - - /// - /// 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(int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.all(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// 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 @this=this; - return NumPy.Instance.all(@this); - } - - /// - /// 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(int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.any(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// 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 @this=this; - return NumPy.Instance.any(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isfinite(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isinf(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isnan(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isnat(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isneginf(@this, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isposinf(@this, y:y); - } - - /// - /// 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 @this=this; - return NumPy.Instance.iscomplex(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isfortran(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isreal(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_and(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_or(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_not(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_xor(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.allclose(@this, a, rtol, atol, equal_nan); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isclose(@this, a, rtol, atol, equal_nan); - } - - /// - /// 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 @this=this; - return NumPy.Instance.array_equal(@this, a1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.array_equiv(@this, a1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.greater(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.greater_equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.less(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.less_equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.not_equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sin(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cos(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tan(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arcsin(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arccos(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arctan(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.hypot(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arctan2(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.degrees(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.radians(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.unwrap(@this, discont:discont, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.deg2rad(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rad2deg(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sinh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cosh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tanh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arcsinh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arccosh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arctanh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.around(@this, decimals:decimals, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rint(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fix(@this, y:y); - } - - /// - /// 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 @this=this; - return NumPy.Instance.floor(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ceil(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trunc(@this, @out:@out, @where:@where); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.prod(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.sum(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanprod(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nansum(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cumprod(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cumsum(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nancumprod(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nancumsum(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.diff(@this, n:n, axis:axis, append:append, prepend:prepend); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ediff1d(@this, to_end:to_end, to_begin:to_begin); - } - - /// - /// 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, int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.gradient(@this, varargs:varargs, edge_order:edge_order, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cross(@this, b, axisa:axisa, axisb:axisb, axisc:axisc, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trapz(@this, x:x, dx:dx, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.exp(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.expm1(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.exp2(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log10(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log2(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log1p(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logaddexp(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logaddexp2(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sinc(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.signbit(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.copysign(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.frexp(@this, out1:out1, out2:out2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ldexp(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nextafter(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.spacing(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.lcm(@this, x1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.gcd(@this, x1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.@add(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.reciprocal(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.positive(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.negative(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.multiply(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.divide(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.power(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.subtract(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.true_divide(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.floor_divide(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.float_power(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fmod(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.mod(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.modf(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.remainder(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.divmod(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.angle(@this, deg:deg); - } - - /// - /// Return the real part of the complex argument. - /// - /// - /// The real component of the complex argument. If val is real, the type - /// of val is used for the output. If val has complex elements, the - /// returned type is float. - /// - public NDarray real() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.real(@this); - } - - /// - /// Return the imaginary part of the complex argument. - /// - /// - /// The imaginary component of the complex argument. If val is real, - /// the type of val is used for the output. If val has complex - /// elements, the returned type is float. - /// - public NDarray imag() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.imag(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.conj(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.convolve(@this, v, mode:mode); - } - - /// - /// 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 @this=this; - return NumPy.Instance.clip(@this, a_min, a_max, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sqrt(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cbrt(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.square(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.absolute(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fabs(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sign(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.heaviside(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.maximum(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.minimum(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fmax(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fmin(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nan_to_num(@this, copy:copy); - } - - /// - /// 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 @this=this; - return NumPy.Instance.real_if_close(@this, tol); - } - - /* - /// - /// One-dimensional linear interpolation. - /// - /// Returns the one-dimensional piecewise linear interpolant to a function - /// with given discrete data points (xp, fp), evaluated at x. - /// - /// Notes - /// - /// Does not check that the x-coordinate sequence xp is increasing. - /// If xp is not increasing, the results are nonsense. - /// A simple check for increasing is: - /// - /// - /// The x-coordinates of the data points, must be increasing if argument - /// period is not specified. Otherwise, xp is internally sorted after - /// normalizing the periodic boundaries with xp = xp % period. - /// - /// - /// The y-coordinates of the data points, same length as xp. - /// - /// - /// Value to return for x < xp[0], default is fp[0]. - /// - /// - /// Value to return for x > xp[-1], default is fp[-1]. - /// - /// - /// A period for the x-coordinates. This parameter allows the proper - /// interpolation of angular x-coordinates. Parameters left and right - /// are ignored if period is specified. - /// - /// - /// The interpolated values, same shape as x. - /// - public float or complex (corresponding to fp) or ndarray interp(1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.interp(@this, xp, fp, left:left, right:right, period:period); - } - */ - - /// - /// Pads an array. - /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes. This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis. - /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced. It has the - /// following signature: - /// - /// where - /// - /// - /// Number of values padded to the edges of each axis. - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis. - /// ((before, after),) yields same before and after pad for each axis. - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. - /// - /// - /// One of the following string values or a user supplied function. - /// - /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis. - /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis. - /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes. - /// - /// Default is None, to use the entire axis. - /// - /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis. - /// - /// ((before, after),) yields same before and after constants for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis. - /// - /// ((before, after),) yields same before and after end values for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value. For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. - /// - /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. - /// - public NDarray pad(NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.pad(@this, pad_width, mode, stat_length:stat_length, constant_values:constant_values, end_values:end_values, reflect_type:reflect_type); - } - - /// - /// Test whether each element of a 1-D array is also present in a second array. - /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise. - /// - /// We recommend using isin instead of in1d for new code. - /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences. in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]). - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. - /// - /// - /// The values against which to test each value of ar1. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise). - /// Default is False. np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). - /// - /// - /// The values ar1[in1d] are in ar2. - /// - public NDarray in1d(NDarray ar2, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.in1d(@this, ar2, assume_unique:assume_unique, invert:invert); - } - - /// - /// Find the intersection of two arrays. - /// - /// Return the sorted, unique values that are in both of the input arrays. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned. The first instance of a value is used if there are - /// multiple. Default is False. - /// - /// - /// A tuple of: - /// intersect1d - /// Sorted 1D array of common and unique elements. - /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. - /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. - /// - public (NDarray, NDarray, NDarray) intersect1d(NDarray ar1, bool assume_unique = false, bool return_indices = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.intersect1d(@this, ar1, assume_unique, return_indices); - } - - /// - /// Calculates element in test_elements, broadcasting over element only. - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise. - /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in. - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences. - /// - /// element and test_elements are converted to arrays if they are not - /// already. If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements. This is a consequence - /// of the array constructor’s way of handling non-sequence collections. - /// Converting the set to a list usually gives the desired behavior. - /// - /// - /// The values against which to test each value of element. - /// This argument is flattened if it is an array or array_like. - /// See notes for behavior with non-array-like parameters. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements. Default is False. - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). - /// - /// - /// Has the same shape as element. The values element[isin] - /// are in test_elements. - /// - public NDarray isin(NDarray test_elements, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.isin(@this, test_elements, assume_unique:assume_unique, invert:invert); - } - - /// - /// Find the set difference of two arrays. - /// - /// Return the unique values in ar1 that are not in ar2. - /// - /// - /// Input comparison array. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. - /// - public NDarray setdiff1d(NDarray ar2, bool assume_unique = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.setdiff1d(@this, ar2, assume_unique); - } - - /// - /// Find the set exclusive-or of two arrays. - /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. - /// - /// - /// Input arrays. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. - /// - public NDarray setxor1d(NDarray ar1, bool assume_unique = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.setxor1d(@this, ar1, assume_unique); - } - - /// - /// Find the union of two arrays. - /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Unique, sorted union of the input arrays. - /// - public NDarray union1d(NDarray ar1) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.union1d(@this, ar1); - } - - /// - /// Return a sorted copy of an array. - /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable. A - /// stable sort keeps items with the same key in the same relative - /// order. The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis. Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts. - /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour. In numpy versions >= 1.4.0 nan - /// values are sorted to the end. The extended sort order is: - /// - /// where R is a non-nan real value. Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists. - /// Non-nan values are sorted as before. - /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress. This makes its - /// worst case O(n*log(n)). - /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted. It is currently mapped to - /// merge sort. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray sort(int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.sort(@this, axis:axis, kind:kind, order:order); - } - - /// - /// Perform an indirect stable sort using a sequence of keys. - /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns. The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on. The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape. If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. - /// - /// - /// Axis to be indirectly sorted. By default, sort over the last axis. - /// - /// - /// Array of indices that sort the keys along the specified axis. - /// - public NDarray lexsort(int? axis = -1) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.lexsort(@this, axis:axis); - } - - /// - /// Returns the indices that would sort an array. - /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword. It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If None, - /// the flattened array is used. - /// - /// - /// Sorting algorithm. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of indices that sort a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a sorted a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. - /// - public NDarray argsort(int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argsort(@this, axis:axis, kind:kind, order:order); - } - - /// - /// Return a copy of an array sorted along the first axis. - /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray msort() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.msort(@this); - } - - /// - /// Sort a complex array using the real part first, then the imaginary part. - /// - /// - /// Always returns a sorted complex array. - /// - public NDarray sort_complex() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.sort_complex(@this); - } - - /// - /// Return a partitioned copy of an array. - /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array. All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it. The ordering of the elements in the two - /// partitions is undefined. - /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable. A stable sort keeps items with the same key in the same - /// relative order. The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis. Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. - /// - /// - /// Element index to partition by. The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it. The order of all elements in the partitions is undefined. If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Selection algorithm. Default is ‘introselect’. - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string. Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray partition(int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.partition(@this, kth, axis:axis, kind:kind, order:order); - } - - /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword. It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order. - /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. - /// - /// - /// Element index to partition by. The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it. The order all - /// elements in the partitions is undefined. If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If - /// None, the flattened array is used. - /// - /// - /// Selection algorithm. Default is ‘introselect’ - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of indices that partition a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a partitioned a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. - /// - public NDarray argpartition(int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argpartition(@this, kth, axis:axis, kind:kind, order:order); - } - - /// - /// Returns the indices of the maximum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmax(int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argmax(@this, axis:axis, @out:@out); - } - - /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmax(int? axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanargmax(@this, axis:axis); - } - - /// - /// Returns the indices of the minimum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmin(int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argmin(@this, axis:axis, @out:@out); - } - - /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmin(int? axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanargmin(@this, axis:axis); - } - - /// - /// Find the indices of array elements that are non-zero, grouped by element. - /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)). - /// - /// The output of argwhere is not suitable for indexing arrays. - /// For this purpose use nonzero(a) instead. - /// - /// - /// Indices of elements that are non-zero. Indices are grouped by element. - /// - public NDarray argwhere() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argwhere(@this); - } - - /// - /// Return indices that are non-zero in the flattened version of a. - /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. - /// - /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. - /// - public NDarray flatnonzero() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.flatnonzero(@this); - } - - /// - /// Find indices where elements should be inserted to maintain order. - /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved. - /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points. - /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. - /// - /// - /// Values to insert into a. - /// - /// - /// If ‘left’, the index of the first suitable location found is given. - /// If ‘right’, return the last such index. If there is no suitable - /// index, return either 0 or N (where N is the length of a). - /// - /// - /// Optional array of integer indices that sort array a into ascending - /// order. They are typically the result of argsort. - /// - /// - /// Array of insertion points with the same shape as v. - /// - public NDarray searchsorted(NDarray v, string side = "left", NDarray sorter = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.searchsorted(@this, v, side:side, sorter:sorter); - } - - /// - /// Return the elements of an array that satisfy some condition. - /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)). If - /// condition is boolean np.extract is equivalent to arr[condition]. - /// - /// Note that place does the exact opposite of extract. - /// - /// - /// Input array of the same size as condition. - /// - /// - /// Rank 1 array of values from arr where condition is True. - /// - public NDarray extract(NDarray arr) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.extract(@this, arr); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// Axis or tuple of axes along which to count non-zeros. - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public NDarray count_nonzero(int[] axis) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.count_nonzero(@this, axis:axis); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public int count_nonzero() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.count_nonzero(@this); - } - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amin(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.amin(@this, axis:axis, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amax(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.amax(@this, axis:axis, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs. - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.min. - /// - /// - /// Axis or axes along which the minimum is computed. The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis - /// removed. If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned. The same dtype as a is returned. - /// - public NDarray nanmin(int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmin(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs. When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.max. - /// - /// - /// Axis or axes along which the maximum is computed. The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis removed. - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned. The same dtype as a is returned. - /// - public NDarray nanmax(int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmax(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// Range of values (maximum - minimum) along an axis. - /// - /// The name of the function comes from the acronym for ‘peak to peak’. - /// - /// - /// Axis along which to find the peaks. By default, flatten the - /// array. axis may be negative, in - /// which case it counts from the last to the first axis. - /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. - /// - public NDarray ptp(int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.ptp(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray percentile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.percentile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double percentile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.percentile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanpercentile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanpercentile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanpercentile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanpercentile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray quantile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.quantile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double quantile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.quantile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanquantile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanquantile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanquantile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanquantile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original arr. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray median(int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.median(@this, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double median(NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.median(@this, @out:@out, overwrite_input:overwrite_input); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Axis or axes along which to average a. The default, - /// axis=None, will average over all of the elements of the input array. - /// If axis is negative it counts from the last to the first axis. - /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public NDarray average(int[] axis, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.average(@this, axis:axis, weights:weights, returned:returned); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public double average(NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.average(@this, weights:weights, returned:returned); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Axis or axes along which the means are computed. The default is to - /// compute the mean of the flattened array. - /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public NDarray mean(int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.mean(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public double mean(Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.mean(@this, dtype:dtype, @out:@out); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Axis or axes along which the standard deviation is computed. The - /// default is to compute the standard deviation of the flattened array. - /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public NDarray std(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.std(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public double std(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.std(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Axis or axes along which the variance is computed. The default is to - /// compute the variance of the flattened array. - /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public NDarray @var(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.@var(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public double @var(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.@var(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanmedian(int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmedian(@this, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanmedian(NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmedian(@this, @out:@out, overwrite_input:overwrite_input); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Axis or axes along which the means are computed. The default is to compute - /// the mean of the flattened array. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public NDarray nanmean(int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmean(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public double nanmean(Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmean(@this, dtype:dtype, @out:@out); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Axis or axes along which the standard deviation is computed. The default is - /// to compute the standard deviation of the flattened array. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes. If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public NDarray nanstd(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanstd(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public double nanstd(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanstd(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Axis or axes along which the variance is computed. The default is to compute - /// the variance of the flattened array. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public NDarray nanvar(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanvar(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public double nanvar(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanvar(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Return Pearson product-moment correlation coefficients. - /// - /// Please refer to the documentation for cov for more detail. The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive. - /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1. The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case. - /// - /// This function accepts but discards arguments bias and ddof. This is - /// for backwards compatibility with previous versions of this function. These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. - /// - /// - /// An additional set of variables and observations. y has the same - /// shape as x. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// The correlation coefficient matrix of the variables. - /// - public NDarray corrcoef(NDarray y = null, bool? rowvar = true) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.corrcoef(@this, y:y, rowvar:rowvar); - } - - /// - /// Cross-correlation of two 1-dimensional sequences. - /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate. - /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently. Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. - /// - /// - /// Input sequences. - /// - /// - /// Refer to the convolve docstring. Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. - /// - /// - /// Discrete cross-correlation of a and v. - /// - public NDarray correlate(NDarray a, string mode = "valid") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.correlate(@this, a, mode:mode); - } - - /// - /// Estimate a covariance matrix, given data and weights. - /// - /// Covariance indicates the level to which two variables vary together. - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm. - /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity. The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. - /// - /// - /// An additional set of variables and observations. y has the same form - /// as that of m. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate). If bias is True, - /// then normalization is by N. These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. - /// - /// - /// If not None the default value implied by bias is overridden. - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average. See the notes for the details. The default value - /// is None. - /// - /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. - /// - /// - /// 1-D array of observation vector weights. These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. - /// - /// - /// The covariance matrix of the variables. - /// - public NDarray cov(NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.cov(@this, y:y, rowvar:rowvar, bias:bias, ddof:ddof, fweights:fweights, aweights:aweights); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram(@this, bins:bins, range:range, normed:normed, weights:weights, density:density); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram(@this, bins:bins, range:range, normed:normed, weights:weights, density:density); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram(@this, bins:bins, range:range, normed:normed, weights:weights, density:density); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram2d(@this, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram2d(@this, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram2d(@this, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogramdd(@this, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogramdd(@this, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogramdd(@this, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Count number of occurrences of each value in array of non-negative ints. - /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x. If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x). - /// Each bin gives the number of occurrences of its index value in x. - /// If weights is specified the input array is weighted by it, i.e. if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. - /// - /// - /// Weights, array of the same shape as x. - /// - /// - /// A minimum number of bins for the output array. - /// - /// - /// The result of binning the input array. - /// The length of out is equal to np.amax(x)+1. - /// - public NDarray bincount(NDarray weights = null, int? minlength = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.bincount(@this, weights:weights, minlength:minlength); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(int? bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram_bin_edges(@this, bins:bins, range:range, weights:weights); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram_bin_edges(@this, bins:bins, range:range, weights:weights); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(List bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram_bin_edges(@this, bins:bins, range:range, weights:weights); - } - - /// - /// Return the indices of the bins to which each value in input array belongs. - /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate. - /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError. - /// - /// np.digitize is implemented in terms of np.searchsorted. This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search. It also removes - /// the requirement for the input array to be 1-dimensional. - /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too. - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks. Perhaps more importantly, it supports all dtypes. - /// - /// - /// Array of bins. It has to be 1-dimensional and monotonic. - /// - /// - /// Indicating whether the intervals include the right or the left bin - /// edge. Default behavior is (right==False) indicating that the interval - /// does not include the right edge. The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. - /// - /// - /// Output array of indices, of same shape as x. - /// - public NDarray digitize(NDarray bins, bool? right = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.digitize(@this, bins, right:right); - } - - } -} diff --git a/src/Numpy.Bare/Models/PythonObject.cs b/src/Numpy.Bare/Models/PythonObject.cs deleted file mode 100644 index a582604..0000000 --- a/src/Numpy.Bare/Models/PythonObject.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Python.Runtime; - -namespace Numpy -{ - public partial class PythonObject : IDisposable - { - protected readonly PyObject self; - public dynamic PyObject => self; - - public IntPtr Handle => self.Handle; - - public PythonObject(PyObject pyobject) - { - this.self = pyobject; - } - - public PythonObject(PythonObject t) - { - this.self = t.PyObject; - } - - public override bool Equals(object obj) - { - if (obj == null) - return false; - switch (obj) - { - case PythonObject other: - return self.Equals(other.self); - case PyObject other: - return self.Equals(other); - } - return base.Equals(obj); - } - - public override int GetHashCode() - { - return self.GetHashCode(); - } - - public override string ToString() - { - return self.ToString(); - } - - public void Dispose() - { - self?.Dispose(); - } - - public static PythonObject Create(string python_class) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/Numpy.Bare/Models/PythonObject.gen.cs b/src/Numpy.Bare/Models/PythonObject.gen.cs deleted file mode 100644 index 018bcc0..0000000 --- a/src/Numpy.Bare/Models/PythonObject.gen.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class PythonObject - { - - - //auto-generated - protected PyTuple ToTuple(Array input) - { - var array = new PyObject[input.Length]; - for (int i = 0; i < input.Length; i++) - { - array[i]=ToPython(input.GetValue(i)); - } - return new PyTuple(array); - } - - //auto-generated - protected PyObject ToPython(object obj) - { - if (obj == null) return Runtime.GetPyNone(); - switch (obj) - { - // basic types - case int o: return new PyInt(o); - case float o: return new PyFloat(o); - case double o: return new PyFloat(o); - case string o: return new PyString(o); - case PyObject o: return o; - // sequence types - case Array o: return ToTuple(o); - // special types from 'ToPythonConversions' - case Shape o: return ToTuple(o.Dimensions); - case Slice o: return o.ToPython(); - case PythonObject o: return o.PyObject; - default: throw new NotImplementedException($"Type is not yet supported: { obj.GetType().Name}. Add it to 'ToPythonConversions'"); - } - } - - //auto-generated - protected T ToCsharp(dynamic pyobj) - { - switch (typeof(T).Name) - { - // types from 'ToCsharpConversions' - case "Dtype": return (T)(object)new Dtype(pyobj); - case "NDarray": return (T)(object)new NDarray(pyobj); - case "NDarray`1": - switch (typeof(T).GenericTypeArguments[0].Name) - { - case "Byte": return (T)(object)new NDarray(pyobj); - case "Short": return (T)(object)new NDarray(pyobj); - case "Boolean": return (T)(object)new NDarray(pyobj); - case "Int32": return (T)(object)new NDarray(pyobj); - case "Int64": return (T)(object)new NDarray(pyobj); - case "Single": return (T)(object)new NDarray(pyobj); - case "Double": return (T)(object)new NDarray(pyobj); - default: throw new NotImplementedException($"Type NDarray<{typeof(T).GenericTypeArguments[0].Name}> missing. Add it to 'ToCsharpConversions'"); - } - break; - case "Matrix": return (T)(object)new Matrix(pyobj); - default: return (T)pyobj; - } - } - - //auto-generated - protected T SharpToSharp(object obj) - { - if (obj == null) return default(T); - switch (obj) - { - // from 'SharpToSharpConversions': - case Array a: - if (typeof(T)==typeof(NDarray)) return (T)(object)ConvertArrayToNDarray(a); - break; - } - throw new NotImplementedException($"Type is not yet supported: { obj.GetType().Name}. Add it to 'SharpToSharpConversions'"); - } - - //auto-generated: SpecialConversions - protected NDarray ConvertArrayToNDarray(Array a) - { - switch(a) - { - case bool[] arr: return np.array(arr); - case int[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - case float[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - case double[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - case bool[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - default: throw new NotImplementedException($"Type {a.GetType()} not supported yet in ConvertArrayToNDarray."); - } - } - } -} diff --git a/src/Numpy.Bare/Models/Shape.cs b/src/Numpy.Bare/Models/Shape.cs deleted file mode 100644 index 9da4fbd..0000000 --- a/src/Numpy.Bare/Models/Shape.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Numpy.Models -{ - public class Shape - { - public int[] Dimensions { get; } - - public Shape(params int[] shape) - { - this.Dimensions = shape; - } - - public int this[int n] => Dimensions[n]; - - #region Equality - - public static bool operator ==(Shape a, Shape b) - { - if (b is null) return false; - return Enumerable.SequenceEqual(a.Dimensions, b?.Dimensions); - } - - public static bool operator !=(Shape a, Shape b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - if (obj.GetType() != typeof(Shape)) - return false; - return Enumerable.SequenceEqual(Dimensions, ((Shape)obj).Dimensions); - } - - public override int GetHashCode() - { - return (Dimensions??new int[0]).GetHashCode(); - } - - public override string ToString() - { - return $"({string.Join(", ", Dimensions ?? new int[0])})"; - } - - #endregion - } -} diff --git a/src/Numpy.Bare/Models/Slice.cs b/src/Numpy.Bare/Models/Slice.cs deleted file mode 100644 index 87015fd..0000000 --- a/src/Numpy.Bare/Models/Slice.cs +++ /dev/null @@ -1,248 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using Python.Runtime; - -namespace Numpy.Models -{ - /// - /// NDArray can be indexed using slicing - /// A slice is constructed by start:stop:step notation - /// - /// Examples: - /// - /// a[start:stop] # items start through stop-1 - /// a[start:] # items start through the rest of the array - /// a[:stop] # items from the beginning through stop-1 - /// - /// The key point to remember is that the :stop value represents the first value that is not - /// in the selected slice. So, the difference between stop and start is the number of elements - /// selected (if step is 1, the default). - /// - /// There is also the step value, which can be used with any of the above: - /// a[:] # a copy of the whole array - /// a[start:stop:step] # start through not past stop, by step - /// - /// The other feature is that start or stop may be a negative number, which means it counts - /// from the end of the array instead of the beginning. So: - /// a[-1] # last item in the array - /// a[-2:] # last two items in the array - /// a[:-2] # everything except the last two items - /// Similarly, step may be a negative number: - /// - /// a[::- 1] # all items in the array, reversed - /// a[1::- 1] # the first two items, reversed - /// a[:-3:-1] # the last two items, reversed - /// a[-3::- 1] # everything except the last two items, reversed - /// - /// NumSharp is kind to the programmer if there are fewer items than - /// you ask for. For example, if you ask for a[:-2] and a only contains one element, you get an - /// empty list instead of an error.Sometimes you would prefer the error, so you have to be aware - /// that this may happen. - /// - /// Adapted from Greg Hewgill's answer on Stackoverflow: https://stackoverflow.com/questions/509211/understanding-slice-notation - /// - /// Note: special IsIndex == true - /// It will pick only a single value at Start in this dimension effectively reducing the Shape of the sliced matrix by 1 dimension. - /// It can be used to reduce an N-dimensional array/matrix to a (N-1)-dimensional array/matrix - /// - /// Example: - /// a=[[1, 2], [3, 4]] - /// a[:, 1] returns the second column of that 2x2 matrix as a 1-D vector - - /// - public class Slice - { - public int? Start { get; set; } - public int? Stop { get; set; } - public int Step { get; set; } = 1; - public bool IsIndex { get; set; } - - /// - /// Length of the slice. - /// - /// The length is not guaranteed to be known for i.e. a slice like ":". Make sure to check Start and Stop - /// for null before using it - /// - public int? Length => Stop - Start; - - /// - /// ndarray can be indexed using slicing - /// slice is constructed by start:stop:step notation - /// - /// Start index of the slice, null means from the start of the array - /// Stop index (first index after end of slice), null means to the end of the array - /// Optional step to select every n-th element, defaults to 1 - public Slice(int? start=null, int? stop=null, int step = 1) - { - Start = start; - Stop = stop; - Step = step; - } - - public Slice(string slice_notation) - { - Parse(slice_notation); - } - - /// - /// Parses Python array slice notation and returns an array of Slice objects - /// - public static Slice[] ParseSlices(string multi_slice_notation) - { - return Regex.Split(multi_slice_notation, @",\s*").Where(s=>!string.IsNullOrWhiteSpace(s)).Select(token=>new Slice(token)).ToArray(); - } - - /// - /// Creates Python array slice notation out of an array of Slice objects (mainly used for tests) - /// - public static string FormatSlices(params Slice[] slices) - { - return string.Join(",", slices.Select(s=>s.ToString())); - } - - private void Parse(string slice_notation) - { - if (string.IsNullOrEmpty(slice_notation)) - throw new ArgumentException("Slice notation expected, got empty string or null"); - var match=Regex.Match(slice_notation, @"^\s*([+-]?\s*\d+)?\s*:\s*([+-]?\s*\d+)?\s*(:\s*([+-]?\s*\d+)?)?\s*$|^\s*([+-]?\s*\d+)\s*$"); - if (!match.Success) - throw new ArgumentException("Invalid slice notation"); - var start_string = Regex.Replace(match.Groups[1].Value??"", @"\s+", ""); // removing spaces from match to be able to parse what python allows, like: "+ 1" or "- 9"; - var stop_string = Regex.Replace(match.Groups[2].Value ?? "", @"\s+", ""); - var step_string = Regex.Replace(match.Groups[4].Value ?? "", @"\s+", ""); - var single_pick_string = match.Groups[5].Value; - if (!string.IsNullOrWhiteSpace(single_pick_string)) - { - if (!int.TryParse(Regex.Replace(single_pick_string ?? "", @"\s+", ""), out var start)) - throw new ArgumentException($"Invalid value for start: {start_string}"); - Start = start; - Stop = start+1; - Step = 1; // special case for dimensionality reduction by picking a single element - IsIndex = true; - return; - } - if (string.IsNullOrWhiteSpace(start_string)) - Start = null; - else - { - if (!int.TryParse(start_string, out var start)) - throw new ArgumentException($"Invalid value for start: {start_string}"); - Start = start; - } - if (string.IsNullOrWhiteSpace(stop_string)) - Stop = null; - else - { - if (!int.TryParse(stop_string, out var stop)) - throw new ArgumentException($"Invalid value for start: {stop_string}"); - Stop = stop; - } - if (string.IsNullOrWhiteSpace(step_string)) - Step = 1; - else - { - if (!int.TryParse(step_string, out var step)) - throw new ArgumentException($"Invalid value for start: {step_string}"); - Step = step; - } - } - - #region Equality comparison - - public static bool operator ==(Slice a, Slice b) - { - if (a == null && b == null) - return true; - if (b is null) return false; - if (a is null) return false; - return a.Start == b.Start && a.Stop == b.Stop && a.Step == b.Step; - } - - public static bool operator !=(Slice a, Slice b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - if (obj == null) - return false; - if (obj.GetType() != typeof(Slice)) - return false; - var a = this; - var b = (Slice)obj; - return a.Start == b.Start && a.Stop == b.Stop && a.Step == b.Step; - } - - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - - #endregion - - public static Slice All() - { - return new Slice(null, null); - } - - public static Slice Index(int index) - { - return new Slice(index, index + 1) { IsIndex = true }; - } - - public override string ToString() - { - if (IsIndex) - return $"{Start ?? 0}"; - var optional_step = Step == 1 ? "" : $":{Step}"; - return $"{(Start == 0 ? "" : Start.ToString())}:{(Stop == null ? "" : Stop.ToString())}{optional_step}"; - } - - // return the size of the slice, given the data dimension on this axiy - public int GetSize(int dim) - { - var absStart = GetAbsStart(dim); - var absStop = GetAbsStop(dim); - var absStep = GetAbsStep(); - return ((absStop - absStart)+(absStep-1)) / absStep; - } - - public int GetAbsStep() - { - return Math.Abs(Step); - } - public int GetAbsStart(int dim) - { - // Note: No handling of out of range - var absStartN = Start < 0 ? dim + Start : Start; - var absStart = Step < 0 ? (absStartN ?? dim) : (absStartN ?? 0); - return absStart; - } - - public int GetAbsStop(int dim) - { - // Note: No handling of out of range - var absStopN = Stop < 0 ? dim + Stop : Stop; - var absStop = Step < 0 ? (absStopN ?? 0) : (absStopN ?? dim); - return absStop; - } - - public PyObject ToPython() - { - var inst=NumPy.Instance; // <--- this is important, to make sure PythonEngine is initialized! - var f = new Func(FormatNullableIntForPython); - return PythonEngine.Eval($"slice({f(Start)},{f(Stop)},{f(Step)})"); - } - - protected string FormatNullableIntForPython(int? i) - { - if (i == null) - return "None"; - return i.Value.ToString(); - } - } -} diff --git a/src/Numpy.Bare/NumPy.array_creation.gen.cs b/src/Numpy.Bare/NumPy.array_creation.gen.cs deleted file mode 100644 index 0640d3f..0000000 --- a/src/Numpy.Bare/NumPy.array_creation.gen.cs +++ /dev/null @@ -1,3768 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return a new array of given shape and type, without initializing entries. - /// - /// Notes - /// - /// empty, unlike zeros, does not set the array values to zero, - /// and may therefore be marginally faster. On the other hand, it requires - /// the user to manually set all the values in the array, and should be - /// used with caution. - /// - /// - /// Shape of the empty array, e.g., (2, 3) or 2. - /// - /// - /// Desired output data-type for the array, e.g, numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of uninitialized (arbitrary) data of the given shape, dtype, and - /// order. Object arrays will be initialized to None. - /// - public NDarray empty(Shape shape, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("empty", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public NDarray empty_like(NDarray prototype, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - prototype, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public NDarray empty_like(T[] prototype, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(prototype), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public NDarray empty_like(T[,] prototype, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(prototype), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a 2-D array with ones on the diagonal and zeros elsewhere. - /// - /// - /// Number of rows in the output. - /// - /// - /// Number of columns in the output. If None, defaults to N. - /// - /// - /// Index of the diagonal: 0 (the default) refers to the main diagonal, - /// a positive value refers to an upper diagonal, and a negative value - /// to a lower diagonal. - /// - /// - /// Data-type of the returned array. - /// - /// - /// Whether the output should be stored in row-major (C-style) or - /// column-major (Fortran-style) order in memory. - /// - /// - /// An array where all elements are equal to zero, except for the k-th - /// diagonal, whose values are equal to one. - /// - public NDarray eye(int N, int? M = null, int? k = 0, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - N, - }); - var kwargs=new PyDict(); - if (M!=null) kwargs["M"]=ToPython(M); - if (k!=0) kwargs["k"]=ToPython(k); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("eye", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the identity array. - /// - /// The identity array is a square array with ones on - /// the main diagonal. - /// - /// - /// Number of rows (and columns) in n x n output. - /// - /// - /// Data-type of the output. Defaults to float. - /// - /// - /// n x n array with its main diagonal set to one, - /// and all other elements 0. - /// - public NDarray identity(int n, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("identity", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array of given shape and type, filled with ones. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of ones with the given shape, dtype, and order. - /// - public NDarray ones(Shape shape, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ones", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public NDarray ones_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public NDarray ones_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public NDarray ones_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a new array of given shape and type, filled with zeros. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of zeros with the given shape, dtype, and order. - /// - public NDarray zeros(Shape shape, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("zeros", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public NDarray zeros_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public NDarray zeros_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public NDarray zeros_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a new array of given shape and type, filled with fill_value. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// Fill value. - /// - /// - /// Whether to store multidimensional data in C- or Fortran-contiguous - /// (row- or column-wise) order in memory. - /// - /// - /// Array of fill_value with the given shape, dtype, and order. - /// - public NDarray full(Shape shape, ValueType fill_value, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("full", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public NDarray full_like(NDarray a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public NDarray full_like(T[] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public NDarray full_like(T[,] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public NDarray asarray(NDarray a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public NDarray asarray(T[] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public NDarray asarray(T[,] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public NDarray asanyarray(NDarray a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public NDarray asanyarray(T[] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public NDarray asanyarray(T[,] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public NDarray ascontiguousarray(NDarray a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public NDarray ascontiguousarray(T[] a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public NDarray ascontiguousarray(T[,] a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix asmatrix(NDarray data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - data, - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix asmatrix(T[] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix asmatrix(T[,] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public NDarray copy(NDarray a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public NDarray copy(T[] a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public NDarray copy(T[,] a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); - return ToCsharp>(py); - } - - /* - /// - /// Interpret a buffer as a 1-dimensional array. - /// - /// Notes - /// - /// If the buffer has data that is not in machine byte-order, this should - /// be specified as part of the data-type, e.g.: - /// - /// The data of the resulting array will not be byteswapped, but will be - /// interpreted correctly. - /// - /// - /// An object that exposes the buffer interface. - /// - /// - /// Data-type of the returned array; default: float. - /// - /// - /// Number of items to read. -1 means all data in the buffer. - /// - /// - /// Start reading the buffer from this offset (in bytes); default: 0. - /// - public void frombuffer(buffer_like buffer, Dtype dtype = null, int? count = -1, int? offset = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - buffer, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (count!=-1) kwargs["count"]=ToPython(count); - if (offset!=0) kwargs["offset"]=ToPython(offset); - dynamic py = __self__.InvokeMethod("frombuffer", pyargs, kwargs); - } - */ - - /// - /// Construct an array from data in a text or binary file. - /// - /// A highly efficient way of reading binary data with a known data-type, - /// as well as parsing simply formatted text files. Data written using the - /// tofile method can be read using this function. - /// - /// Notes - /// - /// Do not rely on the combination of tofile and fromfile for - /// data storage, as the binary files generated are are not platform - /// independent. In particular, no byte-order or data-type information is - /// saved. Data can be stored in the platform independent .npy format - /// using save and load instead. - /// - /// - /// Open file object or filename. - /// - /// - /// Data type of the returned array. - /// For binary files, it is used to determine the size and byte-order - /// of the items in the file. - /// - /// - /// Number of items to read. -1 means all items (i.e., the complete - /// file). - /// - /// - /// Separator between items if file is a text file. - /// Empty (“”) separator means the file should be treated as binary. - /// Spaces (” “) in the separator match zero or more whitespace characters. - /// A separator consisting only of spaces must match at least one - /// whitespace. - /// - public void fromfile(string file, Dtype dtype = null, int count = -1, string sep = "") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - dtype, - count, - sep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("fromfile", pyargs, kwargs); - } - - /// - /// Construct an array by executing a function over each coordinate. - /// - /// The resulting array therefore has a value fn(x, y, z) at - /// coordinate (x, y, z). - /// - /// Notes - /// - /// Keywords other than dtype are passed to function. - /// - /// - /// The function is called with N parameters, where N is the rank of - /// shape. Each parameter represents the coordinates of the array - /// varying along a specific axis. For example, if shape - /// were (2, 2), then the parameters would be - /// array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]]) - /// - /// - /// Shape of the output array, which also determines the shape of - /// the coordinate arrays passed to function. - /// - /// - /// Data-type of the coordinate arrays passed to function. - /// By default, dtype is float. - /// - /// - /// The result of the call to function is passed back directly. - /// Therefore the shape of fromfunction is completely determined by - /// function. If function returns a scalar value, the shape of - /// fromfunction would not match the shape parameter. - /// - public object fromfunction(Delegate function, Shape shape, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - function, - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("fromfunction", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a new 1-dimensional array from an iterable object. - /// - /// Notes - /// - /// Specify count to improve performance. It allows fromiter to - /// pre-allocate the output array, instead of resizing it on demand. - /// - /// - /// An iterable object providing data for the array. - /// - /// - /// The data-type of the returned array. - /// - /// - /// The number of items to read from iterable. The default is -1, - /// which means all data is read. - /// - /// - /// The output array. - /// - public NDarray fromiter(IEnumerable iterable, Dtype dtype, int? count = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - iterable, - dtype, - }); - var kwargs=new PyDict(); - if (count!=-1) kwargs["count"]=ToPython(count); - dynamic py = __self__.InvokeMethod("fromiter", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// A new 1-D array initialized from text data in a string. - /// - /// - /// A string containing the data. - /// - /// - /// The data type of the array; default: float. For binary input data, - /// the data must be in exactly this format. - /// - /// - /// Read this number of dtype elements from the data. If this is - /// negative (the default), the count will be determined from the - /// length of the data. - /// - /// - /// The string separating numbers in the data; extra whitespace between - /// elements is also ignored. - /// - /// - /// The constructed array. - /// - public NDarray fromstring(string @string, Dtype dtype = null, int? count = -1, string sep = "") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - @string, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (count!=-1) kwargs["count"]=ToPython(count); - if (sep!="") kwargs["sep"]=ToPython(sep); - dynamic py = __self__.InvokeMethod("fromstring", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Load data from a text file. - /// - /// Each row in the text file must have the same number of values. - /// - /// Notes - /// - /// This function aims to be a fast reader for simply formatted files. The - /// genfromtxt function provides more sophisticated handling of, e.g., - /// lines with missing values. - /// - /// The strings produced by the Python float.hex method can be used as - /// input for floats. - /// - /// - /// File, filename, or generator to read. If the filename extension is - /// .gz or .bz2, the file is first decompressed. Note that - /// generators should return byte strings for Python 3k. - /// - /// - /// Data-type of the resulting array; default: float. If this is a - /// structured data-type, the resulting array will be 1-dimensional, and - /// each row will be interpreted as an element of the array. In this - /// case, the number of columns used must match the number of fields in - /// the data-type. - /// - /// - /// The characters or list of characters used to indicate the start of a - /// comment. None implies no comments. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is ‘#’. - /// - /// - /// The string used to separate values. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is whitespace. - /// - /// - /// A dictionary mapping column number to a function that will parse the - /// column string into the desired value. E.g., if column 0 is a date - /// string: converters = {0: datestr2num}. Converters can also be - /// used to provide a default value for missing data (but see also - /// genfromtxt): converters = {3: lambda s: float(s.strip() or 0)}. - /// Default: None. - /// - /// - /// Skip the first skiprows lines; default: 0. - /// - /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1,4,5) will extract the 2nd, 5th and 6th columns. - /// The default, None, results in all columns being read. - /// - /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...). When used with a structured - /// data-type, arrays are returned for each field. Default is False. - /// - /// - /// The returned array will have at least ndmin dimensions. - /// Otherwise mono-dimensional axes will be squeezed. - /// Legal values: 0 (default), 1 or 2. - /// - /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// The special value ‘bytes’ enables backward compatibility workarounds - /// that ensures you receive byte arrays as results if possible and passes - /// ‘latin1’ encoded strings to converters. Override this value to receive - /// unicode arrays and pass strings as input to converters. If set to None - /// the system default is used. The default value is ‘bytes’. - /// - /// - /// Read max_rows lines of content after skiprows lines. The default - /// is to read all the lines. - /// - /// - /// Data read from the text file. - /// - public NDarray loadtxt(string fname, Dtype dtype = null, string[] comments = null, string delimiter = null, Hashtable converters = null, int? skiprows = 0, int[] usecols = null, bool? unpack = false, int? ndmin = 0, string encoding = "bytes", int? max_rows = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fname, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (comments!=null) kwargs["comments"]=ToPython(comments); - if (delimiter!=null) kwargs["delimiter"]=ToPython(delimiter); - if (converters!=null) kwargs["converters"]=ToPython(converters); - if (skiprows!=0) kwargs["skiprows"]=ToPython(skiprows); - if (usecols!=null) kwargs["usecols"]=ToPython(usecols); - if (unpack!=false) kwargs["unpack"]=ToPython(unpack); - if (ndmin!=0) kwargs["ndmin"]=ToPython(ndmin); - if (encoding!="bytes") kwargs["encoding"]=ToPython(encoding); - if (max_rows!=null) kwargs["max_rows"]=ToPython(max_rows); - dynamic py = __self__.InvokeMethod("loadtxt", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a chararray. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy - /// will only be made if __array__ returns a copy, if obj is a - /// nested sequence, or if a copy is needed to satisfy any of the other - /// requirements (itemsize, unicode, order, etc.). - /// - /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. - /// - /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). If order is ‘A’, then the returned array may - /// be in any order (either C-, Fortran-contiguous, or even - /// discontiguous). - /// - public void core_defchararray_array(string[] obj, int? itemsize = null, bool? copy = true, bool? unicode = null, string order = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (copy!=true) kwargs["copy"]=ToPython(copy); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("array", pyargs, kwargs); - } - - /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. - /// - /// - /// Shape of the array. - /// - /// - /// Length of each array element, in number of characters. Default is 1. - /// - /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. - /// - /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. - /// - /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. - /// - /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. - /// - /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. - /// - public void chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (buffer!=null) kwargs["buffer"]=ToPython(buffer); - if (offset!=null) kwargs["offset"]=ToPython(offset); - if (strides!=null) kwargs["strides"]=ToPython(strides); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("chararray", pyargs, kwargs); - } - - /// - /// Convert the input to a chararray, copying the data only if - /// necessary. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. - /// - /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. - /// - /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). - /// - public void core_defchararray_asarray(string[] obj, int? itemsize = null, bool? unicode = null, string order = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(byte start, byte stop, byte step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(byte stop, byte step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(short start, short stop, short step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(short stop, short step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(int start, int stop, int step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(int stop, int step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(long start, long stop, long step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(long stop, long step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(float start, float stop, float step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(float stop, float step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(double start, double stop, double step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(double stop, double step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced numbers over a specified interval. - /// - /// Returns num evenly spaced samples, calculated over the - /// interval [start, stop]. - /// - /// The endpoint of the interval can optionally be excluded. - /// - /// - /// The starting value of the sequence. - /// - /// - /// The end value of the sequence, unless endpoint is set to False. - /// In that case, the sequence consists of all but the last of num + 1 - /// evenly spaced samples, so that stop is excluded. Note that the step - /// size changes when endpoint is False. - /// - /// - /// Number of samples to generate. Default is 50. Must be non-negative. - /// - /// - /// If True, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// If True, return (samples, step), where step is the spacing - /// between samples. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// A tuple of: - /// samples - /// There are num equally spaced samples in the closed interval - /// [start, stop] or the half-open interval [start, stop) - /// (depending on whether endpoint is True or False). - /// step - /// Only returned if retstep is True - /// - /// Size of spacing between samples. - /// - public (NDarray, float) linspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, bool? retstep = false, Dtype dtype = null, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (num!=50) kwargs["num"]=ToPython(num); - if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); - if (retstep!=false) kwargs["retstep"]=ToPython(retstep); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("linspace", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Return numbers spaced evenly on a log scale. - /// - /// In linear space, the sequence starts at base ** start - /// (base to the power of start) and ends with base ** stop - /// (see endpoint below). - /// - /// Notes - /// - /// Logspace is equivalent to the code - /// - /// - /// base ** start is the starting value of the sequence. - /// - /// - /// base ** stop is the final value of the sequence, unless endpoint - /// is False. In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. - /// - /// - /// Number of samples to generate. Default is 50. - /// - /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// The base of the log space. The step size between the elements in - /// ln(samples) / ln(base) (or log_base(samples)) is uniform. - /// Default is 10.0. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// num samples, equally spaced on a log scale. - /// - public NDarray logspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, float? @base = 10.0f, Dtype dtype = null, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (num!=50) kwargs["num"]=ToPython(num); - if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); - if (@base!=10.0f) kwargs["base"]=ToPython(@base); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("logspace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return numbers spaced evenly on a log scale (a geometric progression). - /// - /// This is similar to logspace, but with endpoints specified directly. - /// Each output sample is a constant multiple of the previous. - /// - /// Notes - /// - /// If the inputs or dtype are complex, the output will follow a logarithmic - /// spiral in the complex plane. (There are an infinite number of spirals - /// passing through two points; the output will follow the shortest such path.) - /// - /// - /// The starting value of the sequence. - /// - /// - /// The final value of the sequence, unless endpoint is False. - /// In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. - /// - /// - /// Number of samples to generate. Default is 50. - /// - /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// num samples, equally spaced on a log scale. - /// - public NDarray geomspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, Dtype dtype = null, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (num!=50) kwargs["num"]=ToPython(num); - if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("geomspace", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(NDarray x2, NDarray x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - x1, - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[,] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - x1, - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(NDarray x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(NDarray x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[,] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[,] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /// - /// nd_grid instance which returns a dense multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an dense - /// (or fleshed out) mesh-grid when indexed, so that each returned argument - /// has the same shape. The dimensions and number of the output arrays are - /// equal to the number of indexing dimensions. If the step length is not a - /// complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public void mgrid() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("mgrid"); - } - - /* - /// - /// nd_grid instance which returns an open multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an open - /// (i.e. not fleshed out) mesh-grid when indexed, so that only one dimension - /// of each returned array is greater than 1. The dimension and number of the - /// output arrays are equal to the number of indexing dimensions. If the step - /// length is not a complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public void ogrid(math mesh-grid `ndarrays` with only one dimension) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - mesh-grid `ndarrays` with only one dimension, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ogrid", pyargs, kwargs); - } - */ - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public NDarray diag(NDarray v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public NDarray diag(T[] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public NDarray diag(T[,] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public NDarray diagflat(NDarray v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public NDarray diagflat(T[] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public NDarray diagflat(T[,] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// An array with ones at and below the given diagonal and zeros elsewhere. - /// - /// - /// Number of rows in the array. - /// - /// - /// Number of columns in the array. - /// By default, M is taken equal to N. - /// - /// - /// The sub-diagonal at and below which the array is filled. - /// k = 0 is the main diagonal, while k < 0 is below it, - /// and k > 0 is above. The default is 0. - /// - /// - /// Data type of the returned array. The default is float. - /// - /// - /// Array with its lower triangle filled with ones and zero elsewhere; - /// in other words T[i,j] == 1 for i <= j + k, 0 otherwise. - /// - public NDarray tri(int N, int? M = null, int? k = 0, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - N, - }); - var kwargs=new PyDict(); - if (M!=null) kwargs["M"]=ToPython(M); - if (k!=0) kwargs["k"]=ToPython(k); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("tri", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public NDarray tril(NDarray m, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public NDarray tril(T[] m, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(m), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public NDarray tril(T[,] m, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(m), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public NDarray vander(NDarray x, int? N = null, bool? increasing = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (N!=null) kwargs["N"]=ToPython(N); - if (increasing!=false) kwargs["increasing"]=ToPython(increasing); - dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public NDarray vander(T[] x, int? N = null, bool? increasing = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x), - }); - var kwargs=new PyDict(); - if (N!=null) kwargs["N"]=ToPython(N); - if (increasing!=false) kwargs["increasing"]=ToPython(increasing); - dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public NDarray vander(T[,] x, int? N = null, bool? increasing = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x), - }); - var kwargs=new PyDict(); - if (N!=null) kwargs["N"]=ToPython(N); - if (increasing!=false) kwargs["increasing"]=ToPython(increasing); - dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); - return ToCsharp>(py); - } - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix mat(NDarray data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - data, - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix mat(T[] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix mat(T[,] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Build a matrix object from a string, nested sequence, or array. - /// - /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. - /// - /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. - /// - /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. - /// - /// - /// Returns a matrix object, which is a specialized 2-D array. - /// - public Matrix bmat(string obj, Hashtable ldict = null, Hashtable gdict = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (ldict!=null) kwargs["ldict"]=ToPython(ldict); - if (gdict!=null) kwargs["gdict"]=ToPython(gdict); - dynamic py = __self__.InvokeMethod("bmat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Build a matrix object from a string, nested sequence, or array. - /// - /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. - /// - /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. - /// - /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. - /// - /// - /// Returns a matrix object, which is a specialized 2-D array. - /// - public Matrix bmat(T[] obj, Hashtable ldict = null, Hashtable gdict = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(obj), - }); - var kwargs=new PyDict(); - if (ldict!=null) kwargs["ldict"]=ToPython(ldict); - if (gdict!=null) kwargs["gdict"]=ToPython(gdict); - dynamic py = __self__.InvokeMethod("bmat", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - } -} diff --git a/src/Numpy.Bare/NumPy.array_manipulation.gen.cs b/src/Numpy.Bare/NumPy.array_manipulation.gen.cs deleted file mode 100644 index 737bc12..0000000 --- a/src/Numpy.Bare/NumPy.array_manipulation.gen.cs +++ /dev/null @@ -1,1538 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. - /// - /// - /// The array into which values are copied. - /// - /// - /// The array from which values are copied. - /// - /// - /// Controls what kind of data casting may occur when copying. - /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. - /// - public void copyto(NDarray dst, NDarray src, string casting = "same_kind", NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dst, - src, - }); - var kwargs=new PyDict(); - if (casting!="same_kind") kwargs["casting"]=ToPython(casting); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("copyto", pyargs, kwargs); - } - - /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. - /// - /// - /// The array into which values are copied. - /// - /// - /// The array from which values are copied. - /// - /// - /// Controls what kind of data casting may occur when copying. - /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. - /// - public void copyto(NDarray dst, NDarray src, string casting = "same_kind", bool[] @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dst, - src, - }); - var kwargs=new PyDict(); - if (casting!="same_kind") kwargs["casting"]=ToPython(casting); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("copyto", 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. - /// - /// - /// Array to be reshaped. - /// - /// - /// 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(NDarray a, Shape newshape, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input array. The elements in a are read in the order specified by - /// order, and packed as a 1-D array. - /// - /// - /// 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(NDarray a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ravel", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of the array collapsed into one dimension. - /// - /// - /// ‘C’ means to flatten in row-major (C-style) order. - /// ‘F’ means to flatten in column-major (Fortran- - /// style) order. ‘A’ means to flatten in column-major - /// order if a is Fortran contiguous in memory, - /// row-major order otherwise. ‘K’ means to flatten - /// a in the order the elements occur in memory. - /// The default is ‘C’. - /// - /// - /// A copy of the input array, flattened to one dimension. - /// - public NDarray flatten(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("flatten", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Move axes of an array to new positions. - /// - /// Other axes remain in their original order. - /// - /// - /// The array whose axes should be reordered. - /// - /// - /// 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(NDarray a, int[] source, int[] destination) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int axis, int? start = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input 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(NDarray a, int axis1, int axis2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - axis1, - axis2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("swapaxes", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Permute the dimensions of an array. - /// - /// Notes - /// - /// Use transpose(a, argsort(axes)) to invert the transposition of tensors - /// when using the axes keyword argument. - /// - /// Transposing a 1-D array returns an unchanged view of the original array. - /// - /// - /// Input array. - /// - /// - /// By default, reverse the dimensions, otherwise permute the axes - /// according to the values given. - /// - /// - /// a with its axes permuted. A view is returned whenever - /// possible. - /// - public NDarray transpose(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("transpose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert inputs to arrays with at least one dimension. - /// - /// Scalar inputs are converted to 1-dimensional arrays, whilst - /// higher-dimensional inputs are preserved. - /// - /// - /// One or more input arrays. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 1. - /// Copies are made only if necessary. - /// - public NDarray atleast_1d(params NDarray[] arys) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("atleast_1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// View inputs as arrays with at least two dimensions. - /// - /// - /// One or more array-like sequences. Non-array inputs are converted - /// to arrays. Arrays that already have two or more dimensions are - /// preserved. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 2. - /// Copies are avoided where possible, and views with two or more - /// dimensions are returned. - /// - public NDarray atleast_2d(params NDarray[] arys) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("atleast_2d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// View inputs as arrays with at least three dimensions. - /// - /// - /// One or more array-like sequences. Non-array inputs are converted to - /// arrays. Arrays that already have three or more dimensions are - /// preserved. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 3. Copies are - /// avoided where possible, and views with three or more dimensions are - /// returned. For example, a 1-D array of shape (N,) becomes a view - /// of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a - /// view of shape (M, N, 1). - /// - public NDarray atleast_3d(params NDarray[] arys) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("atleast_3d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Produce an object that mimics broadcasting. - /// - /// - /// Input parameters. - /// - /// - /// 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 in2, NDarray in1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - in2, - in1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("broadcast", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Broadcast an array to a new shape. - /// - /// Notes - /// - /// - /// The array to broadcast. - /// - /// - /// 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(NDarray array, Shape shape, bool? subok = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array, - shape, - }); - var kwargs=new PyDict(); - if (subok!=false) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("broadcast_to", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Broadcast any number of arrays against each other. - /// - /// - /// The arrays to broadcast. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned arrays will be forced to be a base-class array (default). - /// - /// - /// These arrays are views on the original arrays. They are typically - /// not contiguous. Furthermore, more than one element of a - /// broadcasted array may refer to a single memory location. If you - /// need to write to the arrays, make copies first. - /// - public NDarray[] broadcast_arrays(NDarray[] args, bool? subok = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - if (subok!=null) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("broadcast_arrays", 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input data. - /// - /// - /// 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(NDarray a, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// The input array. - /// - /// - /// 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(NDarray a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// By default, the data-type is inferred from the input data. - /// - /// - /// The input a in Fortran, or column-major, order. - /// - public NDarray asfortranarray(NDarray a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. Success requires no 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(NDarray a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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 object to be converted to a type-and-requirement-satisfying array. - /// - /// - /// 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(NDarray a, Dtype dtype, string[] requirements = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - dtype, - requirements, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("require", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Join a sequence of arrays along an existing axis. - /// - /// Notes - /// - /// When one or more of the arrays to be concatenated is a MaskedArray, - /// this function will return a MaskedArray object instead of an ndarray, - /// but the input masks are not preserved. In cases where a MaskedArray - /// is expected as input, use the ma.concatenate function from the masked - /// array module instead. - /// - /// - /// The arrays must have the same shape, except in the dimension - /// corresponding to axis (the first, by default). - /// - /// - /// The axis along which the arrays will be joined. If axis is None, - /// arrays are flattened before use. Default is 0. - /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what concatenate would have returned if no - /// out argument were specified. - /// - /// - /// The concatenated array. - /// - public NDarray concatenate(NDarray[] arys, int? axis = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("concatenate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Join a sequence of arrays along a new axis. - /// - /// The axis parameter specifies the index of the new axis in the dimensions - /// of the result. For example, if axis=0 it will be the first dimension - /// and if axis=-1 it will be the last dimension. - /// - /// - /// Each array must have the same shape. - /// - /// - /// The axis in the result array along which the input arrays are stacked. - /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what stack would have returned if no - /// out argument were specified. - /// - /// - /// The stacked array has one more dimension than the input arrays. - /// - public NDarray stack(NDarray[] arrays, int? axis = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arrays, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("stack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack 1-D arrays as columns into a 2-D array. - /// - /// Take a sequence of 1-D arrays and stack them as columns - /// to make a single 2-D array. 2-D arrays are stacked as-is, - /// just like with hstack. 1-D arrays are turned into 2-D columns - /// first. - /// - /// - /// Arrays to stack. All of them must have the same first dimension. - /// - /// - /// The array formed by stacking the given arrays. - /// - public NDarray column_stack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("column_stack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack arrays in sequence depth wise (along third axis). - /// - /// This is equivalent to concatenation along the third axis after 2-D arrays - /// of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape - /// (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by - /// dsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the third axis. - /// 1-D or 2-D arrays must have the same shape. - /// - /// - /// The array formed by stacking the given arrays, will be at least 3-D. - /// - public NDarray dstack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("dstack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack arrays in sequence horizontally (column wise). - /// - /// This is equivalent to concatenation along the second axis, except for 1-D - /// arrays where it concatenates along the first axis. Rebuilds arrays divided - /// by hsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the second axis, - /// except 1-D arrays which can be any length. - /// - /// - /// The array formed by stacking the given arrays. - /// - public NDarray hstack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("hstack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack arrays in sequence vertically (row wise). - /// - /// This is equivalent to concatenation along the first axis after 1-D arrays - /// of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by - /// vsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the first axis. - /// 1-D arrays must have the same length. - /// - /// - /// The array formed by stacking the given arrays, will be at least 2-D. - /// - public NDarray vstack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("vstack", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Assemble an nd-array from nested lists of blocks. - /// - /// Blocks in the innermost lists are concatenated (see concatenate) along - /// the last dimension (-1), then these are concatenated along the - /// second-last dimension (-2), and so on until the outermost list is reached. - /// - /// Blocks can be of any dimension, but will not be broadcasted using the normal - /// rules. Instead, leading axes of size 1 are inserted, to make block.ndim - /// the same for all blocks. This is primarily useful for working with scalars, - /// and means that code like np.block([v, 1]) is valid, where - /// v.ndim == 1. - /// - /// When the nested list is two levels deep, this allows block matrices to be - /// constructed from their components. - /// - /// Notes - /// - /// When called with only scalars, np.block is equivalent to an ndarray - /// call. So np.block([[1, 2], [3, 4]]) is equivalent to - /// np.array([[1, 2], [3, 4]]). - /// - /// This function does not enforce that the blocks lie on a fixed grid. - /// np.block([[a, b], [c, d]]) is not restricted to arrays of the form: - /// - /// But is also allowed to produce, for some a, b, c, d: - /// - /// Since concatenation happens along the last axis first, block is _not_ - /// capable of producing the following directly: - /// - /// Matlab’s “square bracket stacking”, [A, B, ...; p, q, ...], is - /// equivalent to np.block([[A, B, ...], [p, q, ...]]). - /// - /// - /// If passed a single ndarray or scalar (a nested list of depth 0), this - /// is returned unmodified (and not copied). - /// - /// Elements shapes must match along the appropriate axes (without - /// broadcasting), but leading 1s will be prepended to the shape as - /// necessary to make the dimensions match. - /// - /// - /// The array assembled from the given blocks. - /// - /// The dimensionality of the output is equal to the greatest of: - /// * the dimensionality of all the inputs - /// * the depth to which the input list is nested - /// - public NDarray block(nested list of array_like or scalars (but not tuples) arrays) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arrays, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("block", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Split an array into multiple sub-arrays. - /// - /// - /// Array to be divided into sub-arrays. - /// - /// - /// If indices_or_sections is an integer, N, the array will be divided - /// into N equal arrays along axis. If such a split is not possible, - /// an error is raised. - /// - /// If indices_or_sections is a 1-D array of sorted integers, the entries - /// indicate where along axis the array is split. For example, - /// [2, 3] would, for axis=0, result in - /// - /// If an index exceeds the dimension of the array along axis, - /// an empty sub-array is returned correspondingly. - /// - /// - /// The axis along which to split, default is 0. - /// - /// - /// A list of sub-arrays. - /// - public NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ary, - indices_or_sections, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Construct an array by repeating A the number of times given by reps. - /// - /// 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 input array. - /// - /// - /// The number of repetitions of A along each axis. - /// - /// - /// The tiled output array. - /// - public NDarray tile(NDarray A, NDarray reps) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - A, - reps, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Repeat elements of an array. - /// - /// - /// Input 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(NDarray a, int[] repeats, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray arr, Slice obj, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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. - /// - /// - /// 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 NDarray insert(NDarray arr, int obj = 0, NDarray values = null, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - obj, - values, - }); - var kwargs=new PyDict(); - 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. - /// - /// - /// Values are appended to a copy of this 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 arr, NDarray values, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray filt, string trim = "fb") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - filt, - }); - 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. - /// - /// - /// Input array. Unless axis is specified, this will be flattened if it - /// is not already 1-D. - /// - /// - /// 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. - /// - /// - /// A tuple of: - /// unique - /// The sorted unique values. - /// unique_indices - /// The indices of the first occurrences of the unique values in the - /// original array. Only provided if return_index is True. - /// unique_inverse - /// The indices to reconstruct the original array from the - /// unique array. Only provided if return_inverse is True. - /// unique_counts - /// The number of times each of the unique values comes up in the - /// original array. Only provided if return_counts is True. - /// - public (NDarray, NDarray, NDarray, NDarray) unique(NDarray ar, bool? return_index = false, bool? return_inverse = false, bool? return_counts = false, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar, - }); - var kwargs=new PyDict(); - if (return_index!=false) kwargs["return_index"]=ToPython(return_index); - if (return_inverse!=false) kwargs["return_inverse"]=ToPython(return_inverse); - if (return_counts!=false) kwargs["return_counts"]=ToPython(return_counts); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unique", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2]), ToCsharp(t[3])); - } - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray m, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - 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. - /// - /// - /// Input array, must be at least 2-D. - /// - /// - /// A view of m with the columns reversed. Since a view - /// is returned, this operation is . - /// - public NDarray fliplr(NDarray m) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("fliplr", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - /// - /// A view of m with the rows reversed. Since a view is - /// returned, this operation is . - /// - public NDarray flipud(NDarray m) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("flipud", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int[] shift, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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)) - /// - /// - /// Array of two or more dimensions. - /// - /// - /// 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(NDarray m, int k = 1, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - k, - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("rot90", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.bitwise.gen.cs b/src/Numpy.Bare/NumPy.bitwise.gen.cs deleted file mode 100644 index 3d69d64..0000000 --- a/src/Numpy.Bare/NumPy.bitwise.gen.cs +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// 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 x is a scalar. - /// - public NDarray invert(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 left. - /// - /// Bits are shifted to the left by appending x2 0s at the right of x1. - /// Since the internal representation of numbers is in binary format, this - /// operation is equivalent to multiplying x1 by 2**x2. - /// - /// - /// Input values. - /// - /// - /// Number of zeros to append to x1. Has to be non-negative. - /// - /// - /// 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 left. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray left_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("left_shift", 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. - /// - /// - /// Input values. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// An array of integers or booleans whose elements should be packed to - /// bits. - /// - /// - /// 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(NDarray myarray, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - myarray, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray myarray, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - myarray, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unpackbits", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the binary representation of the input number as a string. - /// - /// For negative numbers, if width is not given, a minus sign is added to the - /// front. If width is given, the two’s complement of the number is - /// returned, with respect to that width. - /// - /// 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 - /// - /// binary_repr is equivalent to using base_repr with base 2, but about 25x - /// faster. - /// - /// References - /// - /// - /// Only an integer decimal number can be used. - /// - /// - /// The length of the returned string if num is positive, or the length - /// of the two’s complement if num is negative, provided that width is - /// at least a sufficient number of bits for num to be represented in the - /// designated form. - /// - /// If the width value is insufficient, it will be ignored, and num will - /// be returned in binary (num > 0) or two’s complement (num < 0) form - /// with its width equal to the minimum number of bits needed to represent - /// the number in the designated form. This behavior is deprecated and will - /// later raise an error. - /// - /// - /// Binary representation of num or two’s complement of num. - /// - public string binary_repr(int num, int? width = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - num, - }); - var kwargs=new PyDict(); - if (width!=null) kwargs["width"]=ToPython(width); - dynamic py = __self__.InvokeMethod("binary_repr", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.datetime.gen.cs b/src/Numpy.Bare/NumPy.datetime.gen.cs deleted file mode 100644 index 0e7fb9d..0000000 --- a/src/Numpy.Bare/NumPy.datetime.gen.cs +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Convert an array of datetimes into an array of strings. - /// - /// - /// The array of UTC timestamps to format. - /// - /// - /// One of None, ‘auto’, or a datetime unit. - /// - /// - /// Timezone information to use when displaying the datetime. If ‘UTC’, end - /// with a Z to indicate UTC time. If ‘local’, convert to the local timezone - /// first, and suffix with a +-#### timezone offset. If a tzinfo object, - /// then do as with ‘local’, but use the specified timezone. - /// - /// - /// Casting to allow when changing between datetime units. - /// - /// - /// An array of strings the same shape as arr. - /// - public NDarray datetime_as_string(string[] arr, string unit, string timezone = "naive", string casting = "same_kind") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - unit, - timezone, - casting, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("datetime_as_string", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Get information about the step size of a date or time type. - /// - /// The returned tuple can be passed as the second argument of numpy.datetime64 and - /// numpy.timedelta64. - /// - /// - /// The dtype object, which must be a datetime64 or timedelta64 type. - /// - /// - /// A tuple of: - /// unit - /// The datetime unit on which this dtype - /// is based. - /// count - /// The number of base units in a step. - /// - public (string, int) datetime_data(Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("datetime_data", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /* - /// - /// A business day calendar object that efficiently stores information - /// defining valid days for the busday family of functions. - /// - /// The default valid days are Monday through Friday (“business days”). - /// A busdaycalendar object can be specified with any set of weekly - /// valid days, plus an optional “holiday” dates that always will be invalid. - /// - /// Once a busdaycalendar object is created, the weekmask and holidays - /// cannot be modified. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates, no matter which - /// weekday they fall upon. Holiday dates may be specified in any - /// order, and NaT (not-a-time) dates are ignored. This list is - /// saved in a normalized form that is suited for fast calculations - /// of valid days. - /// - /// - /// A business day calendar object containing the specified - /// weekmask and holidays values. - /// - public busdaycalendar busdaycalendar(string weekmask = null, string[] holidays = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (weekmask!=null) kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=null) kwargs["holidays"]=ToPython(holidays); - dynamic py = __self__.InvokeMethod("busdaycalendar", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Calculates which of the given dates are valid days, and which are not. - /// - /// - /// The array of dates to process. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with the same shape as dates, containing True for - /// each valid day, and False for each invalid day. - /// - public NDarray is_busday(string[] dates, string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dates, - }); - var kwargs=new PyDict(); - if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=null) kwargs["holidays"]=ToPython(holidays); - if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("is_busday", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// First adjusts the date to fall on a valid day according to - /// the roll rule, then applies offsets to the given dates - /// counted in valid days. - /// - /// - /// The array of dates to process. - /// - /// - /// The array of offsets, which is broadcast with dates. - /// - /// - /// How to treat dates that do not fall on a valid day. The default - /// is ‘raise’. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with a shape from broadcasting dates and offsets - /// together, containing the dates with offsets applied. - /// - public array of datetime64[D] busday_offset(string[] dates, array_like of int offsets, string roll = "raise", string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, array of datetime64[D] @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dates, - offsets, - }); - var kwargs=new PyDict(); - if (roll!="raise") kwargs["roll"]=ToPython(roll); - if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=null) kwargs["holidays"]=ToPython(holidays); - if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("busday_offset", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Counts the number of valid days between begindates and - /// enddates, not including the day of enddates. - /// - /// If enddates specifies a date value that is earlier than the - /// corresponding begindates date value, the count will be negative. - /// - /// - /// The array of the first dates for counting. - /// - /// - /// The array of the end dates for counting, which are excluded - /// from the count themselves. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with a shape from broadcasting begindates and enddates - /// together, containing the number of valid days between - /// the begin and end dates. - /// - public array of int busday_count(string[] begindates, string[] enddates, string weekmask = "1111100", string[] holidays = [], busdaycalendar busdaycal = null, array of int @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - begindates, - enddates, - }); - var kwargs=new PyDict(); - if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=[]) kwargs["holidays"]=ToPython(holidays); - if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("busday_count", pyargs, kwargs); - return ToCsharp(py); - } - */ - - } -} diff --git a/src/Numpy.Bare/NumPy.dtype.gen.cs b/src/Numpy.Bare/NumPy.dtype.gen.cs deleted file mode 100644 index 80eddd3..0000000 --- a/src/Numpy.Bare/NumPy.dtype.gen.cs +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// compatible: Python bool - /// - public Dtype bool_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("bool_"); - return ToCsharp(py); - } - } - - /// - /// 8 bits - /// - public Dtype bool8 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("bool8"); - return ToCsharp(py); - } - } - - /// - /// compatible: C char - /// - public Dtype @byte - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("byte"); - return ToCsharp(py); - } - } - - /// - /// compatible: C short - /// - public Dtype @short - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("short"); - return ToCsharp(py); - } - } - - /// - /// compatible: C int - /// - public Dtype intc - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("intc"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python int - /// - public Dtype int_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int_"); - return ToCsharp(py); - } - } - - /// - /// compatible: C long long - /// - public Dtype longlong - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("longlong"); - return ToCsharp(py); - } - } - - /// - /// large enough to fit a pointer - /// - public Dtype intp - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("intp"); - return ToCsharp(py); - } - } - - /// - /// 8 bits - /// - public Dtype int8 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int8"); - return ToCsharp(py); - } - } - - /// - /// 16 bits - /// - public Dtype int16 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int16"); - return ToCsharp(py); - } - } - - /// - /// 32 bits - /// - public Dtype int32 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int32"); - return ToCsharp(py); - } - } - - /// - /// 64 bits - /// - public Dtype int64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int64"); - return ToCsharp(py); - } - } - - /// - /// compatible: C unsigned char - /// - public Dtype ubyte - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("ubyte"); - return ToCsharp(py); - } - } - - /// - /// compatible: C unsigned short - /// - public Dtype @ushort - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("ushort"); - return ToCsharp(py); - } - } - - /// - /// compatible: C unsigned int - /// - public Dtype uintc - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uintc"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python int - /// - public Dtype @uint - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint"); - return ToCsharp(py); - } - } - - /// - /// compatible: C long long - /// - public Dtype ulonglong - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("ulonglong"); - return ToCsharp(py); - } - } - - /// - /// large enough to fit a pointer - /// - public Dtype uintp - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uintp"); - return ToCsharp(py); - } - } - - /// - /// 8 bits - /// - public Dtype uint8 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint8"); - return ToCsharp(py); - } - } - - /// - /// 16 bits - /// - public Dtype uint16 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint16"); - return ToCsharp(py); - } - } - - /// - /// 32 bits - /// - public Dtype uint32 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint32"); - return ToCsharp(py); - } - } - - /// - /// 64 bits - /// - public Dtype uint64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint64"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype half - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("half"); - return ToCsharp(py); - } - } - - /// - /// compatible: C float - /// - public Dtype single - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("single"); - return ToCsharp(py); - } - } - - /// - /// compatible: C double - /// - public Dtype @double - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("double"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python float - /// - public Dtype float_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float_"); - return ToCsharp(py); - } - } - - /// - /// compatible: C long float - /// - public Dtype longfloat - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("longfloat"); - return ToCsharp(py); - } - } - - /// - /// 16 bits - /// - public Dtype float16 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float16"); - return ToCsharp(py); - } - } - - /// - /// 32 bits - /// - public Dtype float32 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float32"); - return ToCsharp(py); - } - } - - /// - /// 64 bits - /// - public Dtype float64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float64"); - return ToCsharp(py); - } - } - - /// - /// 96 bits, platform? - /// - public Dtype float96 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float96"); - return ToCsharp(py); - } - } - - /// - /// 128 bits, platform? - /// - public Dtype float128 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float128"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype csingle - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("csingle"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python complex - /// - public Dtype complex_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex_"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype clongfloat - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("clongfloat"); - return ToCsharp(py); - } - } - - /// - /// two 32-bit floats - /// - public Dtype complex64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex64"); - return ToCsharp(py); - } - } - - /// - /// two 64-bit floats - /// - public Dtype complex128 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex128"); - return ToCsharp(py); - } - } - - /// - /// two 96-bit floats, - /// platform? - /// - public Dtype complex192 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex192"); - return ToCsharp(py); - } - } - - /// - /// two 128-bit floats, - /// platform? - /// - public Dtype complex256 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex256"); - return ToCsharp(py); - } - } - - /// - /// any Python object - /// - public Dtype object_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("object_"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python bytes - /// - public Dtype bytes_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("bytes_"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python unicode/str - /// - public Dtype unicode_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("unicode_"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype @void - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("void"); - return ToCsharp(py); - } - } - - } -} diff --git a/src/Numpy.Bare/NumPy.dtype.routines.gen.cs b/src/Numpy.Bare/NumPy.dtype.routines.gen.cs deleted file mode 100644 index 1ead937..0000000 --- a/src/Numpy.Bare/NumPy.dtype.routines.gen.cs +++ /dev/null @@ -1,631 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Returns True if cast between data types can occur according to the - /// casting rule. If from is a scalar or array scalar, also returns - /// True if the scalar value can be cast without overflow or truncation - /// to an integer. - /// - /// Notes - /// - /// Starting in NumPy 1.9, can_cast function now returns False in ‘safe’ - /// casting mode for integer/float dtype and string dtype if the string dtype - /// length is not long enough to store the max integer/float value converted - /// to a string. Previously can_cast in ‘safe’ mode returned True for - /// integer/float dtype and a string dtype of any length. - /// - /// - /// Data type, scalar, or array to cast from. - /// - /// - /// Data type to cast to. - /// - /// - /// Controls what kind of data casting may occur. - /// - /// - /// True if cast can occur according to the casting rule. - /// - public bool can_cast(Dtype from_, Dtype to, string casting = "safe") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - from_, - to, - }); - var kwargs=new PyDict(); - if (casting!="safe") kwargs["casting"]=ToPython(casting); - dynamic py = __self__.InvokeMethod("can_cast", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the data type with the smallest size and smallest scalar - /// kind to which both type1 and type2 may be safely cast. - /// The returned data type is always in native byte order. - /// - /// This function is symmetric, but rarely associative. - /// - /// Notes - /// - /// Starting in NumPy 1.9, promote_types function now returns a valid string - /// length when given an integer or float dtype as one argument and a string - /// dtype as another argument. Previously it always returned the input string - /// dtype, even if it wasn’t long enough to store the max integer/float value - /// converted to a string. - /// - /// - /// First data type. - /// - /// - /// Second data type. - /// - /// - /// The promoted data type. - /// - public Dtype promote_types(Dtype type1, Dtype type2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - type1, - type2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("promote_types", 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 value whose minimal data type is to be found. - /// - /// - /// The minimal data type. - /// - public Dtype min_scalar_type(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("min_scalar_type", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Returns the type that results from applying the NumPy - /// type promotion rules to the arguments. - /// - /// Type promotion in NumPy works similarly to the rules in languages - /// like C++, with some slight differences. When both scalars and - /// arrays are used, the array’s type takes precedence and the actual value - /// of the scalar is taken into account. - /// - /// For example, calculating 3*a, where a is an array of 32-bit floats, - /// intuitively should result in a 32-bit float output. If the 3 is a - /// 32-bit integer, the NumPy rules indicate it can’t convert losslessly - /// into a 32-bit float, so a 64-bit float should be the result type. - /// By examining the value of the constant, ‘3’, we see that it fits in - /// an 8-bit integer, which can be cast losslessly into the 32-bit float. - /// - /// Notes - /// - /// The specific algorithm used is as follows. - /// - /// Categories are determined by first checking which of boolean, - /// integer (int/uint), or floating point (float/complex) the maximum - /// kind of all the arrays and the scalars are. - /// - /// If there are only scalars or the maximum category of the scalars - /// is higher than the maximum category of the arrays, - /// the data types are combined with promote_types - /// to produce the return value. - /// - /// Otherwise, min_scalar_type is called on each array, and - /// the resulting data types are all combined with promote_types - /// to produce the return value. - /// - /// The set of int values is not a subset of the uint values for types - /// with the same number of bits, something not reflected in - /// min_scalar_type, but handled as a special case in result_type. - /// - /// - /// The operands of some operation whose result type is needed. - /// - /// - /// The result type. - /// - public Dtype result_type(list of arrays and dtypes arrays_and_dtypes) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arrays_and_dtypes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("result_type", pyargs, kwargs); - 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. - /// - /// - /// Input arrays. - /// - /// - /// Data type code. - /// - public Dtype common_type(NDarray array2, NDarray array1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array2, - array1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("common_type", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the scalar dtype or NumPy equivalent of Python type of an object. - /// - /// - /// The object of which the type is returned. - /// - /// - /// If given, this is returned for objects whose types can not be - /// determined. If not given, None is returned for those objects. - /// - /// - /// The data type of rep. - /// - public Dtype obj2sctype(object rep, object @default = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rep, - }); - var kwargs=new PyDict(); - if (@default!=null) kwargs["default"]=ToPython(@default); - dynamic py = __self__.InvokeMethod("obj2sctype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a data type object. - /// - /// A numpy array is homogeneous, and contains elements described by a - /// dtype object. A dtype object can be constructed from different - /// combinations of fundamental numeric types. - /// - /// - /// Add padding to the fields to match what a C compiler would output - /// for a similar C-struct. Can be True only if obj is a dictionary - /// or a comma-separated string. If a struct dtype is being created, - /// this also sets a sticky alignment flag isalignedstruct. - /// - /// - /// Make a new copy of the data-type object. If False, the result - /// may just be a reference to a built-in data-type object. - /// - public void dtype(bool? align = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (align!=null) kwargs["align"]=ToPython(align); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("dtype", pyargs, kwargs); - } - - /// - /// Class to convert formats, names, titles description to a dtype. - /// - /// After constructing the format_parser object, the dtype attribute is - /// the converted data-type: - /// dtype = format_parser(formats, names, titles).dtype - /// - /// - /// The format description, either specified as a string with - /// comma-separated format descriptions in the form 'f8, i4, a5', or - /// a list of format description strings in the form - /// ['f8', 'i4', 'a5']. - /// - /// - /// The field names, either specified as a comma-separated string in the - /// form 'col1, col2, col3', or as a list or tuple of strings in the - /// form ['col1', 'col2', 'col3']. - /// An empty list can be used, in that case default field names - /// (‘f0’, ‘f1’, …) are used. - /// - /// - /// Sequence of title strings. An empty list can be used to leave titles - /// out. - /// - /// - /// If True, align the fields by padding as the C-compiler would. - /// Default is False. - /// - /// - /// If specified, all the fields will be changed to the - /// provided byte-order. Otherwise, the default byte-order is - /// used. For all available string specifiers, see dtype.newbyteorder. - /// - public void format_parser(string[] formats, string[] names, string[] titles, bool? aligned = null, string byteorder = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - formats, - names, - titles, - }); - var kwargs=new PyDict(); - if (aligned!=null) kwargs["aligned"]=ToPython(aligned); - if (byteorder!=null) kwargs["byteorder"]=ToPython(byteorder); - dynamic py = __self__.InvokeMethod("format_parser", pyargs, kwargs); - } - - /// - /// Machine limits for floating point types. - /// - /// Notes - /// - /// For developers of NumPy: do not instantiate this at the module level. - /// The initial calculation of these parameters is expensive and negatively - /// impacts import times. These objects are cached, so calling finfo() - /// repeatedly inside your functions is not a problem. - /// - /// - /// Kind of floating point data-type about which to get information. - /// - public void finfo(Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("finfo", pyargs, kwargs); - } - - /// - /// Machine limits for integer types. - /// - /// - /// The kind of integer data type to get information about. - /// - public void iinfo(Dtype int_type) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - int_type, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("iinfo", pyargs, kwargs); - } - - /// - /// Diagnosing machine parameters. - /// - /// References - /// - /// - /// Function that converts an integer or integer array to a float - /// or float array. Default is float. - /// - /// - /// Function that converts a float or float array to an integer or - /// integer array. Default is int. - /// - /// - /// Function that converts a float array to float. Default is float. - /// Note that this does not seem to do anything useful in the current - /// implementation. - /// - /// - /// Function that converts a single float to a string. Default is - /// lambda v:'%24.16e' %v. - /// - /// - /// Title that is printed in the string representation of MachAr. - /// - public void MachAr(Delegate float_conv = null, Delegate int_conv = null, Delegate float_to_float = null, Delegate float_to_str = null, string title = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (float_conv!=null) kwargs["float_conv"]=ToPython(float_conv); - if (int_conv!=null) kwargs["int_conv"]=ToPython(int_conv); - if (float_to_float!=null) kwargs["float_to_float"]=ToPython(float_to_float); - if (float_to_str!=null) kwargs["float_to_str"]=ToPython(float_to_str); - if (title!=null) kwargs["title"]=ToPython(title); - dynamic py = __self__.InvokeMethod("MachAr", pyargs, kwargs); - } - - /// - /// Determines whether the given object represents a scalar data-type. - /// - /// - /// If rep is an instance of a scalar dtype, True is returned. If not, - /// False is returned. - /// - /// - /// Boolean result of check whether rep is a scalar dtype. - /// - public bool issctype(object rep) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issctype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns True if first argument is a typecode lower/equal in type hierarchy. - /// - /// - /// dtype or string representing a typecode. - /// - /// - /// dtype or string representing a typecode. - /// - public bool issubdtype(Dtype arg2, Dtype arg1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arg2, - arg1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issubdtype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Determine if the first argument is a subclass of the second argument. - /// - /// - /// Data-types. - /// - /// - /// Data-types. - /// - /// - /// The result. - /// - public bool issubsctype(Dtype arg2, Dtype arg1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arg2, - arg1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issubsctype", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Determine if a class is a subclass of a second class. - /// - /// issubclass_ is equivalent to the Python built-in issubclass, - /// except that it returns False instead of raising a TypeError if one - /// of the arguments is not a class. - /// - /// - /// Input class. True is returned if arg1 is a subclass of arg2. - /// - /// - /// Input class. If a tuple of classes, True is returned if arg1 is a - /// subclass of any of the tuple elements. - /// - /// - /// Whether arg1 is a subclass of arg2 or not. - /// - public bool issubclass_(class arg1, class or tuple of classes. arg2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arg1, - arg2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issubclass_", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Determine common type following standard coercion rules. - /// - /// - /// A list of dtypes or dtype convertible objects representing arrays. - /// - /// - /// A list of dtypes or dtype convertible objects representing scalars. - /// - /// - /// The common data type, which is the maximum of array_types ignoring - /// scalar_types, unless the maximum of scalar_types is of a - /// different kind (dtype.kind). If the kind is not understood, then - /// None is returned. - /// - public Dtype find_common_type(sequence array_types, sequence scalar_types) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array_types, - scalar_types, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("find_common_type", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Return a description for the given data type code. - /// - /// - /// Data type code. - /// - /// - /// Description of the input data type code. - /// - public string typename(string @char) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - @char, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("typename", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the string representation of a scalar dtype. - /// - /// - /// If a scalar dtype, the corresponding string character is - /// returned. If an object, sctype2char tries to infer its scalar type - /// and then return the corresponding string character. - /// - /// - /// The string character corresponding to the scalar type. - /// - public string sctype2char(object sctype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sctype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("sctype2char", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the character for the minimum-size type to which given types can - /// be safely cast. - /// - /// The returned type character must represent the smallest size dtype such - /// that an array of the returned type can handle the data from an array of - /// all types in typechars (or if typechars is an array, then its - /// dtype.char). - /// - /// - /// If a list of strings, each string should represent a dtype. - /// If array_like, the character representation of the array dtype is used. - /// - /// - /// The set of characters that the returned character is chosen from. - /// The default set is ‘GDFgdf’. - /// - /// - /// The default character, this is returned if none of the characters in - /// typechars matches a character in typeset. - /// - /// - /// The character representing the minimum-size type that was found. - /// - public string mintypecode(string[] typechars, string[] typeset = null, string @default = "d") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - typechars, - }); - var kwargs=new PyDict(); - if (typeset!=null) kwargs["typeset"]=ToPython(typeset); - if (@default!="d") kwargs["default"]=ToPython(@default); - dynamic py = __self__.InvokeMethod("mintypecode", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.fft.gen.cs b/src/Numpy.Bare/NumPy.fft.gen.cs deleted file mode 100644 index 1a8622e..0000000 --- a/src/Numpy.Bare/NumPy.fft.gen.cs +++ /dev/null @@ -1,598 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Compute the one-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) of a real-valued array by means of an efficient algorithm - /// called the Fast Fourier Transform (FFT). - /// - /// Notes - /// - /// When the DFT is computed for purely real input, the output is - /// Hermitian-symmetric, i.e. the negative frequency terms are just the complex - /// conjugates of the corresponding positive-frequency terms, and the - /// negative-frequency terms are therefore redundant. This function does not - /// compute the negative frequency terms, and the length of the transformed - /// axis of the output is therefore n//2 + 1. - /// - /// When A = rfft(a) and fs is the sampling frequency, A[0] contains - /// the zero-frequency term 0*fs, which is real due to Hermitian symmetry. - /// - /// If n is even, A[-1] contains the term representing both positive - /// and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely - /// real. If n is odd, there is no term at fs/2; A[-1] contains - /// the largest positive frequency (fs/2*(n-1)/n), and is complex in the - /// general case. - /// - /// If the input a contains an imaginary part, it is silently discarded. - /// - /// - /// Input array - /// - /// - /// Number of points along transformation axis in the input to use. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// If n is even, the length of the transformed axis is (n/2)+1. - /// If n is odd, the length is (n+1)/2. - /// - public NDarray fft_rfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("rfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the inverse of the n-point DFT for real input. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier Transform of real input computed by rfft. - /// In other words, irfft(rfft(a), len(a)) == a to within numerical - /// accuracy. (See Notes below for why len(a) is necessary here.) - /// - /// The input is expected to be in the form returned by rfft, i.e. the - /// real zero-frequency term followed by the complex positive frequency terms - /// in order of increasing frequency. Since the discrete Fourier Transform of - /// real input is Hermitian-symmetric, the negative frequency terms are taken - /// to be the complex conjugates of the corresponding positive frequency terms. - /// - /// Notes - /// - /// Returns the real valued n-point inverse discrete Fourier transform - /// of a, where a contains the non-negative frequency terms of a - /// Hermitian-symmetric sequence. n is the length of the result, not the - /// input. - /// - /// If you specify an n such that a must be zero-padded or truncated, the - /// extra/removed values will be added/removed at high frequencies. One can - /// thus resample a series to m points via Fourier interpolation by: - /// a_resamp = irfft(rfft(a), m). - /// - /// - /// The input array. - /// - /// - /// Length of the transformed axis of the output. - /// For n output points, n//2+1 input points are necessary. If the - /// input is longer than this, it is cropped. If it is shorter than this, - /// it is padded with zeros. If n is not given, it is determined from - /// the length of the input along the axis specified by axis. - /// - /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*(m-1) where m is the length of the transformed axis of the - /// input. To get an odd number of output points, n must be specified. - /// - public NDarray fft_irfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("irfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional FFT of a real array. - /// - /// Notes - /// - /// This is really just rfftn with different default behavior. - /// For more details see rfftn. - /// - /// - /// Input array, taken to be real. - /// - /// - /// Shape of the FFT. - /// - /// - /// Axes over which to compute the FFT. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The result of the real 2-D FFT. - /// - public NDarray fft_rfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("rfft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional inverse FFT of a real array. - /// - /// Notes - /// - /// This is really irfftn with different defaults. - /// For more details see irfftn. - /// - /// - /// The input array - /// - /// - /// Shape of the inverse FFT. - /// - /// - /// The axes over which to compute the inverse fft. - /// Default is the last two axes. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The result of the inverse real 2-D FFT. - /// - public NDarray fft_irfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("irfft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the N-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional real array by means of the Fast - /// Fourier Transform (FFT). By default, all axes are transformed, with the - /// real transform performed over the last axis, while the remaining - /// transforms are complex. - /// - /// Notes - /// - /// The transform for real input is performed over the last transformation - /// axis, as by rfft, then the transform over the remaining axes is - /// performed as by fftn. The order of the output is as for rfft for the - /// final transformation axis, and as for fftn for the remaining - /// transformation axes. - /// - /// See fft for details, definitions and conventions used. - /// - /// - /// Input array, taken to be real. - /// - /// - /// Shape (length along each transformed axis) to use from the input. - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// The final element of s corresponds to n for rfft(x, n), while - /// for the remaining axes, it corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// The length of the last axis transformed will be s[-1]//2+1, - /// while the remaining transformed axes will have lengths according to - /// s, or unchanged from the input. - /// - public NDarray fft_rfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("rfftn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the inverse of the N-dimensional FFT of real input. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform for real input over any number of axes in an - /// M-dimensional array by means of the Fast Fourier Transform (FFT). In - /// other words, irfftn(rfftn(a), a.shape) == a to within numerical - /// accuracy. (The a.shape is necessary like len(a) is for irfft, - /// and for the same reason.) - /// - /// The input should be ordered in the same way as is returned by rfftn, - /// i.e. as for irfft for the final transformation axis, and as for ifftn - /// along all the other axes. - /// - /// Notes - /// - /// See fft for definitions and conventions used. - /// - /// See rfft for definitions and conventions used for real input. - /// - /// - /// Input array. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). s is also the - /// number of input points used along this axis, except for the last axis, - /// where s[-1]//2+1 points of the input are used. - /// Along any axis, if the shape indicated by s is smaller than that of - /// the input, the input is cropped. If it is larger, the input is padded - /// with zeros. If s is not given, the shape of the input along the - /// axes specified by axes is used. - /// - /// - /// Axes over which to compute the inverse FFT. If not given, the last - /// len(s) axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// The length of each transformed axis is as given by the corresponding - /// element of s, or the length of the input in every axis except for the - /// last one if s is not given. In the final transformed axis the length - /// of the output when s is not given is 2*(m-1) where m is the - /// length of the final transformed axis of the input. To get an odd - /// number of output points in the final axis, s must be specified. - /// - public NDarray fft_irfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("irfftn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the FFT of a signal that has Hermitian symmetry, i.e., a real - /// spectrum. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd. - /// - /// - /// The input array. - /// - /// - /// Length of the transformed axis of the output. For n output - /// points, n//2 + 1 input points are necessary. If the input is - /// longer than this, it is cropped. If it is shorter than this, it is - /// padded with zeros. If n is not given, it is determined from the - /// length of the input along the axis specified by axis. - /// - /// - /// Axis over which to compute the FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*m - 2 where m is the length of the transformed axis of - /// the input. To get an odd number of output points, n must be - /// specified, for instance as 2*m - 1 in the typical case, - /// - public NDarray fft_hfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("hfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the inverse FFT of a signal that has Hermitian symmetry. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd: - /// - /// - /// Input array. - /// - /// - /// Length of the inverse FFT, the number of points along - /// transformation axis in the input to use. If n is smaller than - /// the length of the input, the input is cropped. If it is larger, - /// the input is padded with zeros. If n is not given, the length of - /// the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n//2 + 1. - /// - public NDarray fft_ihfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ihfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Discrete Fourier Transform sample frequencies. - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// - /// Window length. - /// - /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. - /// - /// - /// Array of length n containing the sample frequencies. - /// - public NDarray fft_fftfreq(int n, float? d = 1.0f) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (d!=1.0f) kwargs["d"]=ToPython(d); - dynamic py = __self__.InvokeMethod("fftfreq", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Discrete Fourier Transform sample frequencies - /// (for usage with rfft, irfft). - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// Unlike fftfreq (but like scipy.fftpack.rfftfreq) - /// the Nyquist frequency component is considered to be positive. - /// - /// - /// Window length. - /// - /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. - /// - /// - /// Array of length n//2 + 1 containing the sample frequencies. - /// - public NDarray fft_rfftfreq(int n, float? d = 1.0f) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (d!=1.0f) kwargs["d"]=ToPython(d); - dynamic py = __self__.InvokeMethod("rfftfreq", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Shift the zero-frequency component to the center of the spectrum. - /// - /// This function swaps half-spaces for all axes listed (defaults to all). - /// Note that y[0] is the Nyquist component only if len(x) is even. - /// - /// - /// Input array. - /// - /// - /// Axes over which to shift. Default is None, which shifts all axes. - /// - /// - /// The shifted array. - /// - public NDarray fft_fftshift(NDarray x, int[] axes = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("fftshift", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// The inverse of fftshift. Although identical for even-length x, the - /// functions differ by one sample for odd-length x. - /// - /// - /// Input array. - /// - /// - /// Axes over which to calculate. Defaults to None, which shifts all axes. - /// - /// - /// The shifted array. - /// - public NDarray fft_ifftshift(NDarray x, int[] axes = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("ifftshift", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.financial.gen.cs b/src/Numpy.Bare/NumPy.financial.gen.cs deleted file mode 100644 index 4aae740..0000000 --- a/src/Numpy.Bare/NumPy.financial.gen.cs +++ /dev/null @@ -1,490 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Compute the future value. - /// - /// Notes - /// - /// The future value is computed by solving the equation: - /// - /// or, when rate == 0: - /// - /// References - /// - /// - /// Rate of interest as decimal (not per cent) per period - /// - /// - /// 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 rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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 - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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); - } - - /// - /// Returns the NPV (Net Present Value) of a cash flow series. - /// - /// Notes - /// - /// Returns the result of: [G] - /// - /// References - /// - /// - /// The discount rate. - /// - /// - /// The values of the time series of cash flows. The (fixed) time - /// interval between cash flow “events” must be the same as that for - /// which rate is given (i.e., if rate is per year, then precisely - /// a year is understood to elapse between each cash flow event). By - /// convention, investments or “deposits” are negative, income or - /// “withdrawals” are positive; values must begin with the initial - /// investment, thus values[0] will typically be negative. - /// - /// - /// The NPV of the input cash flow series values at the discount - /// rate. - /// - public float npv(ValueType rate, NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("npv", 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 - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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. - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 rate, 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[] - { - rate, - 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 - /// - /// - /// Rate of interest as decimal (not per cent) per period - /// - /// - /// 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 rate, 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[] - { - rate, - 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 - /// - /// - /// Input cash flows per time period. By convention, net “deposits” - /// are negative and net “withdrawals” are positive. Thus, for - /// example, at least the first element of values, which represents - /// the initial investment, will typically be negative. - /// - /// - /// Internal Rate of Return for periodic input values. - /// - public float irr(NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("irr", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Modified internal rate of return. - /// - /// - /// Cash flows (must contain at least one positive and one negative - /// value) or nan is returned. The first value is considered a sunk - /// cost at time zero. - /// - /// - /// Interest rate paid on the cash flows - /// - /// - /// Interest rate received on the cash flows upon reinvestment - /// - /// - /// Modified internal rate of return - /// - public float mirr(NDarray values, ValueType finance_rate, ValueType reinvest_rate) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - values, - 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: - /// - /// - /// Rate of interest (per period) - /// - /// - /// Payment - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public void nper(NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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 - /// - /// - /// Number of compounding periods - /// - /// - /// 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 nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - nper, - 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); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.indexing.gen.cs b/src/Numpy.Bare/NumPy.indexing.gen.cs deleted file mode 100644 index eddf6c0..0000000 --- a/src/Numpy.Bare/NumPy.indexing.gen.cs +++ /dev/null @@ -1,1348 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Translates slice objects to concatenation along the first axis. - /// - /// This is a simple way to build up arrays quickly. There are two use cases. - /// - /// If slice notation is used, the syntax start:stop:step is equivalent - /// to np.arange(start, stop, step) inside of the brackets. However, if - /// step is an imaginary number (i.e. 100j) then its integer portion is - /// interpreted as a number-of-points desired and the start and stop are - /// inclusive. In other words start:stop:stepj is interpreted as - /// np.linspace(start, stop, step, endpoint=1) inside of the brackets. - /// After expansion of slice notation, all comma separated sequences are - /// concatenated together. - /// - /// Optional character strings placed as the first element of the index - /// expression can be used to change the output. The strings ‘r’ or ‘c’ result - /// in matrix output. If the result is 1-D and ‘r’ is specified a 1 x N (row) - /// matrix is produced. If the result is 1-D and ‘c’ is specified, then a N x 1 - /// (column) matrix is produced. If the result is 2-D then both provide the - /// same matrix result. - /// - /// A string integer specifies which axis to stack multiple comma separated - /// arrays along. A string of two comma-separated integers allows indication - /// of the minimum number of dimensions to force each entry into as the - /// second integer (the axis to concatenate along is still the first integer). - /// - /// A string with three comma-separated integers allows specification of the - /// axis to concatenate along, the minimum number of dimensions to force the - /// entries to, and which axis should contain the start of the arrays which - /// are less than the specified number of dimensions. In other words the third - /// integer allows you to specify where the 1’s should be placed in the shape - /// of the arrays that have their shapes upgraded. By default, they are placed - /// in the front of the shape tuple. The third argument allows you to specify - /// where the start of the array should be instead. Thus, a third argument of - /// ‘0’ would place the 1’s at the end of the array shape. Negative integers - /// specify where in the new shape tuple the last dimension of upgraded arrays - /// should be placed, so the default is ‘-1’. - /// - public void r_() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("r_"); - } - - /// - /// A nicer way to build up index tuples for arrays. - /// - /// For any index combination, including slicing and axis insertion, - /// a[indices] is the same as a[np.index_exp[indices]] for any - /// array a. However, np.index_exp[indices] can be used anywhere - /// in Python code and returns a tuple of slice objects that can be - /// used in the construction of complex index expressions. - /// - /// Notes - /// - /// You can do all this with slice() plus a few special objects, - /// but there’s a lot to remember and this version is simpler because - /// it uses the standard array indexing syntax. - /// - /// - /// If True, always returns a tuple. - /// - public void s_(bool maketuple) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - maketuple, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("s_", 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. - /// - /// - /// Input array. - /// - /// - /// Indices of elements that are non-zero. - /// - public NDarray[] nonzero(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("nonzero", 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: - /// - /// - /// Where True, yield x, otherwise yield y. - /// - /// - /// 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 condition, NDarray y, NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condition, - y, - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("where", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array representing the indices of a grid. - /// - /// Compute an array where the subarrays contain index values 0,1,… - /// varying only along the corresponding axis. - /// - /// Notes - /// - /// The output shape is obtained by prepending the number of dimensions - /// in front of the tuple of dimensions, i.e. if dimensions is a tuple - /// (r0, ..., rN-1) of length N, the output shape is - /// (N,r0,...,rN-1). - /// - /// The subarrays grid[k] contains the N-D array of indices along the - /// k-th axis. Explicitly: - /// - /// - /// The shape of the grid. - /// - /// - /// Data type of the result. - /// - /// - /// The array of grid indices, - /// grid.shape = (len(dimensions),) + tuple(dimensions). - /// - public NDarray indices(int[] dimensions, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dimensions, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Construct an open mesh from multiple sequences. - /// - /// This function takes N 1-D sequences and returns N outputs with N - /// dimensions each, such that the shape is 1 in all but one dimension - /// and the dimension with the non-unit shape value cycles through all - /// N dimensions. - /// - /// Using ix_ one can quickly construct index arrays that will index - /// the cross product. a[np.ix_([1,3],[2,5])] returns the array - /// [[a[1,2] a[1,5]], [a[3,2] a[3,5]]]. - /// - /// - /// Each sequence should be of integer or boolean type. - /// Boolean sequences will be interpreted as boolean masks for the - /// corresponding dimension (equivalent to passing in - /// np.nonzero(boolean_sequence)). - /// - /// - /// N arrays with N dimensions each, with N the number of input - /// sequences. Together these arrays form an open mesh. - /// - public NDarray[] ix_(NDarray[] args) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ix_", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Converts a tuple of index arrays into an array of flat - /// indices, applying boundary modes to the multi-index. - /// - /// Notes - /// - /// - /// A tuple of integer arrays, one array for each dimension. - /// - /// - /// The shape of array into which the indices from multi_index apply. - /// - /// - /// Specifies how out-of-bounds indices are handled. Can specify - /// either one mode or a tuple of modes, one mode per index. - /// - /// In ‘clip’ mode, a negative index which would normally - /// wrap will clip to 0 instead. - /// - /// - /// Determines whether the multi-index should be viewed as - /// indexing in row-major (C-style) or column-major - /// (Fortran-style) order. - /// - /// - /// An array of indices into the flattened version of an array - /// of dimensions dims. - /// - public NDarray ravel_multi_index(tuple of array_like multi_index, tuple of ints dims, string mode = "raise", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - multi_index, - dims, - }); - var kwargs=new PyDict(); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ravel_multi_index", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Converts a flat index or array of flat indices into a tuple - /// of coordinate arrays. - /// - /// - /// An integer array whose elements are indices into the flattened - /// version of an array of dimensions shape. Before version 1.6.0, - /// this function accepted just one index value. - /// - /// - /// 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(NDarray indices, Shape shape, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - indices, - 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 array. - /// - /// This returns a tuple of indices that can be used to access the main - /// diagonal of an array a with a.ndim >= 2 dimensions and shape - /// (n, n, …, n). For a.ndim = 2 this is the usual diagonal, for - /// a.ndim > 2 this is the set of indices to access a[i, i, ..., i] - /// for i = [0..n-1]. - /// - /// Notes - /// - /// - /// The size, along each dimension, of the arrays for which the returned - /// indices can be used. - /// - /// - /// The number of dimensions. - /// - public void diag_indices(int n, int? ndim = 2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (ndim!=2) kwargs["ndim"]=ToPython(ndim); - dynamic py = __self__.InvokeMethod("diag_indices", pyargs, kwargs); - } - - /// - /// 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(NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("diag_indices_from", pyargs, kwargs); - } - - /// - /// Return the indices to access (n, n) arrays, given a masking function. - /// - /// Assume mask_func is a function that, for a square array a of size - /// (n, n) with a possible offset argument k, when called as - /// mask_func(a, k) returns a new array with zeros in certain locations - /// (functions like triu or tril do precisely this). Then this function - /// returns the indices where the non-zero values would be located. - /// - /// Notes - /// - /// - /// The returned indices will be valid to access arrays of shape (n, n). - /// - /// - /// A function whose call signature is similar to that of triu, tril. - /// That is, mask_func(x, k) returns a boolean array, shaped like x. - /// k is an optional argument to the function. - /// - /// - /// An optional argument which is passed through to mask_func. Functions - /// like triu, tril take a second argument that is interpreted as an - /// offset. - /// - /// - /// The n arrays of indices corresponding to the locations where - /// mask_func(np.ones((n, n)), k) is True. - /// - public NDarray[] mask_indices(int n, Delegate mask_func, int k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - mask_func, - k, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mask_indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices for the lower-triangle of an (n, m) array. - /// - /// Notes - /// - /// - /// The row dimension of the arrays for which the returned - /// indices will be valid. - /// - /// - /// Diagonal offset (see tril for details). - /// - /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. - /// - /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. - /// - public NDarray[] tril_indices(int n, int? k = 0, int? m = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - if (m!=null) kwargs["m"]=ToPython(m); - dynamic py = __self__.InvokeMethod("tril_indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices for the lower-triangle of arr. - /// - /// See tril_indices for full details. - /// - /// Notes - /// - /// - /// The indices will be valid for square arrays whose dimensions are - /// the same as arr. - /// - /// - /// Diagonal offset (see tril for details). - /// - public void tril_indices_from(NDarray arr, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - 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 an (n, m) array. - /// - /// Notes - /// - /// - /// The size of the arrays for which the returned indices will - /// be valid. - /// - /// - /// Diagonal offset (see triu for details). - /// - /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. - /// - /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. Can be used - /// to slice a ndarray of shape(n, n). - /// - public NDarray[] triu_indices(int n, int? k = 0, int? m = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - if (m!=null) kwargs["m"]=ToPython(m); - dynamic py = __self__.InvokeMethod("triu_indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices for the upper-triangle of arr. - /// - /// See triu_indices for full details. - /// - /// Notes - /// - /// - /// The indices will be valid for square arrays. - /// - /// - /// Diagonal offset (see triu for details). - /// - /// - /// Indices for the upper-triangle of arr. - /// - public NDarray[] triu_indices_from(NDarray arr, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("triu_indices_from", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Take elements from an array along an axis. - /// - /// When axis is not None, this function does the same thing as “fancy” - /// indexing (indexing arrays using arrays); however, it can be easier to use - /// if you need elements along a given axis. A call such as - /// np.take(arr, indices, axis=3) is equivalent to - /// arr[:,:,:,indices,...]. - /// - /// Explained without fancy indexing, this is equivalent to the following use - /// of ndindex, which sets each of ii, jj, and kk to a tuple of - /// indices: - /// - /// Notes - /// - /// By eliminating the inner loop in the description above, and using s_ to - /// build simple slice objects, take can be expressed in terms of applying - /// fancy indexing to each 1-d slice: - /// - /// For this reason, it is equivalent to (but faster than) the following use - /// of apply_along_axis: - /// - /// - /// The source array. - /// - /// - /// The indices of the values to extract. - /// - /// Also allow scalars for indices. - /// - /// - /// The axis over which to select values. By default, the flattened - /// input array is used. - /// - /// - /// If provided, the result will be placed in this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// 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. - /// - /// - /// The returned array has the same type as a. - /// - public NDarray take(NDarray[] a, NDarray[] indices, int? axis = null, NDarray @out = null, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - indices, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("take", 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: - /// - /// - /// Source array - /// - /// - /// 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 void take_along_axis(NDarray arr, NDarray indices, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - indices, - axis, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("take_along_axis", pyargs, kwargs); - } - - /// - /// Construct an array from an index array and a set of arrays to choose from. - /// - /// First of all, if confused or uncertain, definitely look at the Examples - - /// in its full generality, this function is less simple than it might - /// seem from the following code description (below ndi = - /// numpy.lib.index_tricks): - /// - /// np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)]). - /// - /// But this omits some subtleties. Here is a fully general summary: - /// - /// Given an “index” array (a) of integers and a sequence of n arrays - /// (choices), a and each choice array are first broadcast, as necessary, - /// to arrays of a common shape; calling these Ba and Bchoices[i], i = - /// 0,…,n-1 we have that, necessarily, Ba.shape == Bchoices[i].shape - /// for each i. Then, a new array with shape Ba.shape is created as - /// follows: - /// - /// Notes - /// - /// To reduce the chance of misinterpretation, even though the following - /// “abuse” is nominally supported, choices should neither be, nor be - /// thought of as, a single array, i.e., the outermost sequence-like container - /// should be either a list or a tuple. - /// - /// - /// This array must contain integers in [0, n-1], where n is the number - /// of choices, unless mode=wrap or mode=clip, in which cases any - /// integers are permissible. - /// - /// - /// Choice arrays. a and all of the choices must be broadcastable to the - /// same shape. If choices is itself an array (not recommended), then - /// its outermost dimension (i.e., the one corresponding to - /// choices.shape[0]) is taken as defining the “sequence”. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Specifies how indices outside [0, n-1] will be treated: - /// - /// - /// The merged result. - /// - public NDarray choose(NDarray a, NDarray[] choices, NDarray @out = null, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - choices, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("choose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return selected slices of an array along given axis. - /// - /// When working along a given axis, a slice along that axis is returned in - /// output for each index where condition evaluates to True. When - /// working on a 1-D array, compress is equivalent to extract. - /// - /// - /// Array that selects which entries to return. If len(condition) - /// is less than the size of a along the given axis, then output is - /// truncated to the length of the condition array. - /// - /// - /// Array from which to extract a part. - /// - /// - /// Axis along which to take slices. If None (default), work on the - /// flattened array. - /// - /// - /// Output array. Its type is preserved and it must be of the right - /// shape to hold the output. - /// - /// - /// A copy of a without the slices along axis for which condition - /// is false. - /// - public NDarray compress(NDarray condition, NDarray a, int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condition, - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("compress", 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. - /// - /// - /// Array from which the diagonals are taken. - /// - /// - /// 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(NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - } - - /// - /// Return an array drawn from elements in choicelist, depending on conditions. - /// - /// - /// The list of conditions which determine from which array in choicelist - /// the output elements are taken. When multiple conditions are satisfied, - /// the first one encountered in condlist is used. - /// - /// - /// The list of arrays from which the output elements are taken. It has - /// to be of the same length as condlist. - /// - /// - /// The element inserted in output when all conditions evaluate to False. - /// - /// - /// The output at position m is the m-th element of the array in - /// choicelist where the m-th element of the corresponding array in - /// condlist is True. - /// - public NDarray @select(NDarray[] condlist, NDarray[] choicelist, object @default = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condlist, - choicelist, - }); - var kwargs=new PyDict(); - if (@default!=null) kwargs["default"]=ToPython(@default); - dynamic py = __self__.InvokeMethod("select", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a view into the array with the given shape and strides. - /// - /// Notes - /// - /// as_strided creates a view into the array given the exact strides - /// and shape. This means it manipulates the internal data structure of - /// ndarray and, if done incorrectly, the array elements can point to - /// invalid memory and can corrupt results or crash your program. - /// It is advisable to always use the original x.strides when - /// calculating new strides to avoid reliance on a contiguous memory - /// layout. - /// - /// Furthermore, arrays created with this function often contain self - /// overlapping memory, so that two elements are identical. - /// Vectorized write operations on such arrays will typically be - /// unpredictable. They may even give different results for small, large, - /// or transposed arrays. - /// Since writing to these arrays has to be tested and done with great - /// care, you may want to use writeable=False to avoid accidental write - /// operations. - /// - /// For these reasons it is advisable to avoid as_strided when - /// possible. - /// - /// - /// Array to create a new. - /// - /// - /// The shape of the new array. Defaults to x.shape. - /// - /// - /// The strides of the new array. Defaults to x.strides. - /// - /// - /// If True, subclasses are preserved. - /// - /// - /// If set to False, the returned array will always be readonly. - /// Otherwise it will be writable if the original array was. It - /// is advisable to set this to False if possible (see Notes). - /// - public NDarray lib_stride_tricks_as_strided(NDarray x, Shape shape = null, int[] strides = null, bool? subok = false, bool? writeable = true) - { - //auto-generated code, do not change - var lib = self.GetAttr("lib"); - var stride_tricks = lib.GetAttr("stride_tricks"); - var __self__=stride_tricks; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (shape!=null) kwargs["shape"]=ToPython(shape); - if (strides!=null) kwargs["strides"]=ToPython(strides); - if (subok!=false) kwargs["subok"]=ToPython(subok); - if (writeable!=true) kwargs["writeable"]=ToPython(writeable); - dynamic py = __self__.InvokeMethod("as_strided", 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. - /// - /// - /// Array to put data into. - /// - /// - /// 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 arr, NDarray mask, NDarray vals) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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 array. - /// - /// - /// 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 a, NDarray ind, NDarray v, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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: - /// - /// - /// Destination array. - /// - /// - /// 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 arr, NDarray indices, NDarray[] values, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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. - /// - /// - /// Target array. - /// - /// - /// 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 a, NDarray mask, NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Array whose diagonal is to be filled, it gets modified in-place. - /// - /// - /// 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(NDarray a, ValueType val, bool wrap = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - val, - wrap, - }); - var kwargs=new PyDict(); - 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. - /// - /// - /// The array(s) to iterate over. - /// - /// - /// 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(NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - op, - }); - 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. - /// - /// - /// Input array. - /// - public void ndenumerate(NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ndenumerate", pyargs, kwargs); - } - - /// - /// An N-dimensional iterator object to index arrays. - /// - /// Given the shape of an array, an ndindex instance iterates over - /// the N-dimensional index of the array. At each iteration a tuple - /// of indices is returned, the last dimension is iterated over first. - /// - /// - /// The size of each dimension of the array. - /// - public void ndindex(int[] args) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ndindex", pyargs, kwargs); - } - - /* - /// - /// 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. - /// - /// - /// The array(s) to iterate over. - /// - /// - /// 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(NDarray op, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - op, - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("nested_iters", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Flat iterator object to iterate over arrays. - /// - /// A flatiter iterator is returned by x.flat for any array x. - /// It allows iterating over the array as if it were a 1-D array, - /// either in a for-loop or by calling its next method. - /// - /// Iteration is done in row-major, C-style order (the last - /// index varying the fastest). The iterator can also be indexed using - /// basic slicing or advanced indexing. - /// - /// Notes - /// - /// A flatiter iterator can not be constructed directly from Python code - /// by calling the flatiter constructor. - /// - public void flatiter() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("flatiter"); - } - - /// - /// Buffered iterator for big arrays. - /// - /// Arrayterator creates a buffered iterator for reading big arrays in small - /// contiguous blocks. The class is useful for objects stored in the - /// file system. It allows iteration over the object without reading - /// everything in memory; instead, small blocks are read and iterated over. - /// - /// Arrayterator can be used with any object that supports multidimensional - /// slices. This includes NumPy arrays, but also variables from - /// Scientific.IO.NetCDF or pynetcdf for example. - /// - /// Notes - /// - /// The algorithm works by first finding a “running dimension”, along which - /// the blocks will be extracted. Given an array of dimensions - /// (d1, d2, ..., dn), e.g. if buf_size is smaller than d1, the - /// first dimension will be used. If, on the other hand, - /// d1 < buf_size < d1*d2 the second dimension will be used, and so on. - /// Blocks are extracted along this dimension, and when the last block is - /// returned the process continues from the next dimension, until all - /// elements have been read. - /// - /// - /// The object to iterate over. - /// - /// - /// The buffer size. If buf_size is supplied, the maximum amount of - /// data that will be read into memory is buf_size elements. - /// Default is None, which will read as many element as possible - /// into memory. - /// - public void lib_Arrayterator(NDarray @var, int? buf_size = null) - { - //auto-generated code, do not change - var lib = self.GetAttr("lib"); - var __self__=lib; - var pyargs=ToTuple(new object[] - { - @var, - }); - var kwargs=new PyDict(); - if (buf_size!=null) kwargs["buf_size"]=ToPython(buf_size); - dynamic py = __self__.InvokeMethod("Arrayterator", pyargs, kwargs); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.io.gen.cs b/src/Numpy.Bare/NumPy.io.gen.cs deleted file mode 100644 index 6e1681c..0000000 --- a/src/Numpy.Bare/NumPy.io.gen.cs +++ /dev/null @@ -1,1174 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Load arrays or pickled objects from .npy, .npz or pickled files. - /// - /// Notes - /// - /// - /// The file to read. File-like objects must support the - /// seek() and read() methods. Pickled files require that the - /// file-like object support the readline() method as well. - /// - /// - /// If not None, then memory-map the file, using the given mode (see - /// numpy.memmap for a detailed description of the modes). A - /// memory-mapped array is kept on disk. However, it can be accessed - /// and sliced like any ndarray. Memory mapping is especially useful - /// for accessing small fragments of large files without reading the - /// entire file into memory. - /// - /// - /// Allow loading pickled object arrays stored in npy files. Reasons for - /// disallowing pickles include security, as loading pickled data can - /// execute arbitrary code. If pickles are disallowed, loading object - /// arrays will fail. - /// Default: True - /// - /// - /// Only useful when loading Python 2 generated pickled files on Python 3, - /// which includes npy/npz files containing object arrays. If fix_imports - /// is True, pickle will try to map the old Python 2 names to the new names - /// used in Python 3. - /// - /// - /// What encoding to use when reading Python 2 strings. Only useful when - /// loading Python 2 generated pickled files in Python 3, which includes - /// npy/npz files containing object arrays. Values other than ‘latin1’, - /// ‘ASCII’, and ‘bytes’ are not allowed, as they can corrupt numerical - /// data. Default: ‘ASCII’ - /// - /// - /// Data stored in the file. For .npz files, the returned instance - /// of NpzFile class must be closed to avoid leaking file descriptors. - /// - public NDarray load(string file, MemMapMode mmap_mode = null, bool? allow_pickle = true, bool? fix_imports = true, string encoding = "ASCII") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - if (mmap_mode!=null) kwargs["mmap_mode"]=ToPython(mmap_mode); - if (allow_pickle!=true) kwargs["allow_pickle"]=ToPython(allow_pickle); - if (fix_imports!=true) kwargs["fix_imports"]=ToPython(fix_imports); - if (encoding!="ASCII") kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("load", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Save an array to a binary file in NumPy .npy format. - /// - /// Notes - /// - /// For a description of the .npy format, see numpy.lib.format. - /// - /// - /// File or filename to which the data is saved. If file is a file-object, - /// then the filename is unchanged. If file is a string or Path, a .npy - /// extension will be appended to the file name if it does not already - /// have one. - /// - /// - /// Array data to be saved. - /// - /// - /// Allow saving object arrays using Python pickles. Reasons for disallowing - /// pickles include security (loading pickled data can execute arbitrary - /// code) and portability (pickled objects may not be loadable on different - /// Python installations, for example if the stored objects require libraries - /// that are not available, and not all pickled data is compatible between - /// Python 2 and Python 3). - /// Default: True - /// - /// - /// Only useful in forcing objects in object arrays on Python 3 to be - /// pickled in a Python 2 compatible way. If fix_imports is True, pickle - /// will try to map the new Python 3 names to the old module names used in - /// Python 2, so that the pickle data stream is readable with Python 2. - /// - public void save(string file, NDarray arr, bool? allow_pickle = true, bool? fix_imports = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - arr, - }); - var kwargs=new PyDict(); - if (allow_pickle!=true) kwargs["allow_pickle"]=ToPython(allow_pickle); - if (fix_imports!=true) kwargs["fix_imports"]=ToPython(fix_imports); - dynamic py = __self__.InvokeMethod("save", pyargs, kwargs); - } - - /// - /// Save several arrays into a single file in uncompressed .npz format. - /// - /// If arguments are passed in with no keywords, the corresponding variable - /// names, in the .npz file, are ‘arr_0’, ‘arr_1’, etc. If keyword - /// arguments are given, the corresponding variable names, in the .npz - /// file will match the keyword names. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is not compressed and each file - /// in the archive contains one variable in .npy format. For a - /// description of the .npy format, see numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public void savez(string file, NDarray[] args = null, Dictionary kwds = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - if (args!=null) kwargs["args"]=ToPython(args); - if (kwds!=null) kwargs["kwds"]=ToPython(kwds); - dynamic py = __self__.InvokeMethod("savez", pyargs, kwargs); - } - - /// - /// Save several arrays into a single file in compressed .npz format. - /// - /// If keyword arguments are given, then filenames are taken from the keywords. - /// If arguments are passed in with no keywords, then stored file names are - /// arr_0, arr_1, etc. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is compressed with - /// zipfile.ZIP_DEFLATED and each file in the archive contains one variable - /// in .npy format. For a description of the .npy format, see - /// numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public void savez_compressed(string file, NDarray[] args = null, Dictionary kwds = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - if (args!=null) kwargs["args"]=ToPython(args); - if (kwds!=null) kwargs["kwds"]=ToPython(kwds); - dynamic py = __self__.InvokeMethod("savez_compressed", pyargs, kwargs); - } - - /// - /// Save an array to a text file. - /// - /// Notes - /// - /// Further explanation of the fmt parameter - /// (%[flag]width[.precision]specifier): - /// - /// This explanation of fmt is not complete, for an exhaustive - /// specification see [1]. - /// - /// References - /// - /// - /// If the filename ends in .gz, the file is automatically saved in - /// compressed gzip format. loadtxt understands gzipped files - /// transparently. - /// - /// - /// Data to be saved to a text file. - /// - /// - /// A single format (%10.5f), a sequence of formats, or a - /// multi-format string, e.g. ‘Iteration %d – %10.5f’, in which - /// case delimiter is ignored. For complex X, the legal options - /// for fmt are: - /// - /// - /// String or character separating columns. - /// - /// - /// String or character separating lines. - /// - /// - /// String that will be written at the beginning of the file. - /// - /// - /// String that will be written at the end of the file. - /// - /// - /// String that will be prepended to the header and footer strings, - /// to mark them as comments. Default: ‘# ‘, as expected by e.g. - /// numpy.loadtxt. - /// - /// - /// Encoding used to encode the outputfile. Does not apply to output - /// streams. If the encoding is something other than ‘bytes’ or ‘latin1’ - /// you will not be able to load the file in NumPy versions < 1.14. Default - /// is ‘latin1’. - /// - public void savetxt(string fname, NDarray X, string[] fmt = null, string delimiter = " ", string newline = "\n", string header = "", string footer = "", string comments = null, string encoding = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fname, - X, - }); - var kwargs=new PyDict(); - if (fmt!=null) kwargs["fmt"]=ToPython(fmt); - if (delimiter!=" ") kwargs["delimiter"]=ToPython(delimiter); - if (newline!="\n") kwargs["newline"]=ToPython(newline); - if (header!="") kwargs["header"]=ToPython(header); - if (footer!="") kwargs["footer"]=ToPython(footer); - if (comments!=null) kwargs["comments"]=ToPython(comments); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("savetxt", pyargs, kwargs); - } - - /* - /// - /// Load data from a text file, with missing values handled as specified. - /// - /// Each line past the first skip_header lines is split at the delimiter - /// character, and characters following the comments character are discarded. - /// - /// Notes - /// - /// References - /// - /// - /// File, filename, list, or generator to read. If the filename - /// extension is gz or bz2, the file is first decompressed. Note - /// that generators must return byte strings in Python 3k. The strings - /// in a list or produced by a generator are treated as lines. - /// - /// - /// Data type of the resulting array. - /// If None, the dtypes will be determined by the contents of each - /// column, individually. - /// - /// - /// The character used to indicate the start of a comment. - /// All the characters occurring on a line after a comment are discarded - /// - /// - /// The string used to separate values. By default, any consecutive - /// whitespaces act as delimiter. An integer or sequence of integers - /// can also be provided as width(s) of each field. - /// - /// - /// skiprows was removed in numpy 1.10. Please use skip_header instead. - /// - /// - /// The number of lines to skip at the beginning of the file. - /// - /// - /// The number of lines to skip at the end of the file. - /// - /// - /// The set of functions that convert the data of a column to a value. - /// The converters can also be used to provide a default value - /// for missing data: converters = {3: lambda s: float(s or 0)}. - /// - /// - /// missing was removed in numpy 1.10. Please use missing_values - /// instead. - /// - /// - /// The set of strings corresponding to missing data. - /// - /// - /// The set of values to be used as default when the data are missing. - /// - /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1, 4, 5) will extract the 2nd, 5th and 6th columns. - /// - /// - /// If names is True, the field names are read from the first line after - /// the first skip_header lines. This line can optionally be proceeded - /// by a comment delimiter. If names is a sequence or a single-string of - /// comma-separated names, the names will be used to define the field names - /// in a structured dtype. If names is None, the names of the dtype - /// fields will be used, if any. - /// - /// - /// A list of names to exclude. This list is appended to the default list - /// [‘return’,’file’,’print’]. Excluded names are appended an underscore: - /// for example, file would become file_. - /// - /// - /// A string combining invalid characters that must be deleted from the - /// names. - /// - /// - /// A format used to define default field names, such as “f%i” or “f_%02i”. - /// - /// - /// Whether to automatically strip white spaces from the variables. - /// - /// - /// Character(s) used in replacement of white spaces in the variables - /// names. By default, use a ‘_’. - /// - /// - /// If True, field names are case sensitive. - /// If False or ‘upper’, field names are converted to upper case. - /// If ‘lower’, field names are converted to lower case. - /// - /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...) - /// - /// - /// If True, return a masked array. - /// If False, return a regular array. - /// - /// - /// If True, do not raise errors for invalid values. - /// - /// - /// If True, an exception is raised if an inconsistency is detected in the - /// number of columns. - /// If False, a warning is emitted and the offending lines are skipped. - /// - /// - /// The maximum number of rows to read. Must not be used with skip_footer - /// at the same time. If given, the value must be at least 1. Default is - /// to read the entire file. - /// - /// - /// Encoding used to decode the inputfile. Does not apply when fname is - /// a file object. The special value ‘bytes’ enables backward compatibility - /// workarounds that ensure that you receive byte arrays when possible - /// and passes latin1 encoded strings to converters. Override this value to - /// receive unicode arrays and pass strings as input to converters. If set - /// to None the system default is used. The default value is ‘bytes’. - /// - /// - /// Data read from the text file. If usemask is True, this is a - /// masked array. - /// - public NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, char replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fname, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (comments!=null) kwargs["comments"]=ToPython(comments); - if (delimiter!=null) kwargs["delimiter"]=ToPython(delimiter); - if (skiprows!=null) kwargs["skiprows"]=ToPython(skiprows); - if (skip_header!=0) kwargs["skip_header"]=ToPython(skip_header); - if (skip_footer!=0) kwargs["skip_footer"]=ToPython(skip_footer); - if (converters!=null) kwargs["converters"]=ToPython(converters); - if (missing!=null) kwargs["missing"]=ToPython(missing); - if (missing_values!=null) kwargs["missing_values"]=ToPython(missing_values); - if (filling_values!=null) kwargs["filling_values"]=ToPython(filling_values); - if (usecols!=null) kwargs["usecols"]=ToPython(usecols); - if (names!=null) kwargs["names"]=ToPython(names); - if (excludelist!=null) kwargs["excludelist"]=ToPython(excludelist); - if (deletechars!=null) kwargs["deletechars"]=ToPython(deletechars); - if (defaultfmt!="f%i") kwargs["defaultfmt"]=ToPython(defaultfmt); - if (autostrip!=false) kwargs["autostrip"]=ToPython(autostrip); - if (replace_space!="_") kwargs["replace_space"]=ToPython(replace_space); - if (case_sensitive!=true) kwargs["case_sensitive"]=ToPython(case_sensitive); - if (unpack!=null) kwargs["unpack"]=ToPython(unpack); - if (usemask!=false) kwargs["usemask"]=ToPython(usemask); - if (loose!=true) kwargs["loose"]=ToPython(loose); - if (invalid_raise!=true) kwargs["invalid_raise"]=ToPython(invalid_raise); - if (max_rows!=null) kwargs["max_rows"]=ToPython(max_rows); - if (encoding!="bytes") kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("genfromtxt", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Construct an array from a text file, using regular expression parsing. - /// - /// The returned array is always a structured array, and is constructed from - /// all matches of the regular expression in the file. Groups in the regular - /// expression are converted to fields of the structured array. - /// - /// Notes - /// - /// Dtypes for structured arrays can be specified in several forms, but all - /// forms specify at least the data type and field name. For details see - /// doc.structured_arrays. - /// - /// - /// File name or file object to read. - /// - /// - /// Regular expression used to parse the file. - /// Groups in the regular expression correspond to fields in the dtype. - /// - /// - /// Dtype for the structured array. - /// - /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// - /// - /// The output array, containing the part of the content of file that - /// was matched by regexp. output is always a structured array. - /// - public NDarray fromregex(string file, string regexp, Dtype dtype, string encoding = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - regexp, - dtype, - }); - var kwargs=new PyDict(); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("fromregex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Write array to a file as text or binary (default). - /// - /// Data is always written in ‘C’ order, independent of the order of a. - /// The data produced by this method can be recovered using the function - /// fromfile(). - /// - /// Notes - /// - /// This is a convenience function for quick storage of array data. - /// Information on endianness and precision is lost, so this method is not a - /// good choice for files intended to archive data or transport data between - /// machines with different endianness. Some of these problems can be overcome - /// by outputting the data as text files, at the expense of speed and file - /// size. - /// - /// When fid is a file object, array contents are directly written to the - /// file, bypassing the file object’s write method. As a result, tofile - /// cannot be used with files objects supporting compression (e.g., GzipFile) - /// or file-like objects that do not support fileno() (e.g., BytesIO). - /// - /// - /// An open file object, or a string containing a filename. - /// - /// - /// Separator between array items for text output. - /// If “” (empty), a binary file is written, equivalent to - /// file.write(a.tobytes()). - /// - /// - /// Format string for text file output. - /// Each entry in the array is formatted to text by first converting - /// it to the closest Python type, and then using “format” % item. - /// - public void tofile(string fid, string sep, string format) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fid, - sep, - format, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tofile", pyargs, kwargs); - } - - /* - /// - /// Return the array as a (possibly nested) list. - /// - /// Return a copy of the array data as a (nested) Python list. - /// Data items are converted to the nearest compatible Python type. - /// - /// Notes - /// - /// The array may be recreated, a = np.array(a.tolist()). - /// - /// - /// The possibly nested list of array elements. - /// - public List tolist() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("tolist"); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input 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(NDarray arr, 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[] - { - arr, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, 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[] - { - a, - }); - 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); - } - - /* - /// - /// Format a floating-point scalar as a decimal string in positional notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. - /// - /// - /// Value to format. - /// - /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. - /// - /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print out all necessary digits, otherwise digit generation - /// is cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. - /// - /// - /// If True, the cutoff of precision digits refers to the total number - /// of digits after the decimal point, including leading zeros. - /// If False, precision refers to the total number of significant - /// digits, before or after the decimal point, ignoring leading zeros. - /// - /// - /// Controls post-processing trimming of trailing digits, as follows: - /// - /// - /// Whether to show the sign for positive values. - /// - /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. - /// - /// - /// Pad the right side of the string with whitespace until at least that - /// many characters are to the right of the decimal point. - /// - /// - /// The string representation of the floating point value - /// - public string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (unique!=true) kwargs["unique"]=ToPython(unique); - if (fractional!=true) kwargs["fractional"]=ToPython(fractional); - if (trim!="k") kwargs["trim"]=ToPython(trim); - if (sign!=false) kwargs["sign"]=ToPython(sign); - if (pad_left!=null) kwargs["pad_left"]=ToPython(pad_left); - if (pad_right!=null) kwargs["pad_right"]=ToPython(pad_right); - dynamic py = __self__.InvokeMethod("format_float_positional", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Format a floating-point scalar as a decimal string in scientific notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. - /// - /// - /// Value to format. - /// - /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. - /// - /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print all necessary digits, otherwise digit generation is - /// cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. - /// - /// - /// Controls post-processing trimming of trailing digits, as follows: - /// - /// - /// Whether to show the sign for positive values. - /// - /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. - /// - /// - /// Pad the exponent with zeros until it contains at least this many digits. - /// If omitted, the exponent will be at least 2 digits. - /// - /// - /// The string representation of the floating point value - /// - public string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (unique!=true) kwargs["unique"]=ToPython(unique); - if (trim!="k") kwargs["trim"]=ToPython(trim); - if (sign!=false) kwargs["sign"]=ToPython(sign); - if (pad_left!=null) kwargs["pad_left"]=ToPython(pad_left); - if (exp_digits!=null) kwargs["exp_digits"]=ToPython(exp_digits); - dynamic py = __self__.InvokeMethod("format_float_scientific", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Create a memory-map to an array stored in a binary file on disk. - /// - /// Memory-mapped files are used for accessing small segments of large files - /// on disk, without reading the entire file into memory. NumPy’s - /// memmap’s are array-like objects. This differs from Python’s mmap - /// module, which uses file-like objects. - /// - /// This subclass of ndarray has some unpleasant interactions with - /// some operations, because it doesn’t quite fit properly as a subclass. - /// An alternative to using this subclass is to create the mmap - /// object yourself, then create an ndarray with ndarray.__new__ directly, - /// passing the object created in its ‘buffer=’ parameter. - /// - /// This class may at some point be turned into a factory function - /// which returns a view into an mmap buffer. - /// - /// Delete the memmap instance to close the memmap file. - /// - /// Notes - /// - /// The memmap object can be used anywhere an ndarray is accepted. - /// Given a memmap fp, isinstance(fp, numpy.ndarray) returns - /// True. - /// - /// Memory-mapped files cannot be larger than 2GB on 32-bit systems. - /// - /// When a memmap causes a file to be created or extended beyond its - /// current size in the filesystem, the contents of the new part are - /// unspecified. On systems with POSIX filesystem semantics, the extended - /// part will be filled with zero bytes. - /// - /// - /// The file name or file object to be used as the array data buffer. - /// - /// - /// The data-type used to interpret the file contents. - /// Default is uint8. - /// - /// - /// The file is opened in this mode: - /// - /// Default is ‘r+’. - /// - /// - /// In the file, array data starts at this offset. Since offset is - /// measured in bytes, it should normally be a multiple of the byte-size - /// of dtype. When mode != 'r', even positive offsets beyond end of - /// file are valid; The file will be extended to accommodate the - /// additional data. By default, memmap will start at the beginning of - /// the file, even if filename is a file pointer fp and - /// fp.tell() != 0. - /// - /// - /// The desired shape of the array. If mode == 'r' and the number - /// of remaining bytes after offset is not a multiple of the byte-size - /// of dtype, you must specify shape. By default, the returned array - /// will be 1-D with the number of elements determined by file size - /// and data-type. - /// - /// - /// Specify the order of the ndarray memory layout: - /// row-major, C-style or column-major, - /// Fortran-style. This only has an effect if the shape is - /// greater than 1-D. The default order is ‘C’. - /// - public void memmap(string filename, Dtype dtype = null, string mode = null, int? offset = null, Shape shape = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - filename, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (mode!=null) kwargs["mode"]=ToPython(mode); - if (offset!=null) kwargs["offset"]=ToPython(offset); - if (shape!=null) kwargs["shape"]=ToPython(shape); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("memmap", pyargs, kwargs); - } - - /* - /// - /// Set printing options. - /// - /// These options determine the way floating point numbers, arrays and - /// other NumPy objects are displayed. - /// - /// Notes - /// - /// formatter is always reset with a call to set_printoptions. - /// - /// - /// Number of digits of precision for floating point output (default 8). - /// May be None if floatmode is not fixed, to print as many digits as - /// necessary to uniquely specify the value. - /// - /// - /// Total number of array elements which trigger summarization - /// rather than full repr (default 1000). - /// - /// - /// Number of array items in summary at beginning and end of - /// each dimension (default 3). - /// - /// - /// The number of characters per line for the purpose of inserting - /// line breaks (default 75). - /// - /// - /// If True, always print floating point numbers using fixed point - /// notation, in which case numbers equal to zero in the current precision - /// will print as zero. If False, then scientific notation is used when - /// absolute value of the smallest number is < 1e-4 or the ratio of the - /// maximum absolute value to the minimum is > 1e3. The default is False. - /// - /// - /// String representation of floating point not-a-number (default nan). - /// - /// - /// String representation of floating point infinity (default inf). - /// - /// - /// 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. (default ‘-‘) - /// - /// - /// 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: - /// - /// - /// 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. - /// - public void set_printoptions(int? precision = null, int? threshold = null, int? edgeitems = null, int? linewidth = null, bool? suppress = null, string nanstr = null, string infstr = null, string sign = null, dict of callables formatter = 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 (precision!=null) kwargs["precision"]=ToPython(precision); - if (threshold!=null) kwargs["threshold"]=ToPython(threshold); - if (edgeitems!=null) kwargs["edgeitems"]=ToPython(edgeitems); - if (linewidth!=null) kwargs["linewidth"]=ToPython(linewidth); - if (suppress!=null) kwargs["suppress"]=ToPython(suppress); - if (nanstr!=null) kwargs["nanstr"]=ToPython(nanstr); - if (infstr!=null) kwargs["infstr"]=ToPython(infstr); - if (sign!=null) kwargs["sign"]=ToPython(sign); - if (formatter!=null) kwargs["formatter"]=ToPython(formatter); - if (floatmode!=null) kwargs["floatmode"]=ToPython(floatmode); - if (legacy!=null) kwargs["legacy"]=ToPython(legacy); - dynamic py = __self__.InvokeMethod("set_printoptions", pyargs, kwargs); - } - */ - - /// - /// Return the current print options. - /// - /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. - /// - /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. - /// - public Hashtable get_printoptions(Hashtable print_opts) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - print_opts, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("get_printoptions", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Set a Python function to be used when pretty printing arrays. - /// - /// - /// Function to be used to pretty print arrays. The function should expect - /// a single array argument and return a string of the representation of - /// the array. If None, the function is reset to the default NumPy function - /// to print arrays. - /// - /// - /// If True (default), the function for pretty printing (__repr__) - /// is set, if False the function that returns the default string - /// representation (__str__) is set. - /// - public void set_string_function(function or None f, bool? repr = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - f, - }); - var kwargs=new PyDict(); - if (repr!=true) kwargs["repr"]=ToPython(repr); - dynamic py = __self__.InvokeMethod("set_string_function", pyargs, kwargs); - } - */ - - /// - /// Return a string representation of a number in the given base system. - /// - /// - /// The value to convert. Positive and negative values are handled. - /// - /// - /// Convert number to the base number system. The valid range is 2-36, - /// the default value is 2. - /// - /// - /// Number of zeros padded on the left. Default is 0 (no padding). - /// - /// - /// String representation of number in base system. - /// - public string base_repr(int number, int? @base = 2, int? padding = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - number, - }); - var kwargs=new PyDict(); - if (@base!=2) kwargs["base"]=ToPython(@base); - if (padding!=0) kwargs["padding"]=ToPython(padding); - dynamic py = __self__.InvokeMethod("base_repr", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// A generic data source file (file, http, ftp, …). - /// - /// DataSources can be local files or remote files/URLs. The files may - /// also be compressed or uncompressed. DataSource hides some of the - /// low-level details of downloading the file, allowing you to simply pass - /// in a valid file path (or URL) and obtain a file object. - /// - /// Notes - /// - /// URLs require a scheme string (http://) to be used, without it they - /// will fail: - /// - /// Temporary directories are deleted when the DataSource is deleted. - /// - /// - /// Path to the directory where the source file gets downloaded to for - /// use. If destpath is None, a temporary directory will be created. - /// The default path is the current directory. - /// - public void DataSource(string destpath = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (destpath!=null) kwargs["destpath"]=ToPython(destpath); - dynamic py = __self__.InvokeMethod("DataSource", pyargs, kwargs); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.linalg.gen.cs b/src/Numpy.Bare/NumPy.linalg.gen.cs deleted file mode 100644 index a1bb240..0000000 --- a/src/Numpy.Bare/NumPy.linalg.gen.cs +++ /dev/null @@ -1,963 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Dot product of two arrays. Specifically, - /// - /// - /// First argument. - /// - /// - /// 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 a, NDarray b, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("dot", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the dot product of two or more arrays in a single function call, - /// while automatically selecting the fastest evaluation order. - /// - /// multi_dot chains numpy.dot and uses optimal parenthesization - /// of the matrices [1] [2]. Depending on the shapes of the matrices, - /// this can speed up the multiplication a lot. - /// - /// If the first argument is 1-D it is treated as a row vector. - /// If the last argument is 1-D it is treated as a column vector. - /// The other arguments must be 2-D. - /// - /// Think of multi_dot as: - /// - /// Notes - /// - /// The cost for a matrix multiplication can be calculated with the - /// following function: - /// - /// Let’s assume we have three matrices - /// . - /// - /// The costs for the two different parenthesizations are as follows: - /// - /// References - /// - /// - /// If the first argument is 1-D it is treated as row vector. - /// If the last argument is 1-D it is treated as column vector. - /// The other arguments must be 2-D. - /// - /// - /// Returns the dot product of the supplied arrays. - /// - public NDarray linalg_multi_dot(NDarray[] arrays) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - arrays, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("multi_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. - /// - /// - /// If a is complex the complex conjugate is taken before calculation - /// of the dot product. - /// - /// - /// 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 a, NDarray b) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// If a and b are nonscalar, their last dimensions must match. - /// - /// - /// out.shape = a.shape[:-1] + b.shape[:-1] - /// - public NDarray inner(NDarray b, NDarray a) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - 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 - /// - /// - /// First input vector. Input is flattened if - /// not already 1-dimensional. - /// - /// - /// 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 a, NDarray b, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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”. - /// - /// - /// Tensors to “dot”. - /// - public NDarray tensordot(NDarray b, NDarray a, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - a, - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tensordot", 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 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, - operands, - }); - 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 lowest cost contraction order for an einsum expression by - /// considering the creation of intermediate arrays. - /// - /// Notes - /// - /// The resulting path indicates which terms of the input contraction should be - /// contracted first, the result of this contraction is then appended to the - /// end of the contraction list. This list can then be iterated over until all - /// intermediate contractions are complete. - /// - /// - /// Specifies the subscripts for summation. - /// - /// - /// These are the arrays for the operation. - /// - /// - /// Choose the type of path. If a tuple is provided, the second argument is - /// assumed to be the maximum intermediate size created. If only a single - /// argument is provided the largest input or output array size is used - /// as a maximum intermediate size. - /// - /// Default is ‘greedy’. - /// - /// - /// A tuple of: - /// path - /// A list representation of the einsum path. - /// string_repr - /// A printable representation of the einsum path. - /// - public (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, {bool optimize = "greedy") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - subscripts, - operands, - optimize, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("einsum_path", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - */ - - /// - /// Raise a square matrix to the (integer) power n. - /// - /// For positive integers n, the power is computed by repeated matrix - /// squarings and matrix multiplications. If n == 0, the identity matrix - /// of the same shape as M is returned. If n < 0, the inverse - /// is computed and then raised to the abs(n). - /// - /// - /// Matrix to be “powered.” - /// - /// - /// The exponent can be any integer or long integer, positive, - /// negative, or zero. - /// - /// - /// The return value is the same shape and type as M; - /// if the exponent is positive or zero then the type of the - /// elements is the same as those of M. If the exponent is - /// negative the elements are floating-point. - /// - public NDarray linalg_matrix_power(NDarray a, int n) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - n, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("matrix_power", 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 b, NDarray a) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("kron", 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 (NDarray, NDarray, NDarray) linalg_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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /* - /// - /// Compute the condition number of a matrix. - /// - /// This function is capable of returning the condition number using - /// one of seven different norms, depending on the value of p (see - /// Parameters below). - /// - /// Notes - /// - /// The condition number of x is defined as the norm of x times the - /// norm of the inverse of x [1]; the norm can be the usual L2-norm - /// (root-of-sum-of-squares) or one of a number of other matrix norms. - /// - /// References - /// - /// - /// The matrix whose condition number is sought. - /// - /// - /// Order of the norm: - /// - /// inf means the numpy.inf object, and the Frobenius norm is - /// the root-of-sum-of-squares norm. - /// - /// - /// The condition number of the matrix. May be infinite. - /// - public {float linalg_cond(NDarray x, {None p = null) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (p!=null) kwargs["p"]=ToPython(p); - dynamic py = __self__.InvokeMethod("cond", pyargs, kwargs); - return ToCsharp<{float>(py); - } - */ - - /// - /// Return matrix rank of array using SVD method - /// - /// Rank of the array is the number of singular values of the array that are - /// greater than tol. - /// - /// Notes - /// - /// The default threshold to detect rank deficiency is a test on the magnitude - /// of the singular values of M. By default, we identify singular values less - /// than S.max() * max(M.shape) * eps as indicating rank deficiency (with - /// the symbols defined above). This is the algorithm MATLAB uses [1]. It also - /// appears in Numerical recipes in the discussion of SVD solutions for linear - /// least squares [2]. - /// - /// This default threshold is designed to detect rank deficiency accounting for - /// the numerical errors of the SVD computation. Imagine that there is a column - /// in M that is an exact (in floating point) linear combination of other - /// columns in M. Computing the SVD on M will not produce a singular value - /// exactly equal to 0 in general: any difference of the smallest SVD value from - /// 0 will be caused by numerical imprecision in the calculation of the SVD. - /// Our threshold for small SVD values takes this numerical imprecision into - /// account, and the default threshold will detect such numerical rank - /// deficiency. The threshold may declare a matrix M rank deficient even if - /// the linear combination of some columns of M is not exactly equal to - /// another column of M but only numerically very close to another column of - /// M. - /// - /// We chose our default threshold because it is in wide use. Other thresholds - /// are possible. For example, elsewhere in the 2007 edition of Numerical - /// recipes there is an alternative threshold of S.max() * - /// np.finfo(M.dtype).eps / 2. * np.sqrt(m + n + 1.). The authors describe - /// this threshold as being based on “expected roundoff error” (p 71). - /// - /// The thresholds above deal with floating point roundoff error in the - /// calculation of the SVD. However, you may have more information about the - /// sources of error in M that would make you consider other tolerance values - /// to detect effective rank deficiency. The most useful measure of the - /// tolerance depends on the operations you intend to use on your matrix. For - /// example, if your data come from uncertain measurements with uncertainties - /// greater than floating point epsilon, choosing a tolerance near that - /// uncertainty may be preferable. The tolerance may be absolute if the - /// uncertainties are absolute rather than relative. - /// - /// References - /// - /// - /// input vector or stack of matrices - /// - /// - /// threshold below which SVD values are considered zero. If tol is - /// None, and S is an array with singular values for M, and - /// eps is the epsilon value for datatype of S, then tol is - /// set to S.max() * max(M.shape) * eps. - /// - /// - /// If True, M is assumed to be Hermitian (symmetric if real-valued), - /// enabling a more efficient method for finding singular values. - /// Defaults to False. - /// - public int linalg_matrix_rank(NDarray M, NDarray tol = null, bool? hermitian = false) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - if (tol!=null) kwargs["tol"]=ToPython(tol); - if (hermitian!=false) kwargs["hermitian"]=ToPython(hermitian); - dynamic py = __self__.InvokeMethod("matrix_rank", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the sign and (natural) logarithm of the determinant of an array. - /// - /// If an array has a very small or very large determinant, then a call to - /// det may overflow or underflow. This routine is more robust against such - /// issues, because it computes the logarithm of the determinant rather than - /// the determinant itself. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. - /// - /// - /// Input array, has to be a square 2-D array. - /// - /// - /// A tuple of: - /// sign - /// A number representing the sign of the determinant. For a real matrix, - /// this is 1, 0, or -1. For a complex matrix, this is a complex number - /// with absolute value 1 (i.e., it is on the unit circle), or else 0. - /// logdet - /// The natural log of the absolute value of the determinant. - /// - public (NDarray, NDarray) linalg_slogdet(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("slogdet", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// 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. - /// - /// - /// Input array, from which the diagonals are taken. - /// - /// - /// 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(NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - } - - /// - /// Solve the tensor equation a x = b for x. - /// - /// It is assumed that all indices of x are summed over in the product, - /// together with the rightmost indices of a, as is done in, for example, - /// tensordot(a, x, axes=b.ndim). - /// - /// - /// Coefficient tensor, of shape b.shape + Q. Q, a tuple, equals - /// the shape of that sub-tensor of a consisting of the appropriate - /// number of its rightmost indices, and must be such that - /// prod(Q) == prod(b.shape) (in which sense a is said to be - /// ‘square’). - /// - /// - /// Right-hand tensor, which can be of any shape. - /// - /// - /// Axes in a to reorder to the right, before inversion. - /// If None (default), no reordering is done. - /// - public NDarray linalg_tensorsolve(NDarray a, NDarray b, int[] axes = null) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("tensorsolve", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the ‘inverse’ of an N-dimensional array. - /// - /// The result is an inverse for a relative to the tensordot operation - /// tensordot(a, b, ind), i. e., up to floating-point accuracy, - /// tensordot(tensorinv(a), a, ind) is the “identity” tensor for the - /// tensordot operation. - /// - /// - /// Tensor to ‘invert’. Its shape must be ‘square’, i. e., - /// prod(a.shape[:ind]) == prod(a.shape[ind:]). - /// - /// - /// Number of first indices that are involved in the inverse sum. - /// Must be a positive integer, default is 2. - /// - /// - /// a’s tensordot inverse, shape a.shape[ind:] + a.shape[:ind]. - /// - public NDarray linalg_tensorinv(NDarray a, int? ind = 2) - { - //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 (ind!=2) kwargs["ind"]=ToPython(ind); - dynamic py = __self__.InvokeMethod("tensorinv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Generic Python-exception-derived object raised by linalg functions. - /// - /// General purpose exception class, derived from Python’s exception.Exception - /// class, programmatically raised in linalg functions when a Linear - /// Algebra-related condition would prevent further correct execution of the - /// function. - /// - public void linalg_LinAlgError() - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - dynamic py = __self__.InvokeMethod("LinAlgError"); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.linalg_fft.gen.cs b/src/Numpy.Bare/NumPy.linalg_fft.gen.cs deleted file mode 100644 index 667f026..0000000 --- a/src/Numpy.Bare/NumPy.linalg_fft.gen.cs +++ /dev/null @@ -1,988 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Cholesky decomposition. - /// - /// Return the Cholesky decomposition, L * L.H, of the square matrix a, - /// where L is lower-triangular and .H is the conjugate transpose operator - /// (which is the ordinary transpose if a is real-valued). a must be - /// Hermitian (symmetric if real-valued) and positive-definite. Only L is - /// actually returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The Cholesky decomposition is often used as a fast way of solving - /// - /// (when A is both Hermitian/symmetric and positive-definite). - /// - /// First, we solve for in - /// - /// and then for in - /// - /// - /// Hermitian (symmetric if all elements are real), positive-definite - /// input matrix. - /// - /// - /// Upper or lower-triangular Cholesky factor of a. Returns a - /// matrix object if a is a matrix object. - /// - public NDarray linalg_cholesky(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("cholesky", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the determinant of an array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. - /// - /// - /// Input array to compute determinants for. - /// - /// - /// Determinant of a. - /// - public NDarray linalg_det(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("det", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the eigenvalues and right eigenvectors of a square array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// The number w is an eigenvalue of a if there exists a vector - /// v such that dot(a,v) = w * v. Thus, the arrays a, w, and - /// v satisfy the equations dot(a[:,:], v[:,i]) = w[i] * v[:,i] - /// for . - /// - /// The array v of eigenvectors may not be of maximum rank, that is, some - /// of the columns may be linearly dependent, although round-off error may - /// obscure that fact. If the eigenvalues are all different, then theoretically - /// the eigenvectors are linearly independent. Likewise, the (complex-valued) - /// matrix of eigenvectors v is unitary if the matrix a is normal, i.e., - /// if dot(a, a.H) = dot(a.H, a), where a.H denotes the conjugate - /// transpose of a. - /// - /// Finally, it is emphasized that v consists of the right (as in - /// right-hand side) eigenvectors of a. A vector y satisfying - /// dot(y.T, a) = z * y.T for some number z is called a left - /// eigenvector of a, and, in general, the left and right eigenvectors - /// of a matrix are not necessarily the (perhaps conjugate) transposes - /// of each other. - /// - /// References - /// - /// G. Strang, Linear Algebra and Its Applications, 2nd Ed., Orlando, FL, - /// Academic Press, Inc., 1980, Various pp. - /// - /// - /// Matrices for which the eigenvalues and right eigenvectors will - /// be computed - /// - /// - /// A tuple of: - /// w - /// The eigenvalues, each repeated according to its multiplicity. - /// The eigenvalues are not necessarily ordered. The resulting - /// array will be of complex type, unless the imaginary part is - /// zero in which case it will be cast to a real type. When a - /// is real the resulting eigenvalues will be real (0 imaginary - /// part) or occur in conjugate pairs - /// v - /// The normalized (unit “length”) eigenvectors, such that the - /// column v[:,i] is the eigenvector corresponding to the - /// eigenvalue w[i]. - /// - public (NDarray, NDarray) linalg_eig(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("eig", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Return the eigenvalues and eigenvectors of a complex Hermitian - /// (conjugate symmetric) or a real symmetric matrix. - /// - /// Returns two objects, a 1-D array containing the eigenvalues of a, and - /// a 2-D square array or matrix (depending on the input type) of the - /// corresponding eigenvectors (in columns). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues/eigenvectors are computed using LAPACK routines _syevd, - /// _heevd - /// - /// The eigenvalues of real symmetric or complex Hermitian matrices are - /// always real. [1] The array v of (column) eigenvectors is unitary - /// and a, w, and v satisfy the equations - /// dot(a, v[:, i]) = w[i] * v[:, i]. - /// - /// References - /// - /// - /// Hermitian or real symmetric matrices whose eigenvalues and - /// eigenvectors are to be computed. - /// - /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. - /// - /// - /// A tuple of: - /// w - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. - /// v - /// The column v[:, i] is the normalized eigenvector corresponding - /// to the eigenvalue w[i]. Will return a matrix object if a is - /// a matrix object. - /// - public (NDarray, NDarray) linalg_eigh(NDarray a, string UPLO = "L") - { - //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 (UPLO!="L") kwargs["UPLO"]=ToPython(UPLO); - dynamic py = __self__.InvokeMethod("eigh", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the eigenvalues of a general matrix. - /// - /// Main difference between eigvals and eig: the eigenvectors aren’t - /// returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// - /// A complex- or real-valued matrix whose eigenvalues will be computed. - /// - /// - /// The eigenvalues, each repeated according to its multiplicity. - /// They are not necessarily ordered, nor are they necessarily - /// real for real matrices. - /// - public NDarray linalg_eigvals(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("eigvals", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the eigenvalues of a complex Hermitian or real symmetric matrix. - /// - /// Main difference from eigh: the eigenvectors are not computed. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues are computed using LAPACK routines _syevd, _heevd - /// - /// - /// A complex- or real-valued matrix whose eigenvalues are to be - /// computed. - /// - /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. - /// - /// - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. - /// - public NDarray linalg_eigvalsh(NDarray a, string UPLO = "L") - { - //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 (UPLO!="L") kwargs["UPLO"]=ToPython(UPLO); - dynamic py = __self__.InvokeMethod("eigvalsh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the (multiplicative) inverse of a matrix. - /// - /// Given a square matrix a, return the matrix ainv satisfying - /// dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// - /// Matrix to be inverted. - /// - /// - /// (Multiplicative) inverse of the matrix a. - /// - public NDarray linalg_inv(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("inv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the least-squares solution to a linear matrix equation. - /// - /// Solves the equation a x = b by computing a vector x that - /// minimizes the Euclidean 2-norm || b - a x ||^2. The equation may - /// be under-, well-, or over- determined (i.e., the number of - /// linearly independent rows of a can be less than, equal to, or - /// greater than its number of linearly independent columns). If a - /// is square and of full rank, then x (but for round-off error) is - /// the “exact” solution of the equation. - /// - /// Notes - /// - /// If b is a matrix, then all array results are returned as matrices. - /// - /// - /// “Coefficient” matrix. - /// - /// - /// Ordinate or “dependent variable” values. If b is two-dimensional, - /// the least-squares solution is calculated for each of the K columns - /// of b. - /// - /// - /// Cut-off ratio for small singular values of a. - /// For the purposes of rank determination, singular values are treated - /// as zero if they are smaller than rcond times the largest singular - /// value of a. - /// - /// - /// A tuple of: - /// x - /// Least-squares solution. If b is two-dimensional, - /// the solutions are in the K columns of x. - /// residuals - /// Sums of residuals; squared Euclidean 2-norm for each column in - /// b - a*x. - /// If the rank of a is < N or M <= N, this is an empty array. - /// If b is 1-dimensional, this is a (1,) shape array. - /// Otherwise the shape is (K,). - /// rank - /// Rank of matrix a. - /// s - /// Singular values of a. - /// - public (NDarray, NDarray, int, NDarray) linalg_lstsq(NDarray a, NDarray b, float? rcond = null) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (rcond!=null) kwargs["rcond"]=ToPython(rcond); - dynamic py = __self__.InvokeMethod("lstsq", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2]), ToCsharp(t[3])); - } - - /// - /// Compute the (Moore-Penrose) pseudo-inverse of a matrix. - /// - /// Calculate the generalized inverse of a matrix using its - /// singular-value decomposition (SVD) and including all - /// large singular values. - /// - /// Notes - /// - /// The pseudo-inverse of a matrix A, denoted , is - /// defined as: “the matrix that ‘solves’ [the least-squares problem] - /// ,” i.e., if is said solution, then - /// is that matrix such that . - /// - /// It can be shown that if is the singular - /// value decomposition of A, then - /// , where are - /// orthogonal matrices, is a diagonal matrix consisting - /// of A’s so-called singular values, (followed, typically, by - /// zeros), and then is simply the diagonal matrix - /// consisting of the reciprocals of A’s singular values - /// (again, followed by zeros). [1] - /// - /// References - /// - /// - /// Matrix or stack of matrices to be pseudo-inverted. - /// - /// - /// Cutoff for small singular values. - /// Singular values smaller (in modulus) than - /// rcond * largest_singular_value (again, in modulus) - /// are set to zero. Broadcasts against the stack of matrices - /// - /// - /// The pseudo-inverse of a. If a is a matrix instance, then so - /// is B. - /// - public NDarray linalg_pinv(NDarray a, float rcond = 1e-15f) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - rcond, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("pinv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Solve a linear matrix equation, or system of linear scalar equations. - /// - /// Computes the “exact” solution, x, of the well-determined, i.e., full - /// rank, linear matrix equation ax = b. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The solutions are computed using LAPACK routine _gesv - /// - /// a must be square and of full-rank, i.e., all rows (or, equivalently, - /// columns) must be linearly independent; if either is not true, use - /// lstsq for the least-squares best “solution” of the - /// system/equation. - /// - /// References - /// - /// - /// Coefficient matrix. - /// - /// - /// Ordinate or “dependent variable” values. - /// - /// - /// Solution to the system a x = b. Returned shape is identical to b. - /// - public NDarray linalg_solve(NDarray a, NDarray b) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("solve", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Singular Value Decomposition. - /// - /// When a is a 2D array, it is factorized as u @ np.diag(s) @ vh - /// = (u * s) @ vh, where u and vh are 2D unitary arrays and s is a 1D - /// array of a’s singular values. When a is higher-dimensional, SVD is - /// applied in stacked mode as explained below. - /// - /// Notes - /// - /// The decomposition is performed using LAPACK routine _gesdd. - /// - /// SVD is usually described for the factorization of a 2D matrix . - /// The higher-dimensional case will be discussed below. In the 2D case, SVD is - /// written as , where , , - /// and . The 1D array s - /// contains the singular values of a and u and vh are unitary. The rows - /// of vh are the eigenvectors of and the columns of u are - /// the eigenvectors of . In both cases the corresponding - /// (possibly non-zero) eigenvalues are given by s**2. - /// - /// If a has more than two dimensions, then broadcasting rules apply, as - /// explained in Linear algebra on several matrices at once. This means that SVD is - /// working in “stacked” mode: it iterates over all indices of the first - /// a.ndim - 2 dimensions and for each combination SVD is applied to the - /// last two indices. The matrix a can be reconstructed from the - /// decomposition with either (u * s[..., None, :]) @ vh or - /// u @ (s[..., None] * vh). (The @ operator can be replaced by the - /// function np.matmul for python versions below 3.5.) - /// - /// If a is a matrix object (as opposed to an ndarray), then so are - /// all the return values. - /// - /// - /// A real or complex array with a.ndim >= 2. - /// - /// - /// If True (default), u and vh have the shapes (..., M, M) and - /// (..., N, N), respectively. Otherwise, the shapes are - /// (..., M, K) and (..., K, N), respectively, where - /// K = min(M, N). - /// - /// - /// Whether or not to compute u and vh in addition to s. True - /// by default. - /// - /// - /// A tuple of: - /// u - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. - /// s - /// Vector(s) with the singular values, within each vector sorted in - /// descending order. The first a.ndim - 2 dimensions have the same - /// size as those of the input a. - /// vh - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. - /// - public (NDarray, NDarray, NDarray) linalg_svd(NDarray a, bool? full_matrices = true, bool? compute_uv = true) - { - //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 (full_matrices!=true) kwargs["full_matrices"]=ToPython(full_matrices); - if (compute_uv!=true) kwargs["compute_uv"]=ToPython(compute_uv); - dynamic py = __self__.InvokeMethod("svd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the one-dimensional discrete Fourier Transform. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) with the efficient Fast Fourier Transform (FFT) - /// algorithm [CT]. - /// - /// Notes - /// - /// FFT (Fast Fourier Transform) refers to a way the discrete Fourier - /// Transform (DFT) can be calculated efficiently, by using symmetries in the - /// calculated terms. The symmetry is highest when n is a power of 2, and - /// the transform is therefore most efficient for these sizes. - /// - /// The DFT is defined, with the conventions used in this implementation, in - /// the documentation for the numpy.fft module. - /// - /// References - /// - /// - /// Input array, can be complex. - /// - /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// - public NDarray fft_fft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("fft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional discrete Fourier Transform - /// - /// This function computes the n-dimensional discrete Fourier Transform - /// over any axes in an M-dimensional array by means of the - /// Fast Fourier Transform (FFT). By default, the transform is computed over - /// the last two axes of the input array, i.e., a 2-dimensional FFT. - /// - /// Notes - /// - /// fft2 is just fftn with a different default for axes. - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of the transformed axes, the positive frequency terms - /// in the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// the axes, in order of decreasingly negative frequency. - /// - /// See fftn for details and a plotting example, and numpy.fft for - /// definitions and conventions used. - /// - /// - /// Input array, can be complex - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. - /// - public NDarray fft_fft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("fft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the N-dimensional discrete Fourier Transform. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional array by means of the Fast Fourier - /// Transform (FFT). - /// - /// Notes - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of all axes, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// See numpy.fft for details, definitions and conventions used. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the transform over that axis is - /// performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// - public NDarray fft_fftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("fftn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the one-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier transform computed by fft. In other words, - /// ifft(fft(a)) == a to within numerical accuracy. - /// For a general description of the algorithm and definitions, - /// see numpy.fft. - /// - /// The input should be ordered in the same way as is returned by fft, - /// i.e., - /// - /// For an even number of input points, A[n//2] represents the sum of - /// the values at the positive and negative Nyquist frequencies, as the two - /// are aliased together. See numpy.fft for details. - /// - /// Notes - /// - /// If the input parameter n is larger than the size of the input, the input - /// is padded by appending zeros at the end. Even though this is the common - /// approach, it might lead to surprising results. If a different padding is - /// desired, it must be performed before calling ifft. - /// - /// - /// Input array, can be complex. - /// - /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// See notes about padding issues. - /// - /// - /// Axis over which to compute the inverse DFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// - public NDarray fft_ifft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ifft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the 2-dimensional discrete Fourier - /// Transform over any number of axes in an M-dimensional array by means of - /// the Fast Fourier Transform (FFT). In other words, ifft2(fft2(a)) == a - /// to within numerical accuracy. By default, the inverse transform is - /// computed over the last two axes of the input array. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fft2, i.e. it should have the term for zero frequency - /// in the low-order corner of the two axes, the positive frequency terms in - /// the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// both axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// ifft2 is just ifftn with a different default for axes. - /// - /// See ifftn for details and a plotting example, and numpy.fft for - /// definition and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifft2 is called. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each axis) of the output (s[0] refers to axis 0, - /// s[1] to axis 1, etc.). This corresponds to n for ifft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. - /// - /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. - /// - public NDarray fft_ifft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ifft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the N-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform over any number of axes in an M-dimensional array by - /// means of the Fast Fourier Transform (FFT). In other words, - /// ifftn(fftn(a)) == a to within numerical accuracy. - /// For a description of the definitions and conventions used, see numpy.fft. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fftn, i.e. it should have the term for zero frequency - /// in all axes in the low-order corner, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// See numpy.fft for definitions and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifftn is called. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for ifft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. - /// - /// - /// Axes over which to compute the IFFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// - public NDarray fft_ifftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ifftn", 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 - /// - /// - /// Argument of the Bessel function. - /// - /// - /// The modified Bessel function evaluated at each of the elements of x. - /// - public NDarray i0(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("i0", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.logic.gen.cs b/src/Numpy.Bare/NumPy.logic.gen.cs deleted file mode 100644 index d89a613..0000000 --- a/src/Numpy.Bare/NumPy.logic.gen.cs +++ /dev/null @@ -1,1209 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// 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(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// A new boolean or array is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public bool all(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("all", 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// 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(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// A new boolean or ndarray is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public bool any(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("any", pyargs, kwargs); - 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. - /// - /// - /// 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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. - /// - /// - /// True where x is positive or negative infinity, false otherwise. - /// This is a scalar if x is a scalar. - /// - public NDarray isinf(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 NaN, false otherwise. - /// This is a scalar if x is a scalar. - /// - public NDarray isnan(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array with datetime or timedelta data type. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// The input array. - /// - /// - /// 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 x, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// The input array. - /// - /// - /// 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 x, NDarray y = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// Output array. - /// - public NDarray iscomplex(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("iscomplex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Check for a complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. Even if the input - /// has an imaginary part equal to zero, iscomplexobj evaluates to True. - /// - /// - /// The input can be of any type and shape. - /// - /// - /// The return value, True if x is of a complex type or has at least - /// one complex element. - /// - public bool iscomplexobj(object x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("iscomplexobj", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - public bool isfortran(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("isfortran", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - /// - /// Boolean array of same shape as x. - /// - public NDarray isreal(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isreal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return True if x is a not complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. So even if the input - /// has an imaginary part equal to zero, isrealobj evaluates to False - /// if the data type is complex. - /// - /// - /// The input can be of any type and shape. - /// - /// - /// The return value, False if x is of a complex type. - /// - public bool isrealobj(object x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isrealobj", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns True if the type of num is a scalar type. - /// - /// Notes - /// - /// In almost all cases np.ndim(x) == 0 should be used instead of this - /// function, as that will also return true for 0d arrays. This is how - /// numpy overloads functions in the style of the dx arguments to gradient - /// and the bins argument to histogram. Some key differences: - /// - /// - /// Input argument, can be of any type and shape. - /// - /// - /// True if num is a scalar type, False if it is not. - /// - public bool isscalar(object num) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - num, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isscalar", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the truth value of x1 AND x2 element-wise. - /// - /// - /// Input arrays. x1 and x2 must be of the same shape. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Logical NOT is applied to the elements 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 b, 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[] - { - b, - a, - rtol, - atol, - equal_nan, - }); - var kwargs=new PyDict(); - 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. - /// - /// - /// 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 b, 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[] - { - b, - a, - rtol, - atol, - equal_nan, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isclose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// True if two arrays have the same shape and elements, False otherwise. - /// - /// - /// Input arrays. - /// - /// - /// Input arrays. - /// - /// - /// Returns True if the arrays are equal. - /// - public bool array_equal(NDarray a2, NDarray a1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a2, - 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. - /// - /// - /// Input arrays. - /// - /// - /// True if equivalent, False otherwise. - /// - public bool array_equiv(NDarray a2, NDarray a1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.math.gen.cs b/src/Numpy.Bare/NumPy.math.gen.cs deleted file mode 100644 index 973887f..0000000 --- a/src/Numpy.Bare/NumPy.math.gen.cs +++ /dev/null @@ -1,4273 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// 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. - /// - /// - /// Angle, in radians ( rad equals 360 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 sine of each element of x. - /// This is a scalar if x is a scalar. - /// - public NDarray sin(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array in 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 cosine values. - /// This is a scalar if x is a scalar. - /// - public NDarray cos(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 corresponding tangent values. - /// This is a scalar if x is a scalar. - /// - public NDarray tan(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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/ - /// - /// - /// y-coordinate on the unit circle. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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/ - /// - /// - /// x-coordinate on the unit circle. - /// For real arguments, the domain is [-1, 1]. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// y-coordinates. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Input array in 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 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array in 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 radian values. - /// This is a scalar if x is a scalar. - /// - public NDarray radians(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// Maximum discontinuity between values, default is pi. - /// - /// - /// Axis along which unwrap will operate, default is the last axis. - /// - /// - /// Output array. - /// - public NDarray unwrap(NDarray p, float? discont = 3.141592653589793f, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - p, - }); - 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. - /// - /// - /// Angles in 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 angle in radians. - /// This is a scalar if x is a scalar. - /// - public NDarray deg2rad(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Angle in 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 angle in degrees. - /// This is a scalar if x is a scalar. - /// - public NDarray rad2deg(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 corresponding hyperbolic sine values. - /// This is a scalar if x is a scalar. - /// - public NDarray sinh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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). - /// - /// - /// Input 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. - /// - /// - /// Output array of same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray cosh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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 corresponding hyperbolic tangent values. - /// This is a scalar if x is a scalar. - /// - public NDarray tanh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray arcsinh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray arccosh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray arctanh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input data. - /// - /// - /// 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(NDarray a, int? decimals = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input 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. - /// - /// - /// Output array is same shape and type as x. - /// This is a scalar if x is a scalar. - /// - public NDarray rint(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// An array of floats to be rounded - /// - /// - /// Output array - /// - /// - /// The array of rounded numbers - /// - public NDarray fix(NDarray x, NDarray y = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 floor of each element in x. - /// This is a scalar if x is a scalar. - /// - public NDarray floor(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 . - /// - /// - /// Input 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 ceiling of each element in x, with float dtype. - /// This is a scalar if x is a scalar. - /// - public NDarray ceil(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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 truncated value of each element in x. - /// This is a scalar if x is a scalar. - /// - public NDarray trunc(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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: - /// - /// - /// Input data. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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: - /// - /// - /// Elements to sum. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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. - /// - /// - /// Array containing numbers whose product is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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). - /// - /// - /// Array containing numbers whose sum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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: - /// - /// - /// Input array - /// - /// - /// 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(NDarray a, 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[] - { - a, - }); - 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. - /// - /// - /// If necessary, will be flattened before the differences are taken. - /// - /// - /// 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 ary, NDarray to_end = null, NDarray to_begin = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ary, - }); - 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 - /// - /// - /// 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 NDarray gradient(NDarray f, NDarray varargs = null, int? edge_order = null, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - f, - }); - 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 first vector(s). - /// - /// - /// 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 a, 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[] - { - a, - 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 - /// - /// - /// Input array to integrate. - /// - /// - /// 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 y, NDarray x = null, float? dx = 1.0f, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - y, - }); - 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 - /// - /// - /// 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. - /// - /// - /// Output array, element-wise exponential of x. - /// This is a scalar if x is a scalar. - /// - public NDarray exp(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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. - /// - /// - /// Element-wise exponential minus one: out = exp(x) - 1. - /// This is a scalar if x is a scalar. - /// - public NDarray expm1(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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. - /// - /// - /// Element-wise 2 to the power x. - /// This is a scalar if x is a scalar. - /// - public NDarray exp2(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input value. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x. - /// This is a scalar if x is a scalar. - /// - public NDarray log2(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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. - /// - /// - /// Natural logarithm of 1 + x, element-wise. - /// This is a scalar if x is a scalar. - /// - public NDarray log1p(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// Array (possibly multi-dimensional) of values for which to to - /// calculate sinc(x). - /// - /// - /// sinc(x), which has the same shape as the input. - /// - public NDarray sinc(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("sinc", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns element-wise True where signbit is set (less than zero). - /// - /// - /// The input value(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. - /// - /// - /// Output array, or reference to out if that was supplied. - /// This is a scalar if x is a scalar. - /// - public NDarray signbit(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Values to change the sign of. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Array of numbers to be decomposed. - /// - /// - /// 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 x, 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[] - { - x, - }); - 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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[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 multipliers. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Values to find the next representable value of. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Values to find the spacing of. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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 x2, NDarray x1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// 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 x2, NDarray x1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Input 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. - /// - /// - /// Return array. - /// This is a scalar if x is a scalar. - /// - public NDarray reciprocal(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// Returned array or scalar: y = +x. - /// This is a scalar if x is a scalar. - /// - public NDarray positive(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("positive", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Numerical negative, element-wise. - /// - /// - /// Input 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. - /// - /// - /// Returned array or scalar: y = -x. - /// This is a scalar if x is a scalar. - /// - public NDarray negative(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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 bases. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Numerator. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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 bases. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Dividend. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Input 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: - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Return the angle of the complex argument. - /// - /// - /// A complex number or sequence of complex numbers. - /// - /// - /// 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(NDarray z, bool? deg = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - z, - }); - var kwargs=new PyDict(); - if (deg!=false) kwargs["deg"]=ToPython(deg); - dynamic py = __self__.InvokeMethod("angle", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the real part of the complex argument. - /// - /// - /// Input array. - /// - /// - /// The real component of the complex argument. If val is real, the type - /// of val is used for the output. If val has complex elements, the - /// returned type is float. - /// - public NDarray real(NDarray val) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - val, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("real", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the imaginary part of the complex argument. - /// - /// - /// Input array. - /// - /// - /// The imaginary component of the complex argument. If val is real, - /// the type of val is used for the output. If val has complex - /// elements, the returned type is float. - /// - public NDarray imag(NDarray val) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - val, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("imag", 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. - /// - /// - /// Input value. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// First one-dimensional input array. - /// - /// - /// Second one-dimensional input array. - /// - /// - /// Discrete, linear convolution of a and v. - /// - public NDarray convolve(NDarray a, NDarray v, string mode = "full") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Array containing elements to clip. - /// - /// - /// 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, NDarray a_min, NDarray a_max, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// The values whose square-roots are required. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// The values whose cube-roots are required. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// The array of numbers for which the absolute values are required. If - /// x is a scalar, the result y will also be a scalar. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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, . - /// - /// - /// 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. - /// - /// - /// The sign of x. - /// This is a scalar if x is a scalar. - /// - public NDarray sign(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input values. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Input data. - /// - /// - /// 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(NDarray x, bool? copy = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, float tol = 100) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - tol, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("real_if_close", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// One-dimensional linear interpolation. - /// - /// Returns the one-dimensional piecewise linear interpolant to a function - /// with given discrete data points (xp, fp), evaluated at x. - /// - /// Notes - /// - /// Does not check that the x-coordinate sequence xp is increasing. - /// If xp is not increasing, the results are nonsense. - /// A simple check for increasing is: - /// - /// - /// The x-coordinates 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 float or complex (corresponding to fp) or ndarray interp(NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - { - //auto-generated code, do not change - 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); - } - */ - - } -} diff --git a/src/Numpy.Bare/NumPy.padding.gen.cs b/src/Numpy.Bare/NumPy.padding.gen.cs deleted file mode 100644 index 7b3d17d..0000000 --- a/src/Numpy.Bare/NumPy.padding.gen.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Pads an array. - /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes. This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis. - /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced. It has the - /// following signature: - /// - /// where - /// - /// - /// Input array - /// - /// - /// Number of values padded to the edges of each axis. - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis. - /// ((before, after),) yields same before and after pad for each axis. - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. - /// - /// - /// One of the following string values or a user supplied function. - /// - /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis. - /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis. - /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes. - /// - /// Default is None, to use the entire axis. - /// - /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis. - /// - /// ((before, after),) yields same before and after constants for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis. - /// - /// ((before, after),) yields same before and after end values for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value. For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. - /// - /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. - /// - public NDarray pad(NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array, - pad_width, - mode, - }); - var kwargs=new PyDict(); - if (stat_length!=null) kwargs["stat_length"]=ToPython(stat_length); - if (constant_values!=null) kwargs["constant_values"]=ToPython(constant_values); - if (end_values!=null) kwargs["end_values"]=ToPython(end_values); - if (reflect_type!=null) kwargs["reflect_type"]=ToPython(reflect_type); - dynamic py = __self__.InvokeMethod("pad", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.random.gen.cs b/src/Numpy.Bare/NumPy.random.gen.cs deleted file mode 100644 index 1df0567..0000000 --- a/src/Numpy.Bare/NumPy.random.gen.cs +++ /dev/null @@ -1,2597 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Random values in a given shape. - /// - /// Create an array of the given shape and populate it with - /// random samples from a uniform distribution - /// over [0, 1). - /// - /// Notes - /// - /// This is a convenience function. If you want an interface that - /// takes a shape-tuple as the first argument, refer to - /// np.random.random_sample . - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// Random values. - /// - public NDarray random_rand(int? d1 = null, int? d0 = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (d1!=null) kwargs["d1"]=ToPython(d1); - if (d0!=null) kwargs["d0"]=ToPython(d0); - dynamic py = __self__.InvokeMethod("rand", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a sample (or samples) from the “standard normal” distribution. - /// - /// If positive, int_like or int-convertible arguments are provided, - /// randn generates an array of shape (d0, d1, ..., dn), filled - /// with random floats sampled from a univariate “normal” (Gaussian) - /// distribution of mean 0 and variance 1 (if any of the are - /// floats, they are first converted to integers by truncation). A single - /// float randomly sampled from the distribution is returned if no - /// argument is provided. - /// - /// This is a convenience function. If you want an interface that takes a - /// tuple as the first argument, use numpy.random.standard_normal instead. - /// - /// Notes - /// - /// For random samples from , use: - /// - /// sigma * np.random.randn(...) + mu - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// A (d0, d1, ..., dn)-shaped array of floating-point samples from - /// the standard normal distribution, or a single such float if - /// no parameters were supplied. - /// - public NDarray random_randn(int? d1 = null, int? d0 = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (d1!=null) kwargs["d1"]=ToPython(d1); - if (d0!=null) kwargs["d0"]=ToPython(d0); - dynamic py = __self__.InvokeMethod("randn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return random integers from low (inclusive) to high (exclusive). - /// - /// Return random integers from the “discrete uniform” distribution of - /// the specified dtype in the “half-open” interval [low, high). If - /// high is None (the default), then results are from [0, low). - /// - /// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is one above the - /// highest such integer). - /// - /// - /// If provided, one above the largest (signed) integer to be drawn - /// from the distribution (see above for behavior if high=None). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Desired dtype of the result. All dtypes are determined by their - /// name, i.e., ‘int64’, ‘int’, etc, so byteorder is not available - /// and a specific precision may have different C types depending - /// on the platform. The default value is ‘np.int’. - /// - /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. - /// - public NDarray random_randint(int low, int? high = null, int[] size = null, Dtype dtype = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - low, - }); - var kwargs=new PyDict(); - if (high!=null) kwargs["high"]=ToPython(high); - if (size!=null) kwargs["size"]=ToPython(size); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("randint", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Random integers of type np.int between low and high, inclusive. - /// - /// Return random integers of type np.int from the “discrete uniform” - /// distribution in the closed interval [low, high]. If high is - /// None (the default), then results are from [1, low]. The np.int - /// type translates to the C long type used by Python 2 for “short” - /// integers and its precision is platform dependent. - /// - /// This function has been deprecated. Use randint instead. - /// - /// Notes - /// - /// To sample from N evenly spaced floating-point numbers between a and b, - /// use: - /// - /// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is the highest such - /// integer). - /// - /// - /// If provided, the largest (signed) integer to be drawn from the - /// distribution (see above for behavior if high=None). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. - /// - public NDarray random_random_integers(int low, int? high = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - low, - }); - var kwargs=new PyDict(); - if (high!=null) kwargs["high"]=ToPython(high); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("random_integers", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_random_sample(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("random_sample", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_random(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("random", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_ranf(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("ranf", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_sample(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("sample", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Generates a random sample from a given 1-D array - /// - /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Whether the sample is with or without replacement - /// - /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. - /// - /// - /// The generated random samples - /// - public NDarray random_choice(NDarray a, int[] size = null, bool? replace = true, NDarray p = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - if (replace!=true) kwargs["replace"]=ToPython(replace); - if (p!=null) kwargs["p"]=ToPython(p); - dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Generates a random sample from a given 1-D array - /// - /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Whether the sample is with or without replacement - /// - /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. - /// - /// - /// The generated random samples - /// - public NDarray random_choice(int a, int[] size = null, bool? replace = true, NDarray p = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - if (replace!=true) kwargs["replace"]=ToPython(replace); - if (p!=null) kwargs["p"]=ToPython(p); - dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return random bytes. - /// - /// - /// Number of random bytes. - /// - /// - /// String of length length. - /// - public string random_bytes(int length) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - length, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("bytes", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Modify a sequence in-place by shuffling its contents. - /// - /// This function only shuffles the array along the first axis of a - /// multi-dimensional array. The order of sub-arrays is changed but - /// their contents remains the same. - /// - /// - /// The array or list to be shuffled. - /// - public void random_shuffle(NDarray x) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("shuffle", pyargs, kwargs); - } - - /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. - /// - /// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. - /// - /// - /// Permuted sequence or array range. - /// - public NDarray random_permutation(NDarray x) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. - /// - /// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. - /// - /// - /// Permuted sequence or array range. - /// - public NDarray random_permutation(int x) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Beta distribution. - /// - /// The Beta distribution is a special case of the Dirichlet distribution, - /// and is related to the Gamma distribution. It has the probability - /// distribution function - /// - /// where the normalisation, B, is the beta function, - /// - /// It is often seen in Bayesian inference and order statistics. - /// - /// - /// Alpha, positive (>0). - /// - /// - /// Beta, positive (>0). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a and b are both scalars. - /// Otherwise, np.broadcast(a, b).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized beta distribution. - /// - public NDarray random_beta(NDarray a, NDarray b, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("beta", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References - /// - /// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. - /// - public NDarray random_binomial(NDarray n, NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References - /// - /// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. - /// - public NDarray random_binomial(int n, NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a chi-square distribution. - /// - /// When df independent random variables, each with standard normal - /// distributions (mean 0, variance 1), are squared and summed, the - /// resulting distribution is chi-square (see Notes). This distribution - /// is often used in hypothesis testing. - /// - /// Notes - /// - /// The variable obtained by summing the squares of df independent, - /// standard normally distributed random variables: - /// - /// is chi-square distributed, denoted - /// - /// The probability density function of the chi-squared distribution is - /// - /// where is the gamma function, - /// - /// References - /// - /// - /// Number of degrees of freedom, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized chi-square distribution. - /// - public NDarray random_chisquare(NDarray df, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - df, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("chisquare", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the Dirichlet distribution. - /// - /// Draw size samples of dimension k from a Dirichlet distribution. A - /// Dirichlet-distributed random variable can be seen as a multivariate - /// generalization of a Beta distribution. Dirichlet pdf is the conjugate - /// prior of a multinomial in Bayesian inference. - /// - /// Notes - /// - /// Uses the following property for computation: for each dimension, - /// draw a random sample y_i from a standard gamma generator of shape - /// alpha_i, then - /// is - /// Dirichlet distributed. - /// - /// References - /// - /// - /// Parameter of the distribution (k dimension for sample of - /// dimension k). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples, of shape (size, alpha.ndim). - /// - public NDarray random_dirichlet(NDarray alpha, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - alpha, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("dirichlet", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from an exponential distribution. - /// - /// Its probability density function is - /// - /// for x > 0 and 0 elsewhere. is the scale parameter, - /// which is the inverse of the rate parameter . - /// The rate parameter is an alternative, widely used parameterization - /// of the exponential distribution [3]. - /// - /// The exponential distribution is a continuous analogue of the - /// geometric distribution. It describes many common situations, such as - /// the size of raindrops measured over many rainstorms [1], or the time - /// between page requests to Wikipedia [2]. - /// - /// References - /// - /// - /// The scale parameter, . - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized exponential distribution. - /// - public NDarray random_exponential(NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - scale, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("exponential", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from an F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters should be greater than - /// zero. - /// - /// The random variate of the F distribution (also known as the - /// Fisher distribution) is a continuous probability distribution - /// that arises in ANOVA tests, and is the ratio of two chi-square - /// variates. - /// - /// Notes - /// - /// The F statistic is used to compare in-group variances to between-group - /// variances. Calculating the distribution depends on the sampling, and - /// so it is a function of the respective degrees of freedom in the - /// problem. The variable dfnum is the number of samples minus one, the - /// between-groups degrees of freedom, while dfden is the within-groups - /// degrees of freedom, the sum of the number of samples in each group - /// minus the number of groups. - /// - /// References - /// - /// - /// Degrees of freedom in numerator, should be > 0. - /// - /// - /// Degrees of freedom in denominator, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum and dfden are both scalars. - /// Otherwise, np.broadcast(dfnum, dfden).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Fisher distribution. - /// - public NDarray random_f(NDarray dfnum, NDarray dfden, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - dfnum, - dfden, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("f", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale (sometimes designated - /// “theta”), where both parameters are > 0. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References - /// - /// - /// The shape of the gamma distribution. Should be greater than zero. - /// - /// - /// The scale of the gamma distribution. Should be greater than zero. - /// Default is equal to 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape and scale are both scalars. - /// Otherwise, np.broadcast(shape, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized gamma distribution. - /// - public NDarray random_gamma(Shape shape, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("gamma", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the geometric distribution. - /// - /// Bernoulli trials are experiments with one of two outcomes: - /// success or failure (an example of such an experiment is flipping - /// a coin). The geometric distribution models the number of trials - /// that must be run in order to achieve success. It is therefore - /// supported on the positive integers, k = 1, 2, .... - /// - /// The probability mass function of the geometric distribution is - /// - /// where p is the probability of success of an individual trial. - /// - /// - /// The probability of success of an individual trial. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized geometric distribution. - /// - public NDarray random_geometric(NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("geometric", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Gumbel distribution. - /// - /// Draw samples from a Gumbel distribution with specified location and - /// scale. For more information on the Gumbel distribution, see - /// Notes and References below. - /// - /// Notes - /// - /// The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme - /// Value Type I) distribution is one of a class of Generalized Extreme - /// Value (GEV) distributions used in modeling extreme value problems. - /// The Gumbel is a special case of the Extreme Value Type I distribution - /// for maximums from distributions with “exponential-like” tails. - /// - /// The probability density for the Gumbel distribution is - /// - /// where is the mode, a location parameter, and - /// is the scale parameter. - /// - /// The Gumbel (named for German mathematician Emil Julius Gumbel) was used - /// very early in the hydrology literature, for modeling the occurrence of - /// flood events. It is also used for modeling maximum wind speed and - /// rainfall rates. It is a “fat-tailed” distribution - the probability of - /// an event in the tail of the distribution is larger than if one used a - /// Gaussian, hence the surprisingly frequent occurrence of 100-year - /// floods. Floods were initially modeled as a Gaussian process, which - /// underestimated the frequency of extreme events. - /// - /// It is one of a class of extreme value distributions, the Generalized - /// Extreme Value (GEV) distributions, which also includes the Weibull and - /// Frechet. - /// - /// The function has a mean of and a variance - /// of . - /// - /// References - /// - /// - /// The location of the mode of the distribution. Default is 0. - /// - /// - /// The scale parameter of the distribution. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Gumbel distribution. - /// - public NDarray random_gumbel(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("gumbel", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Hypergeometric distribution. - /// - /// Samples are drawn from a hypergeometric distribution with specified - /// parameters, ngood (ways to make a good selection), nbad (ways to make - /// a bad selection), and nsample = number of items sampled, which is less - /// than or equal to the sum ngood + nbad. - /// - /// Notes - /// - /// The probability density for the Hypergeometric distribution is - /// - /// where and - /// - /// for P(x) the probability of x successes, g = ngood, b = nbad, and - /// n = number of samples. - /// - /// Consider an urn with black and white marbles in it, ngood of them - /// black and nbad are white. If you draw nsample balls without - /// replacement, then the hypergeometric distribution describes the - /// distribution of black balls in the drawn sample. - /// - /// Note that this distribution is very similar to the binomial - /// distribution, except that in this case, samples are drawn without - /// replacement, whereas in the Binomial case samples are drawn with - /// replacement (or the sample space is infinite). As the sample space - /// becomes large, this distribution approaches the binomial. - /// - /// References - /// - /// - /// Number of ways to make a good selection. Must be nonnegative. - /// - /// - /// Number of ways to make a bad selection. Must be nonnegative. - /// - /// - /// Number of items sampled. Must be at least 1 and at most - /// ngood + nbad. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if ngood, nbad, and nsample - /// are all scalars. Otherwise, np.broadcast(ngood, nbad, nsample).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized hypergeometric distribution. - /// - public NDarray random_hypergeometric(NDarray ngood, NDarray nbad, NDarray nsample, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - ngood, - nbad, - nsample, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("hypergeometric", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the Laplace or double exponential distribution with - /// specified location (or mean) and scale (decay). - /// - /// The Laplace distribution is similar to the Gaussian/normal distribution, - /// but is sharper at the peak and has fatter tails. It represents the - /// difference between two independent, identically distributed exponential - /// random variables. - /// - /// Notes - /// - /// It has the probability density function - /// - /// The first law of Laplace, from 1774, states that the frequency - /// of an error can be expressed as an exponential function of the - /// absolute magnitude of the error, which leads to the Laplace - /// distribution. For many problems in economics and health - /// sciences, this distribution seems to model the data better - /// than the standard Gaussian distribution. - /// - /// References - /// - /// - /// The position, , of the distribution peak. Default is 0. - /// - /// - /// , the exponential decay. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Laplace distribution. - /// - public NDarray random_laplace(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("laplace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a logistic distribution. - /// - /// Samples are drawn from a logistic distribution with specified - /// parameters, loc (location or mean, also median), and scale (>0). - /// - /// Notes - /// - /// The probability density for the Logistic distribution is - /// - /// where = location and = scale. - /// - /// The Logistic distribution is used in Extreme Value problems where it - /// can act as a mixture of Gumbel distributions, in Epidemiology, and by - /// the World Chess Federation (FIDE) where it is used in the Elo ranking - /// system, assuming the performance of each player is a logistically - /// distributed random variable. - /// - /// References - /// - /// - /// Parameter of the distribution. Default is 0. - /// - /// - /// Parameter of the distribution. Should be greater than zero. - /// Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized logistic distribution. - /// - public NDarray random_logistic(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("logistic", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a log-normal distribution. - /// - /// Draw samples from a log-normal distribution with specified mean, - /// standard deviation, and array shape. Note that the mean and standard - /// deviation are not the values for the distribution itself, but of the - /// underlying normal distribution it is derived from. - /// - /// Notes - /// - /// A variable x has a log-normal distribution if log(x) is normally - /// distributed. The probability density function for the log-normal - /// distribution is: - /// - /// where is the mean and is the standard - /// deviation of the normally distributed logarithm of the variable. - /// A log-normal distribution results if a random variable is the product - /// of a large number of independent, identically-distributed variables in - /// the same way that a normal distribution results if the variable is the - /// sum of a large number of independent, identically-distributed - /// variables. - /// - /// References - /// - /// - /// Mean value of the underlying normal distribution. Default is 0. - /// - /// - /// Standard deviation of the underlying normal distribution. Should - /// be greater than zero. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and sigma are both scalars. - /// Otherwise, np.broadcast(mean, sigma).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized log-normal distribution. - /// - public NDarray random_lognormal(NDarray mean = null, NDarray sigma = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (mean!=null) kwargs["mean"]=ToPython(mean); - if (sigma!=null) kwargs["sigma"]=ToPython(sigma); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("lognormal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a logarithmic series distribution. - /// - /// Samples are drawn from a log series distribution with specified - /// shape parameter, 0 < p < 1. - /// - /// Notes - /// - /// The probability density for the Log Series distribution is - /// - /// where p = probability. - /// - /// The log series distribution is frequently used to represent species - /// richness and occurrence, first proposed by Fisher, Corbet, and - /// Williams in 1943 [2]. It may also be used to model the numbers of - /// occupants seen in cars [3]. - /// - /// References - /// - /// - /// Shape parameter for the distribution. Must be in the range (0, 1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized logarithmic series distribution. - /// - public NDarray random_logseries(NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("logseries", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a multinomial distribution. - /// - /// The multinomial distribution is a multivariate generalisation of the - /// binomial distribution. Take an experiment with one of p - /// possible outcomes. An example of such an experiment is throwing a dice, - /// where the outcome can be 1 through 6. Each sample drawn from the - /// distribution represents n such experiments. Its values, - /// X_i = [X_0, X_1, ..., X_p], represent the number of times the - /// outcome was i. - /// - /// - /// Number of experiments. - /// - /// - /// Probabilities of each of the p different outcomes. These - /// should sum to 1 (however, the last element is always assumed to - /// account for the remaining probability, as long as - /// sum(pvals[:-1]) <= 1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. - /// - public NDarray random_multinomial(int n, NDarray pvals, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - pvals, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("multinomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw random samples from a multivariate normal distribution. - /// - /// The multivariate normal, multinormal or Gaussian distribution is a - /// generalization of the one-dimensional normal distribution to higher - /// dimensions. Such a distribution is specified by its mean and - /// covariance matrix. These parameters are analogous to the mean - /// (average or “center”) and variance (standard deviation, or “width,” - /// squared) of the one-dimensional normal distribution. - /// - /// Notes - /// - /// The mean is a coordinate in N-dimensional space, which represents the - /// location where samples are most likely to be generated. This is - /// analogous to the peak of the bell curve for the one-dimensional or - /// univariate normal distribution. - /// - /// Covariance indicates the level to which two variables vary together. - /// From the multivariate normal distribution, we draw N-dimensional - /// samples, . The covariance matrix - /// element is the covariance of and . - /// The element is the variance of (i.e. its - /// “spread”). - /// - /// Instead of specifying the full covariance matrix, popular - /// approximations include: - /// - /// This geometrical property can be seen in two dimensions by plotting - /// generated data-points: - /// - /// Diagonal covariance means that points are oriented along x or y-axis: - /// - /// Note that the covariance matrix must be positive semidefinite (a.k.a. - /// nonnegative-definite). Otherwise, the behavior of this method is - /// undefined and backwards compatibility is not guaranteed. - /// - /// References - /// - /// - /// Mean of the N-dimensional distribution. - /// - /// - /// Covariance matrix of the distribution. It must be symmetric and - /// positive-semidefinite for proper sampling. - /// - /// - /// Given a shape of, for example, (m,n,k), m*n*k samples are - /// generated, and packed in an m-by-n-by-k arrangement. Because - /// each sample is N-dimensional, the output shape is (m,n,k,N). - /// If no shape is specified, a single (N-D) sample is returned. - /// - /// - /// Behavior when the covariance matrix is not positive semidefinite. - /// - /// - /// Tolerance when checking the singular values in covariance matrix. - /// - /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. - /// - public NDarray random_multivariate_normal(NDarray mean, NDarray cov, int[] size = null, string check_valid = null, float? tol = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - mean, - cov, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - if (check_valid!=null) kwargs["check_valid"]=ToPython(check_valid); - if (tol!=null) kwargs["tol"]=ToPython(tol); - dynamic py = __self__.InvokeMethod("multivariate_normal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a negative binomial distribution. - /// - /// Samples are drawn from a negative binomial distribution with specified - /// parameters, n successes and p probability of success where n is an - /// integer > 0 and p is in the interval [0, 1]. - /// - /// Notes - /// - /// The probability density for the negative binomial distribution is - /// - /// where is the number of successes, is the - /// probability of success, and is the number of trials. - /// The negative binomial distribution gives the probability of N - /// failures given n successes, with a success on the last trial. - /// - /// If one throws a die repeatedly until the third time a “1” appears, - /// then the probability distribution of the number of non-“1”s that - /// appear before the third “1” is a negative binomial distribution. - /// - /// References - /// - /// - /// Parameter of the distribution, > 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized negative binomial distribution, - /// where each sample is equal to N, the number of failures that - /// occurred before a total of n successes was reached. - /// - public NDarray random_negative_binomial(NDarray n, NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("negative_binomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a noncentral chi-square distribution. - /// - /// The noncentral distribution is a generalisation of - /// the distribution. - /// - /// Notes - /// - /// The probability density function for the noncentral Chi-square - /// distribution is - /// - /// where is the Chi-square with q degrees of freedom. - /// - /// In Delhi (2007), it is noted that the noncentral chi-square is - /// useful in bombing and coverage problems, the probability of - /// killing the point target given by the noncentral chi-squared - /// distribution. - /// - /// References - /// - /// - /// Degrees of freedom, should be > 0. - /// - /// - /// Non-centrality, should be non-negative. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df and nonc are both scalars. - /// Otherwise, np.broadcast(df, nonc).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized noncentral chi-square distribution. - /// - public NDarray random_noncentral_chisquare(NDarray df, NDarray nonc, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - df, - nonc, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("noncentral_chisquare", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the noncentral F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters > 1. - /// nonc is the non-centrality parameter. - /// - /// Notes - /// - /// When calculating the power of an experiment (power = probability of - /// rejecting the null hypothesis when a specific alternative is true) the - /// non-central F statistic becomes important. When the null hypothesis is - /// true, the F statistic follows a central F distribution. When the null - /// hypothesis is not true, then it follows a non-central F statistic. - /// - /// References - /// - /// - /// Numerator degrees of freedom, should be > 0. - /// - /// - /// Denominator degrees of freedom, should be > 0. - /// - /// - /// Non-centrality parameter, the sum of the squares of the numerator - /// means, should be >= 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum, dfden, and nonc - /// are all scalars. Otherwise, np.broadcast(dfnum, dfden, nonc).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized noncentral Fisher distribution. - /// - public NDarray random_noncentral_f(NDarray dfnum, NDarray dfden, NDarray nonc, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - dfnum, - dfden, - nonc, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("noncentral_f", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw random samples from a normal (Gaussian) distribution. - /// - /// The probability density function of the normal distribution, first - /// derived by De Moivre and 200 years later by both Gauss and Laplace - /// independently [2], is often called the bell curve because of - /// its characteristic shape (see the example below). - /// - /// The normal distributions occurs often in nature. For example, it - /// describes the commonly occurring distribution of samples influenced - /// by a large number of tiny, random disturbances, each with its own - /// unique distribution [2]. - /// - /// Notes - /// - /// The probability density for the Gaussian distribution is - /// - /// where is the mean and the standard - /// deviation. The square of the standard deviation, , - /// is called the variance. - /// - /// The function has its peak at the mean, and its “spread” increases with - /// the standard deviation (the function reaches 0.607 times its maximum at - /// and [2]). This implies that - /// numpy.random.normal is more likely to return samples lying close to - /// the mean, rather than those far away. - /// - /// References - /// - /// - /// Mean (“centre”) of the distribution. - /// - /// - /// Standard deviation (spread or “width”) of the distribution. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized normal distribution. - /// - public NDarray random_normal(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("normal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Pareto II or Lomax distribution with - /// specified shape. - /// - /// The Lomax or Pareto II distribution is a shifted Pareto - /// distribution. The classical Pareto distribution can be - /// obtained from the Lomax distribution by adding 1 and - /// multiplying by the scale parameter m (see Notes). The - /// smallest value of the Lomax distribution is zero while for the - /// classical Pareto distribution it is mu, where the standard - /// Pareto distribution has location mu = 1. Lomax can also - /// be considered as a simplified version of the Generalized - /// Pareto distribution (available in SciPy), with the scale set - /// to one and the location set to zero. - /// - /// The Pareto distribution must be greater than zero, and is - /// unbounded above. It is also known as the “80-20 rule”. In - /// this distribution, 80 percent of the weights are in the lowest - /// 20 percent of the range, while the other 20 percent fill the - /// remaining 80 percent of the range. - /// - /// Notes - /// - /// The probability density for the Pareto distribution is - /// - /// where is the shape and the scale. - /// - /// The Pareto distribution, named after the Italian economist - /// Vilfredo Pareto, is a power law probability distribution - /// useful in many real world problems. Outside the field of - /// economics it is generally referred to as the Bradford - /// distribution. Pareto developed the distribution to describe - /// the distribution of wealth in an economy. It has also found - /// use in insurance, web page access statistics, oil field sizes, - /// and many other problems, including the download frequency for - /// projects in Sourceforge [1]. It is one of the so-called - /// “fat-tailed” distributions. - /// - /// References - /// - /// - /// Shape of the distribution. Should be greater than zero. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Pareto distribution. - /// - public NDarray random_pareto(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("pareto", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Poisson distribution. - /// - /// The Poisson distribution is the limit of the binomial distribution - /// for large N. - /// - /// Notes - /// - /// The Poisson distribution - /// - /// For events with an expected separation the Poisson - /// distribution describes the probability of - /// events occurring within the observed - /// interval . - /// - /// Because the output is limited to the range of the C long type, a - /// ValueError is raised when lam is within 10 sigma of the maximum - /// representable value. - /// - /// References - /// - /// - /// Expectation of interval, should be >= 0. A sequence of expectation - /// intervals must be broadcastable over the requested size. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if lam is a scalar. Otherwise, - /// np.array(lam).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Poisson distribution. - /// - public NDarray random_poisson(NDarray lam = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (lam!=null) kwargs["lam"]=ToPython(lam); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("poisson", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draws samples in [0, 1] from a power distribution with positive - /// exponent a - 1. - /// - /// Also known as the power function distribution. - /// - /// Notes - /// - /// The probability density function is - /// - /// The power function distribution is just the inverse of the Pareto - /// distribution. It may also be seen as a special case of the Beta - /// distribution. - /// - /// It is used, for example, in modeling the over-reporting of insurance - /// claims. - /// - /// References - /// - /// - /// Parameter of the distribution. Should be greater than zero. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized power distribution. - /// - public NDarray random_power(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("power", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Rayleigh distribution. - /// - /// The and Weibull distributions are generalizations of the - /// Rayleigh. - /// - /// Notes - /// - /// The probability density function for the Rayleigh distribution is - /// - /// The Rayleigh distribution would arise, for example, if the East - /// and North components of the wind velocity had identical zero-mean - /// Gaussian distributions. Then the wind speed would have a Rayleigh - /// distribution. - /// - /// References - /// - /// - /// Scale, also equals the mode. Should be >= 0. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Rayleigh distribution. - /// - public NDarray random_rayleigh(NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("rayleigh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Cauchy distribution with mode = 0. - /// - /// Also known as the Lorentz distribution. - /// - /// Notes - /// - /// The probability density function for the full Cauchy distribution is - /// - /// and the Standard Cauchy distribution just sets and - /// - /// - /// The Cauchy distribution arises in the solution to the driven harmonic - /// oscillator problem, and also describes spectral line broadening. It - /// also describes the distribution of values at which a line tilted at - /// a random angle will cut the x axis. - /// - /// When studying hypothesis tests that assume normality, seeing how the - /// tests perform on data from a Cauchy distribution is a good indicator of - /// their sensitivity to a heavy-tailed distribution, since the Cauchy looks - /// very much like a Gaussian distribution, but with heavier tails. - /// - /// References - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples. - /// - public NDarray random_standard_cauchy(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_cauchy", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the standard exponential distribution. - /// - /// standard_exponential is identical to the exponential distribution - /// with a scale parameter of 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Drawn samples. - /// - public NDarray random_standard_exponential(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_exponential", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale=1. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References - /// - /// - /// Parameter, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape is a scalar. Otherwise, - /// np.array(shape).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized standard gamma distribution. - /// - public NDarray random_standard_gamma(Shape shape, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_gamma", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Normal distribution (mean=0, stdev=1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Drawn samples. - /// - public NDarray random_standard_normal(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_normal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Student’s t distribution with df degrees - /// of freedom. - /// - /// A special case of the hyperbolic distribution. As df gets - /// large, the result resembles that of the standard normal - /// distribution (standard_normal). - /// - /// Notes - /// - /// The probability density function for the t distribution is - /// - /// The t test is based on an assumption that the data come from a - /// Normal distribution. The t test provides a way to test whether - /// the sample mean (that is the mean calculated from the data) is - /// a good estimate of the true mean. - /// - /// The derivation of the t-distribution was first published in - /// 1908 by William Gosset while working for the Guinness Brewery - /// in Dublin. Due to proprietary issues, he had to publish under - /// a pseudonym, and so he used the name Student. - /// - /// References - /// - /// - /// Degrees of freedom, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized standard Student’s t distribution. - /// - public NDarray random_standard_t(NDarray df, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - df, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_t", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the triangular distribution over the - /// interval [left, right]. - /// - /// The triangular distribution is a continuous probability - /// distribution with lower limit left, peak at mode, and upper - /// limit right. Unlike the other distributions, these parameters - /// directly define the shape of the pdf. - /// - /// Notes - /// - /// The probability density function for the triangular distribution is - /// - /// The triangular distribution is often used in ill-defined - /// problems where the underlying distribution is not known, but - /// some knowledge of the limits and mode exists. Often it is used - /// in simulations. - /// - /// References - /// - /// - /// Lower limit. - /// - /// - /// The value where the peak of the distribution occurs. - /// The value should fulfill the condition left <= mode <= right. - /// - /// - /// Upper limit, should be larger than left. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if left, mode, and right - /// are all scalars. Otherwise, np.broadcast(left, mode, right).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized triangular distribution. - /// - public NDarray random_triangular(NDarray left, NDarray mode, NDarray right, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - left, - mode, - right, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("triangular", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a uniform distribution. - /// - /// Samples are uniformly distributed over the half-open interval - /// [low, high) (includes low, but excludes high). In other words, - /// any value within the given interval is equally likely to be drawn - /// by uniform. - /// - /// Notes - /// - /// The probability density function of the uniform distribution is - /// - /// anywhere within the interval [a, b), and zero elsewhere. - /// - /// When high == low, values of low will be returned. - /// If high < low, the results are officially undefined - /// and may eventually raise an error, i.e. do not rely on this - /// function to behave when passed arguments satisfying that - /// inequality condition. - /// - /// - /// Lower boundary of the output interval. All values generated will be - /// greater than or equal to low. The default value is 0. - /// - /// - /// Upper boundary of the output interval. All values generated will be - /// less than high. The default value is 1.0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if low and high are both scalars. - /// Otherwise, np.broadcast(low, high).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized uniform distribution. - /// - public NDarray random_uniform(NDarray low = null, NDarray high = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (low!=null) kwargs["low"]=ToPython(low); - if (high!=null) kwargs["high"]=ToPython(high); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("uniform", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a von Mises distribution. - /// - /// Samples are drawn from a von Mises distribution with specified mode - /// (mu) and dispersion (kappa), on the interval [-pi, pi]. - /// - /// The von Mises distribution (also known as the circular normal - /// distribution) is a continuous probability distribution on the unit - /// circle. It may be thought of as the circular analogue of the normal - /// distribution. - /// - /// Notes - /// - /// The probability density for the von Mises distribution is - /// - /// where is the mode and the dispersion, - /// and is the modified Bessel function of order 0. - /// - /// The von Mises is named for Richard Edler von Mises, who was born in - /// Austria-Hungary, in what is now the Ukraine. He fled to the United - /// States in 1939 and became a professor at Harvard. He worked in - /// probability theory, aerodynamics, fluid mechanics, and philosophy of - /// science. - /// - /// References - /// - /// - /// Mode (“center”) of the distribution. - /// - /// - /// Dispersion of the distribution, has to be >=0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mu and kappa are both scalars. - /// Otherwise, np.broadcast(mu, kappa).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized von Mises distribution. - /// - public NDarray random_vonmises(NDarray mu, NDarray kappa, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - mu, - kappa, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("vonmises", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Wald, or inverse Gaussian, distribution. - /// - /// As the scale approaches infinity, the distribution becomes more like a - /// Gaussian. Some references claim that the Wald is an inverse Gaussian - /// with mean equal to 1, but this is by no means universal. - /// - /// The inverse Gaussian distribution was first studied in relationship to - /// Brownian motion. In 1956 M.C.K. Tweedie used the name inverse Gaussian - /// because there is an inverse relationship between the time to cover a - /// unit distance and distance covered in unit time. - /// - /// Notes - /// - /// The probability density function for the Wald distribution is - /// - /// As noted above the inverse Gaussian distribution first arise - /// from attempts to model Brownian motion. It is also a - /// competitor to the Weibull for use in reliability modeling and - /// modeling stock returns and interest rate processes. - /// - /// References - /// - /// - /// Distribution mean, should be > 0. - /// - /// - /// Scale parameter, should be >= 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and scale are both scalars. - /// Otherwise, np.broadcast(mean, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Wald distribution. - /// - public NDarray random_wald(NDarray mean, NDarray scale, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - mean, - scale, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("wald", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Weibull distribution. - /// - /// Draw samples from a 1-parameter Weibull distribution with the given - /// shape parameter a. - /// - /// Here, U is drawn from the uniform distribution over (0,1]. - /// - /// The more common 2-parameter Weibull, including a scale parameter - /// is just . - /// - /// Notes - /// - /// The Weibull (or Type III asymptotic extreme value distribution - /// for smallest values, SEV Type III, or Rosin-Rammler - /// distribution) is one of a class of Generalized Extreme Value - /// (GEV) distributions used in modeling extreme value problems. - /// This class includes the Gumbel and Frechet distributions. - /// - /// The probability density for the Weibull distribution is - /// - /// where is the shape and the scale. - /// - /// The function has its peak (the mode) at - /// . - /// - /// When a = 1, the Weibull distribution reduces to the exponential - /// distribution. - /// - /// References - /// - /// - /// Shape parameter of the distribution. Must be nonnegative. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Weibull distribution. - /// - public NDarray random_weibull(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("weibull", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Zipf distribution. - /// - /// Samples are drawn from a Zipf distribution with specified parameter - /// a > 1. - /// - /// The Zipf distribution (also known as the zeta distribution) is a - /// continuous probability distribution that satisfies Zipf’s law: the - /// frequency of an item is inversely proportional to its rank in a - /// frequency table. - /// - /// Notes - /// - /// The probability density for the Zipf distribution is - /// - /// where is the Riemann Zeta function. - /// - /// It is named for the American linguist George Kingsley Zipf, who noted - /// that the frequency of any word in a sample of a language is inversely - /// proportional to its rank in the frequency table. - /// - /// References - /// - /// - /// Distribution parameter. Should be greater than 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Zipf distribution. - /// - public NDarray random_zipf(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("zipf", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods - /// - /// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. - /// - public void random_RandomState(int? seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("RandomState", pyargs, kwargs); - } - - /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods - /// - /// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. - /// - public void random_RandomState(NDarray seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("RandomState", pyargs, kwargs); - } - - /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. - /// - /// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. - /// - public void random_seed(int? seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("seed", pyargs, kwargs); - } - - /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. - /// - /// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. - /// - public void random_seed(NDarray seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("seed", pyargs, kwargs); - } - - /* - /// - /// Return a tuple representing the internal state of the generator. - /// - /// For more details, see set_state. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// - /// The returned tuple has the following items: - /// - /// - /// The returned tuple has the following items: - /// - public tuple(str random_get_state(tuple(str @out = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("get_state", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Set the internal state of the generator from a tuple. - /// - /// For use if one has reason to manually (re-)set the internal state of the - /// “Mersenne Twister”[1] pseudo-random number generating algorithm. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// For backwards compatibility, the form (str, array of 624 uints, int) is - /// also accepted although it is missing some information about the cached - /// Gaussian value: state = ('MT19937', keys, pos). - /// - /// References - /// - /// - /// The state tuple has the following items: - /// - /// - /// Returns ‘None’ on success. - /// - public None random_set_state(tuple(str state) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - state, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("set_state", pyargs, kwargs); - return ToCsharp(py); - } - */ - - } -} diff --git a/src/Numpy.Bare/NumPy.set.gen.cs b/src/Numpy.Bare/NumPy.set.gen.cs deleted file mode 100644 index a8ce06a..0000000 --- a/src/Numpy.Bare/NumPy.set.gen.cs +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Test whether each element of a 1-D array is also present in a second array. - /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise. - /// - /// We recommend using isin instead of in1d for new code. - /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences. in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]). - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. - /// - /// - /// Input array. - /// - /// - /// The values against which to test each value of ar1. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise). - /// Default is False. np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). - /// - /// - /// The values ar1[in1d] are in ar2. - /// - public NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - ar2, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (invert!=false) kwargs["invert"]=ToPython(invert); - dynamic py = __self__.InvokeMethod("in1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the intersection of two arrays. - /// - /// Return the sorted, unique values that are in both of the input arrays. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned. The first instance of a value is used if there are - /// multiple. Default is False. - /// - /// - /// A tuple of: - /// intersect1d - /// Sorted 1D array of common and unique elements. - /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. - /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. - /// - public (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - ar1, - assume_unique, - return_indices, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("intersect1d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Calculates element in test_elements, broadcasting over element only. - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise. - /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in. - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences. - /// - /// element and test_elements are converted to arrays if they are not - /// already. If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements. This is a consequence - /// of the array constructor’s way of handling non-sequence collections. - /// Converting the set to a list usually gives the desired behavior. - /// - /// - /// Input array. - /// - /// - /// The values against which to test each value of element. - /// This argument is flattened if it is an array or array_like. - /// See notes for behavior with non-array-like parameters. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements. Default is False. - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). - /// - /// - /// Has the same shape as element. The values element[isin] - /// are in test_elements. - /// - public NDarray isin(NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - element, - test_elements, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (invert!=false) kwargs["invert"]=ToPython(invert); - dynamic py = __self__.InvokeMethod("isin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the set difference of two arrays. - /// - /// Return the unique values in ar1 that are not in ar2. - /// - /// - /// Input array. - /// - /// - /// Input comparison array. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. - /// - public NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - ar2, - assume_unique, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("setdiff1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the set exclusive-or of two arrays. - /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. - /// - /// - /// Input arrays. - /// - /// - /// Input arrays. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. - /// - public NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - ar1, - assume_unique, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("setxor1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the union of two arrays. - /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Unique, sorted union of the input arrays. - /// - public NDarray union1d(NDarray ar2, NDarray ar1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - ar1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("union1d", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.sorting.gen.cs b/src/Numpy.Bare/NumPy.sorting.gen.cs deleted file mode 100644 index 085aa25..0000000 --- a/src/Numpy.Bare/NumPy.sorting.gen.cs +++ /dev/null @@ -1,744 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return a sorted copy of an array. - /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable. A - /// stable sort keeps items with the same key in the same relative - /// order. The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis. Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts. - /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour. In numpy versions >= 1.4.0 nan - /// values are sorted to the end. The extended sort order is: - /// - /// where R is a non-nan real value. Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists. - /// Non-nan values are sorted as before. - /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress. This makes its - /// worst case O(n*log(n)). - /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted. It is currently mapped to - /// merge sort. - /// - /// - /// Array to be sorted. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="quicksort") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Perform an indirect stable sort using a sequence of keys. - /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns. The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on. The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape. If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. - /// - /// - /// The k different “columns” to be sorted. The last column (or row if - /// keys is a 2D array) is the primary sort key. - /// - /// - /// Axis to be indirectly sorted. By default, sort over the last axis. - /// - /// - /// Array of indices that sort the keys along the specified axis. - /// - public NDarray lexsort(NDarray keys, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - keys, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("lexsort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices that would sort an array. - /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword. It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// - /// Array to sort. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If None, - /// the flattened array is used. - /// - /// - /// Sorting algorithm. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of indices that sort a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a sorted a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. - /// - public NDarray argsort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="quicksort") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("argsort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Sort an array, in-place. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// - /// Axis along which to sort. Default is -1, which means sort along the - /// last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - public void sort(int? axis = -1, string kind = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!=null) kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); - } - - /// - /// Return a copy of an array sorted along the first axis. - /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). - /// - /// - /// Array to be sorted. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray msort(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("msort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Sort a complex array using the real part first, then the imaginary part. - /// - /// - /// Input array - /// - /// - /// Always returns a sorted complex array. - /// - public NDarray sort_complex(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("sort_complex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a partitioned copy of an array. - /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array. All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it. The ordering of the elements in the two - /// partitions is undefined. - /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable. A stable sort keeps items with the same key in the same - /// relative order. The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis. Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. - /// - /// - /// Array to be sorted. - /// - /// - /// Element index to partition by. The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it. The order of all elements in the partitions is undefined. If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Selection algorithm. Default is ‘introselect’. - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string. Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray partition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - kth, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="introselect") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword. It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order. - /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. - /// - /// - /// Array to sort. - /// - /// - /// Element index to partition by. The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it. The order all - /// elements in the partitions is undefined. If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If - /// None, the flattened array is used. - /// - /// - /// Selection algorithm. Default is ‘introselect’ - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of indices that partition a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a partitioned a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. - /// - public NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - kth, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="introselect") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("argpartition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices of the maximum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// Input array. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmax(NDarray a, int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("argmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. - /// - /// - /// Input data. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmax(NDarray a, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("nanargmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices of the minimum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// Input array. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmin(NDarray a, int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("argmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. - /// - /// - /// Input data. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmin(NDarray a, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("nanargmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the indices of array elements that are non-zero, grouped by element. - /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)). - /// - /// The output of argwhere is not suitable for indexing arrays. - /// For this purpose use nonzero(a) instead. - /// - /// - /// Input data. - /// - /// - /// Indices of elements that are non-zero. Indices are grouped by element. - /// - public NDarray argwhere(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("argwhere", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return indices that are non-zero in the flattened version of a. - /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. - /// - /// - /// Input data. - /// - /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. - /// - public NDarray flatnonzero(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("flatnonzero", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find indices where elements should be inserted to maintain order. - /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved. - /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points. - /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. - /// - /// - /// Input array. If sorter is None, then it must be sorted in - /// ascending order, otherwise sorter must be an array of indices - /// that sort it. - /// - /// - /// Values to insert into a. - /// - /// - /// If ‘left’, the index of the first suitable location found is given. - /// If ‘right’, return the last such index. If there is no suitable - /// index, return either 0 or N (where N is the length of a). - /// - /// - /// Optional array of integer indices that sort array a into ascending - /// order. They are typically the result of argsort. - /// - /// - /// Array of insertion points with the same shape as v. - /// - public NDarray searchsorted(NDarray a, NDarray v, string side = "left", NDarray sorter = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - v, - }); - var kwargs=new PyDict(); - if (side!="left") kwargs["side"]=ToPython(side); - if (sorter!=null) kwargs["sorter"]=ToPython(sorter); - dynamic py = __self__.InvokeMethod("searchsorted", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the elements of an array that satisfy some condition. - /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)). If - /// condition is boolean np.extract is equivalent to arr[condition]. - /// - /// Note that place does the exact opposite of extract. - /// - /// - /// An array whose nonzero or True entries indicate the elements of arr - /// to extract. - /// - /// - /// Input array of the same size as condition. - /// - /// - /// Rank 1 array of values from arr where condition is True. - /// - public NDarray extract(NDarray condition, NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condition, - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("extract", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// The array for which to count non-zeros. - /// - /// - /// Axis or tuple of axes along which to count non-zeros. - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public NDarray count_nonzero(NDarray a, int[] axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("count_nonzero", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// The array for which to count non-zeros. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public int count_nonzero(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("count_nonzero", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.staticstics.gen.cs b/src/Numpy.Bare/NumPy.staticstics.gen.cs deleted file mode 100644 index b61f50e..0000000 --- a/src/Numpy.Bare/NumPy.staticstics.gen.cs +++ /dev/null @@ -1,3275 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - if (initial!=null) kwargs["initial"]=ToPython(initial); - dynamic py = __self__.InvokeMethod("amin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - if (initial!=null) kwargs["initial"]=ToPython(initial); - dynamic py = __self__.InvokeMethod("amax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs. - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.min. - /// - /// - /// Array containing numbers whose minimum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the minimum is computed. The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis - /// removed. If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned. The same dtype as a is returned. - /// - public NDarray nanmin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs. When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.max. - /// - /// - /// Array containing numbers whose maximum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the maximum is computed. The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis removed. - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned. The same dtype as a is returned. - /// - public NDarray nanmax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Range of values (maximum - minimum) along an axis. - /// - /// The name of the function comes from the acronym for ‘peak to peak’. - /// - /// - /// Input values. - /// - /// - /// Axis along which to find the peaks. By default, flatten the - /// array. axis may be negative, in - /// which case it counts from the last to the first axis. - /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. - /// - public NDarray ptp(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("ptp", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray percentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double percentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanpercentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanpercentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray quantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double quantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanquantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanquantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original arr. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray median(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double median(NDarray a, NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. - /// - /// - /// Axis or axes along which to average a. The default, - /// axis=None, will average over all of the elements of the input array. - /// If axis is negative it counts from the last to the first axis. - /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public NDarray average(NDarray a, int[] axis, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (returned!=false) kwargs["returned"]=ToPython(returned); - dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public double average(NDarray a, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (returned!=false) kwargs["returned"]=ToPython(returned); - dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the means are computed. The default is to - /// compute the mean of the flattened array. - /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public NDarray mean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public double mean(NDarray a, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Calculate the standard deviation of these values. - /// - /// - /// Axis or axes along which the standard deviation is computed. The - /// default is to compute the standard deviation of the flattened array. - /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public NDarray std(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Calculate the standard deviation of these values. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public double std(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the variance is computed. The default is to - /// compute the variance of the flattened array. - /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public NDarray @var(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public double @var(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanmedian(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanmedian(NDarray a, NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the means are computed. The default is to compute - /// the mean of the flattened array. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public NDarray nanmean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public double nanmean(NDarray a, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Calculate the standard deviation of the non-NaN values. - /// - /// - /// Axis or axes along which the standard deviation is computed. The default is - /// to compute the standard deviation of the flattened array. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes. If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public NDarray nanstd(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Calculate the standard deviation of the non-NaN values. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public double nanstd(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the variance is computed. The default is to compute - /// the variance of the flattened array. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public NDarray nanvar(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public double nanvar(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return Pearson product-moment correlation coefficients. - /// - /// Please refer to the documentation for cov for more detail. The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive. - /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1. The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case. - /// - /// This function accepts but discards arguments bias and ddof. This is - /// for backwards compatibility with previous versions of this function. These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. - /// - /// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of x represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. - /// - /// - /// An additional set of variables and observations. y has the same - /// shape as x. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// The correlation coefficient matrix of the variables. - /// - public NDarray corrcoef(NDarray x, NDarray y = null, bool? rowvar = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); - dynamic py = __self__.InvokeMethod("corrcoef", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Cross-correlation of two 1-dimensional sequences. - /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate. - /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently. Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. - /// - /// - /// Input sequences. - /// - /// - /// Input sequences. - /// - /// - /// Refer to the convolve docstring. Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. - /// - /// - /// Discrete cross-correlation of a and v. - /// - public NDarray correlate(NDarray v, NDarray a, string mode = "valid") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - a, - }); - var kwargs=new PyDict(); - if (mode!="valid") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("correlate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Estimate a covariance matrix, given data and weights. - /// - /// Covariance indicates the level to which two variables vary together. - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm. - /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity. The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. - /// - /// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of m represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. - /// - /// - /// An additional set of variables and observations. y has the same form - /// as that of m. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate). If bias is True, - /// then normalization is by N. These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. - /// - /// - /// If not None the default value implied by bias is overridden. - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average. See the notes for the details. The default value - /// is None. - /// - /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. - /// - /// - /// 1-D array of observation vector weights. These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. - /// - /// - /// The covariance matrix of the variables. - /// - public NDarray cov(NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); - if (bias!=false) kwargs["bias"]=ToPython(bias); - if (ddof!=null) kwargs["ddof"]=ToPython(ddof); - if (fweights!=null) kwargs["fweights"]=ToPython(fweights); - if (aweights!=null) kwargs["aweights"]=ToPython(aweights); - dynamic py = __self__.InvokeMethod("cov", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sample, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sample, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sample, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Count number of occurrences of each value in array of non-negative ints. - /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x. If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x). - /// Each bin gives the number of occurrences of its index value in x. - /// If weights is specified the input array is weighted by it, i.e. if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. - /// - /// - /// Input array. - /// - /// - /// Weights, array of the same shape as x. - /// - /// - /// A minimum number of bins for the output array. - /// - /// - /// The result of binning the input array. - /// The length of out is equal to np.amax(x)+1. - /// - public NDarray bincount(NDarray x, NDarray weights = null, int? minlength = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (minlength!=0) kwargs["minlength"]=ToPython(minlength); - dynamic py = __self__.InvokeMethod("bincount", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the indices of the bins to which each value in input array belongs. - /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate. - /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError. - /// - /// np.digitize is implemented in terms of np.searchsorted. This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search. It also removes - /// the requirement for the input array to be 1-dimensional. - /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too. - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks. Perhaps more importantly, it supports all dtypes. - /// - /// - /// Input array to be binned. Prior to NumPy 1.10.0, this array had to - /// be 1-dimensional, but can now have any shape. - /// - /// - /// Array of bins. It has to be 1-dimensional and monotonic. - /// - /// - /// Indicating whether the intervals include the right or the left bin - /// edge. Default behavior is (right==False) indicating that the interval - /// does not include the right edge. The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. - /// - /// - /// Output array of indices, of same shape as x. - /// - public NDarray digitize(NDarray x, NDarray bins, bool? right = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - bins, - }); - var kwargs=new PyDict(); - if (right!=false) kwargs["right"]=ToPython(right); - dynamic py = __self__.InvokeMethod("digitize", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.string.gen.cs b/src/Numpy.Bare/NumPy.string.gen.cs deleted file mode 100644 index 2d9db9c..0000000 --- a/src/Numpy.Bare/NumPy.string.gen.cs +++ /dev/null @@ -1,1480 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return element-wise string concatenation for two arrays of str or unicode. - /// - /// Arrays x1 and x2 must have the same shape. - /// - /// - /// Input array. - /// - /// - /// Input array. - /// - /// - /// Output array of string_ or unicode_, depending on input types - /// of the same shape as x1 and x2. - /// - public NDarray core_defchararray_add(string[] x1, string[] x2) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x1, - x2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("add", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (a * i), that is string multiple concatenation, - /// element-wise. - /// - /// Values in i of less than 0 are treated as 0 (which yields an - /// empty string). - /// - /// - /// Output array of str or unicode, depending on input types - /// - public NDarray core_defchararray_multiply(string[] a, int[] i) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - i, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("multiply", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (a % i), that is pre-Python 2.6 string formatting - /// (iterpolation), element-wise for a pair of array_likes of str - /// or unicode. - /// - /// - /// These values will be element-wise interpolated into the string. - /// - /// - /// Output array of str or unicode, depending on input types - /// - public NDarray core_defchararray_mod(string[] a, NDarray values) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of a with only the first character of each element - /// capitalized. - /// - /// Calls str.capitalize element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array of strings to capitalize. - /// - /// - /// Output array of str or unicode, depending on input - /// types - /// - public NDarray core_defchararray_capitalize(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("capitalize", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of a with its elements centered in a string of - /// length width. - /// - /// Calls str.center element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The padding character to use (default is space). - /// - /// - /// Output array of str or unicode, depending on input - /// types - /// - public NDarray core_defchararray_center(string[] a, int width, string fillchar = " ") - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); - dynamic py = __self__.InvokeMethod("center", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calls str.decode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the - /// codecs module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. - /// - /// - /// The name of an encoding - /// - /// - /// Specifies how to handle encoding errors - /// - public NDarray core_defchararray_decode(string[] a, string encoding = null, string errors = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - if (errors!=null) kwargs["errors"]=ToPython(errors); - dynamic py = __self__.InvokeMethod("decode", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calls str.encode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the codecs - /// module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. - /// - /// - /// The name of an encoding - /// - /// - /// Specifies how to handle encoding errors - /// - public NDarray core_defchararray_encode(string[] a, string encoding = null, string errors = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - if (errors!=null) kwargs["errors"]=ToPython(errors); - dynamic py = __self__.InvokeMethod("encode", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a string which is the concatenation of the strings in the - /// sequence seq. - /// - /// Calls str.join element-wise. - /// - /// - /// Output array of str or unicode, depending on input types - /// - public NDarray core_defchararray_join(string[] sep, string[] seq) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - sep, - seq, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("join", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements of a left-justified in a - /// string of length width. - /// - /// Calls str.ljust element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The character to use for padding - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_ljust(string[] a, int width, string fillchar = " ") - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); - dynamic py = __self__.InvokeMethod("ljust", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements converted to lowercase. - /// - /// Call str.lower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_lower(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("lower", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy with the leading characters - /// removed. - /// - /// Calls str.lstrip element-wise. - /// - /// - /// Input array. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix; rather, all combinations of its values are - /// stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_lstrip(NDarray a, string chars = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (chars!=null) kwargs["chars"]=ToPython(chars); - dynamic py = __self__.InvokeMethod("lstrip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Partition each element in a around sep. - /// - /// Calls str.partition element-wise. - /// - /// For each element in a, split the element as the first - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. - /// - /// - /// Input array - /// - /// - /// Separator to split each string element in a. - /// - /// - /// Output array of str or unicode, depending on input type. - /// The output array will have an extra dimension with 3 - /// elements per input element. - /// - public NDarray core_defchararray_partition(NDarray a, string sep) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy of the string with all - /// occurrences of substring old replaced by new. - /// - /// Calls str.replace element-wise. - /// - /// - /// If the optional argument count is given, only the first - /// count occurrences are replaced. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_replace(string[] a, string @new, string old, int? count = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - @new, - old, - }); - var kwargs=new PyDict(); - if (count!=null) kwargs["count"]=ToPython(count); - dynamic py = __self__.InvokeMethod("replace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements of a right-justified in a - /// string of length width. - /// - /// Calls str.rjust element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The character to use for padding - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_rjust(string[] a, int width, string fillchar = " ") - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); - dynamic py = __self__.InvokeMethod("rjust", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Partition (split) each element around the right-most separator. - /// - /// Calls str.rpartition element-wise. - /// - /// For each element in a, split the element as the last - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. - /// - /// - /// Input array - /// - /// - /// Right-most separator to split each element in array. - /// - /// - /// Output array of string or unicode, depending on input - /// type. The output array will have an extra dimension with - /// 3 elements per input element. - /// - public NDarray core_defchararray_rpartition(string[] a, string sep) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("rpartition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.rsplit element-wise. - /// - /// Except for splitting from the right, rsplit - /// behaves like split. - /// - /// - /// If sep is not specified or None, any whitespace string - /// is a separator. - /// - /// - /// If maxsplit is given, at most maxsplit splits are done, - /// the rightmost ones. - /// - /// - /// Array of list objects - /// - public NDarray core_defchararray_rsplit(string[] a, string sep = null, int? maxsplit = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (sep!=null) kwargs["sep"]=ToPython(sep); - if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); - dynamic py = __self__.InvokeMethod("rsplit", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy with the trailing - /// characters removed. - /// - /// Calls str.rstrip element-wise. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a suffix; rather, all combinations of its values are - /// stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_rstrip(string[] a, string chars = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (chars!=null) kwargs["chars"]=ToPython(chars); - dynamic py = __self__.InvokeMethod("rstrip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.split element-wise. - /// - /// - /// If sep is not specified or None, any whitespace string is a - /// separator. - /// - /// - /// If maxsplit is given, at most maxsplit splits are done. - /// - /// - /// Array of list objects - /// - public NDarray core_defchararray_split(string[] a, string sep = null, int? maxsplit = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (sep!=null) kwargs["sep"]=ToPython(sep); - if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); - dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a list of the lines in the - /// element, breaking at line boundaries. - /// - /// Calls str.splitlines element-wise. - /// - /// - /// Line breaks are not included in the resulting list unless - /// keepends is given and true. - /// - /// - /// Array of list objects - /// - public NDarray core_defchararray_splitlines(string[] a, bool? keepends = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (keepends!=null) kwargs["keepends"]=ToPython(keepends); - dynamic py = __self__.InvokeMethod("splitlines", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy with the leading and - /// trailing characters removed. - /// - /// Calls str.strip element-wise. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix or suffix; rather, all combinations of its - /// values are stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_strip(string[] a, string chars = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (chars!=null) kwargs["chars"]=ToPython(chars); - dynamic py = __self__.InvokeMethod("strip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return element-wise a copy of the string with - /// uppercase characters converted to lowercase and vice versa. - /// - /// Calls str.swapcase element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_swapcase(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("swapcase", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return element-wise title cased version of string or unicode. - /// - /// Title case words start with uppercase characters, all remaining cased - /// characters are lowercase. - /// - /// Calls str.title element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_title(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("title", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy of the string where all - /// characters occurring in the optional argument deletechars are - /// removed, and the remaining characters have been mapped through the - /// given translation table. - /// - /// Calls str.translate element-wise. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_translate(string[] a, string table, string deletechars) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - table, - deletechars, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("translate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements converted to uppercase. - /// - /// Calls str.upper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_upper(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("upper", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the numeric string left-filled with zeros - /// - /// Calls str.zfill element-wise. - /// - /// - /// Input array. - /// - /// - /// Width of string to left-fill elements in a. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_zfill(NDarray a, int width) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("zfill", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 == x2) element-wise. - /// - /// Unlike numpy.equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 != x2) element-wise. - /// - /// Unlike numpy.not_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_not_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("not_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 >= x2) element-wise. - /// - /// Unlike numpy.greater_equal, this comparison is performed by - /// first stripping whitespace characters from the end of the string. - /// This behavior is provided for backward-compatibility with - /// numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_greater_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("greater_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 <= x2) element-wise. - /// - /// Unlike numpy.less_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_less_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("less_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 > x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_greater(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("greater", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 < x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_less(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("less", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns an array with the number of non-overlapping occurrences of - /// substring sub in the range [start, end]. - /// - /// Calls str.count element-wise. - /// - /// - /// The substring to search for. - /// - /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. - /// - /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. - /// - /// - /// Output array of ints. - /// - public NDarray core_defchararray_count(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("count", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element, return the lowest index in the string where - /// substring sub is found. - /// - /// Calls str.find element-wise. - /// - /// For each element, return the lowest index in the string where - /// substring sub is found, such that sub is contained in the - /// range [start, end]. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Output array of ints. Returns -1 if sub is not found. - /// - public NDarray core_defchararray_find(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("find", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Like find, but raises ValueError when the substring is not found. - /// - /// Calls str.index element-wise. - /// - /// - /// Output array of ints. Returns -1 if sub is not found. - /// - public NDarray core_defchararray_index(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("index", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all characters in the string are - /// alphabetic and there is at least one character, false otherwise. - /// - /// Calls str.isalpha element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isalpha(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isalpha", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element, return True if there are only decimal - /// characters in the element. - /// - /// Calls unicode.isdecimal element-wise. - /// - /// Decimal characters include digit characters, and all characters - /// that that can be used to form decimal-radix numbers, - /// e.g. U+0660, ARABIC-INDIC DIGIT ZERO. - /// - /// - /// Input array. - /// - /// - /// Array of booleans identical in shape to a. - /// - public NDarray core_defchararray_isdecimal(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isdecimal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all characters in the string are - /// digits and there is at least one character, false otherwise. - /// - /// Calls str.isdigit element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isdigit(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isdigit", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all cased characters in the - /// string are lowercase and there is at least one cased character, - /// false otherwise. - /// - /// Calls str.islower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_islower(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("islower", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element, return True if there are only numeric - /// characters in the element. - /// - /// Calls unicode.isnumeric element-wise. - /// - /// Numeric characters include digit characters, and all characters - /// that have the Unicode numeric value property, e.g. U+2155, - /// VULGAR FRACTION ONE FIFTH. - /// - /// - /// Input array. - /// - /// - /// Array of booleans of same shape as a. - /// - public NDarray core_defchararray_isnumeric(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isnumeric", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if there are only whitespace - /// characters in the string and there is at least one character, - /// false otherwise. - /// - /// Calls str.isspace element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isspace(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isspace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if the element is a titlecased - /// string and there is at least one character, false otherwise. - /// - /// Call str.istitle element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_istitle(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("istitle", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all cased characters in the - /// string are uppercase and there is at least one character, false - /// otherwise. - /// - /// Call str.isupper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isupper(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isupper", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return the highest index in the string - /// where substring sub is found, such that sub is contained - /// within [start, end]. - /// - /// Calls str.rfind element-wise. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Output array of ints. Return -1 on failure. - /// - public NDarray core_defchararray_rfind(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("rfind", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Like rfind, but raises ValueError when the substring sub is - /// not found. - /// - /// Calls str.rindex element-wise. - /// - /// - /// Output array of ints. - /// - public NDarray core_defchararray_rindex(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("rindex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns a boolean array which is True where the string element - /// in a starts with prefix, otherwise False. - /// - /// Calls str.startswith element-wise. - /// - /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. - /// - /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. - /// - /// - /// Array of booleans - /// - public NDarray core_defchararray_startswith(string[] a, string prefix, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - prefix, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("startswith", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. - /// - /// - /// Shape of the array. - /// - /// - /// Length of each array element, in number of characters. Default is 1. - /// - /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. - /// - /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. - /// - /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. - /// - /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. - /// - /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. - /// - public void core_defchararray_chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (buffer!=null) kwargs["buffer"]=ToPython(buffer); - if (offset!=null) kwargs["offset"]=ToPython(offset); - if (strides!=null) kwargs["strides"]=ToPython(strides); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("chararray", pyargs, kwargs); - } - - } -} diff --git a/src/Numpy.Bare/NumPy.window.gen.cs b/src/Numpy.Bare/NumPy.window.gen.cs deleted file mode 100644 index 617a788..0000000 --- a/src/Numpy.Bare/NumPy.window.gen.cs +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return the Bartlett window. - /// - /// The Bartlett window is very similar to a triangular window, except - /// that the end points are at zero. It is often used in signal - /// processing for tapering a signal, without generating too much - /// ripple in the frequency domain. - /// - /// Notes - /// - /// The Bartlett window is defined as - /// - /// Most references to the Bartlett window come from the signal - /// processing literature, where it is used as one of many windowing - /// functions for smoothing values. Note that convolution with this - /// window produces linear interpolation. It is also known as an - /// apodization (which means”removing the foot”, i.e. smoothing - /// discontinuities at the beginning and end of the sampled signal) or - /// tapering function. The fourier transform of the Bartlett is the product - /// of two sinc functions. - /// Note the excellent discussion in Kanasewich. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The triangular window, with the maximum value normalized to one - /// (the value one appears only if the number of samples is odd), with - /// the first and last samples equal to zero. - /// - public NDarray bartlett(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("bartlett", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Blackman window. - /// - /// The Blackman window is a taper formed by using the first three - /// terms of a summation of cosines. It was designed to have close to the - /// minimal leakage possible. It is close to optimal, only slightly worse - /// than a Kaiser window. - /// - /// Notes - /// - /// The Blackman window is defined as - /// - /// Most references to the Blackman window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. It is known as a - /// “near optimal” tapering function, almost as good (by some measures) - /// as the kaiser window. - /// - /// References - /// - /// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, - /// Dover Publications, New York. - /// - /// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. - /// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. - /// - /// - /// Number of points in the output window. If zero or less, an empty - /// array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value one - /// appears only if the number of samples is odd). - /// - public NDarray blackman(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("blackman", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Hamming window. - /// - /// The Hamming window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hamming window is defined as - /// - /// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey - /// and is described in Blackman and Tukey. It was recommended for - /// smoothing the truncated autocovariance function in the time domain. - /// Most references to the Hamming window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). - /// - public NDarray hamming(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("hamming", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Hanning window. - /// - /// The Hanning window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hanning window is defined as - /// - /// The Hanning was named for Julius von Hann, an Austrian meteorologist. - /// It is also known as the Cosine Bell. Some authors prefer that it be - /// called a Hann window, to help avoid confusion with the very similar - /// Hamming window. - /// - /// Most references to the Hanning window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if M is odd). - /// - public NDarray hanning(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("hanning", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Kaiser window. - /// - /// The Kaiser window is a taper formed by using a Bessel function. - /// - /// Notes - /// - /// The Kaiser window is defined as - /// - /// with - /// - /// where is the modified zeroth-order Bessel function. - /// - /// The Kaiser was named for Jim Kaiser, who discovered a simple - /// approximation to the DPSS window based on Bessel functions. The Kaiser - /// window is a very good approximation to the Digital Prolate Spheroidal - /// Sequence, or Slepian window, which is the transform which maximizes the - /// energy in the main lobe of the window relative to total energy. - /// - /// The Kaiser can approximate many other windows by varying the beta - /// parameter. - /// - /// A beta value of 14 is probably a good starting point. Note that as beta - /// gets large, the window narrows, and so the number of samples needs to be - /// large enough to sample the increasingly narrow spike, otherwise NaNs will - /// get returned. - /// - /// Most references to the Kaiser window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// Shape parameter for window. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). - /// - public NDarray kaiser(int M, float beta) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - beta, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("kaiser", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy.Bare/Numpy.Bare.csproj b/src/Numpy.Bare/Numpy.Bare.csproj index 328fbbc..b1c5c8f 100644 --- a/src/Numpy.Bare/Numpy.Bare.csproj +++ b/src/Numpy.Bare/Numpy.Bare.csproj @@ -8,25 +8,91 @@ Meinrad Recheis Numpy.NET Numpy.Bare - C# bindings for NumPy - a fundamental library for scientific computing, machine learning and AI. Does require Python 3.7 with NumPy 1.16 installed! - + C# bindings for NumPy on Win64 - a fundamental library for scientific computing, machine learning and AI. Does require Python 3.7 with NumPy 1.16 installed! 2019 - Meinrad Recheis https://github.com/SciSharp/Numpy.NET https://github.com/SciSharp/Numpy.NET - Data science, Machine Learning, AI, Scientific Computing, NumPy + Data science, Machine Learning, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 1.1.0 + 3.11.1.33 + https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true + 3.7.1.4 + + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - + + diff --git a/src/Numpy.Bare/np.array_creation.gen.cs b/src/Numpy.Bare/np.array_creation.gen.cs deleted file mode 100644 index 259c430..0000000 --- a/src/Numpy.Bare/np.array_creation.gen.cs +++ /dev/null @@ -1,2856 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Return a new array of given shape and type, without initializing entries. - /// - /// Notes - /// - /// empty, unlike zeros, does not set the array values to zero, - /// and may therefore be marginally faster. On the other hand, it requires - /// the user to manually set all the values in the array, and should be - /// used with caution. - /// - /// - /// Shape of the empty array, e.g., (2, 3) or 2. - /// - /// - /// Desired output data-type for the array, e.g, numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of uninitialized (arbitrary) data of the given shape, dtype, and - /// order. Object arrays will be initialized to None. - /// - public static NDarray empty(Shape shape, Dtype dtype = null, string order = null) - => NumPy.Instance.empty(shape, dtype:dtype, order:order); - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public static NDarray empty_like(NDarray prototype, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.empty_like(prototype, dtype:dtype, order:order, subok:subok); - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public static NDarray empty_like(T[] prototype, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.empty_like(prototype, dtype:dtype, order:order, subok:subok); - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public static NDarray empty_like(T[,] prototype, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.empty_like(prototype, dtype:dtype, order:order, subok:subok); - - /// - /// Return a 2-D array with ones on the diagonal and zeros elsewhere. - /// - /// - /// Number of rows in the output. - /// - /// - /// Number of columns in the output. If None, defaults to N. - /// - /// - /// Index of the diagonal: 0 (the default) refers to the main diagonal, - /// a positive value refers to an upper diagonal, and a negative value - /// to a lower diagonal. - /// - /// - /// Data-type of the returned array. - /// - /// - /// Whether the output should be stored in row-major (C-style) or - /// column-major (Fortran-style) order in memory. - /// - /// - /// An array where all elements are equal to zero, except for the k-th - /// diagonal, whose values are equal to one. - /// - public static NDarray eye(int N, int? M = null, int? k = 0, Dtype dtype = null, string order = null) - => NumPy.Instance.eye(N, M:M, k:k, dtype:dtype, order:order); - - /// - /// Return the identity array. - /// - /// The identity array is a square array with ones on - /// the main diagonal. - /// - /// - /// Number of rows (and columns) in n x n output. - /// - /// - /// Data-type of the output. Defaults to float. - /// - /// - /// n x n array with its main diagonal set to one, - /// and all other elements 0. - /// - public static NDarray identity(int n, Dtype dtype = null) - => NumPy.Instance.identity(n, dtype:dtype); - - /// - /// Return a new array of given shape and type, filled with ones. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of ones with the given shape, dtype, and order. - /// - public static NDarray ones(Shape shape, Dtype dtype = null, string order = null) - => NumPy.Instance.ones(shape, dtype:dtype, order:order); - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public static NDarray ones_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.ones_like(a, dtype:dtype, order:order, subok:subok); - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public static NDarray ones_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.ones_like(a, dtype:dtype, order:order, subok:subok); - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public static NDarray ones_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.ones_like(a, dtype:dtype, order:order, subok:subok); - - /// - /// Return a new array of given shape and type, filled with zeros. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of zeros with the given shape, dtype, and order. - /// - public static NDarray zeros(Shape shape, Dtype dtype = null, string order = null) - => NumPy.Instance.zeros(shape, dtype:dtype, order:order); - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public static NDarray zeros_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.zeros_like(a, dtype:dtype, order:order, subok:subok); - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public static NDarray zeros_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.zeros_like(a, dtype:dtype, order:order, subok:subok); - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public static NDarray zeros_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.zeros_like(a, dtype:dtype, order:order, subok:subok); - - /// - /// Return a new array of given shape and type, filled with fill_value. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// Fill value. - /// - /// - /// Whether to store multidimensional data in C- or Fortran-contiguous - /// (row- or column-wise) order in memory. - /// - /// - /// Array of fill_value with the given shape, dtype, and order. - /// - public static NDarray full(Shape shape, ValueType fill_value, Dtype dtype = null, string order = null) - => NumPy.Instance.full(shape, fill_value, dtype:dtype, order:order); - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public static NDarray full_like(NDarray a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.full_like(a, fill_value, dtype:dtype, order:order, subok:subok); - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public static NDarray full_like(T[] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.full_like(a, fill_value, dtype:dtype, order:order, subok:subok); - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public static NDarray full_like(T[,] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.full_like(a, fill_value, dtype:dtype, order:order, subok:subok); - - /// - /// Create an array. - /// - /// Notes - /// - /// When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, - /// and a copy is forced by a change in dtype, then the order of the result is - /// not necessarily ‘C’ as expected. This is likely a bug. - /// - /// - /// An array, any object exposing the array interface, an object whose - /// __array__ method returns an array, or any (nested) sequence. - /// - /// - /// The desired data-type for the array. If not given, then the type will - /// be determined as the minimum type required to hold the objects in the - /// sequence. This argument can only be used to ‘upcast’ the array. For - /// downcasting, use the .astype(t) method. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy will - /// only be made if __array__ returns a copy, if obj is a nested sequence, - /// or if a copy is needed to satisfy any of the other requirements - /// (dtype, order, etc.). - /// - /// - /// Specify the memory layout of the array. If object is not an array, the - /// newly created array will be in C order (row major) unless ‘F’ is - /// specified, in which case it will be in Fortran order (column major). - /// If object is an array the following holds. - /// - /// When copy=False and a copy is made for other reasons, the result is - /// the same as if copy=True, with some exceptions for A, see the - /// Notes section. The default order is ‘K’. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// Specifies the minimum number of dimensions that the resulting - /// array should have. Ones will be pre-pended to the shape as - /// needed to meet this requirement. - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(NDarray @object, Dtype dtype = null, bool? copy = true, string order = null, bool? subok = false, int? ndmin = 0) - => NumPy.Instance.array(@object, dtype:dtype, copy:copy, order:order, subok:subok, ndmin:ndmin); - - /// - /// Create an array. - /// - /// Notes - /// - /// When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, - /// and a copy is forced by a change in dtype, then the order of the result is - /// not necessarily ‘C’ as expected. This is likely a bug. - /// - /// - /// An array, any object exposing the array interface, an object whose - /// __array__ method returns an array, or any (nested) sequence. - /// - /// - /// The desired data-type for the array. If not given, then the type will - /// be determined as the minimum type required to hold the objects in the - /// sequence. This argument can only be used to ‘upcast’ the array. For - /// downcasting, use the .astype(t) method. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy will - /// only be made if __array__ returns a copy, if obj is a nested sequence, - /// or if a copy is needed to satisfy any of the other requirements - /// (dtype, order, etc.). - /// - /// - /// Specify the memory layout of the array. If object is not an array, the - /// newly created array will be in C order (row major) unless ‘F’ is - /// specified, in which case it will be in Fortran order (column major). - /// If object is an array the following holds. - /// - /// When copy=False and a copy is made for other reasons, the result is - /// the same as if copy=True, with some exceptions for A, see the - /// Notes section. The default order is ‘K’. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// Specifies the minimum number of dimensions that the resulting - /// array should have. Ones will be pre-pended to the shape as - /// needed to meet this requirement. - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(T[] @object, Dtype dtype = null, bool? copy = true, string order = null, bool? subok = false, int? ndmin = 0) - => NumPy.Instance.array(@object, dtype:dtype, copy:copy, order:order, subok:subok, ndmin:ndmin); - - /// - /// Create an array. - /// - /// Notes - /// - /// When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, - /// and a copy is forced by a change in dtype, then the order of the result is - /// not necessarily ‘C’ as expected. This is likely a bug. - /// - /// - /// An array, any object exposing the array interface, an object whose - /// __array__ method returns an array, or any (nested) sequence. - /// - /// - /// The desired data-type for the array. If not given, then the type will - /// be determined as the minimum type required to hold the objects in the - /// sequence. This argument can only be used to ‘upcast’ the array. For - /// downcasting, use the .astype(t) method. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy will - /// only be made if __array__ returns a copy, if obj is a nested sequence, - /// or if a copy is needed to satisfy any of the other requirements - /// (dtype, order, etc.). - /// - /// - /// Specify the memory layout of the array. If object is not an array, the - /// newly created array will be in C order (row major) unless ‘F’ is - /// specified, in which case it will be in Fortran order (column major). - /// If object is an array the following holds. - /// - /// When copy=False and a copy is made for other reasons, the result is - /// the same as if copy=True, with some exceptions for A, see the - /// Notes section. The default order is ‘K’. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// Specifies the minimum number of dimensions that the resulting - /// array should have. Ones will be pre-pended to the shape as - /// needed to meet this requirement. - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(T[,] @object, Dtype dtype = null, bool? copy = true, string order = null, bool? subok = false, int? ndmin = 0) - => NumPy.Instance.array(@object, dtype:dtype, copy:copy, order:order, subok:subok, ndmin:ndmin); - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public static NDarray asarray(NDarray a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray(a, dtype:dtype, order:order); - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public static NDarray asarray(T[] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray(a, dtype:dtype, order:order); - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public static NDarray asarray(T[,] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray(a, dtype:dtype, order:order); - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public static NDarray asanyarray(NDarray a, Dtype dtype = null, string order = null) - => NumPy.Instance.asanyarray(a, dtype:dtype, order:order); - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public static NDarray asanyarray(T[] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asanyarray(a, dtype:dtype, order:order); - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public static NDarray asanyarray(T[,] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asanyarray(a, dtype:dtype, order:order); - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public static NDarray ascontiguousarray(NDarray a, Dtype dtype = null) - => NumPy.Instance.ascontiguousarray(a, dtype:dtype); - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public static NDarray ascontiguousarray(T[] a, Dtype dtype = null) - => NumPy.Instance.ascontiguousarray(a, dtype:dtype); - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public static NDarray ascontiguousarray(T[,] a, Dtype dtype = null) - => NumPy.Instance.ascontiguousarray(a, dtype:dtype); - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public static Matrix asmatrix(NDarray data, Dtype dtype) - => NumPy.Instance.asmatrix(data, dtype); - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public static Matrix asmatrix(T[] data, Dtype dtype) - => NumPy.Instance.asmatrix(data, dtype); - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public static Matrix asmatrix(T[,] data, Dtype dtype) - => NumPy.Instance.asmatrix(data, dtype); - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public static NDarray copy(NDarray a, string order = null) - => NumPy.Instance.copy(a, order:order); - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public static NDarray copy(T[] a, string order = null) - => NumPy.Instance.copy(a, order:order); - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public static NDarray copy(T[,] a, string order = null) - => NumPy.Instance.copy(a, order:order); - - /* - /// - /// Interpret a buffer as a 1-dimensional array. - /// - /// Notes - /// - /// If the buffer has data that is not in machine byte-order, this should - /// be specified as part of the data-type, e.g.: - /// - /// The data of the resulting array will not be byteswapped, but will be - /// interpreted correctly. - /// - /// - /// An object that exposes the buffer interface. - /// - /// - /// Data-type of the returned array; default: float. - /// - /// - /// Number of items to read. -1 means all data in the buffer. - /// - /// - /// Start reading the buffer from this offset (in bytes); default: 0. - /// - public static void frombuffer(buffer_like buffer, Dtype dtype = null, int? count = -1, int? offset = 0) - => NumPy.Instance.frombuffer(buffer, dtype:dtype, count:count, offset:offset); - */ - - /// - /// Construct an array from data in a text or binary file. - /// - /// A highly efficient way of reading binary data with a known data-type, - /// as well as parsing simply formatted text files. Data written using the - /// tofile method can be read using this function. - /// - /// Notes - /// - /// Do not rely on the combination of tofile and fromfile for - /// data storage, as the binary files generated are are not platform - /// independent. In particular, no byte-order or data-type information is - /// saved. Data can be stored in the platform independent .npy format - /// using save and load instead. - /// - /// - /// Open file object or filename. - /// - /// - /// Data type of the returned array. - /// For binary files, it is used to determine the size and byte-order - /// of the items in the file. - /// - /// - /// Number of items to read. -1 means all items (i.e., the complete - /// file). - /// - /// - /// Separator between items if file is a text file. - /// Empty (“”) separator means the file should be treated as binary. - /// Spaces (” “) in the separator match zero or more whitespace characters. - /// A separator consisting only of spaces must match at least one - /// whitespace. - /// - public static void fromfile(string file, Dtype dtype = null, int count = -1, string sep = "") - => NumPy.Instance.fromfile(file, dtype, count, sep); - - /// - /// Construct an array by executing a function over each coordinate. - /// - /// The resulting array therefore has a value fn(x, y, z) at - /// coordinate (x, y, z). - /// - /// Notes - /// - /// Keywords other than dtype are passed to function. - /// - /// - /// The function is called with N parameters, where N is the rank of - /// shape. Each parameter represents the coordinates of the array - /// varying along a specific axis. For example, if shape - /// were (2, 2), then the parameters would be - /// array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]]) - /// - /// - /// Shape of the output array, which also determines the shape of - /// the coordinate arrays passed to function. - /// - /// - /// Data-type of the coordinate arrays passed to function. - /// By default, dtype is float. - /// - /// - /// The result of the call to function is passed back directly. - /// Therefore the shape of fromfunction is completely determined by - /// function. If function returns a scalar value, the shape of - /// fromfunction would not match the shape parameter. - /// - public static object fromfunction(Delegate function, Shape shape, Dtype dtype = null) - => NumPy.Instance.fromfunction(function, shape, dtype:dtype); - - /// - /// Create a new 1-dimensional array from an iterable object. - /// - /// Notes - /// - /// Specify count to improve performance. It allows fromiter to - /// pre-allocate the output array, instead of resizing it on demand. - /// - /// - /// An iterable object providing data for the array. - /// - /// - /// The data-type of the returned array. - /// - /// - /// The number of items to read from iterable. The default is -1, - /// which means all data is read. - /// - /// - /// The output array. - /// - public static NDarray fromiter(IEnumerable iterable, Dtype dtype, int? count = -1) - => NumPy.Instance.fromiter(iterable, dtype, count:count); - - /// - /// A new 1-D array initialized from text data in a string. - /// - /// - /// A string containing the data. - /// - /// - /// The data type of the array; default: float. For binary input data, - /// the data must be in exactly this format. - /// - /// - /// Read this number of dtype elements from the data. If this is - /// negative (the default), the count will be determined from the - /// length of the data. - /// - /// - /// The string separating numbers in the data; extra whitespace between - /// elements is also ignored. - /// - /// - /// The constructed array. - /// - public static NDarray fromstring(string @string, Dtype dtype = null, int? count = -1, string sep = "") - => NumPy.Instance.fromstring(@string, dtype:dtype, count:count, sep:sep); - - /// - /// Load data from a text file. - /// - /// Each row in the text file must have the same number of values. - /// - /// Notes - /// - /// This function aims to be a fast reader for simply formatted files. The - /// genfromtxt function provides more sophisticated handling of, e.g., - /// lines with missing values. - /// - /// The strings produced by the Python float.hex method can be used as - /// input for floats. - /// - /// - /// File, filename, or generator to read. If the filename extension is - /// .gz or .bz2, the file is first decompressed. Note that - /// generators should return byte strings for Python 3k. - /// - /// - /// Data-type of the resulting array; default: float. If this is a - /// structured data-type, the resulting array will be 1-dimensional, and - /// each row will be interpreted as an element of the array. In this - /// case, the number of columns used must match the number of fields in - /// the data-type. - /// - /// - /// The characters or list of characters used to indicate the start of a - /// comment. None implies no comments. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is ‘#’. - /// - /// - /// The string used to separate values. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is whitespace. - /// - /// - /// A dictionary mapping column number to a function that will parse the - /// column string into the desired value. E.g., if column 0 is a date - /// string: converters = {0: datestr2num}. Converters can also be - /// used to provide a default value for missing data (but see also - /// genfromtxt): converters = {3: lambda s: float(s.strip() or 0)}. - /// Default: None. - /// - /// - /// Skip the first skiprows lines; default: 0. - /// - /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1,4,5) will extract the 2nd, 5th and 6th columns. - /// The default, None, results in all columns being read. - /// - /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...). When used with a structured - /// data-type, arrays are returned for each field. Default is False. - /// - /// - /// The returned array will have at least ndmin dimensions. - /// Otherwise mono-dimensional axes will be squeezed. - /// Legal values: 0 (default), 1 or 2. - /// - /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// The special value ‘bytes’ enables backward compatibility workarounds - /// that ensures you receive byte arrays as results if possible and passes - /// ‘latin1’ encoded strings to converters. Override this value to receive - /// unicode arrays and pass strings as input to converters. If set to None - /// the system default is used. The default value is ‘bytes’. - /// - /// - /// Read max_rows lines of content after skiprows lines. The default - /// is to read all the lines. - /// - /// - /// Data read from the text file. - /// - public static NDarray loadtxt(string fname, Dtype dtype = null, string[] comments = null, string delimiter = null, Hashtable converters = null, int? skiprows = 0, int[] usecols = null, bool? unpack = false, int? ndmin = 0, string encoding = "bytes", int? max_rows = null) - => NumPy.Instance.loadtxt(fname, dtype:dtype, comments:comments, delimiter:delimiter, converters:converters, skiprows:skiprows, usecols:usecols, unpack:unpack, ndmin:ndmin, encoding:encoding, max_rows:max_rows); - - public static partial class core { - public static partial class defchararray { - /// - /// Create a chararray. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy - /// will only be made if __array__ returns a copy, if obj is a - /// nested sequence, or if a copy is needed to satisfy any of the other - /// requirements (itemsize, unicode, order, etc.). - /// - /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. - /// - /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). If order is ‘A’, then the returned array may - /// be in any order (either C-, Fortran-contiguous, or even - /// discontiguous). - /// - public static void array(string[] obj, int? itemsize = null, bool? copy = true, bool? unicode = null, string order = null) - => NumPy.Instance.core_defchararray_array(obj, itemsize:itemsize, copy:copy, unicode:unicode, order:order); - } - } - - /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. - /// - /// - /// Shape of the array. - /// - /// - /// Length of each array element, in number of characters. Default is 1. - /// - /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. - /// - /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. - /// - /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. - /// - /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. - /// - /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. - /// - public static void chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - => NumPy.Instance.chararray(shape, itemsize:itemsize, unicode:unicode, buffer:buffer, offset:offset, strides:strides, order:order); - - public static partial class core { - public static partial class defchararray { - /// - /// Convert the input to a chararray, copying the data only if - /// necessary. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. - /// - /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. - /// - /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). - /// - public static void asarray(string[] obj, int? itemsize = null, bool? unicode = null, string order = null) - => NumPy.Instance.core_defchararray_asarray(obj, itemsize:itemsize, unicode:unicode, order:order); - } - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(byte start, byte stop, byte step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(byte stop, byte step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(short start, short stop, short step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(short stop, short step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(int start, int stop, int step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(int stop, int step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(long start, long stop, long step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(long stop, long step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(float start, float stop, float step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(float stop, float step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(double start, double stop, double step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public static NDarray arange(double stop, double step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); - - /// - /// Return evenly spaced numbers over a specified interval. - /// - /// Returns num evenly spaced samples, calculated over the - /// interval [start, stop]. - /// - /// The endpoint of the interval can optionally be excluded. - /// - /// - /// The starting value of the sequence. - /// - /// - /// The end value of the sequence, unless endpoint is set to False. - /// In that case, the sequence consists of all but the last of num + 1 - /// evenly spaced samples, so that stop is excluded. Note that the step - /// size changes when endpoint is False. - /// - /// - /// Number of samples to generate. Default is 50. Must be non-negative. - /// - /// - /// If True, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// If True, return (samples, step), where step is the spacing - /// between samples. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// A tuple of: - /// samples - /// There are num equally spaced samples in the closed interval - /// [start, stop] or the half-open interval [start, stop) - /// (depending on whether endpoint is True or False). - /// step - /// Only returned if retstep is True - /// - /// Size of spacing between samples. - /// - public static (NDarray, float) linspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, bool? retstep = false, Dtype dtype = null, int? axis = 0) - => NumPy.Instance.linspace(start, stop, num:num, endpoint:endpoint, retstep:retstep, dtype:dtype, axis:axis); - - /// - /// Return numbers spaced evenly on a log scale. - /// - /// In linear space, the sequence starts at base ** start - /// (base to the power of start) and ends with base ** stop - /// (see endpoint below). - /// - /// Notes - /// - /// Logspace is equivalent to the code - /// - /// - /// base ** start is the starting value of the sequence. - /// - /// - /// base ** stop is the final value of the sequence, unless endpoint - /// is False. In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. - /// - /// - /// Number of samples to generate. Default is 50. - /// - /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// The base of the log space. The step size between the elements in - /// ln(samples) / ln(base) (or log_base(samples)) is uniform. - /// Default is 10.0. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// num samples, equally spaced on a log scale. - /// - public static NDarray logspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, float? @base = 10.0f, Dtype dtype = null, int? axis = 0) - => NumPy.Instance.logspace(start, stop, num:num, endpoint:endpoint, @base:@base, dtype:dtype, axis:axis); - - /// - /// Return numbers spaced evenly on a log scale (a geometric progression). - /// - /// This is similar to logspace, but with endpoints specified directly. - /// Each output sample is a constant multiple of the previous. - /// - /// Notes - /// - /// If the inputs or dtype are complex, the output will follow a logarithmic - /// spiral in the complex plane. (There are an infinite number of spirals - /// passing through two points; the output will follow the shortest such path.) - /// - /// - /// The starting value of the sequence. - /// - /// - /// The final value of the sequence, unless endpoint is False. - /// In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. - /// - /// - /// Number of samples to generate. Default is 50. - /// - /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// num samples, equally spaced on a log scale. - /// - public static NDarray geomspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, Dtype dtype = null, int? axis = 0) - => NumPy.Instance.geomspace(start, stop, num:num, endpoint:endpoint, dtype:dtype, axis:axis); - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(NDarray x2, NDarray x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[,] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(NDarray x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(NDarray x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[,] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[,] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /// - /// nd_grid instance which returns a dense multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an dense - /// (or fleshed out) mesh-grid when indexed, so that each returned argument - /// has the same shape. The dimensions and number of the output arrays are - /// equal to the number of indexing dimensions. If the step length is not a - /// complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public static void mgrid() - => NumPy.Instance.mgrid(); - - /* - /// - /// nd_grid instance which returns an open multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an open - /// (i.e. not fleshed out) mesh-grid when indexed, so that only one dimension - /// of each returned array is greater than 1. The dimension and number of the - /// output arrays are equal to the number of indexing dimensions. If the step - /// length is not a complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public static void ogrid(math mesh-grid `ndarrays` with only one dimension) - => NumPy.Instance.ogrid(mesh-grid `ndarrays` with only one dimension); - */ - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public static NDarray diag(NDarray v, int? k = 0) - => NumPy.Instance.diag(v, k:k); - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public static NDarray diag(T[] v, int? k = 0) - => NumPy.Instance.diag(v, k:k); - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public static NDarray diag(T[,] v, int? k = 0) - => NumPy.Instance.diag(v, k:k); - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public static NDarray diagflat(NDarray v, int? k = 0) - => NumPy.Instance.diagflat(v, k:k); - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public static NDarray diagflat(T[] v, int? k = 0) - => NumPy.Instance.diagflat(v, k:k); - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public static NDarray diagflat(T[,] v, int? k = 0) - => NumPy.Instance.diagflat(v, k:k); - - /// - /// An array with ones at and below the given diagonal and zeros elsewhere. - /// - /// - /// Number of rows in the array. - /// - /// - /// Number of columns in the array. - /// By default, M is taken equal to N. - /// - /// - /// The sub-diagonal at and below which the array is filled. - /// k = 0 is the main diagonal, while k < 0 is below it, - /// and k > 0 is above. The default is 0. - /// - /// - /// Data type of the returned array. The default is float. - /// - /// - /// Array with its lower triangle filled with ones and zero elsewhere; - /// in other words T[i,j] == 1 for i <= j + k, 0 otherwise. - /// - public static NDarray tri(int N, int? M = null, int? k = 0, Dtype dtype = null) - => NumPy.Instance.tri(N, M:M, k:k, dtype:dtype); - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public static NDarray tril(NDarray m, int? k = 0) - => NumPy.Instance.tril(m, k:k); - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public static NDarray tril(T[] m, int? k = 0) - => NumPy.Instance.tril(m, k:k); - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public static NDarray tril(T[,] m, int? k = 0) - => NumPy.Instance.tril(m, k:k); - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public static NDarray vander(NDarray x, int? N = null, bool? increasing = false) - => NumPy.Instance.vander(x, N:N, increasing:increasing); - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public static NDarray vander(T[] x, int? N = null, bool? increasing = false) - => NumPy.Instance.vander(x, N:N, increasing:increasing); - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public static NDarray vander(T[,] x, int? N = null, bool? increasing = false) - => NumPy.Instance.vander(x, N:N, increasing:increasing); - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public static Matrix mat(NDarray data, Dtype dtype) - => NumPy.Instance.mat(data, dtype); - */ - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public static Matrix mat(T[] data, Dtype dtype) - => NumPy.Instance.mat(data, dtype); - */ - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public static Matrix mat(T[,] data, Dtype dtype) - => NumPy.Instance.mat(data, dtype); - */ - - /* - /// - /// Build a matrix object from a string, nested sequence, or array. - /// - /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. - /// - /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. - /// - /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. - /// - /// - /// Returns a matrix object, which is a specialized 2-D array. - /// - public static Matrix bmat(string obj, Hashtable ldict = null, Hashtable gdict = null) - => NumPy.Instance.bmat(obj, ldict:ldict, gdict:gdict); - */ - - /* - /// - /// Build a matrix object from a string, nested sequence, or array. - /// - /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. - /// - /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. - /// - /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. - /// - /// - /// Returns a matrix object, which is a specialized 2-D array. - /// - public static Matrix bmat(T[] obj, Hashtable ldict = null, Hashtable gdict = null) - => NumPy.Instance.bmat(obj, ldict:ldict, gdict:gdict); - */ - - - } -} diff --git a/src/Numpy.Bare/np.array_manipulation.gen.cs b/src/Numpy.Bare/np.array_manipulation.gen.cs deleted file mode 100644 index 75e6e8b..0000000 --- a/src/Numpy.Bare/np.array_manipulation.gen.cs +++ /dev/null @@ -1,1108 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. - /// - /// - /// The array into which values are copied. - /// - /// - /// The array from which values are copied. - /// - /// - /// Controls what kind of data casting may occur when copying. - /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. - /// - public static void copyto(NDarray dst, NDarray src, string casting = "same_kind", NDarray @where = null) - => NumPy.Instance.copyto(dst, src, casting:casting, @where:@where); - - /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. - /// - /// - /// The array into which values are copied. - /// - /// - /// The array from which values are copied. - /// - /// - /// Controls what kind of data casting may occur when copying. - /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. - /// - public static void copyto(NDarray dst, NDarray src, string casting = "same_kind", bool[] @where = null) - => NumPy.Instance.copyto(dst, src, casting:casting, @where:@where); - - /// - /// 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. - /// - /// - /// Array to be reshaped. - /// - /// - /// 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 static NDarray reshape(NDarray a, Shape newshape, string order = null) - => NumPy.Instance.reshape(a, newshape, order:order); - - /// - /// 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. - /// - /// - /// Input array. The elements in a are read in the order specified by - /// order, and packed as a 1-D array. - /// - /// - /// 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 static NDarray ravel(NDarray a, string order = null) - => NumPy.Instance.ravel(a, order:order); - - /// - /// Return a copy of the array collapsed into one dimension. - /// - /// - /// ‘C’ means to flatten in row-major (C-style) order. - /// ‘F’ means to flatten in column-major (Fortran- - /// style) order. ‘A’ means to flatten in column-major - /// order if a is Fortran contiguous in memory, - /// row-major order otherwise. ‘K’ means to flatten - /// a in the order the elements occur in memory. - /// The default is ‘C’. - /// - /// - /// A copy of the input array, flattened to one dimension. - /// - public static NDarray flatten(string order = null) - => NumPy.Instance.flatten(order:order); - - /// - /// Move axes of an array to new positions. - /// - /// Other axes remain in their original order. - /// - /// - /// The array whose axes should be reordered. - /// - /// - /// 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 static NDarray moveaxis(NDarray a, int[] source, int[] destination) - => NumPy.Instance.moveaxis(a, source, destination); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray rollaxis(NDarray a, int axis, int? start = 0) - => NumPy.Instance.rollaxis(a, axis, start:start); - - /// - /// Interchange two axes of an array. - /// - /// - /// Input 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 static NDarray swapaxes(NDarray a, int axis1, int axis2) - => NumPy.Instance.swapaxes(a, axis1, axis2); - - /// - /// Permute the dimensions of an array. - /// - /// Notes - /// - /// Use transpose(a, argsort(axes)) to invert the transposition of tensors - /// when using the axes keyword argument. - /// - /// Transposing a 1-D array returns an unchanged view of the original array. - /// - /// - /// Input array. - /// - /// - /// By default, reverse the dimensions, otherwise permute the axes - /// according to the values given. - /// - /// - /// a with its axes permuted. A view is returned whenever - /// possible. - /// - public static NDarray transpose(NDarray a, int[] axes = null) - => NumPy.Instance.transpose(a, axes:axes); - - /// - /// Convert inputs to arrays with at least one dimension. - /// - /// Scalar inputs are converted to 1-dimensional arrays, whilst - /// higher-dimensional inputs are preserved. - /// - /// - /// One or more input arrays. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 1. - /// Copies are made only if necessary. - /// - public static NDarray atleast_1d(params NDarray[] arys) - => NumPy.Instance.atleast_1d(arys); - - /// - /// View inputs as arrays with at least two dimensions. - /// - /// - /// One or more array-like sequences. Non-array inputs are converted - /// to arrays. Arrays that already have two or more dimensions are - /// preserved. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 2. - /// Copies are avoided where possible, and views with two or more - /// dimensions are returned. - /// - public static NDarray atleast_2d(params NDarray[] arys) - => NumPy.Instance.atleast_2d(arys); - - /// - /// View inputs as arrays with at least three dimensions. - /// - /// - /// One or more array-like sequences. Non-array inputs are converted to - /// arrays. Arrays that already have three or more dimensions are - /// preserved. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 3. Copies are - /// avoided where possible, and views with three or more dimensions are - /// returned. For example, a 1-D array of shape (N,) becomes a view - /// of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a - /// view of shape (M, N, 1). - /// - public static NDarray atleast_3d(params NDarray[] arys) - => NumPy.Instance.atleast_3d(arys); - - /// - /// Produce an object that mimics broadcasting. - /// - /// - /// Input parameters. - /// - /// - /// 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 static NDarray broadcast(NDarray in2, NDarray in1) - => NumPy.Instance.broadcast(in2, in1); - - /// - /// Broadcast an array to a new shape. - /// - /// Notes - /// - /// - /// The array to broadcast. - /// - /// - /// 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 static NDarray broadcast_to(NDarray array, Shape shape, bool? subok = false) - => NumPy.Instance.broadcast_to(array, shape, subok:subok); - - /// - /// Broadcast any number of arrays against each other. - /// - /// - /// The arrays to broadcast. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned arrays will be forced to be a base-class array (default). - /// - /// - /// These arrays are views on the original arrays. They are typically - /// not contiguous. Furthermore, more than one element of a - /// broadcasted array may refer to a single memory location. If you - /// need to write to the arrays, make copies first. - /// - public static NDarray[] broadcast_arrays(NDarray[] args, bool? subok = null) - => NumPy.Instance.broadcast_arrays(args, subok:subok); - - /// - /// Expand the shape of an array. - /// - /// Insert a new axis that will appear at the axis position in the expanded - /// array shape. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray expand_dims(NDarray a, int axis) - => NumPy.Instance.expand_dims(a, axis); - - /// - /// Remove single-dimensional entries from the shape of an array. - /// - /// - /// Input data. - /// - /// - /// 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 static NDarray squeeze(NDarray a, int[] axis = null) - => NumPy.Instance.squeeze(a, axis:axis); - - /// - /// Return an array converted to a float type. - /// - /// - /// The input array. - /// - /// - /// 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 static NDarray asfarray(NDarray a, Dtype dtype = null) - => NumPy.Instance.asfarray(a, dtype:dtype); - - /// - /// Return an array (ndim >= 1) laid out in Fortran order in memory. - /// - /// - /// Input array. - /// - /// - /// By default, the data-type is inferred from the input data. - /// - /// - /// The input a in Fortran, or column-major, order. - /// - public static NDarray asfortranarray(NDarray a, Dtype dtype = null) - => NumPy.Instance.asfortranarray(a, dtype:dtype); - - /// - /// Convert the input to an array, checking for NaNs or Infs. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. Success requires no 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 static NDarray asarray_chkfinite(NDarray a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray_chkfinite(a, dtype:dtype, order:order); - - /// - /// 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 object to be converted to a type-and-requirement-satisfying array. - /// - /// - /// 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 static NDarray require(NDarray a, Dtype dtype, string[] requirements = null) - => NumPy.Instance.require(a, dtype, requirements); - - /// - /// Join a sequence of arrays along an existing axis. - /// - /// Notes - /// - /// When one or more of the arrays to be concatenated is a MaskedArray, - /// this function will return a MaskedArray object instead of an ndarray, - /// but the input masks are not preserved. In cases where a MaskedArray - /// is expected as input, use the ma.concatenate function from the masked - /// array module instead. - /// - /// - /// The arrays must have the same shape, except in the dimension - /// corresponding to axis (the first, by default). - /// - /// - /// The axis along which the arrays will be joined. If axis is None, - /// arrays are flattened before use. Default is 0. - /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what concatenate would have returned if no - /// out argument were specified. - /// - /// - /// The concatenated array. - /// - public static NDarray concatenate(NDarray[] arys, int? axis = 0, NDarray @out = null) - => NumPy.Instance.concatenate(arys, axis:axis, @out:@out); - - /// - /// Join a sequence of arrays along a new axis. - /// - /// The axis parameter specifies the index of the new axis in the dimensions - /// of the result. For example, if axis=0 it will be the first dimension - /// and if axis=-1 it will be the last dimension. - /// - /// - /// Each array must have the same shape. - /// - /// - /// The axis in the result array along which the input arrays are stacked. - /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what stack would have returned if no - /// out argument were specified. - /// - /// - /// The stacked array has one more dimension than the input arrays. - /// - public static NDarray stack(NDarray[] arrays, int? axis = 0, NDarray @out = null) - => NumPy.Instance.stack(arrays, axis:axis, @out:@out); - - /// - /// Stack 1-D arrays as columns into a 2-D array. - /// - /// Take a sequence of 1-D arrays and stack them as columns - /// to make a single 2-D array. 2-D arrays are stacked as-is, - /// just like with hstack. 1-D arrays are turned into 2-D columns - /// first. - /// - /// - /// Arrays to stack. All of them must have the same first dimension. - /// - /// - /// The array formed by stacking the given arrays. - /// - public static NDarray column_stack(NDarray[] tup) - => NumPy.Instance.column_stack(tup); - - /// - /// Stack arrays in sequence depth wise (along third axis). - /// - /// This is equivalent to concatenation along the third axis after 2-D arrays - /// of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape - /// (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by - /// dsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the third axis. - /// 1-D or 2-D arrays must have the same shape. - /// - /// - /// The array formed by stacking the given arrays, will be at least 3-D. - /// - public static NDarray dstack(NDarray[] tup) - => NumPy.Instance.dstack(tup); - - /// - /// Stack arrays in sequence horizontally (column wise). - /// - /// This is equivalent to concatenation along the second axis, except for 1-D - /// arrays where it concatenates along the first axis. Rebuilds arrays divided - /// by hsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the second axis, - /// except 1-D arrays which can be any length. - /// - /// - /// The array formed by stacking the given arrays. - /// - public static NDarray hstack(NDarray[] tup) - => NumPy.Instance.hstack(tup); - - /// - /// Stack arrays in sequence vertically (row wise). - /// - /// This is equivalent to concatenation along the first axis after 1-D arrays - /// of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by - /// vsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the first axis. - /// 1-D arrays must have the same length. - /// - /// - /// The array formed by stacking the given arrays, will be at least 2-D. - /// - public static NDarray vstack(NDarray[] tup) - => NumPy.Instance.vstack(tup); - - /* - /// - /// Assemble an nd-array from nested lists of blocks. - /// - /// Blocks in the innermost lists are concatenated (see concatenate) along - /// the last dimension (-1), then these are concatenated along the - /// second-last dimension (-2), and so on until the outermost list is reached. - /// - /// Blocks can be of any dimension, but will not be broadcasted using the normal - /// rules. Instead, leading axes of size 1 are inserted, to make block.ndim - /// the same for all blocks. This is primarily useful for working with scalars, - /// and means that code like np.block([v, 1]) is valid, where - /// v.ndim == 1. - /// - /// When the nested list is two levels deep, this allows block matrices to be - /// constructed from their components. - /// - /// Notes - /// - /// When called with only scalars, np.block is equivalent to an ndarray - /// call. So np.block([[1, 2], [3, 4]]) is equivalent to - /// np.array([[1, 2], [3, 4]]). - /// - /// This function does not enforce that the blocks lie on a fixed grid. - /// np.block([[a, b], [c, d]]) is not restricted to arrays of the form: - /// - /// But is also allowed to produce, for some a, b, c, d: - /// - /// Since concatenation happens along the last axis first, block is _not_ - /// capable of producing the following directly: - /// - /// Matlab’s “square bracket stacking”, [A, B, ...; p, q, ...], is - /// equivalent to np.block([[A, B, ...], [p, q, ...]]). - /// - /// - /// If passed a single ndarray or scalar (a nested list of depth 0), this - /// is returned unmodified (and not copied). - /// - /// Elements shapes must match along the appropriate axes (without - /// broadcasting), but leading 1s will be prepended to the shape as - /// necessary to make the dimensions match. - /// - /// - /// The array assembled from the given blocks. - /// - /// The dimensionality of the output is equal to the greatest of: - /// * the dimensionality of all the inputs - /// * the depth to which the input list is nested - /// - public static NDarray block(nested list of array_like or scalars (but not tuples) arrays) - => NumPy.Instance.block(arrays); - */ - - /// - /// Split an array into multiple sub-arrays. - /// - /// - /// Array to be divided into sub-arrays. - /// - /// - /// If indices_or_sections is an integer, N, the array will be divided - /// into N equal arrays along axis. If such a split is not possible, - /// an error is raised. - /// - /// If indices_or_sections is a 1-D array of sorted integers, the entries - /// indicate where along axis the array is split. For example, - /// [2, 3] would, for axis=0, result in - /// - /// If an index exceeds the dimension of the array along axis, - /// an empty sub-array is returned correspondingly. - /// - /// - /// The axis along which to split, default is 0. - /// - /// - /// A list of sub-arrays. - /// - public static NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis = 0) - => NumPy.Instance.split(ary, indices_or_sections, axis:axis); - - /// - /// 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 input array. - /// - /// - /// The number of repetitions of A along each axis. - /// - /// - /// The tiled output array. - /// - public static NDarray tile(NDarray A, NDarray reps) - => NumPy.Instance.tile(A, reps); - - /// - /// Repeat elements of an array. - /// - /// - /// Input 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 static NDarray repeat(NDarray a, int[] repeats, int? axis = null) - => NumPy.Instance.repeat(a, repeats, axis:axis); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray delete(NDarray arr, Slice obj, int? axis = null) - => NumPy.Instance.delete(arr, obj, axis:axis); - - /// - /// 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 = 0, NDarray values = null, int? axis = null) - => NumPy.Instance.insert(arr, obj, values, axis:axis); - - /// - /// Append values to the end of an array. - /// - /// - /// Values are appended to a copy of this 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 static NDarray append(NDarray arr, NDarray values, int? axis = null) - => NumPy.Instance.append(arr, values, axis:axis); - - /// - /// Return a new array with the specified shape. - /// - /// If the new array is larger than the original array, then the new - /// array is filled with repeated copies of a. Note that this behavior - /// is different from a.resize(new_shape) which fills with zeros instead - /// of repeated copies of a. - /// - /// Notes - /// - /// Warning: This functionality does not consider axes separately, - /// i.e. it does not apply interpolation/extrapolation. - /// It fills the return array with the required number of elements, taken - /// from a as they are laid out in memory, disregarding strides and axes. - /// (This is in case the new shape is smaller. For larger, see above.) - /// This functionality is therefore not suitable to resize images, - /// or data where each axis represents a separate and distinct entity. - /// - /// - /// Array to be resized. - /// - /// - /// Shape of resized array. - /// - /// - /// The new array is formed from the data in the old array, repeated - /// if necessary to fill out the required number of elements. The - /// data are repeated in the order that they are stored in memory. - /// - public static NDarray resize(NDarray a, Shape new_shape) - => NumPy.Instance.resize(a, new_shape); - - /// - /// Trim the leading and/or trailing zeros from a 1-D array or sequence. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray trim_zeros(NDarray filt, string trim = "fb") - => NumPy.Instance.trim_zeros(filt, trim:trim); - - /// - /// 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. - /// - /// - /// Input array. Unless axis is specified, this will be flattened if it - /// is not already 1-D. - /// - /// - /// 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. - /// - /// - /// A tuple of: - /// unique - /// The sorted unique values. - /// unique_indices - /// The indices of the first occurrences of the unique values in the - /// original array. Only provided if return_index is True. - /// unique_inverse - /// The indices to reconstruct the original array from the - /// unique array. Only provided if return_inverse is True. - /// unique_counts - /// The number of times each of the unique values comes up in the - /// original array. Only provided if return_counts is True. - /// - public static (NDarray, NDarray, NDarray, NDarray) unique(NDarray ar, bool? return_index = false, bool? return_inverse = false, bool? return_counts = false, int? axis = null) - => NumPy.Instance.unique(ar, return_index:return_index, return_inverse:return_inverse, return_counts:return_counts, axis:axis); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray flip(NDarray m, int[] axis = null) - => NumPy.Instance.flip(m, axis:axis); - - /// - /// 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. - /// - /// - /// Input array, must be at least 2-D. - /// - /// - /// A view of m with the columns reversed. Since a view - /// is returned, this operation is . - /// - public static NDarray fliplr(NDarray m) - => NumPy.Instance.fliplr(m); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// A view of m with the rows reversed. Since a view is - /// returned, this operation is . - /// - public static NDarray flipud(NDarray m) - => NumPy.Instance.flipud(m); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray roll(NDarray a, int[] shift, int[] axis = null) - => NumPy.Instance.roll(a, shift, axis:axis); - - /// - /// 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)) - /// - /// - /// Array of two or more dimensions. - /// - /// - /// 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 static NDarray rot90(NDarray m, int k = 1, int[] axes = null) - => NumPy.Instance.rot90(m, k, axes); - - - } -} diff --git a/src/Numpy.Bare/np.bitwise.gen.cs b/src/Numpy.Bare/np.bitwise.gen.cs deleted file mode 100644 index 9af3d62..0000000 --- a/src/Numpy.Bare/np.bitwise.gen.cs +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// 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. - /// - /// - /// 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 static NDarray bitwise_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.bitwise_and(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray bitwise_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.bitwise_or(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray bitwise_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.bitwise_xor(x2, x1, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// 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 x is a scalar. - /// - public static NDarray invert(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.invert(x, @out:@out, @where:@where); - - /// - /// Shift the bits of an integer to the left. - /// - /// Bits are shifted to the left by appending x2 0s at the right of x1. - /// Since the internal representation of numbers is in binary format, this - /// operation is equivalent to multiplying x1 by 2**x2. - /// - /// - /// Input values. - /// - /// - /// Number of zeros to append to x1. Has to be non-negative. - /// - /// - /// 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 left. - /// This is a scalar if both x1 and x2 are scalars. - /// - public static NDarray left_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.left_shift(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input values. - /// - /// - /// 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 static NDarray right_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.right_shift(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// An array of integers or booleans whose elements should be packed to - /// bits. - /// - /// - /// 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 static NDarray packbits(NDarray myarray, int? axis = null) - => NumPy.Instance.packbits(myarray, axis:axis); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// The dimension over which bit-unpacking is done. - /// None implies unpacking the flattened array. - /// - /// - /// The elements are binary-valued (0 or 1). - /// - public static NDarray unpackbits(NDarray myarray, int? axis = null) - => NumPy.Instance.unpackbits(myarray, axis:axis); - - /// - /// Return the binary representation of the input number as a string. - /// - /// For negative numbers, if width is not given, a minus sign is added to the - /// front. If width is given, the two’s complement of the number is - /// returned, with respect to that width. - /// - /// 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 - /// - /// binary_repr is equivalent to using base_repr with base 2, but about 25x - /// faster. - /// - /// References - /// - /// - /// Only an integer decimal number can be used. - /// - /// - /// The length of the returned string if num is positive, or the length - /// of the two’s complement if num is negative, provided that width is - /// at least a sufficient number of bits for num to be represented in the - /// designated form. - /// - /// If the width value is insufficient, it will be ignored, and num will - /// be returned in binary (num > 0) or two’s complement (num < 0) form - /// with its width equal to the minimum number of bits needed to represent - /// the number in the designated form. This behavior is deprecated and will - /// later raise an error. - /// - /// - /// Binary representation of num or two’s complement of num. - /// - public static string binary_repr(int num, int? width = null) - => NumPy.Instance.binary_repr(num, width:width); - - - } -} diff --git a/src/Numpy.Bare/np.datetime.gen.cs b/src/Numpy.Bare/np.datetime.gen.cs deleted file mode 100644 index bb9a162..0000000 --- a/src/Numpy.Bare/np.datetime.gen.cs +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Convert an array of datetimes into an array of strings. - /// - /// - /// The array of UTC timestamps to format. - /// - /// - /// One of None, ‘auto’, or a datetime unit. - /// - /// - /// Timezone information to use when displaying the datetime. If ‘UTC’, end - /// with a Z to indicate UTC time. If ‘local’, convert to the local timezone - /// first, and suffix with a +-#### timezone offset. If a tzinfo object, - /// then do as with ‘local’, but use the specified timezone. - /// - /// - /// Casting to allow when changing between datetime units. - /// - /// - /// An array of strings the same shape as arr. - /// - public static NDarray datetime_as_string(string[] arr, string unit, string timezone = "naive", string casting = "same_kind") - => NumPy.Instance.datetime_as_string(arr, unit, timezone, casting); - - /// - /// Get information about the step size of a date or time type. - /// - /// The returned tuple can be passed as the second argument of numpy.datetime64 and - /// numpy.timedelta64. - /// - /// - /// The dtype object, which must be a datetime64 or timedelta64 type. - /// - /// - /// A tuple of: - /// unit - /// The datetime unit on which this dtype - /// is based. - /// count - /// The number of base units in a step. - /// - public static (string, int) datetime_data(Dtype dtype) - => NumPy.Instance.datetime_data(dtype); - - /* - /// - /// A business day calendar object that efficiently stores information - /// defining valid days for the busday family of functions. - /// - /// The default valid days are Monday through Friday (“business days”). - /// A busdaycalendar object can be specified with any set of weekly - /// valid days, plus an optional “holiday” dates that always will be invalid. - /// - /// Once a busdaycalendar object is created, the weekmask and holidays - /// cannot be modified. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates, no matter which - /// weekday they fall upon. Holiday dates may be specified in any - /// order, and NaT (not-a-time) dates are ignored. This list is - /// saved in a normalized form that is suited for fast calculations - /// of valid days. - /// - /// - /// A business day calendar object containing the specified - /// weekmask and holidays values. - /// - public static busdaycalendar busdaycalendar(string weekmask = null, string[] holidays = null) - => NumPy.Instance.busdaycalendar(weekmask:weekmask, holidays:holidays); - */ - - /* - /// - /// Calculates which of the given dates are valid days, and which are not. - /// - /// - /// The array of dates to process. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with the same shape as dates, containing True for - /// each valid day, and False for each invalid day. - /// - public static NDarray is_busday(string[] dates, string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, NDarray @out = null) - => NumPy.Instance.is_busday(dates, weekmask:weekmask, holidays:holidays, busdaycal:busdaycal, @out:@out); - */ - - /* - /// - /// First adjusts the date to fall on a valid day according to - /// the roll rule, then applies offsets to the given dates - /// counted in valid days. - /// - /// - /// The array of dates to process. - /// - /// - /// The array of offsets, which is broadcast with dates. - /// - /// - /// How to treat dates that do not fall on a valid day. The default - /// is ‘raise’. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with a shape from broadcasting dates and offsets - /// together, containing the dates with offsets applied. - /// - public static array of datetime64[D] busday_offset(string[] dates, array_like of int offsets, string roll = "raise", string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, array of datetime64[D] @out = null) - => NumPy.Instance.busday_offset(dates, offsets, roll:roll, weekmask:weekmask, holidays:holidays, busdaycal:busdaycal, @out:@out); - */ - - /* - /// - /// Counts the number of valid days between begindates and - /// enddates, not including the day of enddates. - /// - /// If enddates specifies a date value that is earlier than the - /// corresponding begindates date value, the count will be negative. - /// - /// - /// The array of the first dates for counting. - /// - /// - /// The array of the end dates for counting, which are excluded - /// from the count themselves. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with a shape from broadcasting begindates and enddates - /// together, containing the number of valid days between - /// the begin and end dates. - /// - public static array of int busday_count(string[] begindates, string[] enddates, string weekmask = "1111100", string[] holidays = [], busdaycalendar busdaycal = null, array of int @out = null) - => NumPy.Instance.busday_count(begindates, enddates, weekmask:weekmask, holidays:holidays, busdaycal:busdaycal, @out:@out); - */ - - - } -} diff --git a/src/Numpy.Bare/np.dtype.gen.cs b/src/Numpy.Bare/np.dtype.gen.cs deleted file mode 100644 index 3d0c40c..0000000 --- a/src/Numpy.Bare/np.dtype.gen.cs +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// compatible: Python bool - /// - public static Dtype bool_ - => NumPy.Instance.bool_; - - /// - /// 8 bits - /// - public static Dtype bool8 - => NumPy.Instance.bool8; - - /// - /// compatible: C char - /// - public static Dtype @byte - => NumPy.Instance.@byte; - - /// - /// compatible: C short - /// - public static Dtype @short - => NumPy.Instance.@short; - - /// - /// compatible: C int - /// - public static Dtype intc - => NumPy.Instance.intc; - - /// - /// compatible: Python int - /// - public static Dtype int_ - => NumPy.Instance.int_; - - /// - /// compatible: C long long - /// - public static Dtype longlong - => NumPy.Instance.longlong; - - /// - /// large enough to fit a pointer - /// - public static Dtype intp - => NumPy.Instance.intp; - - /// - /// 8 bits - /// - public static Dtype int8 - => NumPy.Instance.int8; - - /// - /// 16 bits - /// - public static Dtype int16 - => NumPy.Instance.int16; - - /// - /// 32 bits - /// - public static Dtype int32 - => NumPy.Instance.int32; - - /// - /// 64 bits - /// - public static Dtype int64 - => NumPy.Instance.int64; - - /// - /// compatible: C unsigned char - /// - public static Dtype ubyte - => NumPy.Instance.ubyte; - - /// - /// compatible: C unsigned short - /// - public static Dtype @ushort - => NumPy.Instance.@ushort; - - /// - /// compatible: C unsigned int - /// - public static Dtype uintc - => NumPy.Instance.uintc; - - /// - /// compatible: Python int - /// - public static Dtype @uint - => NumPy.Instance.@uint; - - /// - /// compatible: C long long - /// - public static Dtype ulonglong - => NumPy.Instance.ulonglong; - - /// - /// large enough to fit a pointer - /// - public static Dtype uintp - => NumPy.Instance.uintp; - - /// - /// 8 bits - /// - public static Dtype uint8 - => NumPy.Instance.uint8; - - /// - /// 16 bits - /// - public static Dtype uint16 - => NumPy.Instance.uint16; - - /// - /// 32 bits - /// - public static Dtype uint32 - => NumPy.Instance.uint32; - - /// - /// 64 bits - /// - public static Dtype uint64 - => NumPy.Instance.uint64; - - /// - ///   - /// - public static Dtype half - => NumPy.Instance.half; - - /// - /// compatible: C float - /// - public static Dtype single - => NumPy.Instance.single; - - /// - /// compatible: C double - /// - public static Dtype @double - => NumPy.Instance.@double; - - /// - /// compatible: Python float - /// - public static Dtype float_ - => NumPy.Instance.float_; - - /// - /// compatible: C long float - /// - public static Dtype longfloat - => NumPy.Instance.longfloat; - - /// - /// 16 bits - /// - public static Dtype float16 - => NumPy.Instance.float16; - - /// - /// 32 bits - /// - public static Dtype float32 - => NumPy.Instance.float32; - - /// - /// 64 bits - /// - public static Dtype float64 - => NumPy.Instance.float64; - - /// - /// 96 bits, platform? - /// - public static Dtype float96 - => NumPy.Instance.float96; - - /// - /// 128 bits, platform? - /// - public static Dtype float128 - => NumPy.Instance.float128; - - /// - ///   - /// - public static Dtype csingle - => NumPy.Instance.csingle; - - /// - /// compatible: Python complex - /// - public static Dtype complex_ - => NumPy.Instance.complex_; - - /// - ///   - /// - public static Dtype clongfloat - => NumPy.Instance.clongfloat; - - /// - /// two 32-bit floats - /// - public static Dtype complex64 - => NumPy.Instance.complex64; - - /// - /// two 64-bit floats - /// - public static Dtype complex128 - => NumPy.Instance.complex128; - - /// - /// two 96-bit floats, - /// platform? - /// - public static Dtype complex192 - => NumPy.Instance.complex192; - - /// - /// two 128-bit floats, - /// platform? - /// - public static Dtype complex256 - => NumPy.Instance.complex256; - - /// - /// any Python object - /// - public static Dtype object_ - => NumPy.Instance.object_; - - /// - /// compatible: Python bytes - /// - public static Dtype bytes_ - => NumPy.Instance.bytes_; - - /// - /// compatible: Python unicode/str - /// - public static Dtype unicode_ - => NumPy.Instance.unicode_; - - /// - ///   - /// - public static Dtype @void - => NumPy.Instance.@void; - - - } -} diff --git a/src/Numpy.Bare/np.dtype.routines.gen.cs b/src/Numpy.Bare/np.dtype.routines.gen.cs deleted file mode 100644 index ab6a9b0..0000000 --- a/src/Numpy.Bare/np.dtype.routines.gen.cs +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Returns True if cast between data types can occur according to the - /// casting rule. If from is a scalar or array scalar, also returns - /// True if the scalar value can be cast without overflow or truncation - /// to an integer. - /// - /// Notes - /// - /// Starting in NumPy 1.9, can_cast function now returns False in ‘safe’ - /// casting mode for integer/float dtype and string dtype if the string dtype - /// length is not long enough to store the max integer/float value converted - /// to a string. Previously can_cast in ‘safe’ mode returned True for - /// integer/float dtype and a string dtype of any length. - /// - /// - /// Data type, scalar, or array to cast from. - /// - /// - /// Data type to cast to. - /// - /// - /// Controls what kind of data casting may occur. - /// - /// - /// True if cast can occur according to the casting rule. - /// - public static bool can_cast(Dtype from_, Dtype to, string casting = "safe") - => NumPy.Instance.can_cast(from_, to, casting:casting); - - /// - /// Returns the data type with the smallest size and smallest scalar - /// kind to which both type1 and type2 may be safely cast. - /// The returned data type is always in native byte order. - /// - /// This function is symmetric, but rarely associative. - /// - /// Notes - /// - /// Starting in NumPy 1.9, promote_types function now returns a valid string - /// length when given an integer or float dtype as one argument and a string - /// dtype as another argument. Previously it always returned the input string - /// dtype, even if it wasn’t long enough to store the max integer/float value - /// converted to a string. - /// - /// - /// First data type. - /// - /// - /// Second data type. - /// - /// - /// The promoted data type. - /// - public static Dtype promote_types(Dtype type1, Dtype type2) - => NumPy.Instance.promote_types(type1, type2); - - /// - /// 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 value whose minimal data type is to be found. - /// - /// - /// The minimal data type. - /// - public static Dtype min_scalar_type(NDarray a) - => NumPy.Instance.min_scalar_type(a); - - /* - /// - /// Returns the type that results from applying the NumPy - /// type promotion rules to the arguments. - /// - /// Type promotion in NumPy works similarly to the rules in languages - /// like C++, with some slight differences. When both scalars and - /// arrays are used, the array’s type takes precedence and the actual value - /// of the scalar is taken into account. - /// - /// For example, calculating 3*a, where a is an array of 32-bit floats, - /// intuitively should result in a 32-bit float output. If the 3 is a - /// 32-bit integer, the NumPy rules indicate it can’t convert losslessly - /// into a 32-bit float, so a 64-bit float should be the result type. - /// By examining the value of the constant, ‘3’, we see that it fits in - /// an 8-bit integer, which can be cast losslessly into the 32-bit float. - /// - /// Notes - /// - /// The specific algorithm used is as follows. - /// - /// Categories are determined by first checking which of boolean, - /// integer (int/uint), or floating point (float/complex) the maximum - /// kind of all the arrays and the scalars are. - /// - /// If there are only scalars or the maximum category of the scalars - /// is higher than the maximum category of the arrays, - /// the data types are combined with promote_types - /// to produce the return value. - /// - /// Otherwise, min_scalar_type is called on each array, and - /// the resulting data types are all combined with promote_types - /// to produce the return value. - /// - /// The set of int values is not a subset of the uint values for types - /// with the same number of bits, something not reflected in - /// min_scalar_type, but handled as a special case in result_type. - /// - /// - /// The operands of some operation whose result type is needed. - /// - /// - /// The result type. - /// - public static Dtype result_type(list of arrays and dtypes arrays_and_dtypes) - => NumPy.Instance.result_type(arrays_and_dtypes); - */ - - /// - /// 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. - /// - /// - /// Input arrays. - /// - /// - /// Data type code. - /// - public static Dtype common_type(NDarray array2, NDarray array1) - => NumPy.Instance.common_type(array2, array1); - - /// - /// Return the scalar dtype or NumPy equivalent of Python type of an object. - /// - /// - /// The object of which the type is returned. - /// - /// - /// If given, this is returned for objects whose types can not be - /// determined. If not given, None is returned for those objects. - /// - /// - /// The data type of rep. - /// - public static Dtype obj2sctype(object rep, object @default = null) - => NumPy.Instance.obj2sctype(rep, @default:@default); - - /// - /// Create a data type object. - /// - /// A numpy array is homogeneous, and contains elements described by a - /// dtype object. A dtype object can be constructed from different - /// combinations of fundamental numeric types. - /// - /// - /// Add padding to the fields to match what a C compiler would output - /// for a similar C-struct. Can be True only if obj is a dictionary - /// or a comma-separated string. If a struct dtype is being created, - /// this also sets a sticky alignment flag isalignedstruct. - /// - /// - /// Make a new copy of the data-type object. If False, the result - /// may just be a reference to a built-in data-type object. - /// - public static void dtype(bool? align = null, bool? copy = null) - => NumPy.Instance.dtype(align:align, copy:copy); - - /// - /// Class to convert formats, names, titles description to a dtype. - /// - /// After constructing the format_parser object, the dtype attribute is - /// the converted data-type: - /// dtype = format_parser(formats, names, titles).dtype - /// - /// - /// The format description, either specified as a string with - /// comma-separated format descriptions in the form 'f8, i4, a5', or - /// a list of format description strings in the form - /// ['f8', 'i4', 'a5']. - /// - /// - /// The field names, either specified as a comma-separated string in the - /// form 'col1, col2, col3', or as a list or tuple of strings in the - /// form ['col1', 'col2', 'col3']. - /// An empty list can be used, in that case default field names - /// (‘f0’, ‘f1’, …) are used. - /// - /// - /// Sequence of title strings. An empty list can be used to leave titles - /// out. - /// - /// - /// If True, align the fields by padding as the C-compiler would. - /// Default is False. - /// - /// - /// If specified, all the fields will be changed to the - /// provided byte-order. Otherwise, the default byte-order is - /// used. For all available string specifiers, see dtype.newbyteorder. - /// - public static void format_parser(string[] formats, string[] names, string[] titles, bool? aligned = null, string byteorder = null) - => NumPy.Instance.format_parser(formats, names, titles, aligned:aligned, byteorder:byteorder); - - /// - /// Machine limits for floating point types. - /// - /// Notes - /// - /// For developers of NumPy: do not instantiate this at the module level. - /// The initial calculation of these parameters is expensive and negatively - /// impacts import times. These objects are cached, so calling finfo() - /// repeatedly inside your functions is not a problem. - /// - /// - /// Kind of floating point data-type about which to get information. - /// - public static void finfo(Dtype dtype) - => NumPy.Instance.finfo(dtype); - - /// - /// Machine limits for integer types. - /// - /// - /// The kind of integer data type to get information about. - /// - public static void iinfo(Dtype int_type) - => NumPy.Instance.iinfo(int_type); - - /// - /// Diagnosing machine parameters. - /// - /// References - /// - /// - /// Function that converts an integer or integer array to a float - /// or float array. Default is float. - /// - /// - /// Function that converts a float or float array to an integer or - /// integer array. Default is int. - /// - /// - /// Function that converts a float array to float. Default is float. - /// Note that this does not seem to do anything useful in the current - /// implementation. - /// - /// - /// Function that converts a single float to a string. Default is - /// lambda v:'%24.16e' %v. - /// - /// - /// Title that is printed in the string representation of MachAr. - /// - public static void MachAr(Delegate float_conv = null, Delegate int_conv = null, Delegate float_to_float = null, Delegate float_to_str = null, string title = null) - => NumPy.Instance.MachAr(float_conv:float_conv, int_conv:int_conv, float_to_float:float_to_float, float_to_str:float_to_str, title:title); - - /// - /// Determines whether the given object represents a scalar data-type. - /// - /// - /// If rep is an instance of a scalar dtype, True is returned. If not, - /// False is returned. - /// - /// - /// Boolean result of check whether rep is a scalar dtype. - /// - public static bool issctype(object rep) - => NumPy.Instance.issctype(rep); - - /// - /// Returns True if first argument is a typecode lower/equal in type hierarchy. - /// - /// - /// dtype or string representing a typecode. - /// - /// - /// dtype or string representing a typecode. - /// - public static bool issubdtype(Dtype arg2, Dtype arg1) - => NumPy.Instance.issubdtype(arg2, arg1); - - /// - /// Determine if the first argument is a subclass of the second argument. - /// - /// - /// Data-types. - /// - /// - /// Data-types. - /// - /// - /// The result. - /// - public static bool issubsctype(Dtype arg2, Dtype arg1) - => NumPy.Instance.issubsctype(arg2, arg1); - - /* - /// - /// Determine if a class is a subclass of a second class. - /// - /// issubclass_ is equivalent to the Python built-in issubclass, - /// except that it returns False instead of raising a TypeError if one - /// of the arguments is not a class. - /// - /// - /// Input class. True is returned if arg1 is a subclass of arg2. - /// - /// - /// Input class. If a tuple of classes, True is returned if arg1 is a - /// subclass of any of the tuple elements. - /// - /// - /// Whether arg1 is a subclass of arg2 or not. - /// - public static bool issubclass_(class arg1, class or tuple of classes. arg2) - => NumPy.Instance.issubclass_(arg1, arg2); - */ - - /* - /// - /// Determine common type following standard coercion rules. - /// - /// - /// A list of dtypes or dtype convertible objects representing arrays. - /// - /// - /// A list of dtypes or dtype convertible objects representing scalars. - /// - /// - /// The common data type, which is the maximum of array_types ignoring - /// scalar_types, unless the maximum of scalar_types is of a - /// different kind (dtype.kind). If the kind is not understood, then - /// None is returned. - /// - public static Dtype find_common_type(sequence array_types, sequence scalar_types) - => NumPy.Instance.find_common_type(array_types, scalar_types); - */ - - /// - /// Return a description for the given data type code. - /// - /// - /// Data type code. - /// - /// - /// Description of the input data type code. - /// - public static string typename(string @char) - => NumPy.Instance.typename(@char); - - /// - /// Return the string representation of a scalar dtype. - /// - /// - /// If a scalar dtype, the corresponding string character is - /// returned. If an object, sctype2char tries to infer its scalar type - /// and then return the corresponding string character. - /// - /// - /// The string character corresponding to the scalar type. - /// - public static string sctype2char(object sctype) - => NumPy.Instance.sctype2char(sctype); - - /// - /// Return the character for the minimum-size type to which given types can - /// be safely cast. - /// - /// The returned type character must represent the smallest size dtype such - /// that an array of the returned type can handle the data from an array of - /// all types in typechars (or if typechars is an array, then its - /// dtype.char). - /// - /// - /// If a list of strings, each string should represent a dtype. - /// If array_like, the character representation of the array dtype is used. - /// - /// - /// The set of characters that the returned character is chosen from. - /// The default set is ‘GDFgdf’. - /// - /// - /// The default character, this is returned if none of the characters in - /// typechars matches a character in typeset. - /// - /// - /// The character representing the minimum-size type that was found. - /// - public static string mintypecode(string[] typechars, string[] typeset = null, string @default = "d") - => NumPy.Instance.mintypecode(typechars, typeset:typeset, @default:@default); - - - } -} diff --git a/src/Numpy.Bare/np.fft.gen.cs b/src/Numpy.Bare/np.fft.gen.cs deleted file mode 100644 index df0491c..0000000 --- a/src/Numpy.Bare/np.fft.gen.cs +++ /dev/null @@ -1,463 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - public static partial class fft { - /// - /// Compute the one-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) of a real-valued array by means of an efficient algorithm - /// called the Fast Fourier Transform (FFT). - /// - /// Notes - /// - /// When the DFT is computed for purely real input, the output is - /// Hermitian-symmetric, i.e. the negative frequency terms are just the complex - /// conjugates of the corresponding positive-frequency terms, and the - /// negative-frequency terms are therefore redundant. This function does not - /// compute the negative frequency terms, and the length of the transformed - /// axis of the output is therefore n//2 + 1. - /// - /// When A = rfft(a) and fs is the sampling frequency, A[0] contains - /// the zero-frequency term 0*fs, which is real due to Hermitian symmetry. - /// - /// If n is even, A[-1] contains the term representing both positive - /// and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely - /// real. If n is odd, there is no term at fs/2; A[-1] contains - /// the largest positive frequency (fs/2*(n-1)/n), and is complex in the - /// general case. - /// - /// If the input a contains an imaginary part, it is silently discarded. - /// - /// - /// Input array - /// - /// - /// Number of points along transformation axis in the input to use. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// If n is even, the length of the transformed axis is (n/2)+1. - /// If n is odd, the length is (n+1)/2. - /// - public static NDarray rfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_rfft(a, n:n, axis:axis, norm:norm); - } - - public static partial class fft { - /// - /// Compute the inverse of the n-point DFT for real input. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier Transform of real input computed by rfft. - /// In other words, irfft(rfft(a), len(a)) == a to within numerical - /// accuracy. (See Notes below for why len(a) is necessary here.) - /// - /// The input is expected to be in the form returned by rfft, i.e. the - /// real zero-frequency term followed by the complex positive frequency terms - /// in order of increasing frequency. Since the discrete Fourier Transform of - /// real input is Hermitian-symmetric, the negative frequency terms are taken - /// to be the complex conjugates of the corresponding positive frequency terms. - /// - /// Notes - /// - /// Returns the real valued n-point inverse discrete Fourier transform - /// of a, where a contains the non-negative frequency terms of a - /// Hermitian-symmetric sequence. n is the length of the result, not the - /// input. - /// - /// If you specify an n such that a must be zero-padded or truncated, the - /// extra/removed values will be added/removed at high frequencies. One can - /// thus resample a series to m points via Fourier interpolation by: - /// a_resamp = irfft(rfft(a), m). - /// - /// - /// The input array. - /// - /// - /// Length of the transformed axis of the output. - /// For n output points, n//2+1 input points are necessary. If the - /// input is longer than this, it is cropped. If it is shorter than this, - /// it is padded with zeros. If n is not given, it is determined from - /// the length of the input along the axis specified by axis. - /// - /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*(m-1) where m is the length of the transformed axis of the - /// input. To get an odd number of output points, n must be specified. - /// - public static NDarray irfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_irfft(a, n:n, axis:axis, norm:norm); - } - - public static partial class fft { - /// - /// Compute the 2-dimensional FFT of a real array. - /// - /// Notes - /// - /// This is really just rfftn with different default behavior. - /// For more details see rfftn. - /// - /// - /// Input array, taken to be real. - /// - /// - /// Shape of the FFT. - /// - /// - /// Axes over which to compute the FFT. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The result of the real 2-D FFT. - /// - public static NDarray rfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_rfft2(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the 2-dimensional inverse FFT of a real array. - /// - /// Notes - /// - /// This is really irfftn with different defaults. - /// For more details see irfftn. - /// - /// - /// The input array - /// - /// - /// Shape of the inverse FFT. - /// - /// - /// The axes over which to compute the inverse fft. - /// Default is the last two axes. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The result of the inverse real 2-D FFT. - /// - public static NDarray irfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_irfft2(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the N-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional real array by means of the Fast - /// Fourier Transform (FFT). By default, all axes are transformed, with the - /// real transform performed over the last axis, while the remaining - /// transforms are complex. - /// - /// Notes - /// - /// The transform for real input is performed over the last transformation - /// axis, as by rfft, then the transform over the remaining axes is - /// performed as by fftn. The order of the output is as for rfft for the - /// final transformation axis, and as for fftn for the remaining - /// transformation axes. - /// - /// See fft for details, definitions and conventions used. - /// - /// - /// Input array, taken to be real. - /// - /// - /// Shape (length along each transformed axis) to use from the input. - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// The final element of s corresponds to n for rfft(x, n), while - /// for the remaining axes, it corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// The length of the last axis transformed will be s[-1]//2+1, - /// while the remaining transformed axes will have lengths according to - /// s, or unchanged from the input. - /// - public static NDarray rfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_rfftn(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the inverse of the N-dimensional FFT of real input. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform for real input over any number of axes in an - /// M-dimensional array by means of the Fast Fourier Transform (FFT). In - /// other words, irfftn(rfftn(a), a.shape) == a to within numerical - /// accuracy. (The a.shape is necessary like len(a) is for irfft, - /// and for the same reason.) - /// - /// The input should be ordered in the same way as is returned by rfftn, - /// i.e. as for irfft for the final transformation axis, and as for ifftn - /// along all the other axes. - /// - /// Notes - /// - /// See fft for definitions and conventions used. - /// - /// See rfft for definitions and conventions used for real input. - /// - /// - /// Input array. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). s is also the - /// number of input points used along this axis, except for the last axis, - /// where s[-1]//2+1 points of the input are used. - /// Along any axis, if the shape indicated by s is smaller than that of - /// the input, the input is cropped. If it is larger, the input is padded - /// with zeros. If s is not given, the shape of the input along the - /// axes specified by axes is used. - /// - /// - /// Axes over which to compute the inverse FFT. If not given, the last - /// len(s) axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// The length of each transformed axis is as given by the corresponding - /// element of s, or the length of the input in every axis except for the - /// last one if s is not given. In the final transformed axis the length - /// of the output when s is not given is 2*(m-1) where m is the - /// length of the final transformed axis of the input. To get an odd - /// number of output points in the final axis, s must be specified. - /// - public static NDarray irfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_irfftn(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the FFT of a signal that has Hermitian symmetry, i.e., a real - /// spectrum. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd. - /// - /// - /// The input array. - /// - /// - /// Length of the transformed axis of the output. For n output - /// points, n//2 + 1 input points are necessary. If the input is - /// longer than this, it is cropped. If it is shorter than this, it is - /// padded with zeros. If n is not given, it is determined from the - /// length of the input along the axis specified by axis. - /// - /// - /// Axis over which to compute the FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*m - 2 where m is the length of the transformed axis of - /// the input. To get an odd number of output points, n must be - /// specified, for instance as 2*m - 1 in the typical case, - /// - public static NDarray hfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_hfft(a, n:n, axis:axis, norm:norm); - } - - public static partial class fft { - /// - /// Compute the inverse FFT of a signal that has Hermitian symmetry. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd: - /// - /// - /// Input array. - /// - /// - /// Length of the inverse FFT, the number of points along - /// transformation axis in the input to use. If n is smaller than - /// the length of the input, the input is cropped. If it is larger, - /// the input is padded with zeros. If n is not given, the length of - /// the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n//2 + 1. - /// - public static NDarray ihfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_ihfft(a, n:n, axis:axis, norm:norm); - } - - public static partial class fft { - /// - /// Return the Discrete Fourier Transform sample frequencies. - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// - /// Window length. - /// - /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. - /// - /// - /// Array of length n containing the sample frequencies. - /// - public static NDarray fftfreq(int n, float? d = 1.0f) - => NumPy.Instance.fft_fftfreq(n, d:d); - } - - public static partial class fft { - /// - /// Return the Discrete Fourier Transform sample frequencies - /// (for usage with rfft, irfft). - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// Unlike fftfreq (but like scipy.fftpack.rfftfreq) - /// the Nyquist frequency component is considered to be positive. - /// - /// - /// Window length. - /// - /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. - /// - /// - /// Array of length n//2 + 1 containing the sample frequencies. - /// - public static NDarray rfftfreq(int n, float? d = 1.0f) - => NumPy.Instance.fft_rfftfreq(n, d:d); - } - - public static partial class fft { - /// - /// Shift the zero-frequency component to the center of the spectrum. - /// - /// This function swaps half-spaces for all axes listed (defaults to all). - /// Note that y[0] is the Nyquist component only if len(x) is even. - /// - /// - /// Input array. - /// - /// - /// Axes over which to shift. Default is None, which shifts all axes. - /// - /// - /// The shifted array. - /// - public static NDarray fftshift(NDarray x, int[] axes = null) - => NumPy.Instance.fft_fftshift(x, axes:axes); - } - - public static partial class fft { - /// - /// The inverse of fftshift. Although identical for even-length x, the - /// functions differ by one sample for odd-length x. - /// - /// - /// Input array. - /// - /// - /// Axes over which to calculate. Defaults to None, which shifts all axes. - /// - /// - /// The shifted array. - /// - public static NDarray ifftshift(NDarray x, int[] axes = null) - => NumPy.Instance.fft_ifftshift(x, axes:axes); - } - - - } -} diff --git a/src/Numpy.Bare/np.financial.gen.cs b/src/Numpy.Bare/np.financial.gen.cs deleted file mode 100644 index 6746588..0000000 --- a/src/Numpy.Bare/np.financial.gen.cs +++ /dev/null @@ -1,358 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Compute the future value. - /// - /// Notes - /// - /// The future value is computed by solving the equation: - /// - /// or, when rate == 0: - /// - /// References - /// - /// - /// Rate of interest as decimal (not per cent) per period - /// - /// - /// 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 static NDarray fv(NDarray rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") - => NumPy.Instance.fv(rate, nper, pmt, pv, @when:@when); - - /// - /// 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 - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 static NDarray pv(NDarray rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") - => NumPy.Instance.pv(rate, nper, pmt, fv:fv, @when:@when); - - /// - /// Returns the NPV (Net Present Value) of a cash flow series. - /// - /// Notes - /// - /// Returns the result of: [G] - /// - /// References - /// - /// - /// The discount rate. - /// - /// - /// The values of the time series of cash flows. The (fixed) time - /// interval between cash flow “events” must be the same as that for - /// which rate is given (i.e., if rate is per year, then precisely - /// a year is understood to elapse between each cash flow event). By - /// convention, investments or “deposits” are negative, income or - /// “withdrawals” are positive; values must begin with the initial - /// investment, thus values[0] will typically be negative. - /// - /// - /// The NPV of the input cash flow series values at the discount - /// rate. - /// - public static float npv(ValueType rate, NDarray values) - => NumPy.Instance.npv(rate, values); - - /// - /// 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 - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 static NDarray pmt(NDarray rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.pmt(rate, nper, pv, fv:fv, @when:@when); - - /// - /// Compute the payment against loan principal. - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 static void ppmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.ppmt(rate, per, nper, pv, fv:fv, @when:@when); - - /// - /// Compute the interest portion of a payment. - /// - /// Notes - /// - /// The total payment is made up of payment against principal plus interest. - /// - /// pmt = ppmt + ipmt - /// - /// - /// Rate of interest as decimal (not per cent) per period - /// - /// - /// 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 static NDarray ipmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.ipmt(rate, per, nper, pv, fv:fv, @when:@when); - - /// - /// 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 - /// - /// - /// Input cash flows per time period. By convention, net “deposits” - /// are negative and net “withdrawals” are positive. Thus, for - /// example, at least the first element of values, which represents - /// the initial investment, will typically be negative. - /// - /// - /// Internal Rate of Return for periodic input values. - /// - public static float irr(NDarray values) - => NumPy.Instance.irr(values); - - /// - /// Modified internal rate of return. - /// - /// - /// Cash flows (must contain at least one positive and one negative - /// value) or nan is returned. The first value is considered a sunk - /// cost at time zero. - /// - /// - /// Interest rate paid on the cash flows - /// - /// - /// Interest rate received on the cash flows upon reinvestment - /// - /// - /// Modified internal rate of return - /// - public static float mirr(NDarray values, ValueType finance_rate, ValueType reinvest_rate) - => NumPy.Instance.mirr(values, finance_rate, reinvest_rate); - - /// - /// 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: - /// - /// - /// Rate of interest (per period) - /// - /// - /// Payment - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public static void nper(NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.nper(rate, pmt, pv, fv:fv, @when:@when); - - /// - /// 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 - /// - /// - /// Number of compounding periods - /// - /// - /// 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 static void rate(NDarray nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) - => NumPy.Instance.rate(nper, pmt, pv, fv, @when:@when, guess:guess, tol:tol, maxiter:maxiter); - - - } -} diff --git a/src/Numpy.Bare/np.indexing.gen.cs b/src/Numpy.Bare/np.indexing.gen.cs deleted file mode 100644 index eaf1416..0000000 --- a/src/Numpy.Bare/np.indexing.gen.cs +++ /dev/null @@ -1,988 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Translates slice objects to concatenation along the first axis. - /// - /// This is a simple way to build up arrays quickly. There are two use cases. - /// - /// If slice notation is used, the syntax start:stop:step is equivalent - /// to np.arange(start, stop, step) inside of the brackets. However, if - /// step is an imaginary number (i.e. 100j) then its integer portion is - /// interpreted as a number-of-points desired and the start and stop are - /// inclusive. In other words start:stop:stepj is interpreted as - /// np.linspace(start, stop, step, endpoint=1) inside of the brackets. - /// After expansion of slice notation, all comma separated sequences are - /// concatenated together. - /// - /// Optional character strings placed as the first element of the index - /// expression can be used to change the output. The strings ‘r’ or ‘c’ result - /// in matrix output. If the result is 1-D and ‘r’ is specified a 1 x N (row) - /// matrix is produced. If the result is 1-D and ‘c’ is specified, then a N x 1 - /// (column) matrix is produced. If the result is 2-D then both provide the - /// same matrix result. - /// - /// A string integer specifies which axis to stack multiple comma separated - /// arrays along. A string of two comma-separated integers allows indication - /// of the minimum number of dimensions to force each entry into as the - /// second integer (the axis to concatenate along is still the first integer). - /// - /// A string with three comma-separated integers allows specification of the - /// axis to concatenate along, the minimum number of dimensions to force the - /// entries to, and which axis should contain the start of the arrays which - /// are less than the specified number of dimensions. In other words the third - /// integer allows you to specify where the 1’s should be placed in the shape - /// of the arrays that have their shapes upgraded. By default, they are placed - /// in the front of the shape tuple. The third argument allows you to specify - /// where the start of the array should be instead. Thus, a third argument of - /// ‘0’ would place the 1’s at the end of the array shape. Negative integers - /// specify where in the new shape tuple the last dimension of upgraded arrays - /// should be placed, so the default is ‘-1’. - /// - public static void r_() - => NumPy.Instance.r_(); - - /// - /// A nicer way to build up index tuples for arrays. - /// - /// For any index combination, including slicing and axis insertion, - /// a[indices] is the same as a[np.index_exp[indices]] for any - /// array a. However, np.index_exp[indices] can be used anywhere - /// in Python code and returns a tuple of slice objects that can be - /// used in the construction of complex index expressions. - /// - /// Notes - /// - /// You can do all this with slice() plus a few special objects, - /// but there’s a lot to remember and this version is simpler because - /// it uses the standard array indexing syntax. - /// - /// - /// If True, always returns a tuple. - /// - public static void s_(bool maketuple) - => NumPy.Instance.s_(maketuple); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// Indices of elements that are non-zero. - /// - public static NDarray[] nonzero(NDarray a) - => NumPy.Instance.nonzero(a); - - /// - /// Return elements chosen from x or y depending on condition. - /// - /// Notes - /// - /// If all the arrays are 1-D, where is equivalent to: - /// - /// - /// Where True, yield x, otherwise yield y. - /// - /// - /// 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 static NDarray @where(NDarray condition, NDarray y, NDarray x) - => NumPy.Instance.@where(condition, y, x); - - /// - /// Return an array representing the indices of a grid. - /// - /// Compute an array where the subarrays contain index values 0,1,… - /// varying only along the corresponding axis. - /// - /// Notes - /// - /// The output shape is obtained by prepending the number of dimensions - /// in front of the tuple of dimensions, i.e. if dimensions is a tuple - /// (r0, ..., rN-1) of length N, the output shape is - /// (N,r0,...,rN-1). - /// - /// The subarrays grid[k] contains the N-D array of indices along the - /// k-th axis. Explicitly: - /// - /// - /// The shape of the grid. - /// - /// - /// Data type of the result. - /// - /// - /// The array of grid indices, - /// grid.shape = (len(dimensions),) + tuple(dimensions). - /// - public static NDarray indices(int[] dimensions, Dtype dtype = null) - => NumPy.Instance.indices(dimensions, dtype:dtype); - - /// - /// Construct an open mesh from multiple sequences. - /// - /// This function takes N 1-D sequences and returns N outputs with N - /// dimensions each, such that the shape is 1 in all but one dimension - /// and the dimension with the non-unit shape value cycles through all - /// N dimensions. - /// - /// Using ix_ one can quickly construct index arrays that will index - /// the cross product. a[np.ix_([1,3],[2,5])] returns the array - /// [[a[1,2] a[1,5]], [a[3,2] a[3,5]]]. - /// - /// - /// Each sequence should be of integer or boolean type. - /// Boolean sequences will be interpreted as boolean masks for the - /// corresponding dimension (equivalent to passing in - /// np.nonzero(boolean_sequence)). - /// - /// - /// N arrays with N dimensions each, with N the number of input - /// sequences. Together these arrays form an open mesh. - /// - public static NDarray[] ix_(NDarray[] args) - => NumPy.Instance.ix_(args); - - /* - /// - /// Converts a tuple of index arrays into an array of flat - /// indices, applying boundary modes to the multi-index. - /// - /// Notes - /// - /// - /// A tuple of integer arrays, one array for each dimension. - /// - /// - /// The shape of array into which the indices from multi_index apply. - /// - /// - /// Specifies how out-of-bounds indices are handled. Can specify - /// either one mode or a tuple of modes, one mode per index. - /// - /// In ‘clip’ mode, a negative index which would normally - /// wrap will clip to 0 instead. - /// - /// - /// Determines whether the multi-index should be viewed as - /// indexing in row-major (C-style) or column-major - /// (Fortran-style) order. - /// - /// - /// An array of indices into the flattened version of an array - /// of dimensions dims. - /// - public static NDarray ravel_multi_index(tuple of array_like multi_index, tuple of ints dims, string mode = "raise", string order = null) - => NumPy.Instance.ravel_multi_index(multi_index, dims, mode:mode, order:order); - */ - - /// - /// Converts a flat index or array of flat indices into a tuple - /// of coordinate arrays. - /// - /// - /// An integer array whose elements are indices into the flattened - /// version of an array of dimensions shape. Before version 1.6.0, - /// this function accepted just one index value. - /// - /// - /// 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 static NDarray[] unravel_index(NDarray indices, Shape shape, string order = null) - => NumPy.Instance.unravel_index(indices, shape, order:order); - - /// - /// Return the indices to access the main diagonal of an array. - /// - /// This returns a tuple of indices that can be used to access the main - /// diagonal of an array a with a.ndim >= 2 dimensions and shape - /// (n, n, …, n). For a.ndim = 2 this is the usual diagonal, for - /// a.ndim > 2 this is the set of indices to access a[i, i, ..., i] - /// for i = [0..n-1]. - /// - /// Notes - /// - /// - /// The size, along each dimension, of the arrays for which the returned - /// indices can be used. - /// - /// - /// The number of dimensions. - /// - public static void diag_indices(int n, int? ndim = 2) - => NumPy.Instance.diag_indices(n, ndim:ndim); - - /// - /// Return the indices to access the main diagonal of an n-dimensional array. - /// - /// See diag_indices for full details. - /// - /// Notes - /// - public static void diag_indices_from(NDarray arr) - => NumPy.Instance.diag_indices_from(arr); - - /// - /// Return the indices to access (n, n) arrays, given a masking function. - /// - /// Assume mask_func is a function that, for a square array a of size - /// (n, n) with a possible offset argument k, when called as - /// mask_func(a, k) returns a new array with zeros in certain locations - /// (functions like triu or tril do precisely this). Then this function - /// returns the indices where the non-zero values would be located. - /// - /// Notes - /// - /// - /// The returned indices will be valid to access arrays of shape (n, n). - /// - /// - /// A function whose call signature is similar to that of triu, tril. - /// That is, mask_func(x, k) returns a boolean array, shaped like x. - /// k is an optional argument to the function. - /// - /// - /// An optional argument which is passed through to mask_func. Functions - /// like triu, tril take a second argument that is interpreted as an - /// offset. - /// - /// - /// The n arrays of indices corresponding to the locations where - /// mask_func(np.ones((n, n)), k) is True. - /// - public static NDarray[] mask_indices(int n, Delegate mask_func, int k = 0) - => NumPy.Instance.mask_indices(n, mask_func, k); - - /// - /// Return the indices for the lower-triangle of an (n, m) array. - /// - /// Notes - /// - /// - /// The row dimension of the arrays for which the returned - /// indices will be valid. - /// - /// - /// Diagonal offset (see tril for details). - /// - /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. - /// - /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. - /// - public static NDarray[] tril_indices(int n, int? k = 0, int? m = null) - => NumPy.Instance.tril_indices(n, k:k, m:m); - - /// - /// Return the indices for the lower-triangle of arr. - /// - /// See tril_indices for full details. - /// - /// Notes - /// - /// - /// The indices will be valid for square arrays whose dimensions are - /// the same as arr. - /// - /// - /// Diagonal offset (see tril for details). - /// - public static void tril_indices_from(NDarray arr, int? k = 0) - => NumPy.Instance.tril_indices_from(arr, k:k); - - /// - /// Return the indices for the upper-triangle of an (n, m) array. - /// - /// Notes - /// - /// - /// The size of the arrays for which the returned indices will - /// be valid. - /// - /// - /// Diagonal offset (see triu for details). - /// - /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. - /// - /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. Can be used - /// to slice a ndarray of shape(n, n). - /// - public static NDarray[] triu_indices(int n, int? k = 0, int? m = null) - => NumPy.Instance.triu_indices(n, k:k, m:m); - - /// - /// Return the indices for the upper-triangle of arr. - /// - /// See triu_indices for full details. - /// - /// Notes - /// - /// - /// The indices will be valid for square arrays. - /// - /// - /// Diagonal offset (see triu for details). - /// - /// - /// Indices for the upper-triangle of arr. - /// - public static NDarray[] triu_indices_from(NDarray arr, int? k = 0) - => NumPy.Instance.triu_indices_from(arr, k:k); - - /// - /// Take elements from an array along an axis. - /// - /// When axis is not None, this function does the same thing as “fancy” - /// indexing (indexing arrays using arrays); however, it can be easier to use - /// if you need elements along a given axis. A call such as - /// np.take(arr, indices, axis=3) is equivalent to - /// arr[:,:,:,indices,...]. - /// - /// Explained without fancy indexing, this is equivalent to the following use - /// of ndindex, which sets each of ii, jj, and kk to a tuple of - /// indices: - /// - /// Notes - /// - /// By eliminating the inner loop in the description above, and using s_ to - /// build simple slice objects, take can be expressed in terms of applying - /// fancy indexing to each 1-d slice: - /// - /// For this reason, it is equivalent to (but faster than) the following use - /// of apply_along_axis: - /// - /// - /// The source array. - /// - /// - /// The indices of the values to extract. - /// - /// Also allow scalars for indices. - /// - /// - /// The axis over which to select values. By default, the flattened - /// input array is used. - /// - /// - /// If provided, the result will be placed in this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// 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. - /// - /// - /// The returned array has the same type as a. - /// - public static NDarray take(NDarray[] a, NDarray[] indices, int? axis = null, NDarray @out = null, string mode = "raise") - => NumPy.Instance.take(a, indices, axis:axis, @out:@out, mode:mode); - - /// - /// 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: - /// - /// - /// Source array - /// - /// - /// 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 static void take_along_axis(NDarray arr, NDarray indices, int axis) - => NumPy.Instance.take_along_axis(arr, indices, axis); - - /// - /// Construct an array from an index array and a set of arrays to choose from. - /// - /// First of all, if confused or uncertain, definitely look at the Examples - - /// in its full generality, this function is less simple than it might - /// seem from the following code description (below ndi = - /// numpy.lib.index_tricks): - /// - /// np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)]). - /// - /// But this omits some subtleties. Here is a fully general summary: - /// - /// Given an “index” array (a) of integers and a sequence of n arrays - /// (choices), a and each choice array are first broadcast, as necessary, - /// to arrays of a common shape; calling these Ba and Bchoices[i], i = - /// 0,…,n-1 we have that, necessarily, Ba.shape == Bchoices[i].shape - /// for each i. Then, a new array with shape Ba.shape is created as - /// follows: - /// - /// Notes - /// - /// To reduce the chance of misinterpretation, even though the following - /// “abuse” is nominally supported, choices should neither be, nor be - /// thought of as, a single array, i.e., the outermost sequence-like container - /// should be either a list or a tuple. - /// - /// - /// This array must contain integers in [0, n-1], where n is the number - /// of choices, unless mode=wrap or mode=clip, in which cases any - /// integers are permissible. - /// - /// - /// Choice arrays. a and all of the choices must be broadcastable to the - /// same shape. If choices is itself an array (not recommended), then - /// its outermost dimension (i.e., the one corresponding to - /// choices.shape[0]) is taken as defining the “sequence”. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Specifies how indices outside [0, n-1] will be treated: - /// - /// - /// The merged result. - /// - public static NDarray choose(NDarray a, NDarray[] choices, NDarray @out = null, string mode = "raise") - => NumPy.Instance.choose(a, choices, @out:@out, mode:mode); - - /// - /// Return selected slices of an array along given axis. - /// - /// When working along a given axis, a slice along that axis is returned in - /// output for each index where condition evaluates to True. When - /// working on a 1-D array, compress is equivalent to extract. - /// - /// - /// Array that selects which entries to return. If len(condition) - /// is less than the size of a along the given axis, then output is - /// truncated to the length of the condition array. - /// - /// - /// Array from which to extract a part. - /// - /// - /// Axis along which to take slices. If None (default), work on the - /// flattened array. - /// - /// - /// Output array. Its type is preserved and it must be of the right - /// shape to hold the output. - /// - /// - /// A copy of a without the slices along axis for which condition - /// is false. - /// - public static NDarray compress(NDarray condition, NDarray a, int? axis = null, NDarray @out = null) - => NumPy.Instance.compress(condition, a, axis:axis, @out:@out); - - /// - /// 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. - /// - /// - /// Array from which the diagonals are taken. - /// - /// - /// 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 static NDarray diagonal(NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) - => NumPy.Instance.diagonal(a, offset:offset, axis1:axis1, axis2:axis2); - - /// - /// Return an array drawn from elements in choicelist, depending on conditions. - /// - /// - /// The list of conditions which determine from which array in choicelist - /// the output elements are taken. When multiple conditions are satisfied, - /// the first one encountered in condlist is used. - /// - /// - /// The list of arrays from which the output elements are taken. It has - /// to be of the same length as condlist. - /// - /// - /// The element inserted in output when all conditions evaluate to False. - /// - /// - /// The output at position m is the m-th element of the array in - /// choicelist where the m-th element of the corresponding array in - /// condlist is True. - /// - public static NDarray @select(NDarray[] condlist, NDarray[] choicelist, object @default = null) - => NumPy.Instance.@select(condlist, choicelist, @default:@default); - - public static partial class lib { - public static partial class stride_tricks { - /// - /// Create a view into the array with the given shape and strides. - /// - /// Notes - /// - /// as_strided creates a view into the array given the exact strides - /// and shape. This means it manipulates the internal data structure of - /// ndarray and, if done incorrectly, the array elements can point to - /// invalid memory and can corrupt results or crash your program. - /// It is advisable to always use the original x.strides when - /// calculating new strides to avoid reliance on a contiguous memory - /// layout. - /// - /// Furthermore, arrays created with this function often contain self - /// overlapping memory, so that two elements are identical. - /// Vectorized write operations on such arrays will typically be - /// unpredictable. They may even give different results for small, large, - /// or transposed arrays. - /// Since writing to these arrays has to be tested and done with great - /// care, you may want to use writeable=False to avoid accidental write - /// operations. - /// - /// For these reasons it is advisable to avoid as_strided when - /// possible. - /// - /// - /// Array to create a new. - /// - /// - /// The shape of the new array. Defaults to x.shape. - /// - /// - /// The strides of the new array. Defaults to x.strides. - /// - /// - /// If True, subclasses are preserved. - /// - /// - /// If set to False, the returned array will always be readonly. - /// Otherwise it will be writable if the original array was. It - /// is advisable to set this to False if possible (see Notes). - /// - public static NDarray as_strided(NDarray x, Shape shape = null, int[] strides = null, bool? subok = false, bool? writeable = true) - => NumPy.Instance.lib_stride_tricks_as_strided(x, shape:shape, strides:strides, subok:subok, writeable:writeable); - } - } - - /// - /// 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. - /// - /// - /// Array to put data into. - /// - /// - /// 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 static void place(NDarray arr, NDarray mask, NDarray vals) - => NumPy.Instance.place(arr, mask, vals); - - /// - /// Replaces specified elements of an array with given values. - /// - /// The indexing works on the flattened target array. put is roughly - /// equivalent to: - /// - /// - /// Target array. - /// - /// - /// 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 static void put(NDarray a, NDarray ind, NDarray v, string mode = "raise") - => NumPy.Instance.put(a, ind, v, mode:mode); - - /// - /// 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: - /// - /// - /// Destination array. - /// - /// - /// 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 static void put_along_axis(NDarray arr, NDarray indices, NDarray[] values, int axis) - => NumPy.Instance.put_along_axis(arr, indices, values, axis); - - /// - /// 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. - /// - /// - /// Target array. - /// - /// - /// 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 static void putmask(NDarray a, NDarray mask, NDarray values) - => NumPy.Instance.putmask(a, mask, values); - - /// - /// 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. - /// - /// - /// Array whose diagonal is to be filled, it gets modified in-place. - /// - /// - /// 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 static void fill_diagonal(NDarray a, ValueType val, bool wrap = false) - => NumPy.Instance.fill_diagonal(a, val, wrap); - - /* - /// - /// 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. - /// - /// - /// The array(s) to iterate over. - /// - /// - /// 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 static void nditer(NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) - => NumPy.Instance.nditer(op, flags:flags, op_flags:op_flags, op_dtypes:op_dtypes, order:order, casting:casting, op_axes:op_axes, itershape:itershape, buffersize:buffersize); - */ - - /// - /// Multidimensional index iterator. - /// - /// Return an iterator yielding pairs of array coordinates and values. - /// - /// - /// Input array. - /// - public static void ndenumerate(NDarray arr) - => NumPy.Instance.ndenumerate(arr); - - /// - /// An N-dimensional iterator object to index arrays. - /// - /// Given the shape of an array, an ndindex instance iterates over - /// the N-dimensional index of the array. At each iteration a tuple - /// of indices is returned, the last dimension is iterated over first. - /// - /// - /// The size of each dimension of the array. - /// - public static void ndindex(int[] args) - => NumPy.Instance.ndindex(args); - - /* - /// - /// 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. - /// - /// - /// The array(s) to iterate over. - /// - /// - /// Each item is used as an “op_axes” argument to an nditer - /// - /// - /// An nditer for each item in axes, outermost first - /// - public static tuple of nditer nested_iters(NDarray op, int[] axes = null) - => NumPy.Instance.nested_iters(op, axes); - */ - - /// - /// Flat iterator object to iterate over arrays. - /// - /// A flatiter iterator is returned by x.flat for any array x. - /// It allows iterating over the array as if it were a 1-D array, - /// either in a for-loop or by calling its next method. - /// - /// Iteration is done in row-major, C-style order (the last - /// index varying the fastest). The iterator can also be indexed using - /// basic slicing or advanced indexing. - /// - /// Notes - /// - /// A flatiter iterator can not be constructed directly from Python code - /// by calling the flatiter constructor. - /// - public static void flatiter() - => NumPy.Instance.flatiter(); - - public static partial class lib { - /// - /// Buffered iterator for big arrays. - /// - /// Arrayterator creates a buffered iterator for reading big arrays in small - /// contiguous blocks. The class is useful for objects stored in the - /// file system. It allows iteration over the object without reading - /// everything in memory; instead, small blocks are read and iterated over. - /// - /// Arrayterator can be used with any object that supports multidimensional - /// slices. This includes NumPy arrays, but also variables from - /// Scientific.IO.NetCDF or pynetcdf for example. - /// - /// Notes - /// - /// The algorithm works by first finding a “running dimension”, along which - /// the blocks will be extracted. Given an array of dimensions - /// (d1, d2, ..., dn), e.g. if buf_size is smaller than d1, the - /// first dimension will be used. If, on the other hand, - /// d1 < buf_size < d1*d2 the second dimension will be used, and so on. - /// Blocks are extracted along this dimension, and when the last block is - /// returned the process continues from the next dimension, until all - /// elements have been read. - /// - /// - /// The object to iterate over. - /// - /// - /// The buffer size. If buf_size is supplied, the maximum amount of - /// data that will be read into memory is buf_size elements. - /// Default is None, which will read as many element as possible - /// into memory. - /// - public static void Arrayterator(NDarray @var, int? buf_size = null) - => NumPy.Instance.lib_Arrayterator(@var, buf_size:buf_size); - } - - - } -} diff --git a/src/Numpy.Bare/np.io.gen.cs b/src/Numpy.Bare/np.io.gen.cs deleted file mode 100644 index 23380f5..0000000 --- a/src/Numpy.Bare/np.io.gen.cs +++ /dev/null @@ -1,893 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Load arrays or pickled objects from .npy, .npz or pickled files. - /// - /// Notes - /// - /// - /// The file to read. File-like objects must support the - /// seek() and read() methods. Pickled files require that the - /// file-like object support the readline() method as well. - /// - /// - /// If not None, then memory-map the file, using the given mode (see - /// numpy.memmap for a detailed description of the modes). A - /// memory-mapped array is kept on disk. However, it can be accessed - /// and sliced like any ndarray. Memory mapping is especially useful - /// for accessing small fragments of large files without reading the - /// entire file into memory. - /// - /// - /// Allow loading pickled object arrays stored in npy files. Reasons for - /// disallowing pickles include security, as loading pickled data can - /// execute arbitrary code. If pickles are disallowed, loading object - /// arrays will fail. - /// Default: True - /// - /// - /// Only useful when loading Python 2 generated pickled files on Python 3, - /// which includes npy/npz files containing object arrays. If fix_imports - /// is True, pickle will try to map the old Python 2 names to the new names - /// used in Python 3. - /// - /// - /// What encoding to use when reading Python 2 strings. Only useful when - /// loading Python 2 generated pickled files in Python 3, which includes - /// npy/npz files containing object arrays. Values other than ‘latin1’, - /// ‘ASCII’, and ‘bytes’ are not allowed, as they can corrupt numerical - /// data. Default: ‘ASCII’ - /// - /// - /// Data stored in the file. For .npz files, the returned instance - /// of NpzFile class must be closed to avoid leaking file descriptors. - /// - public static NDarray load(string file, MemMapMode mmap_mode = null, bool? allow_pickle = true, bool? fix_imports = true, string encoding = "ASCII") - => NumPy.Instance.load(file, mmap_mode:mmap_mode, allow_pickle:allow_pickle, fix_imports:fix_imports, encoding:encoding); - - /// - /// Save an array to a binary file in NumPy .npy format. - /// - /// Notes - /// - /// For a description of the .npy format, see numpy.lib.format. - /// - /// - /// File or filename to which the data is saved. If file is a file-object, - /// then the filename is unchanged. If file is a string or Path, a .npy - /// extension will be appended to the file name if it does not already - /// have one. - /// - /// - /// Array data to be saved. - /// - /// - /// Allow saving object arrays using Python pickles. Reasons for disallowing - /// pickles include security (loading pickled data can execute arbitrary - /// code) and portability (pickled objects may not be loadable on different - /// Python installations, for example if the stored objects require libraries - /// that are not available, and not all pickled data is compatible between - /// Python 2 and Python 3). - /// Default: True - /// - /// - /// Only useful in forcing objects in object arrays on Python 3 to be - /// pickled in a Python 2 compatible way. If fix_imports is True, pickle - /// will try to map the new Python 3 names to the old module names used in - /// Python 2, so that the pickle data stream is readable with Python 2. - /// - public static void save(string file, NDarray arr, bool? allow_pickle = true, bool? fix_imports = true) - => NumPy.Instance.save(file, arr, allow_pickle:allow_pickle, fix_imports:fix_imports); - - /// - /// Save several arrays into a single file in uncompressed .npz format. - /// - /// If arguments are passed in with no keywords, the corresponding variable - /// names, in the .npz file, are ‘arr_0’, ‘arr_1’, etc. If keyword - /// arguments are given, the corresponding variable names, in the .npz - /// file will match the keyword names. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is not compressed and each file - /// in the archive contains one variable in .npy format. For a - /// description of the .npy format, see numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public static void savez(string file, NDarray[] args = null, Dictionary kwds = null) - => NumPy.Instance.savez(file, args:args, kwds:kwds); - - /// - /// Save several arrays into a single file in compressed .npz format. - /// - /// If keyword arguments are given, then filenames are taken from the keywords. - /// If arguments are passed in with no keywords, then stored file names are - /// arr_0, arr_1, etc. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is compressed with - /// zipfile.ZIP_DEFLATED and each file in the archive contains one variable - /// in .npy format. For a description of the .npy format, see - /// numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public static void savez_compressed(string file, NDarray[] args = null, Dictionary kwds = null) - => NumPy.Instance.savez_compressed(file, args:args, kwds:kwds); - - /// - /// Save an array to a text file. - /// - /// Notes - /// - /// Further explanation of the fmt parameter - /// (%[flag]width[.precision]specifier): - /// - /// This explanation of fmt is not complete, for an exhaustive - /// specification see [1]. - /// - /// References - /// - /// - /// If the filename ends in .gz, the file is automatically saved in - /// compressed gzip format. loadtxt understands gzipped files - /// transparently. - /// - /// - /// Data to be saved to a text file. - /// - /// - /// A single format (%10.5f), a sequence of formats, or a - /// multi-format string, e.g. ‘Iteration %d – %10.5f’, in which - /// case delimiter is ignored. For complex X, the legal options - /// for fmt are: - /// - /// - /// String or character separating columns. - /// - /// - /// String or character separating lines. - /// - /// - /// String that will be written at the beginning of the file. - /// - /// - /// String that will be written at the end of the file. - /// - /// - /// String that will be prepended to the header and footer strings, - /// to mark them as comments. Default: ‘# ‘, as expected by e.g. - /// numpy.loadtxt. - /// - /// - /// Encoding used to encode the outputfile. Does not apply to output - /// streams. If the encoding is something other than ‘bytes’ or ‘latin1’ - /// you will not be able to load the file in NumPy versions < 1.14. Default - /// is ‘latin1’. - /// - public static void savetxt(string fname, NDarray X, string[] fmt = null, string delimiter = " ", string newline = "\n", string header = "", string footer = "", string comments = null, string encoding = null) - => NumPy.Instance.savetxt(fname, X, fmt:fmt, delimiter:delimiter, newline:newline, header:header, footer:footer, comments:comments, encoding:encoding); - - /* - /// - /// Load data from a text file, with missing values handled as specified. - /// - /// Each line past the first skip_header lines is split at the delimiter - /// character, and characters following the comments character are discarded. - /// - /// Notes - /// - /// References - /// - /// - /// File, filename, list, or generator to read. If the filename - /// extension is gz or bz2, the file is first decompressed. Note - /// that generators must return byte strings in Python 3k. The strings - /// in a list or produced by a generator are treated as lines. - /// - /// - /// Data type of the resulting array. - /// If None, the dtypes will be determined by the contents of each - /// column, individually. - /// - /// - /// The character used to indicate the start of a comment. - /// All the characters occurring on a line after a comment are discarded - /// - /// - /// The string used to separate values. By default, any consecutive - /// whitespaces act as delimiter. An integer or sequence of integers - /// can also be provided as width(s) of each field. - /// - /// - /// skiprows was removed in numpy 1.10. Please use skip_header instead. - /// - /// - /// The number of lines to skip at the beginning of the file. - /// - /// - /// The number of lines to skip at the end of the file. - /// - /// - /// The set of functions that convert the data of a column to a value. - /// The converters can also be used to provide a default value - /// for missing data: converters = {3: lambda s: float(s or 0)}. - /// - /// - /// missing was removed in numpy 1.10. Please use missing_values - /// instead. - /// - /// - /// The set of strings corresponding to missing data. - /// - /// - /// The set of values to be used as default when the data are missing. - /// - /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1, 4, 5) will extract the 2nd, 5th and 6th columns. - /// - /// - /// If names is True, the field names are read from the first line after - /// the first skip_header lines. This line can optionally be proceeded - /// by a comment delimiter. If names is a sequence or a single-string of - /// comma-separated names, the names will be used to define the field names - /// in a structured dtype. If names is None, the names of the dtype - /// fields will be used, if any. - /// - /// - /// A list of names to exclude. This list is appended to the default list - /// [‘return’,’file’,’print’]. Excluded names are appended an underscore: - /// for example, file would become file_. - /// - /// - /// A string combining invalid characters that must be deleted from the - /// names. - /// - /// - /// A format used to define default field names, such as “f%i” or “f_%02i”. - /// - /// - /// Whether to automatically strip white spaces from the variables. - /// - /// - /// Character(s) used in replacement of white spaces in the variables - /// names. By default, use a ‘_’. - /// - /// - /// If True, field names are case sensitive. - /// If False or ‘upper’, field names are converted to upper case. - /// If ‘lower’, field names are converted to lower case. - /// - /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...) - /// - /// - /// If True, return a masked array. - /// If False, return a regular array. - /// - /// - /// If True, do not raise errors for invalid values. - /// - /// - /// If True, an exception is raised if an inconsistency is detected in the - /// number of columns. - /// If False, a warning is emitted and the offending lines are skipped. - /// - /// - /// The maximum number of rows to read. Must not be used with skip_footer - /// at the same time. If given, the value must be at least 1. Default is - /// to read the entire file. - /// - /// - /// Encoding used to decode the inputfile. Does not apply when fname is - /// a file object. The special value ‘bytes’ enables backward compatibility - /// workarounds that ensure that you receive byte arrays when possible - /// and passes latin1 encoded strings to converters. Override this value to - /// receive unicode arrays and pass strings as input to converters. If set - /// to None the system default is used. The default value is ‘bytes’. - /// - /// - /// Data read from the text file. If usemask is True, this is a - /// masked array. - /// - public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, char replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes") - => NumPy.Instance.genfromtxt(fname, dtype:dtype, comments:comments, delimiter:delimiter, skiprows:skiprows, skip_header:skip_header, skip_footer:skip_footer, converters:converters, missing:missing, missing_values:missing_values, filling_values:filling_values, usecols:usecols, names:names, excludelist:excludelist, deletechars:deletechars, defaultfmt:defaultfmt, autostrip:autostrip, replace_space:replace_space, case_sensitive:case_sensitive, unpack:unpack, usemask:usemask, loose:loose, invalid_raise:invalid_raise, max_rows:max_rows, encoding:encoding); - */ - - /// - /// Construct an array from a text file, using regular expression parsing. - /// - /// The returned array is always a structured array, and is constructed from - /// all matches of the regular expression in the file. Groups in the regular - /// expression are converted to fields of the structured array. - /// - /// Notes - /// - /// Dtypes for structured arrays can be specified in several forms, but all - /// forms specify at least the data type and field name. For details see - /// doc.structured_arrays. - /// - /// - /// File name or file object to read. - /// - /// - /// Regular expression used to parse the file. - /// Groups in the regular expression correspond to fields in the dtype. - /// - /// - /// Dtype for the structured array. - /// - /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// - /// - /// The output array, containing the part of the content of file that - /// was matched by regexp. output is always a structured array. - /// - public static NDarray fromregex(string file, string regexp, Dtype dtype, string encoding = null) - => NumPy.Instance.fromregex(file, regexp, dtype, encoding:encoding); - - /// - /// Write array to a file as text or binary (default). - /// - /// Data is always written in ‘C’ order, independent of the order of a. - /// The data produced by this method can be recovered using the function - /// fromfile(). - /// - /// Notes - /// - /// This is a convenience function for quick storage of array data. - /// Information on endianness and precision is lost, so this method is not a - /// good choice for files intended to archive data or transport data between - /// machines with different endianness. Some of these problems can be overcome - /// by outputting the data as text files, at the expense of speed and file - /// size. - /// - /// When fid is a file object, array contents are directly written to the - /// file, bypassing the file object’s write method. As a result, tofile - /// cannot be used with files objects supporting compression (e.g., GzipFile) - /// or file-like objects that do not support fileno() (e.g., BytesIO). - /// - /// - /// An open file object, or a string containing a filename. - /// - /// - /// Separator between array items for text output. - /// If “” (empty), a binary file is written, equivalent to - /// file.write(a.tobytes()). - /// - /// - /// Format string for text file output. - /// Each entry in the array is formatted to text by first converting - /// it to the closest Python type, and then using “format” % item. - /// - public static void tofile(string fid, string sep, string format) - => NumPy.Instance.tofile(fid, sep, format); - - /* - /// - /// Return the array as a (possibly nested) list. - /// - /// Return a copy of the array data as a (nested) Python list. - /// Data items are converted to the nearest compatible Python type. - /// - /// Notes - /// - /// The array may be recreated, a = np.array(a.tolist()). - /// - /// - /// The possibly nested list of array elements. - /// - public static List tolist() - => NumPy.Instance.tolist(); - */ - - /* - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static string array2string(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) - => NumPy.Instance.array2string(a, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small, separator:separator, prefix:prefix, suffix:suffix, formatter:formatter, threshold:threshold, edgeitems:edgeitems, sign:sign, floatmode:floatmode, legacy:legacy); - */ - - /// - /// Return the string representation of an array. - /// - /// - /// Input 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 static string array_repr(NDarray arr, int? max_line_width = null, int? precision = null, bool? suppress_small = null) - => NumPy.Instance.array_repr(arr, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static void array_str(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null) - => NumPy.Instance.array_str(a, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); - - /* - /// - /// Format a floating-point scalar as a decimal string in positional notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. - /// - /// - /// Value to format. - /// - /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. - /// - /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print out all necessary digits, otherwise digit generation - /// is cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. - /// - /// - /// If True, the cutoff of precision digits refers to the total number - /// of digits after the decimal point, including leading zeros. - /// If False, precision refers to the total number of significant - /// digits, before or after the decimal point, ignoring leading zeros. - /// - /// - /// Controls post-processing trimming of trailing digits, as follows: - /// - /// - /// Whether to show the sign for positive values. - /// - /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. - /// - /// - /// Pad the right side of the string with whitespace until at least that - /// many characters are to the right of the decimal point. - /// - /// - /// The string representation of the floating point value - /// - public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null) - => NumPy.Instance.format_float_positional(x, precision:precision, unique:unique, fractional:fractional, trim:trim, sign:sign, pad_left:pad_left, pad_right:pad_right); - */ - - /* - /// - /// Format a floating-point scalar as a decimal string in scientific notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. - /// - /// - /// Value to format. - /// - /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. - /// - /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print all necessary digits, otherwise digit generation is - /// cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. - /// - /// - /// Controls post-processing trimming of trailing digits, as follows: - /// - /// - /// Whether to show the sign for positive values. - /// - /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. - /// - /// - /// Pad the exponent with zeros until it contains at least this many digits. - /// If omitted, the exponent will be at least 2 digits. - /// - /// - /// The string representation of the floating point value - /// - public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null) - => NumPy.Instance.format_float_scientific(x, precision:precision, unique:unique, trim:trim, sign:sign, pad_left:pad_left, exp_digits:exp_digits); - */ - - /// - /// Create a memory-map to an array stored in a binary file on disk. - /// - /// Memory-mapped files are used for accessing small segments of large files - /// on disk, without reading the entire file into memory. NumPy’s - /// memmap’s are array-like objects. This differs from Python’s mmap - /// module, which uses file-like objects. - /// - /// This subclass of ndarray has some unpleasant interactions with - /// some operations, because it doesn’t quite fit properly as a subclass. - /// An alternative to using this subclass is to create the mmap - /// object yourself, then create an ndarray with ndarray.__new__ directly, - /// passing the object created in its ‘buffer=’ parameter. - /// - /// This class may at some point be turned into a factory function - /// which returns a view into an mmap buffer. - /// - /// Delete the memmap instance to close the memmap file. - /// - /// Notes - /// - /// The memmap object can be used anywhere an ndarray is accepted. - /// Given a memmap fp, isinstance(fp, numpy.ndarray) returns - /// True. - /// - /// Memory-mapped files cannot be larger than 2GB on 32-bit systems. - /// - /// When a memmap causes a file to be created or extended beyond its - /// current size in the filesystem, the contents of the new part are - /// unspecified. On systems with POSIX filesystem semantics, the extended - /// part will be filled with zero bytes. - /// - /// - /// The file name or file object to be used as the array data buffer. - /// - /// - /// The data-type used to interpret the file contents. - /// Default is uint8. - /// - /// - /// The file is opened in this mode: - /// - /// Default is ‘r+’. - /// - /// - /// In the file, array data starts at this offset. Since offset is - /// measured in bytes, it should normally be a multiple of the byte-size - /// of dtype. When mode != 'r', even positive offsets beyond end of - /// file are valid; The file will be extended to accommodate the - /// additional data. By default, memmap will start at the beginning of - /// the file, even if filename is a file pointer fp and - /// fp.tell() != 0. - /// - /// - /// The desired shape of the array. If mode == 'r' and the number - /// of remaining bytes after offset is not a multiple of the byte-size - /// of dtype, you must specify shape. By default, the returned array - /// will be 1-D with the number of elements determined by file size - /// and data-type. - /// - /// - /// Specify the order of the ndarray memory layout: - /// row-major, C-style or column-major, - /// Fortran-style. This only has an effect if the shape is - /// greater than 1-D. The default order is ‘C’. - /// - public static void memmap(string filename, Dtype dtype = null, string mode = null, int? offset = null, Shape shape = null, string order = null) - => NumPy.Instance.memmap(filename, dtype:dtype, mode:mode, offset:offset, shape:shape, order:order); - - /* - /// - /// Set printing options. - /// - /// These options determine the way floating point numbers, arrays and - /// other NumPy objects are displayed. - /// - /// Notes - /// - /// formatter is always reset with a call to set_printoptions. - /// - /// - /// Number of digits of precision for floating point output (default 8). - /// May be None if floatmode is not fixed, to print as many digits as - /// necessary to uniquely specify the value. - /// - /// - /// Total number of array elements which trigger summarization - /// rather than full repr (default 1000). - /// - /// - /// Number of array items in summary at beginning and end of - /// each dimension (default 3). - /// - /// - /// The number of characters per line for the purpose of inserting - /// line breaks (default 75). - /// - /// - /// If True, always print floating point numbers using fixed point - /// notation, in which case numbers equal to zero in the current precision - /// will print as zero. If False, then scientific notation is used when - /// absolute value of the smallest number is < 1e-4 or the ratio of the - /// maximum absolute value to the minimum is > 1e3. The default is False. - /// - /// - /// String representation of floating point not-a-number (default nan). - /// - /// - /// String representation of floating point infinity (default inf). - /// - /// - /// 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. (default ‘-‘) - /// - /// - /// 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: - /// - /// - /// 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. - /// - public static void set_printoptions(int? precision = null, int? threshold = null, int? edgeitems = null, int? linewidth = null, bool? suppress = null, string nanstr = null, string infstr = null, string sign = null, dict of callables formatter = null, string floatmode = null, string or False legacy = null) - => NumPy.Instance.set_printoptions(precision:precision, threshold:threshold, edgeitems:edgeitems, linewidth:linewidth, suppress:suppress, nanstr:nanstr, infstr:infstr, sign:sign, formatter:formatter, floatmode:floatmode, legacy:legacy); - */ - - /// - /// Return the current print options. - /// - /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. - /// - /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. - /// - public static Hashtable get_printoptions(Hashtable print_opts) - => NumPy.Instance.get_printoptions(print_opts); - - /* - /// - /// Set a Python function to be used when pretty printing arrays. - /// - /// - /// Function to be used to pretty print arrays. The function should expect - /// a single array argument and return a string of the representation of - /// the array. If None, the function is reset to the default NumPy function - /// to print arrays. - /// - /// - /// If True (default), the function for pretty printing (__repr__) - /// is set, if False the function that returns the default string - /// representation (__str__) is set. - /// - public static void set_string_function(function or None f, bool? repr = true) - => NumPy.Instance.set_string_function(f, repr:repr); - */ - - /// - /// Return a string representation of a number in the given base system. - /// - /// - /// The value to convert. Positive and negative values are handled. - /// - /// - /// Convert number to the base number system. The valid range is 2-36, - /// the default value is 2. - /// - /// - /// Number of zeros padded on the left. Default is 0 (no padding). - /// - /// - /// String representation of number in base system. - /// - public static string base_repr(int number, int? @base = 2, int? padding = 0) - => NumPy.Instance.base_repr(number, @base:@base, padding:padding); - - /// - /// A generic data source file (file, http, ftp, …). - /// - /// DataSources can be local files or remote files/URLs. The files may - /// also be compressed or uncompressed. DataSource hides some of the - /// low-level details of downloading the file, allowing you to simply pass - /// in a valid file path (or URL) and obtain a file object. - /// - /// Notes - /// - /// URLs require a scheme string (http://) to be used, without it they - /// will fail: - /// - /// Temporary directories are deleted when the DataSource is deleted. - /// - /// - /// Path to the directory where the source file gets downloaded to for - /// use. If destpath is None, a temporary directory will be created. - /// The default path is the current directory. - /// - public static void DataSource(string destpath = null) - => NumPy.Instance.DataSource(destpath:destpath); - - - } -} diff --git a/src/Numpy.Bare/np.linalg.gen.cs b/src/Numpy.Bare/np.linalg.gen.cs deleted file mode 100644 index ca2bec5..0000000 --- a/src/Numpy.Bare/np.linalg.gen.cs +++ /dev/null @@ -1,754 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Dot product of two arrays. Specifically, - /// - /// - /// First argument. - /// - /// - /// 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 static NDarray dot(NDarray a, NDarray b, NDarray @out = null) - => NumPy.Instance.dot(a, b, @out:@out); - - public static partial class linalg { - /// - /// Compute the dot product of two or more arrays in a single function call, - /// while automatically selecting the fastest evaluation order. - /// - /// multi_dot chains numpy.dot and uses optimal parenthesization - /// of the matrices [1] [2]. Depending on the shapes of the matrices, - /// this can speed up the multiplication a lot. - /// - /// If the first argument is 1-D it is treated as a row vector. - /// If the last argument is 1-D it is treated as a column vector. - /// The other arguments must be 2-D. - /// - /// Think of multi_dot as: - /// - /// Notes - /// - /// The cost for a matrix multiplication can be calculated with the - /// following function: - /// - /// Let’s assume we have three matrices - /// . - /// - /// The costs for the two different parenthesizations are as follows: - /// - /// References - /// - /// - /// If the first argument is 1-D it is treated as row vector. - /// If the last argument is 1-D it is treated as column vector. - /// The other arguments must be 2-D. - /// - /// - /// Returns the dot product of the supplied arrays. - /// - public static NDarray multi_dot(NDarray[] arrays) - => NumPy.Instance.linalg_multi_dot(arrays); - } - - /// - /// 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. - /// - /// - /// If a is complex the complex conjugate is taken before calculation - /// of the dot product. - /// - /// - /// 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 static NDarray vdot(NDarray a, NDarray b) - => NumPy.Instance.vdot(a, b); - - /// - /// 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. - /// - /// - /// If a and b are nonscalar, their last dimensions must match. - /// - /// - /// out.shape = a.shape[:-1] + b.shape[:-1] - /// - public static NDarray inner(NDarray b, NDarray a) - => NumPy.Instance.inner(b, a); - - /// - /// 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 - /// - /// - /// First input vector. Input is flattened if - /// not already 1-dimensional. - /// - /// - /// 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 static NDarray outer(NDarray a, NDarray b, NDarray @out = null) - => NumPy.Instance.outer(a, b, @out:@out); - - /// - /// 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. - /// - /// - /// 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 static NDarray matmul(NDarray x2, NDarray x1, NDarray @out = null) - => NumPy.Instance.matmul(x2, x1, @out:@out); - - /// - /// 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”. - /// - /// - /// Tensors to “dot”. - /// - public static NDarray tensordot(NDarray b, NDarray a, int[] axes = null) - => NumPy.Instance.tensordot(b, a, axes); - - /// - /// 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) - => NumPy.Instance.einsum(subscripts, operands, @out:@out, dtype:dtype, order:order, casting:casting, optimize:optimize); - - /* - /// - /// Evaluates the lowest cost contraction order for an einsum expression by - /// considering the creation of intermediate arrays. - /// - /// Notes - /// - /// The resulting path indicates which terms of the input contraction should be - /// contracted first, the result of this contraction is then appended to the - /// end of the contraction list. This list can then be iterated over until all - /// intermediate contractions are complete. - /// - /// - /// Specifies the subscripts for summation. - /// - /// - /// These are the arrays for the operation. - /// - /// - /// Choose the type of path. If a tuple is provided, the second argument is - /// assumed to be the maximum intermediate size created. If only a single - /// argument is provided the largest input or output array size is used - /// as a maximum intermediate size. - /// - /// Default is ‘greedy’. - /// - /// - /// A tuple of: - /// path - /// A list representation of the einsum path. - /// string_repr - /// A printable representation of the einsum path. - /// - public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, {bool optimize = "greedy") - => NumPy.Instance.einsum_path(subscripts, operands, optimize); - */ - - public static partial class linalg { - /// - /// Raise a square matrix to the (integer) power n. - /// - /// For positive integers n, the power is computed by repeated matrix - /// squarings and matrix multiplications. If n == 0, the identity matrix - /// of the same shape as M is returned. If n < 0, the inverse - /// is computed and then raised to the abs(n). - /// - /// - /// Matrix to be “powered.” - /// - /// - /// The exponent can be any integer or long integer, positive, - /// negative, or zero. - /// - /// - /// The return value is the same shape and type as M; - /// if the exponent is positive or zero then the type of the - /// elements is the same as those of M. If the exponent is - /// negative the elements are floating-point. - /// - public static NDarray matrix_power(NDarray a, int n) - => NumPy.Instance.linalg_matrix_power(a, n); - } - - /// - /// 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 static NDarray kron(NDarray b, NDarray a) - => NumPy.Instance.kron(b, a); - - public static partial class linalg { - /// - /// 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") - => NumPy.Instance.linalg_qr(a, mode:mode); - } - - /* - public static partial class linalg { - /// - /// Compute the condition number of a matrix. - /// - /// This function is capable of returning the condition number using - /// one of seven different norms, depending on the value of p (see - /// Parameters below). - /// - /// Notes - /// - /// The condition number of x is defined as the norm of x times the - /// norm of the inverse of x [1]; the norm can be the usual L2-norm - /// (root-of-sum-of-squares) or one of a number of other matrix norms. - /// - /// References - /// - /// - /// The matrix whose condition number is sought. - /// - /// - /// Order of the norm: - /// - /// inf means the numpy.inf object, and the Frobenius norm is - /// the root-of-sum-of-squares norm. - /// - /// - /// The condition number of the matrix. May be infinite. - /// - public static {float cond(NDarray x, {None p = null) - => NumPy.Instance.linalg_cond(x, p:p); - } - */ - - public static partial class linalg { - /// - /// Return matrix rank of array using SVD method - /// - /// Rank of the array is the number of singular values of the array that are - /// greater than tol. - /// - /// Notes - /// - /// The default threshold to detect rank deficiency is a test on the magnitude - /// of the singular values of M. By default, we identify singular values less - /// than S.max() * max(M.shape) * eps as indicating rank deficiency (with - /// the symbols defined above). This is the algorithm MATLAB uses [1]. It also - /// appears in Numerical recipes in the discussion of SVD solutions for linear - /// least squares [2]. - /// - /// This default threshold is designed to detect rank deficiency accounting for - /// the numerical errors of the SVD computation. Imagine that there is a column - /// in M that is an exact (in floating point) linear combination of other - /// columns in M. Computing the SVD on M will not produce a singular value - /// exactly equal to 0 in general: any difference of the smallest SVD value from - /// 0 will be caused by numerical imprecision in the calculation of the SVD. - /// Our threshold for small SVD values takes this numerical imprecision into - /// account, and the default threshold will detect such numerical rank - /// deficiency. The threshold may declare a matrix M rank deficient even if - /// the linear combination of some columns of M is not exactly equal to - /// another column of M but only numerically very close to another column of - /// M. - /// - /// We chose our default threshold because it is in wide use. Other thresholds - /// are possible. For example, elsewhere in the 2007 edition of Numerical - /// recipes there is an alternative threshold of S.max() * - /// np.finfo(M.dtype).eps / 2. * np.sqrt(m + n + 1.). The authors describe - /// this threshold as being based on “expected roundoff error” (p 71). - /// - /// The thresholds above deal with floating point roundoff error in the - /// calculation of the SVD. However, you may have more information about the - /// sources of error in M that would make you consider other tolerance values - /// to detect effective rank deficiency. The most useful measure of the - /// tolerance depends on the operations you intend to use on your matrix. For - /// example, if your data come from uncertain measurements with uncertainties - /// greater than floating point epsilon, choosing a tolerance near that - /// uncertainty may be preferable. The tolerance may be absolute if the - /// uncertainties are absolute rather than relative. - /// - /// References - /// - /// - /// input vector or stack of matrices - /// - /// - /// threshold below which SVD values are considered zero. If tol is - /// None, and S is an array with singular values for M, and - /// eps is the epsilon value for datatype of S, then tol is - /// set to S.max() * max(M.shape) * eps. - /// - /// - /// If True, M is assumed to be Hermitian (symmetric if real-valued), - /// enabling a more efficient method for finding singular values. - /// Defaults to False. - /// - public static int matrix_rank(NDarray M, NDarray tol = null, bool? hermitian = false) - => NumPy.Instance.linalg_matrix_rank(M, tol:tol, hermitian:hermitian); - } - - public static partial class linalg { - /// - /// Compute the sign and (natural) logarithm of the determinant of an array. - /// - /// If an array has a very small or very large determinant, then a call to - /// det may overflow or underflow. This routine is more robust against such - /// issues, because it computes the logarithm of the determinant rather than - /// the determinant itself. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. - /// - /// - /// Input array, has to be a square 2-D array. - /// - /// - /// A tuple of: - /// sign - /// A number representing the sign of the determinant. For a real matrix, - /// this is 1, 0, or -1. For a complex matrix, this is a complex number - /// with absolute value 1 (i.e., it is on the unit circle), or else 0. - /// logdet - /// The natural log of the absolute value of the determinant. - /// - public static (NDarray, NDarray) slogdet(NDarray a) - => NumPy.Instance.linalg_slogdet(a); - } - - /// - /// 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. - /// - /// - /// Input array, from which the diagonals are taken. - /// - /// - /// 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 static NDarray trace(NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.trace(a, offset:offset, axis2:axis2, axis1:axis1, dtype:dtype, @out:@out); - - public static partial class linalg { - /// - /// Solve the tensor equation a x = b for x. - /// - /// It is assumed that all indices of x are summed over in the product, - /// together with the rightmost indices of a, as is done in, for example, - /// tensordot(a, x, axes=b.ndim). - /// - /// - /// Coefficient tensor, of shape b.shape + Q. Q, a tuple, equals - /// the shape of that sub-tensor of a consisting of the appropriate - /// number of its rightmost indices, and must be such that - /// prod(Q) == prod(b.shape) (in which sense a is said to be - /// ‘square’). - /// - /// - /// Right-hand tensor, which can be of any shape. - /// - /// - /// Axes in a to reorder to the right, before inversion. - /// If None (default), no reordering is done. - /// - public static NDarray tensorsolve(NDarray a, NDarray b, int[] axes = null) - => NumPy.Instance.linalg_tensorsolve(a, b, axes:axes); - } - - public static partial class linalg { - /// - /// Compute the ‘inverse’ of an N-dimensional array. - /// - /// The result is an inverse for a relative to the tensordot operation - /// tensordot(a, b, ind), i. e., up to floating-point accuracy, - /// tensordot(tensorinv(a), a, ind) is the “identity” tensor for the - /// tensordot operation. - /// - /// - /// Tensor to ‘invert’. Its shape must be ‘square’, i. e., - /// prod(a.shape[:ind]) == prod(a.shape[ind:]). - /// - /// - /// Number of first indices that are involved in the inverse sum. - /// Must be a positive integer, default is 2. - /// - /// - /// a’s tensordot inverse, shape a.shape[ind:] + a.shape[:ind]. - /// - public static NDarray tensorinv(NDarray a, int? ind = 2) - => NumPy.Instance.linalg_tensorinv(a, ind:ind); - } - - public static partial class linalg { - /// - /// Generic Python-exception-derived object raised by linalg functions. - /// - /// General purpose exception class, derived from Python’s exception.Exception - /// class, programmatically raised in linalg functions when a Linear - /// Algebra-related condition would prevent further correct execution of the - /// function. - /// - public static void LinAlgError() - => NumPy.Instance.linalg_LinAlgError(); - } - - - } -} diff --git a/src/Numpy.Bare/np.linalg_fft.gen.cs b/src/Numpy.Bare/np.linalg_fft.gen.cs deleted file mode 100644 index cfa6fd9..0000000 --- a/src/Numpy.Bare/np.linalg_fft.gen.cs +++ /dev/null @@ -1,796 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - public static partial class linalg { - /// - /// Cholesky decomposition. - /// - /// Return the Cholesky decomposition, L * L.H, of the square matrix a, - /// where L is lower-triangular and .H is the conjugate transpose operator - /// (which is the ordinary transpose if a is real-valued). a must be - /// Hermitian (symmetric if real-valued) and positive-definite. Only L is - /// actually returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The Cholesky decomposition is often used as a fast way of solving - /// - /// (when A is both Hermitian/symmetric and positive-definite). - /// - /// First, we solve for in - /// - /// and then for in - /// - /// - /// Hermitian (symmetric if all elements are real), positive-definite - /// input matrix. - /// - /// - /// Upper or lower-triangular Cholesky factor of a. Returns a - /// matrix object if a is a matrix object. - /// - public static NDarray cholesky(NDarray a) - => NumPy.Instance.linalg_cholesky(a); - } - - public static partial class linalg { - /// - /// Compute the determinant of an array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. - /// - /// - /// Input array to compute determinants for. - /// - /// - /// Determinant of a. - /// - public static NDarray det(NDarray a) - => NumPy.Instance.linalg_det(a); - } - - public static partial class linalg { - /// - /// Compute the eigenvalues and right eigenvectors of a square array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// The number w is an eigenvalue of a if there exists a vector - /// v such that dot(a,v) = w * v. Thus, the arrays a, w, and - /// v satisfy the equations dot(a[:,:], v[:,i]) = w[i] * v[:,i] - /// for . - /// - /// The array v of eigenvectors may not be of maximum rank, that is, some - /// of the columns may be linearly dependent, although round-off error may - /// obscure that fact. If the eigenvalues are all different, then theoretically - /// the eigenvectors are linearly independent. Likewise, the (complex-valued) - /// matrix of eigenvectors v is unitary if the matrix a is normal, i.e., - /// if dot(a, a.H) = dot(a.H, a), where a.H denotes the conjugate - /// transpose of a. - /// - /// Finally, it is emphasized that v consists of the right (as in - /// right-hand side) eigenvectors of a. A vector y satisfying - /// dot(y.T, a) = z * y.T for some number z is called a left - /// eigenvector of a, and, in general, the left and right eigenvectors - /// of a matrix are not necessarily the (perhaps conjugate) transposes - /// of each other. - /// - /// References - /// - /// G. Strang, Linear Algebra and Its Applications, 2nd Ed., Orlando, FL, - /// Academic Press, Inc., 1980, Various pp. - /// - /// - /// Matrices for which the eigenvalues and right eigenvectors will - /// be computed - /// - /// - /// A tuple of: - /// w - /// The eigenvalues, each repeated according to its multiplicity. - /// The eigenvalues are not necessarily ordered. The resulting - /// array will be of complex type, unless the imaginary part is - /// zero in which case it will be cast to a real type. When a - /// is real the resulting eigenvalues will be real (0 imaginary - /// part) or occur in conjugate pairs - /// v - /// The normalized (unit “length”) eigenvectors, such that the - /// column v[:,i] is the eigenvector corresponding to the - /// eigenvalue w[i]. - /// - public static (NDarray, NDarray) eig(NDarray a) - => NumPy.Instance.linalg_eig(a); - } - - public static partial class linalg { - /// - /// Return the eigenvalues and eigenvectors of a complex Hermitian - /// (conjugate symmetric) or a real symmetric matrix. - /// - /// Returns two objects, a 1-D array containing the eigenvalues of a, and - /// a 2-D square array or matrix (depending on the input type) of the - /// corresponding eigenvectors (in columns). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues/eigenvectors are computed using LAPACK routines _syevd, - /// _heevd - /// - /// The eigenvalues of real symmetric or complex Hermitian matrices are - /// always real. [1] The array v of (column) eigenvectors is unitary - /// and a, w, and v satisfy the equations - /// dot(a, v[:, i]) = w[i] * v[:, i]. - /// - /// References - /// - /// - /// Hermitian or real symmetric matrices whose eigenvalues and - /// eigenvectors are to be computed. - /// - /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. - /// - /// - /// A tuple of: - /// w - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. - /// v - /// The column v[:, i] is the normalized eigenvector corresponding - /// to the eigenvalue w[i]. Will return a matrix object if a is - /// a matrix object. - /// - public static (NDarray, NDarray) eigh(NDarray a, string UPLO = "L") - => NumPy.Instance.linalg_eigh(a, UPLO:UPLO); - } - - public static partial class linalg { - /// - /// Compute the eigenvalues of a general matrix. - /// - /// Main difference between eigvals and eig: the eigenvectors aren’t - /// returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// - /// A complex- or real-valued matrix whose eigenvalues will be computed. - /// - /// - /// The eigenvalues, each repeated according to its multiplicity. - /// They are not necessarily ordered, nor are they necessarily - /// real for real matrices. - /// - public static NDarray eigvals(NDarray a) - => NumPy.Instance.linalg_eigvals(a); - } - - public static partial class linalg { - /// - /// Compute the eigenvalues of a complex Hermitian or real symmetric matrix. - /// - /// Main difference from eigh: the eigenvectors are not computed. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues are computed using LAPACK routines _syevd, _heevd - /// - /// - /// A complex- or real-valued matrix whose eigenvalues are to be - /// computed. - /// - /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. - /// - /// - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. - /// - public static NDarray eigvalsh(NDarray a, string UPLO = "L") - => NumPy.Instance.linalg_eigvalsh(a, UPLO:UPLO); - } - - public static partial class linalg { - /// - /// Compute the (multiplicative) inverse of a matrix. - /// - /// Given a square matrix a, return the matrix ainv satisfying - /// dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// - /// Matrix to be inverted. - /// - /// - /// (Multiplicative) inverse of the matrix a. - /// - public static NDarray inv(NDarray a) - => NumPy.Instance.linalg_inv(a); - } - - public static partial class linalg { - /// - /// Return the least-squares solution to a linear matrix equation. - /// - /// Solves the equation a x = b by computing a vector x that - /// minimizes the Euclidean 2-norm || b - a x ||^2. The equation may - /// be under-, well-, or over- determined (i.e., the number of - /// linearly independent rows of a can be less than, equal to, or - /// greater than its number of linearly independent columns). If a - /// is square and of full rank, then x (but for round-off error) is - /// the “exact” solution of the equation. - /// - /// Notes - /// - /// If b is a matrix, then all array results are returned as matrices. - /// - /// - /// “Coefficient” matrix. - /// - /// - /// Ordinate or “dependent variable” values. If b is two-dimensional, - /// the least-squares solution is calculated for each of the K columns - /// of b. - /// - /// - /// Cut-off ratio for small singular values of a. - /// For the purposes of rank determination, singular values are treated - /// as zero if they are smaller than rcond times the largest singular - /// value of a. - /// - /// - /// A tuple of: - /// x - /// Least-squares solution. If b is two-dimensional, - /// the solutions are in the K columns of x. - /// residuals - /// Sums of residuals; squared Euclidean 2-norm for each column in - /// b - a*x. - /// If the rank of a is < N or M <= N, this is an empty array. - /// If b is 1-dimensional, this is a (1,) shape array. - /// Otherwise the shape is (K,). - /// rank - /// Rank of matrix a. - /// s - /// Singular values of a. - /// - public static (NDarray, NDarray, int, NDarray) lstsq(NDarray a, NDarray b, float? rcond = null) - => NumPy.Instance.linalg_lstsq(a, b, rcond:rcond); - } - - public static partial class linalg { - /// - /// Compute the (Moore-Penrose) pseudo-inverse of a matrix. - /// - /// Calculate the generalized inverse of a matrix using its - /// singular-value decomposition (SVD) and including all - /// large singular values. - /// - /// Notes - /// - /// The pseudo-inverse of a matrix A, denoted , is - /// defined as: “the matrix that ‘solves’ [the least-squares problem] - /// ,” i.e., if is said solution, then - /// is that matrix such that . - /// - /// It can be shown that if is the singular - /// value decomposition of A, then - /// , where are - /// orthogonal matrices, is a diagonal matrix consisting - /// of A’s so-called singular values, (followed, typically, by - /// zeros), and then is simply the diagonal matrix - /// consisting of the reciprocals of A’s singular values - /// (again, followed by zeros). [1] - /// - /// References - /// - /// - /// Matrix or stack of matrices to be pseudo-inverted. - /// - /// - /// Cutoff for small singular values. - /// Singular values smaller (in modulus) than - /// rcond * largest_singular_value (again, in modulus) - /// are set to zero. Broadcasts against the stack of matrices - /// - /// - /// The pseudo-inverse of a. If a is a matrix instance, then so - /// is B. - /// - public static NDarray pinv(NDarray a, float rcond = 1e-15f) - => NumPy.Instance.linalg_pinv(a, rcond); - } - - public static partial class linalg { - /// - /// Solve a linear matrix equation, or system of linear scalar equations. - /// - /// Computes the “exact” solution, x, of the well-determined, i.e., full - /// rank, linear matrix equation ax = b. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The solutions are computed using LAPACK routine _gesv - /// - /// a must be square and of full-rank, i.e., all rows (or, equivalently, - /// columns) must be linearly independent; if either is not true, use - /// lstsq for the least-squares best “solution” of the - /// system/equation. - /// - /// References - /// - /// - /// Coefficient matrix. - /// - /// - /// Ordinate or “dependent variable” values. - /// - /// - /// Solution to the system a x = b. Returned shape is identical to b. - /// - public static NDarray solve(NDarray a, NDarray b) - => NumPy.Instance.linalg_solve(a, b); - } - - public static partial class linalg { - /// - /// Singular Value Decomposition. - /// - /// When a is a 2D array, it is factorized as u @ np.diag(s) @ vh - /// = (u * s) @ vh, where u and vh are 2D unitary arrays and s is a 1D - /// array of a’s singular values. When a is higher-dimensional, SVD is - /// applied in stacked mode as explained below. - /// - /// Notes - /// - /// The decomposition is performed using LAPACK routine _gesdd. - /// - /// SVD is usually described for the factorization of a 2D matrix . - /// The higher-dimensional case will be discussed below. In the 2D case, SVD is - /// written as , where , , - /// and . The 1D array s - /// contains the singular values of a and u and vh are unitary. The rows - /// of vh are the eigenvectors of and the columns of u are - /// the eigenvectors of . In both cases the corresponding - /// (possibly non-zero) eigenvalues are given by s**2. - /// - /// If a has more than two dimensions, then broadcasting rules apply, as - /// explained in Linear algebra on several matrices at once. This means that SVD is - /// working in “stacked” mode: it iterates over all indices of the first - /// a.ndim - 2 dimensions and for each combination SVD is applied to the - /// last two indices. The matrix a can be reconstructed from the - /// decomposition with either (u * s[..., None, :]) @ vh or - /// u @ (s[..., None] * vh). (The @ operator can be replaced by the - /// function np.matmul for python versions below 3.5.) - /// - /// If a is a matrix object (as opposed to an ndarray), then so are - /// all the return values. - /// - /// - /// A real or complex array with a.ndim >= 2. - /// - /// - /// If True (default), u and vh have the shapes (..., M, M) and - /// (..., N, N), respectively. Otherwise, the shapes are - /// (..., M, K) and (..., K, N), respectively, where - /// K = min(M, N). - /// - /// - /// Whether or not to compute u and vh in addition to s. True - /// by default. - /// - /// - /// A tuple of: - /// u - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. - /// s - /// Vector(s) with the singular values, within each vector sorted in - /// descending order. The first a.ndim - 2 dimensions have the same - /// size as those of the input a. - /// vh - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. - /// - public static (NDarray, NDarray, NDarray) svd(NDarray a, bool? full_matrices = true, bool? compute_uv = true) - => NumPy.Instance.linalg_svd(a, full_matrices:full_matrices, compute_uv:compute_uv); - } - - public static partial class fft { - /// - /// Compute the one-dimensional discrete Fourier Transform. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) with the efficient Fast Fourier Transform (FFT) - /// algorithm [CT]. - /// - /// Notes - /// - /// FFT (Fast Fourier Transform) refers to a way the discrete Fourier - /// Transform (DFT) can be calculated efficiently, by using symmetries in the - /// calculated terms. The symmetry is highest when n is a power of 2, and - /// the transform is therefore most efficient for these sizes. - /// - /// The DFT is defined, with the conventions used in this implementation, in - /// the documentation for the numpy.fft module. - /// - /// References - /// - /// - /// Input array, can be complex. - /// - /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// - public static NDarray fft_(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_fft(a, n:n, axis:axis, norm:norm); - } - - public static partial class fft { - /// - /// Compute the 2-dimensional discrete Fourier Transform - /// - /// This function computes the n-dimensional discrete Fourier Transform - /// over any axes in an M-dimensional array by means of the - /// Fast Fourier Transform (FFT). By default, the transform is computed over - /// the last two axes of the input array, i.e., a 2-dimensional FFT. - /// - /// Notes - /// - /// fft2 is just fftn with a different default for axes. - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of the transformed axes, the positive frequency terms - /// in the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// the axes, in order of decreasingly negative frequency. - /// - /// See fftn for details and a plotting example, and numpy.fft for - /// definitions and conventions used. - /// - /// - /// Input array, can be complex - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. - /// - public static NDarray fft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_fft2(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the N-dimensional discrete Fourier Transform. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional array by means of the Fast Fourier - /// Transform (FFT). - /// - /// Notes - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of all axes, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// See numpy.fft for details, definitions and conventions used. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the transform over that axis is - /// performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// - public static NDarray fftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_fftn(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the one-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier transform computed by fft. In other words, - /// ifft(fft(a)) == a to within numerical accuracy. - /// For a general description of the algorithm and definitions, - /// see numpy.fft. - /// - /// The input should be ordered in the same way as is returned by fft, - /// i.e., - /// - /// For an even number of input points, A[n//2] represents the sum of - /// the values at the positive and negative Nyquist frequencies, as the two - /// are aliased together. See numpy.fft for details. - /// - /// Notes - /// - /// If the input parameter n is larger than the size of the input, the input - /// is padded by appending zeros at the end. Even though this is the common - /// approach, it might lead to surprising results. If a different padding is - /// desired, it must be performed before calling ifft. - /// - /// - /// Input array, can be complex. - /// - /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// See notes about padding issues. - /// - /// - /// Axis over which to compute the inverse DFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// - public static NDarray ifft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_ifft(a, n:n, axis:axis, norm:norm); - } - - public static partial class fft { - /// - /// Compute the 2-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the 2-dimensional discrete Fourier - /// Transform over any number of axes in an M-dimensional array by means of - /// the Fast Fourier Transform (FFT). In other words, ifft2(fft2(a)) == a - /// to within numerical accuracy. By default, the inverse transform is - /// computed over the last two axes of the input array. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fft2, i.e. it should have the term for zero frequency - /// in the low-order corner of the two axes, the positive frequency terms in - /// the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// both axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// ifft2 is just ifftn with a different default for axes. - /// - /// See ifftn for details and a plotting example, and numpy.fft for - /// definition and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifft2 is called. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each axis) of the output (s[0] refers to axis 0, - /// s[1] to axis 1, etc.). This corresponds to n for ifft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. - /// - /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. - /// - public static NDarray ifft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_ifft2(a, s:s, axes:axes, norm:norm); - } - - public static partial class fft { - /// - /// Compute the N-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform over any number of axes in an M-dimensional array by - /// means of the Fast Fourier Transform (FFT). In other words, - /// ifftn(fftn(a)) == a to within numerical accuracy. - /// For a description of the definitions and conventions used, see numpy.fft. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fftn, i.e. it should have the term for zero frequency - /// in all axes in the low-order corner, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// See numpy.fft for definitions and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifftn is called. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for ifft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. - /// - /// - /// Axes over which to compute the IFFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// - public static NDarray ifftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_ifftn(a, s:s, axes:axes, norm:norm); - } - - /// - /// 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 - /// - /// - /// Argument of the Bessel function. - /// - /// - /// The modified Bessel function evaluated at each of the elements of x. - /// - public static NDarray i0(NDarray x) - => NumPy.Instance.i0(x); - - - } -} diff --git a/src/Numpy.Bare/np.logic.gen.cs b/src/Numpy.Bare/np.logic.gen.cs deleted file mode 100644 index 50d7699..0000000 --- a/src/Numpy.Bare/np.logic.gen.cs +++ /dev/null @@ -1,855 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// 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 static NDarray all(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.all(a, axis:axis, @out:@out, keepdims:keepdims); - - /// - /// 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// A new boolean or array is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public static bool all(NDarray a) - => NumPy.Instance.all(a); - - /// - /// 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// 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 static NDarray any(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.any(a, axis:axis, @out:@out, keepdims:keepdims); - - /// - /// 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// A new boolean or ndarray is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public static bool any(NDarray a) - => NumPy.Instance.any(a); - - /// - /// 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. - /// - /// - /// 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. - /// - /// - /// True where x is not positive infinity, negative infinity, - /// or NaN; false otherwise. - /// This is a scalar if x is a scalar. - /// - public static NDarray isfinite(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isfinite(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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. - /// - /// - /// True where x is positive or negative infinity, false otherwise. - /// This is a scalar if x is a scalar. - /// - public static NDarray isinf(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isinf(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input 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 NaN, false otherwise. - /// This is a scalar if x is a scalar. - /// - public static NDarray isnan(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isnan(x, @out:@out, @where:@where); - - /// - /// Test element-wise for NaT (not a time) and return result as a boolean array. - /// - /// - /// Input array with datetime or timedelta data type. - /// - /// - /// 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 static NDarray isnat(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isnat(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// The input array. - /// - /// - /// 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 static NDarray isneginf(NDarray x, NDarray @out = null) - => NumPy.Instance.isneginf(x, @out:@out); - - /// - /// 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 - /// - /// - /// The input array. - /// - /// - /// 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 static NDarray isposinf(NDarray x, NDarray y = null) - => NumPy.Instance.isposinf(x, y:y); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// Output array. - /// - public static NDarray iscomplex(NDarray x) - => NumPy.Instance.iscomplex(x); - - /// - /// Check for a complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. Even if the input - /// has an imaginary part equal to zero, iscomplexobj evaluates to True. - /// - /// - /// The input can be of any type and shape. - /// - /// - /// The return value, True if x is of a complex type or has at least - /// one complex element. - /// - public static bool iscomplexobj(object x) - => NumPy.Instance.iscomplexobj(x); - - /// - /// 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. - /// - /// - /// Input array. - /// - public static bool isfortran(NDarray a) - => NumPy.Instance.isfortran(a); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// Boolean array of same shape as x. - /// - public static NDarray isreal(NDarray x) - => NumPy.Instance.isreal(x); - - /// - /// Return True if x is a not complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. So even if the input - /// has an imaginary part equal to zero, isrealobj evaluates to False - /// if the data type is complex. - /// - /// - /// The input can be of any type and shape. - /// - /// - /// The return value, False if x is of a complex type. - /// - public static bool isrealobj(object x) - => NumPy.Instance.isrealobj(x); - - /// - /// Returns True if the type of num is a scalar type. - /// - /// Notes - /// - /// In almost all cases np.ndim(x) == 0 should be used instead of this - /// function, as that will also return true for 0d arrays. This is how - /// numpy overloads functions in the style of the dx arguments to gradient - /// and the bins argument to histogram. Some key differences: - /// - /// - /// Input argument, can be of any type and shape. - /// - /// - /// True if num is a scalar type, False if it is not. - /// - public static bool isscalar(object num) - => NumPy.Instance.isscalar(num); - - /// - /// Compute the truth value of x1 AND x2 element-wise. - /// - /// - /// Input arrays. x1 and x2 must be of the same shape. - /// - /// - /// 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 static NDarray logical_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_and(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray logical_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_or(x2, x1, @out:@out, @where:@where); - - /// - /// Compute the truth value of NOT x element-wise. - /// - /// - /// Logical NOT is applied to the elements 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. - /// - /// - /// 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 static NDarray logical_not(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_not(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray logical_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_xor(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static bool allclose(NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) - => NumPy.Instance.allclose(b, a, rtol, atol, equal_nan); - - /// - /// 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. - /// - /// - /// 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 static NDarray isclose(NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) - => NumPy.Instance.isclose(b, a, rtol, atol, equal_nan); - - /// - /// True if two arrays have the same shape and elements, False otherwise. - /// - /// - /// Input arrays. - /// - /// - /// Input arrays. - /// - /// - /// Returns True if the arrays are equal. - /// - public static bool array_equal(NDarray a2, NDarray a1) - => NumPy.Instance.array_equal(a2, a1); - - /// - /// 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. - /// - /// - /// Input arrays. - /// - /// - /// True if equivalent, False otherwise. - /// - public static bool array_equiv(NDarray a2, NDarray a1) - => NumPy.Instance.array_equiv(a2, a1); - - /// - /// 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). - /// - /// - /// 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 static NDarray greater(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.greater(x2, x1, @out:@out, @where:@where); - - /// - /// 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). - /// - /// - /// 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 static NDarray greater_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.greater_equal(x2, x1, @out:@out, @where:@where); - - /// - /// 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). - /// - /// - /// 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 static NDarray less(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.less(x2, x1, @out:@out, @where:@where); - - /// - /// 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). - /// - /// - /// 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 static NDarray less_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.less_equal(x2, x1, @out:@out, @where:@where); - - /// - /// Return (x1 == x2) element-wise. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// 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 static NDarray equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.equal(x2, x1, @out:@out, @where:@where); - - /// - /// Return (x1 != x2) element-wise. - /// - /// - /// Input arrays. - /// - /// - /// 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 static NDarray not_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.not_equal(x2, x1, @out:@out, @where:@where); - - - } -} diff --git a/src/Numpy.Bare/np.math.gen.cs b/src/Numpy.Bare/np.math.gen.cs deleted file mode 100644 index 16311f5..0000000 --- a/src/Numpy.Bare/np.math.gen.cs +++ /dev/null @@ -1,3130 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// 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. - /// - /// - /// Angle, in radians ( rad equals 360 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 sine of each element of x. - /// This is a scalar if x is a scalar. - /// - public static NDarray sin(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sin(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input array in 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 cosine values. - /// This is a scalar if x is a scalar. - /// - public static NDarray cos(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.cos(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input 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 corresponding tangent values. - /// This is a scalar if x is a scalar. - /// - public static NDarray tan(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.tan(x, @out:@out, @where:@where); - - /// - /// 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/ - /// - /// - /// y-coordinate on the unit circle. - /// - /// - /// 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 static NDarray arcsin(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arcsin(x, @out:@out, @where:@where); - - /// - /// 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/ - /// - /// - /// x-coordinate on the unit circle. - /// For real arguments, the domain is [-1, 1]. - /// - /// - /// 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 static NDarray arccos(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arccos(x, @out:@out, @where:@where); - - /// - /// 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 static NDarray arctan(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arctan(x, @out:@out, @where:@where); - - /// - /// 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). - /// - /// - /// 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 static NDarray hypot(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.hypot(x2, x1, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// y-coordinates. - /// - /// - /// 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 static NDarray arctan2(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arctan2(x1, x2, @out:@out, @where:@where); - - /// - /// Convert angles from radians to degrees. - /// - /// - /// Input array in 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 degree values; if out was supplied this is a - /// reference to it. - /// This is a scalar if x is a scalar. - /// - public static NDarray degrees(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.degrees(x, @out:@out, @where:@where); - - /// - /// Convert angles from degrees to radians. - /// - /// - /// Input array in 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 radian values. - /// This is a scalar if x is a scalar. - /// - public static NDarray radians(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.radians(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// Maximum discontinuity between values, default is pi. - /// - /// - /// Axis along which unwrap will operate, default is the last axis. - /// - /// - /// Output array. - /// - public static NDarray unwrap(NDarray p, float? discont = 3.141592653589793f, int? axis = -1) - => NumPy.Instance.unwrap(p, discont:discont, axis:axis); - - /// - /// Convert angles from degrees to radians. - /// - /// Notes - /// - /// deg2rad(x) is x * pi / 180. - /// - /// - /// Angles in 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 angle in radians. - /// This is a scalar if x is a scalar. - /// - public static NDarray deg2rad(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.deg2rad(x, @out:@out, @where:@where); - - /// - /// Convert angles from radians to degrees. - /// - /// Notes - /// - /// rad2deg(x) is 180 * x / pi. - /// - /// - /// Angle in 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 angle in degrees. - /// This is a scalar if x is a scalar. - /// - public static NDarray rad2deg(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.rad2deg(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input 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 corresponding hyperbolic sine values. - /// This is a scalar if x is a scalar. - /// - public static NDarray sinh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sinh(x, @out:@out, @where:@where); - - /// - /// Hyperbolic cosine, element-wise. - /// - /// Equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j*x). - /// - /// - /// Input 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. - /// - /// - /// Output array of same shape as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray cosh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.cosh(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input 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 corresponding hyperbolic tangent values. - /// This is a scalar if x is a scalar. - /// - public static NDarray tanh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.tanh(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray arcsinh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arcsinh(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray arccosh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arccosh(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray arctanh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arctanh(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input data. - /// - /// - /// 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 static NDarray around(NDarray a, int? decimals = 0, NDarray @out = null) - => NumPy.Instance.around(a, decimals:decimals, @out:@out); - - /// - /// Round elements of the array to the nearest integer. - /// - /// - /// Input 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. - /// - /// - /// Output array is same shape and type as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray rint(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.rint(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// An array of floats to be rounded - /// - /// - /// Output array - /// - /// - /// The array of rounded numbers - /// - public static NDarray fix(NDarray x, NDarray y = null) - => NumPy.Instance.fix(x, y:y); - - /// - /// 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. - /// - /// - /// Input 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 floor of each element in x. - /// This is a scalar if x is a scalar. - /// - public static NDarray floor(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.floor(x, @out:@out, @where:@where); - - /// - /// 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 . - /// - /// - /// Input 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 ceiling of each element in x, with float dtype. - /// This is a scalar if x is a scalar. - /// - public static NDarray ceil(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.ceil(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input 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 truncated value of each element in x. - /// This is a scalar if x is a scalar. - /// - public static NDarray trunc(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.trunc(x, @out:@out, @where:@where); - - /// - /// 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: - /// - /// - /// Input data. - /// - /// - /// 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 static NDarray prod(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.prod(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); - - /// - /// 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: - /// - /// - /// Elements to sum. - /// - /// - /// 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 static NDarray sum(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.sum(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); - - /// - /// 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. - /// - /// - /// Array containing numbers whose product is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// 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 static NDarray nanprod(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanprod(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - - /// - /// 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). - /// - /// - /// Array containing numbers whose sum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// 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 static NDarray nansum(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nansum(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray cumprod(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.cumprod(a, axis:axis, dtype:dtype, @out:@out); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray cumsum(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.cumsum(a, axis:axis, dtype:dtype, @out:@out); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray nancumprod(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.nancumprod(a, axis:axis, dtype:dtype, @out:@out); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray nancumsum(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.nancumsum(a, axis:axis, dtype:dtype, @out:@out); - - /// - /// 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: - /// - /// - /// Input array - /// - /// - /// 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 static NDarray diff(NDarray a, int? n = 1, int? axis = -1, NDarray append = null, NDarray prepend = null) - => NumPy.Instance.diff(a, n:n, axis:axis, append:append, prepend:prepend); - - /// - /// 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. - /// - /// - /// If necessary, will be flattened before the differences are taken. - /// - /// - /// 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 static NDarray ediff1d(NDarray ary, NDarray to_end = null, NDarray to_begin = null) - => NumPy.Instance.ediff1d(ary, to_end:to_end, to_begin:to_begin); - - /// - /// 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, NDarray varargs = null, int? edge_order = null, int[] axis = null) - => NumPy.Instance.gradient(f, varargs:varargs, edge_order:edge_order, axis:axis); - - /// - /// 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 first vector(s). - /// - /// - /// 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 static NDarray cross(NDarray a, NDarray b, int? axisa = -1, int? axisb = -1, int? axisc = -1, int? axis = null) - => NumPy.Instance.cross(a, b, axisa:axisa, axisb:axisb, axisc:axisc, axis:axis); - - /// - /// 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 - /// - /// - /// Input array to integrate. - /// - /// - /// 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 static float trapz(NDarray y, NDarray x = null, float? dx = 1.0f, int? axis = -1) - => NumPy.Instance.trapz(y, x:x, dx:dx, axis:axis); - - /// - /// 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 - /// - /// - /// 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. - /// - /// - /// Output array, element-wise exponential of x. - /// This is a scalar if x is a scalar. - /// - public static NDarray exp(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.exp(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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. - /// - /// - /// Element-wise exponential minus one: out = exp(x) - 1. - /// This is a scalar if x is a scalar. - /// - public static NDarray expm1(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.expm1(x, @out:@out, @where:@where); - - /// - /// Calculate 2**p for all p in the input array. - /// - /// 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. - /// - /// - /// Element-wise 2 to the power x. - /// This is a scalar if x is a scalar. - /// - public static NDarray exp2(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.exp2(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input value. - /// - /// - /// 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 static NDarray log(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// 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. - /// - /// - /// 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 static NDarray log10(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log10(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 x. - /// This is a scalar if x is a scalar. - /// - public static NDarray log2(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log2(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// 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. - /// - /// - /// Natural logarithm of 1 + x, element-wise. - /// This is a scalar if x is a scalar. - /// - public static NDarray log1p(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log1p(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray logaddexp(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logaddexp(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray logaddexp2(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logaddexp2(x2, x1, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Array (possibly multi-dimensional) of values for which to to - /// calculate sinc(x). - /// - /// - /// sinc(x), which has the same shape as the input. - /// - public static NDarray sinc(NDarray x) - => NumPy.Instance.sinc(x); - - /// - /// Returns element-wise True where signbit is set (less than zero). - /// - /// - /// The input value(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. - /// - /// - /// Output array, or reference to out if that was supplied. - /// This is a scalar if x is a scalar. - /// - public static NDarray signbit(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.signbit(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Values to change the sign of. - /// - /// - /// 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 static NDarray copysign(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.copysign(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Array of numbers to be decomposed. - /// - /// - /// 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 static (NDarray, NDarray) frexp(NDarray x, NDarray out1 = null, NDarray out2 = null, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.frexp(x, out1:out1, out2:out2, @out:@out, @where:@where); - - /// - /// 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 multipliers. - /// - /// - /// 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 static NDarray ldexp(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.ldexp(x1, x2, @out:@out, @where:@where); - - /// - /// Return the next floating-point value after x1 towards x2, element-wise. - /// - /// - /// Values to find the next representable value of. - /// - /// - /// 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 static NDarray nextafter(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.nextafter(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Values to find the spacing of. - /// - /// - /// 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 static NDarray spacing(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.spacing(x, @out:@out, @where:@where); - - /// - /// Returns the lowest common multiple of |x1| and |x2| - /// - /// - /// Arrays of values - /// - /// - /// 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 static NDarray lcm(NDarray x2, NDarray x1) - => NumPy.Instance.lcm(x2, x1); - - /// - /// Returns the greatest common divisor of |x1| and |x2| - /// - /// - /// Arrays of values - /// - /// - /// 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 static NDarray gcd(NDarray x2, NDarray x1) - => NumPy.Instance.gcd(x2, x1); - - /// - /// 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). - /// - /// - /// 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 static NDarray @add(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.@add(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input 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. - /// - /// - /// Return array. - /// This is a scalar if x is a scalar. - /// - public static NDarray reciprocal(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.reciprocal(x, @out:@out, @where:@where); - - /// - /// Numerical positive, element-wise. - /// - /// Notes - /// - /// Equivalent to x.copy(), but only defined for types that support - /// arithmetic. - /// - /// - /// Input array. - /// - /// - /// Returned array or scalar: y = +x. - /// This is a scalar if x is a scalar. - /// - public static NDarray positive(NDarray x) - => NumPy.Instance.positive(x); - - /// - /// Numerical negative, element-wise. - /// - /// - /// Input 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. - /// - /// - /// Returned array or scalar: y = -x. - /// This is a scalar if x is a scalar. - /// - public static NDarray negative(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.negative(x, @out:@out, @where:@where); - - /// - /// Multiply arguments element-wise. - /// - /// Notes - /// - /// Equivalent to x1 * x2 in terms of array broadcasting. - /// - /// - /// Input arrays to be multiplied. - /// - /// - /// 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 static NDarray multiply(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.multiply(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 static NDarray divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.divide(x1, x2, @out:@out, @where:@where); - - /// - /// 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 bases. - /// - /// - /// 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 static NDarray power(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.power(x1, x2, @out:@out, @where:@where); - - /// - /// Subtract arguments, element-wise. - /// - /// Notes - /// - /// Equivalent to x1 - x2 in terms of array broadcasting. - /// - /// - /// The arrays to be subtracted from each other. - /// - /// - /// 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 static NDarray subtract(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.subtract(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 static NDarray true_divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.true_divide(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Numerator. - /// - /// - /// 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 static NDarray floor_divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.floor_divide(x1, x2, @out:@out, @where:@where); - - /// - /// 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 bases. - /// - /// - /// 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 static NDarray float_power(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.float_power(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Dividend. - /// - /// - /// 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 static NDarray fmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fmod(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 static NDarray mod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.mod(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input 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: - /// 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 static (NDarray, NDarray) modf(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.modf(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 static NDarray remainder(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.remainder(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 static (NDarray, NDarray) divmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.divmod(x1, x2, @out:@out, @where:@where); - - /// - /// Return the angle of the complex argument. - /// - /// - /// A complex number or sequence of complex numbers. - /// - /// - /// 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 static NDarray angle(NDarray z, bool? deg = false) - => NumPy.Instance.angle(z, deg:deg); - - /// - /// Return the real part of the complex argument. - /// - /// - /// Input array. - /// - /// - /// The real component of the complex argument. If val is real, the type - /// of val is used for the output. If val has complex elements, the - /// returned type is float. - /// - public static NDarray real(NDarray val) - => NumPy.Instance.real(val); - - /// - /// Return the imaginary part of the complex argument. - /// - /// - /// Input array. - /// - /// - /// The imaginary component of the complex argument. If val is real, - /// the type of val is used for the output. If val has complex - /// elements, the returned type is float. - /// - public static NDarray imag(NDarray val) - => NumPy.Instance.imag(val); - - /// - /// Return the complex conjugate, element-wise. - /// - /// The complex conjugate of a complex number is obtained by changing the - /// sign of its imaginary part. - /// - /// - /// Input value. - /// - /// - /// 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 static NDarray conj(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.conj(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// First one-dimensional input array. - /// - /// - /// Second one-dimensional input array. - /// - /// - /// Discrete, linear convolution of a and v. - /// - public static NDarray convolve(NDarray a, NDarray v, string mode = "full") - => NumPy.Instance.convolve(a, v, mode:mode); - - /// - /// 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. - /// - /// - /// Array containing elements to clip. - /// - /// - /// 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 static NDarray clip(NDarray a, NDarray a_min, NDarray a_max, NDarray @out = null) - => NumPy.Instance.clip(a, a_min, a_max, @out:@out); - - /// - /// 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. - /// - /// - /// The values whose square-roots are required. - /// - /// - /// 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 static NDarray sqrt(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sqrt(x, @out:@out, @where:@where); - - /// - /// Return the cube-root of an array, element-wise. - /// - /// - /// The values whose cube-roots are required. - /// - /// - /// 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 static NDarray cbrt(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.cbrt(x, @out:@out, @where:@where); - - /// - /// Return the element-wise square of the input. - /// - /// - /// Input 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. - /// - /// - /// Element-wise x*x, of the same shape and dtype as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray square(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.square(x, @out:@out, @where:@where); - - /// - /// Calculate the absolute value element-wise. - /// - /// np.abs is a shorthand for this function. - /// - /// - /// Input 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. - /// - /// - /// 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 static NDarray absolute(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.absolute(x, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// The array of numbers for which the absolute values are required. If - /// x is a scalar, the result y will also be a scalar. - /// - /// - /// 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 static NDarray fabs(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fabs(x, @out:@out, @where:@where); - - /// - /// 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, . - /// - /// - /// 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. - /// - /// - /// The sign of x. - /// This is a scalar if x is a scalar. - /// - public static NDarray sign(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sign(x, @out:@out, @where:@where); - - /// - /// 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 - /// - /// - /// Input values. - /// - /// - /// 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 static NDarray heaviside(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.heaviside(x1, x2, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray maximum(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.maximum(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray minimum(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.minimum(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray fmax(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fmax(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// 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 static NDarray fmin(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fmin(x2, x1, @out:@out, @where:@where); - - /// - /// 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. - /// - /// - /// Input data. - /// - /// - /// 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 static NDarray nan_to_num(NDarray x, bool? copy = true) - => NumPy.Instance.nan_to_num(x, copy:copy); - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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 static NDarray real_if_close(NDarray a, float tol = 100) - => NumPy.Instance.real_if_close(a, tol); - - /* - /// - /// 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 float or complex (corresponding to fp) or ndarray interp(NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - => NumPy.Instance.interp(x, xp, fp, left:left, right:right, period:period); - */ - - - } -} diff --git a/src/Numpy.Bare/np.padding.gen.cs b/src/Numpy.Bare/np.padding.gen.cs deleted file mode 100644 index ef33919..0000000 --- a/src/Numpy.Bare/np.padding.gen.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Pads an array. - /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes. This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis. - /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced. It has the - /// following signature: - /// - /// where - /// - /// - /// Input array - /// - /// - /// Number of values padded to the edges of each axis. - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis. - /// ((before, after),) yields same before and after pad for each axis. - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. - /// - /// - /// One of the following string values or a user supplied function. - /// - /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis. - /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis. - /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes. - /// - /// Default is None, to use the entire axis. - /// - /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis. - /// - /// ((before, after),) yields same before and after constants for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis. - /// - /// ((before, after),) yields same before and after end values for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value. For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. - /// - /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. - /// - public static NDarray pad(NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - => NumPy.Instance.pad(array, pad_width, mode, stat_length:stat_length, constant_values:constant_values, end_values:end_values, reflect_type:reflect_type); - - - } -} diff --git a/src/Numpy.Bare/np.random.gen.cs b/src/Numpy.Bare/np.random.gen.cs deleted file mode 100644 index 1470407..0000000 --- a/src/Numpy.Bare/np.random.gen.cs +++ /dev/null @@ -1,2028 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - public static partial class random { - /// - /// Random values in a given shape. - /// - /// Create an array of the given shape and populate it with - /// random samples from a uniform distribution - /// over [0, 1). - /// - /// Notes - /// - /// This is a convenience function. If you want an interface that - /// takes a shape-tuple as the first argument, refer to - /// np.random.random_sample . - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// Random values. - /// - public static NDarray rand(int? d1 = null, int? d0 = null) - => NumPy.Instance.random_rand(d1:d1, d0:d0); - } - - public static partial class random { - /// - /// Return a sample (or samples) from the “standard normal” distribution. - /// - /// If positive, int_like or int-convertible arguments are provided, - /// randn generates an array of shape (d0, d1, ..., dn), filled - /// with random floats sampled from a univariate “normal” (Gaussian) - /// distribution of mean 0 and variance 1 (if any of the are - /// floats, they are first converted to integers by truncation). A single - /// float randomly sampled from the distribution is returned if no - /// argument is provided. - /// - /// This is a convenience function. If you want an interface that takes a - /// tuple as the first argument, use numpy.random.standard_normal instead. - /// - /// Notes - /// - /// For random samples from , use: - /// - /// sigma * np.random.randn(...) + mu - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// A (d0, d1, ..., dn)-shaped array of floating-point samples from - /// the standard normal distribution, or a single such float if - /// no parameters were supplied. - /// - public static NDarray randn(int? d1 = null, int? d0 = null) - => NumPy.Instance.random_randn(d1:d1, d0:d0); - } - - public static partial class random { - /// - /// Return random integers from low (inclusive) to high (exclusive). - /// - /// Return random integers from the “discrete uniform” distribution of - /// the specified dtype in the “half-open” interval [low, high). If - /// high is None (the default), then results are from [0, low). - /// - /// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is one above the - /// highest such integer). - /// - /// - /// If provided, one above the largest (signed) integer to be drawn - /// from the distribution (see above for behavior if high=None). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Desired dtype of the result. All dtypes are determined by their - /// name, i.e., ‘int64’, ‘int’, etc, so byteorder is not available - /// and a specific precision may have different C types depending - /// on the platform. The default value is ‘np.int’. - /// - /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. - /// - public static NDarray randint(int low, int? high = null, int[] size = null, Dtype dtype = null) - => NumPy.Instance.random_randint(low, high:high, size:size, dtype:dtype); - } - - public static partial class random { - /// - /// Random integers of type np.int between low and high, inclusive. - /// - /// Return random integers of type np.int from the “discrete uniform” - /// distribution in the closed interval [low, high]. If high is - /// None (the default), then results are from [1, low]. The np.int - /// type translates to the C long type used by Python 2 for “short” - /// integers and its precision is platform dependent. - /// - /// This function has been deprecated. Use randint instead. - /// - /// Notes - /// - /// To sample from N evenly spaced floating-point numbers between a and b, - /// use: - /// - /// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is the highest such - /// integer). - /// - /// - /// If provided, the largest (signed) integer to be drawn from the - /// distribution (see above for behavior if high=None). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. - /// - public static NDarray random_integers(int low, int? high = null, int[] size = null) - => NumPy.Instance.random_random_integers(low, high:high, size:size); - } - - public static partial class random { - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public static NDarray random_sample(int[] size = null) - => NumPy.Instance.random_random_sample(size:size); - } - - public static partial class random { - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public static NDarray random_(int[] size = null) - => NumPy.Instance.random_random(size:size); - } - - public static partial class random { - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public static NDarray ranf(int[] size = null) - => NumPy.Instance.random_ranf(size:size); - } - - public static partial class random { - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public static NDarray sample(int[] size = null) - => NumPy.Instance.random_sample(size:size); - } - - public static partial class random { - /// - /// Generates a random sample from a given 1-D array - /// - /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Whether the sample is with or without replacement - /// - /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. - /// - /// - /// The generated random samples - /// - public static NDarray choice(NDarray a, int[] size = null, bool? replace = true, NDarray p = null) - => NumPy.Instance.random_choice(a, size:size, replace:replace, p:p); - } - - public static partial class random { - /// - /// Generates a random sample from a given 1-D array - /// - /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Whether the sample is with or without replacement - /// - /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. - /// - /// - /// The generated random samples - /// - public static NDarray choice(int a, int[] size = null, bool? replace = true, NDarray p = null) - => NumPy.Instance.random_choice(a, size:size, replace:replace, p:p); - } - - public static partial class random { - /// - /// Return random bytes. - /// - /// - /// Number of random bytes. - /// - /// - /// String of length length. - /// - public static string bytes(int length) - => NumPy.Instance.random_bytes(length); - } - - public static partial class random { - /// - /// Modify a sequence in-place by shuffling its contents. - /// - /// This function only shuffles the array along the first axis of a - /// multi-dimensional array. The order of sub-arrays is changed but - /// their contents remains the same. - /// - /// - /// The array or list to be shuffled. - /// - public static void shuffle(NDarray x) - => NumPy.Instance.random_shuffle(x); - } - - public static partial class random { - /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. - /// - /// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. - /// - /// - /// Permuted sequence or array range. - /// - public static NDarray permutation(NDarray x) - => NumPy.Instance.random_permutation(x); - } - - public static partial class random { - /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. - /// - /// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. - /// - /// - /// Permuted sequence or array range. - /// - public static NDarray permutation(int x) - => NumPy.Instance.random_permutation(x); - } - - public static partial class random { - /// - /// Draw samples from a Beta distribution. - /// - /// The Beta distribution is a special case of the Dirichlet distribution, - /// and is related to the Gamma distribution. It has the probability - /// distribution function - /// - /// where the normalisation, B, is the beta function, - /// - /// It is often seen in Bayesian inference and order statistics. - /// - /// - /// Alpha, positive (>0). - /// - /// - /// Beta, positive (>0). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a and b are both scalars. - /// Otherwise, np.broadcast(a, b).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized beta distribution. - /// - public static NDarray beta(NDarray a, NDarray b, int[] size = null) - => NumPy.Instance.random_beta(a, b, size:size); - } - - public static partial class random { - /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References - /// - /// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. - /// - public static NDarray binomial(NDarray n, NDarray p, int[] size = null) - => NumPy.Instance.random_binomial(n, p, size:size); - } - - public static partial class random { - /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References - /// - /// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. - /// - public static NDarray binomial(int n, NDarray p, int[] size = null) - => NumPy.Instance.random_binomial(n, p, size:size); - } - - public static partial class random { - /// - /// Draw samples from a chi-square distribution. - /// - /// When df independent random variables, each with standard normal - /// distributions (mean 0, variance 1), are squared and summed, the - /// resulting distribution is chi-square (see Notes). This distribution - /// is often used in hypothesis testing. - /// - /// Notes - /// - /// The variable obtained by summing the squares of df independent, - /// standard normally distributed random variables: - /// - /// is chi-square distributed, denoted - /// - /// The probability density function of the chi-squared distribution is - /// - /// where is the gamma function, - /// - /// References - /// - /// - /// Number of degrees of freedom, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized chi-square distribution. - /// - public static NDarray chisquare(NDarray df, int[] size = null) - => NumPy.Instance.random_chisquare(df, size:size); - } - - public static partial class random { - /// - /// Draw samples from the Dirichlet distribution. - /// - /// Draw size samples of dimension k from a Dirichlet distribution. A - /// Dirichlet-distributed random variable can be seen as a multivariate - /// generalization of a Beta distribution. Dirichlet pdf is the conjugate - /// prior of a multinomial in Bayesian inference. - /// - /// Notes - /// - /// Uses the following property for computation: for each dimension, - /// draw a random sample y_i from a standard gamma generator of shape - /// alpha_i, then - /// is - /// Dirichlet distributed. - /// - /// References - /// - /// - /// Parameter of the distribution (k dimension for sample of - /// dimension k). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples, of shape (size, alpha.ndim). - /// - public static NDarray dirichlet(NDarray alpha, int[] size = null) - => NumPy.Instance.random_dirichlet(alpha, size:size); - } - - public static partial class random { - /// - /// Draw samples from an exponential distribution. - /// - /// Its probability density function is - /// - /// for x > 0 and 0 elsewhere. is the scale parameter, - /// which is the inverse of the rate parameter . - /// The rate parameter is an alternative, widely used parameterization - /// of the exponential distribution [3]. - /// - /// The exponential distribution is a continuous analogue of the - /// geometric distribution. It describes many common situations, such as - /// the size of raindrops measured over many rainstorms [1], or the time - /// between page requests to Wikipedia [2]. - /// - /// References - /// - /// - /// The scale parameter, . - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized exponential distribution. - /// - public static NDarray exponential(NDarray scale = null, int[] size = null) - => NumPy.Instance.random_exponential(scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from an F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters should be greater than - /// zero. - /// - /// The random variate of the F distribution (also known as the - /// Fisher distribution) is a continuous probability distribution - /// that arises in ANOVA tests, and is the ratio of two chi-square - /// variates. - /// - /// Notes - /// - /// The F statistic is used to compare in-group variances to between-group - /// variances. Calculating the distribution depends on the sampling, and - /// so it is a function of the respective degrees of freedom in the - /// problem. The variable dfnum is the number of samples minus one, the - /// between-groups degrees of freedom, while dfden is the within-groups - /// degrees of freedom, the sum of the number of samples in each group - /// minus the number of groups. - /// - /// References - /// - /// - /// Degrees of freedom in numerator, should be > 0. - /// - /// - /// Degrees of freedom in denominator, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum and dfden are both scalars. - /// Otherwise, np.broadcast(dfnum, dfden).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Fisher distribution. - /// - public static NDarray f(NDarray dfnum, NDarray dfden, int[] size = null) - => NumPy.Instance.random_f(dfnum, dfden, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale (sometimes designated - /// “theta”), where both parameters are > 0. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References - /// - /// - /// The shape of the gamma distribution. Should be greater than zero. - /// - /// - /// The scale of the gamma distribution. Should be greater than zero. - /// Default is equal to 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape and scale are both scalars. - /// Otherwise, np.broadcast(shape, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized gamma distribution. - /// - public static NDarray gamma(Shape shape, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_gamma(shape, scale:scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from the geometric distribution. - /// - /// Bernoulli trials are experiments with one of two outcomes: - /// success or failure (an example of such an experiment is flipping - /// a coin). The geometric distribution models the number of trials - /// that must be run in order to achieve success. It is therefore - /// supported on the positive integers, k = 1, 2, .... - /// - /// The probability mass function of the geometric distribution is - /// - /// where p is the probability of success of an individual trial. - /// - /// - /// The probability of success of an individual trial. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized geometric distribution. - /// - public static NDarray geometric(NDarray p, int[] size = null) - => NumPy.Instance.random_geometric(p, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Gumbel distribution. - /// - /// Draw samples from a Gumbel distribution with specified location and - /// scale. For more information on the Gumbel distribution, see - /// Notes and References below. - /// - /// Notes - /// - /// The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme - /// Value Type I) distribution is one of a class of Generalized Extreme - /// Value (GEV) distributions used in modeling extreme value problems. - /// The Gumbel is a special case of the Extreme Value Type I distribution - /// for maximums from distributions with “exponential-like” tails. - /// - /// The probability density for the Gumbel distribution is - /// - /// where is the mode, a location parameter, and - /// is the scale parameter. - /// - /// The Gumbel (named for German mathematician Emil Julius Gumbel) was used - /// very early in the hydrology literature, for modeling the occurrence of - /// flood events. It is also used for modeling maximum wind speed and - /// rainfall rates. It is a “fat-tailed” distribution - the probability of - /// an event in the tail of the distribution is larger than if one used a - /// Gaussian, hence the surprisingly frequent occurrence of 100-year - /// floods. Floods were initially modeled as a Gaussian process, which - /// underestimated the frequency of extreme events. - /// - /// It is one of a class of extreme value distributions, the Generalized - /// Extreme Value (GEV) distributions, which also includes the Weibull and - /// Frechet. - /// - /// The function has a mean of and a variance - /// of . - /// - /// References - /// - /// - /// The location of the mode of the distribution. Default is 0. - /// - /// - /// The scale parameter of the distribution. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Gumbel distribution. - /// - public static NDarray gumbel(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_gumbel(loc:loc, scale:scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Hypergeometric distribution. - /// - /// Samples are drawn from a hypergeometric distribution with specified - /// parameters, ngood (ways to make a good selection), nbad (ways to make - /// a bad selection), and nsample = number of items sampled, which is less - /// than or equal to the sum ngood + nbad. - /// - /// Notes - /// - /// The probability density for the Hypergeometric distribution is - /// - /// where and - /// - /// for P(x) the probability of x successes, g = ngood, b = nbad, and - /// n = number of samples. - /// - /// Consider an urn with black and white marbles in it, ngood of them - /// black and nbad are white. If you draw nsample balls without - /// replacement, then the hypergeometric distribution describes the - /// distribution of black balls in the drawn sample. - /// - /// Note that this distribution is very similar to the binomial - /// distribution, except that in this case, samples are drawn without - /// replacement, whereas in the Binomial case samples are drawn with - /// replacement (or the sample space is infinite). As the sample space - /// becomes large, this distribution approaches the binomial. - /// - /// References - /// - /// - /// Number of ways to make a good selection. Must be nonnegative. - /// - /// - /// Number of ways to make a bad selection. Must be nonnegative. - /// - /// - /// Number of items sampled. Must be at least 1 and at most - /// ngood + nbad. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if ngood, nbad, and nsample - /// are all scalars. Otherwise, np.broadcast(ngood, nbad, nsample).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized hypergeometric distribution. - /// - public static NDarray hypergeometric(NDarray ngood, NDarray nbad, NDarray nsample, int[] size = null) - => NumPy.Instance.random_hypergeometric(ngood, nbad, nsample, size:size); - } - - public static partial class random { - /// - /// Draw samples from the Laplace or double exponential distribution with - /// specified location (or mean) and scale (decay). - /// - /// The Laplace distribution is similar to the Gaussian/normal distribution, - /// but is sharper at the peak and has fatter tails. It represents the - /// difference between two independent, identically distributed exponential - /// random variables. - /// - /// Notes - /// - /// It has the probability density function - /// - /// The first law of Laplace, from 1774, states that the frequency - /// of an error can be expressed as an exponential function of the - /// absolute magnitude of the error, which leads to the Laplace - /// distribution. For many problems in economics and health - /// sciences, this distribution seems to model the data better - /// than the standard Gaussian distribution. - /// - /// References - /// - /// - /// The position, , of the distribution peak. Default is 0. - /// - /// - /// , the exponential decay. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Laplace distribution. - /// - public static NDarray laplace(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_laplace(loc:loc, scale:scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from a logistic distribution. - /// - /// Samples are drawn from a logistic distribution with specified - /// parameters, loc (location or mean, also median), and scale (>0). - /// - /// Notes - /// - /// The probability density for the Logistic distribution is - /// - /// where = location and = scale. - /// - /// The Logistic distribution is used in Extreme Value problems where it - /// can act as a mixture of Gumbel distributions, in Epidemiology, and by - /// the World Chess Federation (FIDE) where it is used in the Elo ranking - /// system, assuming the performance of each player is a logistically - /// distributed random variable. - /// - /// References - /// - /// - /// Parameter of the distribution. Default is 0. - /// - /// - /// Parameter of the distribution. Should be greater than zero. - /// Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized logistic distribution. - /// - public static NDarray logistic(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_logistic(loc:loc, scale:scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from a log-normal distribution. - /// - /// Draw samples from a log-normal distribution with specified mean, - /// standard deviation, and array shape. Note that the mean and standard - /// deviation are not the values for the distribution itself, but of the - /// underlying normal distribution it is derived from. - /// - /// Notes - /// - /// A variable x has a log-normal distribution if log(x) is normally - /// distributed. The probability density function for the log-normal - /// distribution is: - /// - /// where is the mean and is the standard - /// deviation of the normally distributed logarithm of the variable. - /// A log-normal distribution results if a random variable is the product - /// of a large number of independent, identically-distributed variables in - /// the same way that a normal distribution results if the variable is the - /// sum of a large number of independent, identically-distributed - /// variables. - /// - /// References - /// - /// - /// Mean value of the underlying normal distribution. Default is 0. - /// - /// - /// Standard deviation of the underlying normal distribution. Should - /// be greater than zero. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and sigma are both scalars. - /// Otherwise, np.broadcast(mean, sigma).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized log-normal distribution. - /// - public static NDarray lognormal(NDarray mean = null, NDarray sigma = null, int[] size = null) - => NumPy.Instance.random_lognormal(mean:mean, sigma:sigma, size:size); - } - - public static partial class random { - /// - /// Draw samples from a logarithmic series distribution. - /// - /// Samples are drawn from a log series distribution with specified - /// shape parameter, 0 < p < 1. - /// - /// Notes - /// - /// The probability density for the Log Series distribution is - /// - /// where p = probability. - /// - /// The log series distribution is frequently used to represent species - /// richness and occurrence, first proposed by Fisher, Corbet, and - /// Williams in 1943 [2]. It may also be used to model the numbers of - /// occupants seen in cars [3]. - /// - /// References - /// - /// - /// Shape parameter for the distribution. Must be in the range (0, 1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized logarithmic series distribution. - /// - public static NDarray logseries(NDarray p, int[] size = null) - => NumPy.Instance.random_logseries(p, size:size); - } - - public static partial class random { - /// - /// Draw samples from a multinomial distribution. - /// - /// The multinomial distribution is a multivariate generalisation of the - /// binomial distribution. Take an experiment with one of p - /// possible outcomes. An example of such an experiment is throwing a dice, - /// where the outcome can be 1 through 6. Each sample drawn from the - /// distribution represents n such experiments. Its values, - /// X_i = [X_0, X_1, ..., X_p], represent the number of times the - /// outcome was i. - /// - /// - /// Number of experiments. - /// - /// - /// Probabilities of each of the p different outcomes. These - /// should sum to 1 (however, the last element is always assumed to - /// account for the remaining probability, as long as - /// sum(pvals[:-1]) <= 1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. - /// - public static NDarray multinomial(int n, NDarray pvals, int[] size = null) - => NumPy.Instance.random_multinomial(n, pvals, size:size); - } - - public static partial class random { - /// - /// Draw random samples from a multivariate normal distribution. - /// - /// The multivariate normal, multinormal or Gaussian distribution is a - /// generalization of the one-dimensional normal distribution to higher - /// dimensions. Such a distribution is specified by its mean and - /// covariance matrix. These parameters are analogous to the mean - /// (average or “center”) and variance (standard deviation, or “width,” - /// squared) of the one-dimensional normal distribution. - /// - /// Notes - /// - /// The mean is a coordinate in N-dimensional space, which represents the - /// location where samples are most likely to be generated. This is - /// analogous to the peak of the bell curve for the one-dimensional or - /// univariate normal distribution. - /// - /// Covariance indicates the level to which two variables vary together. - /// From the multivariate normal distribution, we draw N-dimensional - /// samples, . The covariance matrix - /// element is the covariance of and . - /// The element is the variance of (i.e. its - /// “spread”). - /// - /// Instead of specifying the full covariance matrix, popular - /// approximations include: - /// - /// This geometrical property can be seen in two dimensions by plotting - /// generated data-points: - /// - /// Diagonal covariance means that points are oriented along x or y-axis: - /// - /// Note that the covariance matrix must be positive semidefinite (a.k.a. - /// nonnegative-definite). Otherwise, the behavior of this method is - /// undefined and backwards compatibility is not guaranteed. - /// - /// References - /// - /// - /// Mean of the N-dimensional distribution. - /// - /// - /// Covariance matrix of the distribution. It must be symmetric and - /// positive-semidefinite for proper sampling. - /// - /// - /// Given a shape of, for example, (m,n,k), m*n*k samples are - /// generated, and packed in an m-by-n-by-k arrangement. Because - /// each sample is N-dimensional, the output shape is (m,n,k,N). - /// If no shape is specified, a single (N-D) sample is returned. - /// - /// - /// Behavior when the covariance matrix is not positive semidefinite. - /// - /// - /// Tolerance when checking the singular values in covariance matrix. - /// - /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. - /// - public static NDarray multivariate_normal(NDarray mean, NDarray cov, int[] size = null, string check_valid = null, float? tol = null) - => NumPy.Instance.random_multivariate_normal(mean, cov, size:size, check_valid:check_valid, tol:tol); - } - - public static partial class random { - /// - /// Draw samples from a negative binomial distribution. - /// - /// Samples are drawn from a negative binomial distribution with specified - /// parameters, n successes and p probability of success where n is an - /// integer > 0 and p is in the interval [0, 1]. - /// - /// Notes - /// - /// The probability density for the negative binomial distribution is - /// - /// where is the number of successes, is the - /// probability of success, and is the number of trials. - /// The negative binomial distribution gives the probability of N - /// failures given n successes, with a success on the last trial. - /// - /// If one throws a die repeatedly until the third time a “1” appears, - /// then the probability distribution of the number of non-“1”s that - /// appear before the third “1” is a negative binomial distribution. - /// - /// References - /// - /// - /// Parameter of the distribution, > 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized negative binomial distribution, - /// where each sample is equal to N, the number of failures that - /// occurred before a total of n successes was reached. - /// - public static NDarray negative_binomial(NDarray n, NDarray p, int[] size = null) - => NumPy.Instance.random_negative_binomial(n, p, size:size); - } - - public static partial class random { - /// - /// Draw samples from a noncentral chi-square distribution. - /// - /// The noncentral distribution is a generalisation of - /// the distribution. - /// - /// Notes - /// - /// The probability density function for the noncentral Chi-square - /// distribution is - /// - /// where is the Chi-square with q degrees of freedom. - /// - /// In Delhi (2007), it is noted that the noncentral chi-square is - /// useful in bombing and coverage problems, the probability of - /// killing the point target given by the noncentral chi-squared - /// distribution. - /// - /// References - /// - /// - /// Degrees of freedom, should be > 0. - /// - /// - /// Non-centrality, should be non-negative. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df and nonc are both scalars. - /// Otherwise, np.broadcast(df, nonc).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized noncentral chi-square distribution. - /// - public static NDarray noncentral_chisquare(NDarray df, NDarray nonc, int[] size = null) - => NumPy.Instance.random_noncentral_chisquare(df, nonc, size:size); - } - - public static partial class random { - /// - /// Draw samples from the noncentral F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters > 1. - /// nonc is the non-centrality parameter. - /// - /// Notes - /// - /// When calculating the power of an experiment (power = probability of - /// rejecting the null hypothesis when a specific alternative is true) the - /// non-central F statistic becomes important. When the null hypothesis is - /// true, the F statistic follows a central F distribution. When the null - /// hypothesis is not true, then it follows a non-central F statistic. - /// - /// References - /// - /// - /// Numerator degrees of freedom, should be > 0. - /// - /// - /// Denominator degrees of freedom, should be > 0. - /// - /// - /// Non-centrality parameter, the sum of the squares of the numerator - /// means, should be >= 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum, dfden, and nonc - /// are all scalars. Otherwise, np.broadcast(dfnum, dfden, nonc).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized noncentral Fisher distribution. - /// - public static NDarray noncentral_f(NDarray dfnum, NDarray dfden, NDarray nonc, int[] size = null) - => NumPy.Instance.random_noncentral_f(dfnum, dfden, nonc, size:size); - } - - public static partial class random { - /// - /// Draw random samples from a normal (Gaussian) distribution. - /// - /// The probability density function of the normal distribution, first - /// derived by De Moivre and 200 years later by both Gauss and Laplace - /// independently [2], is often called the bell curve because of - /// its characteristic shape (see the example below). - /// - /// The normal distributions occurs often in nature. For example, it - /// describes the commonly occurring distribution of samples influenced - /// by a large number of tiny, random disturbances, each with its own - /// unique distribution [2]. - /// - /// Notes - /// - /// The probability density for the Gaussian distribution is - /// - /// where is the mean and the standard - /// deviation. The square of the standard deviation, , - /// is called the variance. - /// - /// The function has its peak at the mean, and its “spread” increases with - /// the standard deviation (the function reaches 0.607 times its maximum at - /// and [2]). This implies that - /// numpy.random.normal is more likely to return samples lying close to - /// the mean, rather than those far away. - /// - /// References - /// - /// - /// Mean (“centre”) of the distribution. - /// - /// - /// Standard deviation (spread or “width”) of the distribution. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized normal distribution. - /// - public static NDarray normal(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_normal(loc:loc, scale:scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Pareto II or Lomax distribution with - /// specified shape. - /// - /// The Lomax or Pareto II distribution is a shifted Pareto - /// distribution. The classical Pareto distribution can be - /// obtained from the Lomax distribution by adding 1 and - /// multiplying by the scale parameter m (see Notes). The - /// smallest value of the Lomax distribution is zero while for the - /// classical Pareto distribution it is mu, where the standard - /// Pareto distribution has location mu = 1. Lomax can also - /// be considered as a simplified version of the Generalized - /// Pareto distribution (available in SciPy), with the scale set - /// to one and the location set to zero. - /// - /// The Pareto distribution must be greater than zero, and is - /// unbounded above. It is also known as the “80-20 rule”. In - /// this distribution, 80 percent of the weights are in the lowest - /// 20 percent of the range, while the other 20 percent fill the - /// remaining 80 percent of the range. - /// - /// Notes - /// - /// The probability density for the Pareto distribution is - /// - /// where is the shape and the scale. - /// - /// The Pareto distribution, named after the Italian economist - /// Vilfredo Pareto, is a power law probability distribution - /// useful in many real world problems. Outside the field of - /// economics it is generally referred to as the Bradford - /// distribution. Pareto developed the distribution to describe - /// the distribution of wealth in an economy. It has also found - /// use in insurance, web page access statistics, oil field sizes, - /// and many other problems, including the download frequency for - /// projects in Sourceforge [1]. It is one of the so-called - /// “fat-tailed” distributions. - /// - /// References - /// - /// - /// Shape of the distribution. Should be greater than zero. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Pareto distribution. - /// - public static NDarray pareto(NDarray a, int[] size = null) - => NumPy.Instance.random_pareto(a, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Poisson distribution. - /// - /// The Poisson distribution is the limit of the binomial distribution - /// for large N. - /// - /// Notes - /// - /// The Poisson distribution - /// - /// For events with an expected separation the Poisson - /// distribution describes the probability of - /// events occurring within the observed - /// interval . - /// - /// Because the output is limited to the range of the C long type, a - /// ValueError is raised when lam is within 10 sigma of the maximum - /// representable value. - /// - /// References - /// - /// - /// Expectation of interval, should be >= 0. A sequence of expectation - /// intervals must be broadcastable over the requested size. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if lam is a scalar. Otherwise, - /// np.array(lam).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Poisson distribution. - /// - public static NDarray poisson(NDarray lam = null, int[] size = null) - => NumPy.Instance.random_poisson(lam:lam, size:size); - } - - public static partial class random { - /// - /// Draws samples in [0, 1] from a power distribution with positive - /// exponent a - 1. - /// - /// Also known as the power function distribution. - /// - /// Notes - /// - /// The probability density function is - /// - /// The power function distribution is just the inverse of the Pareto - /// distribution. It may also be seen as a special case of the Beta - /// distribution. - /// - /// It is used, for example, in modeling the over-reporting of insurance - /// claims. - /// - /// References - /// - /// - /// Parameter of the distribution. Should be greater than zero. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized power distribution. - /// - public static NDarray power(NDarray a, int[] size = null) - => NumPy.Instance.random_power(a, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Rayleigh distribution. - /// - /// The and Weibull distributions are generalizations of the - /// Rayleigh. - /// - /// Notes - /// - /// The probability density function for the Rayleigh distribution is - /// - /// The Rayleigh distribution would arise, for example, if the East - /// and North components of the wind velocity had identical zero-mean - /// Gaussian distributions. Then the wind speed would have a Rayleigh - /// distribution. - /// - /// References - /// - /// - /// Scale, also equals the mode. Should be >= 0. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Rayleigh distribution. - /// - public static NDarray rayleigh(NDarray scale = null, int[] size = null) - => NumPy.Instance.random_rayleigh(scale:scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from a standard Cauchy distribution with mode = 0. - /// - /// Also known as the Lorentz distribution. - /// - /// Notes - /// - /// The probability density function for the full Cauchy distribution is - /// - /// and the Standard Cauchy distribution just sets and - /// - /// - /// The Cauchy distribution arises in the solution to the driven harmonic - /// oscillator problem, and also describes spectral line broadening. It - /// also describes the distribution of values at which a line tilted at - /// a random angle will cut the x axis. - /// - /// When studying hypothesis tests that assume normality, seeing how the - /// tests perform on data from a Cauchy distribution is a good indicator of - /// their sensitivity to a heavy-tailed distribution, since the Cauchy looks - /// very much like a Gaussian distribution, but with heavier tails. - /// - /// References - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples. - /// - public static NDarray standard_cauchy(int[] size = null) - => NumPy.Instance.random_standard_cauchy(size:size); - } - - public static partial class random { - /// - /// Draw samples from the standard exponential distribution. - /// - /// standard_exponential is identical to the exponential distribution - /// with a scale parameter of 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Drawn samples. - /// - public static NDarray standard_exponential(int[] size = null) - => NumPy.Instance.random_standard_exponential(size:size); - } - - public static partial class random { - /// - /// Draw samples from a standard Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale=1. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References - /// - /// - /// Parameter, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape is a scalar. Otherwise, - /// np.array(shape).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized standard gamma distribution. - /// - public static NDarray standard_gamma(Shape shape, int[] size = null) - => NumPy.Instance.random_standard_gamma(shape, size:size); - } - - public static partial class random { - /// - /// Draw samples from a standard Normal distribution (mean=0, stdev=1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Drawn samples. - /// - public static NDarray standard_normal(int[] size = null) - => NumPy.Instance.random_standard_normal(size:size); - } - - public static partial class random { - /// - /// Draw samples from a standard Student’s t distribution with df degrees - /// of freedom. - /// - /// A special case of the hyperbolic distribution. As df gets - /// large, the result resembles that of the standard normal - /// distribution (standard_normal). - /// - /// Notes - /// - /// The probability density function for the t distribution is - /// - /// The t test is based on an assumption that the data come from a - /// Normal distribution. The t test provides a way to test whether - /// the sample mean (that is the mean calculated from the data) is - /// a good estimate of the true mean. - /// - /// The derivation of the t-distribution was first published in - /// 1908 by William Gosset while working for the Guinness Brewery - /// in Dublin. Due to proprietary issues, he had to publish under - /// a pseudonym, and so he used the name Student. - /// - /// References - /// - /// - /// Degrees of freedom, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized standard Student’s t distribution. - /// - public static NDarray standard_t(NDarray df, int[] size = null) - => NumPy.Instance.random_standard_t(df, size:size); - } - - public static partial class random { - /// - /// Draw samples from the triangular distribution over the - /// interval [left, right]. - /// - /// The triangular distribution is a continuous probability - /// distribution with lower limit left, peak at mode, and upper - /// limit right. Unlike the other distributions, these parameters - /// directly define the shape of the pdf. - /// - /// Notes - /// - /// The probability density function for the triangular distribution is - /// - /// The triangular distribution is often used in ill-defined - /// problems where the underlying distribution is not known, but - /// some knowledge of the limits and mode exists. Often it is used - /// in simulations. - /// - /// References - /// - /// - /// Lower limit. - /// - /// - /// The value where the peak of the distribution occurs. - /// The value should fulfill the condition left <= mode <= right. - /// - /// - /// Upper limit, should be larger than left. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if left, mode, and right - /// are all scalars. Otherwise, np.broadcast(left, mode, right).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized triangular distribution. - /// - public static NDarray triangular(NDarray left, NDarray mode, NDarray right, int[] size = null) - => NumPy.Instance.random_triangular(left, mode, right, size:size); - } - - public static partial class random { - /// - /// Draw samples from a uniform distribution. - /// - /// Samples are uniformly distributed over the half-open interval - /// [low, high) (includes low, but excludes high). In other words, - /// any value within the given interval is equally likely to be drawn - /// by uniform. - /// - /// Notes - /// - /// The probability density function of the uniform distribution is - /// - /// anywhere within the interval [a, b), and zero elsewhere. - /// - /// When high == low, values of low will be returned. - /// If high < low, the results are officially undefined - /// and may eventually raise an error, i.e. do not rely on this - /// function to behave when passed arguments satisfying that - /// inequality condition. - /// - /// - /// Lower boundary of the output interval. All values generated will be - /// greater than or equal to low. The default value is 0. - /// - /// - /// Upper boundary of the output interval. All values generated will be - /// less than high. The default value is 1.0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if low and high are both scalars. - /// Otherwise, np.broadcast(low, high).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized uniform distribution. - /// - public static NDarray uniform(NDarray low = null, NDarray high = null, int[] size = null) - => NumPy.Instance.random_uniform(low:low, high:high, size:size); - } - - public static partial class random { - /// - /// Draw samples from a von Mises distribution. - /// - /// Samples are drawn from a von Mises distribution with specified mode - /// (mu) and dispersion (kappa), on the interval [-pi, pi]. - /// - /// The von Mises distribution (also known as the circular normal - /// distribution) is a continuous probability distribution on the unit - /// circle. It may be thought of as the circular analogue of the normal - /// distribution. - /// - /// Notes - /// - /// The probability density for the von Mises distribution is - /// - /// where is the mode and the dispersion, - /// and is the modified Bessel function of order 0. - /// - /// The von Mises is named for Richard Edler von Mises, who was born in - /// Austria-Hungary, in what is now the Ukraine. He fled to the United - /// States in 1939 and became a professor at Harvard. He worked in - /// probability theory, aerodynamics, fluid mechanics, and philosophy of - /// science. - /// - /// References - /// - /// - /// Mode (“center”) of the distribution. - /// - /// - /// Dispersion of the distribution, has to be >=0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mu and kappa are both scalars. - /// Otherwise, np.broadcast(mu, kappa).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized von Mises distribution. - /// - public static NDarray vonmises(NDarray mu, NDarray kappa, int[] size = null) - => NumPy.Instance.random_vonmises(mu, kappa, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Wald, or inverse Gaussian, distribution. - /// - /// As the scale approaches infinity, the distribution becomes more like a - /// Gaussian. Some references claim that the Wald is an inverse Gaussian - /// with mean equal to 1, but this is by no means universal. - /// - /// The inverse Gaussian distribution was first studied in relationship to - /// Brownian motion. In 1956 M.C.K. Tweedie used the name inverse Gaussian - /// because there is an inverse relationship between the time to cover a - /// unit distance and distance covered in unit time. - /// - /// Notes - /// - /// The probability density function for the Wald distribution is - /// - /// As noted above the inverse Gaussian distribution first arise - /// from attempts to model Brownian motion. It is also a - /// competitor to the Weibull for use in reliability modeling and - /// modeling stock returns and interest rate processes. - /// - /// References - /// - /// - /// Distribution mean, should be > 0. - /// - /// - /// Scale parameter, should be >= 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and scale are both scalars. - /// Otherwise, np.broadcast(mean, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Wald distribution. - /// - public static NDarray wald(NDarray mean, NDarray scale, int[] size = null) - => NumPy.Instance.random_wald(mean, scale, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Weibull distribution. - /// - /// Draw samples from a 1-parameter Weibull distribution with the given - /// shape parameter a. - /// - /// Here, U is drawn from the uniform distribution over (0,1]. - /// - /// The more common 2-parameter Weibull, including a scale parameter - /// is just . - /// - /// Notes - /// - /// The Weibull (or Type III asymptotic extreme value distribution - /// for smallest values, SEV Type III, or Rosin-Rammler - /// distribution) is one of a class of Generalized Extreme Value - /// (GEV) distributions used in modeling extreme value problems. - /// This class includes the Gumbel and Frechet distributions. - /// - /// The probability density for the Weibull distribution is - /// - /// where is the shape and the scale. - /// - /// The function has its peak (the mode) at - /// . - /// - /// When a = 1, the Weibull distribution reduces to the exponential - /// distribution. - /// - /// References - /// - /// - /// Shape parameter of the distribution. Must be nonnegative. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Weibull distribution. - /// - public static NDarray weibull(NDarray a, int[] size = null) - => NumPy.Instance.random_weibull(a, size:size); - } - - public static partial class random { - /// - /// Draw samples from a Zipf distribution. - /// - /// Samples are drawn from a Zipf distribution with specified parameter - /// a > 1. - /// - /// The Zipf distribution (also known as the zeta distribution) is a - /// continuous probability distribution that satisfies Zipf’s law: the - /// frequency of an item is inversely proportional to its rank in a - /// frequency table. - /// - /// Notes - /// - /// The probability density for the Zipf distribution is - /// - /// where is the Riemann Zeta function. - /// - /// It is named for the American linguist George Kingsley Zipf, who noted - /// that the frequency of any word in a sample of a language is inversely - /// proportional to its rank in the frequency table. - /// - /// References - /// - /// - /// Distribution parameter. Should be greater than 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Zipf distribution. - /// - public static NDarray zipf(NDarray a, int[] size = null) - => NumPy.Instance.random_zipf(a, size:size); - } - - public static partial class random { - /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods - /// - /// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. - /// - public static void RandomState(int? seed = null) - => NumPy.Instance.random_RandomState(seed:seed); - } - - public static partial class random { - /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods - /// - /// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. - /// - public static void RandomState(NDarray seed = null) - => NumPy.Instance.random_RandomState(seed:seed); - } - - public static partial class random { - /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. - /// - /// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. - /// - public static void seed(int? seed = null) - => NumPy.Instance.random_seed(seed:seed); - } - - public static partial class random { - /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. - /// - /// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. - /// - public static void seed(NDarray seed = null) - => NumPy.Instance.random_seed(seed:seed); - } - - /* - public static partial class random { - /// - /// Return a tuple representing the internal state of the generator. - /// - /// For more details, see set_state. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// - /// The returned tuple has the following items: - /// - /// - /// The returned tuple has the following items: - /// - public static tuple(str get_state(tuple(str @out = null) - => NumPy.Instance.random_get_state(@out:@out); - } - */ - - /* - public static partial class random { - /// - /// Set the internal state of the generator from a tuple. - /// - /// For use if one has reason to manually (re-)set the internal state of the - /// “Mersenne Twister”[1] pseudo-random number generating algorithm. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// For backwards compatibility, the form (str, array of 624 uints, int) is - /// also accepted although it is missing some information about the cached - /// Gaussian value: state = ('MT19937', keys, pos). - /// - /// References - /// - /// - /// The state tuple has the following items: - /// - /// - /// Returns ‘None’ on success. - /// - public static None set_state(tuple(str state) - => NumPy.Instance.random_set_state(state); - } - */ - - - } -} diff --git a/src/Numpy.Bare/np.set.gen.cs b/src/Numpy.Bare/np.set.gen.cs deleted file mode 100644 index 579ee6a..0000000 --- a/src/Numpy.Bare/np.set.gen.cs +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Test whether each element of a 1-D array is also present in a second array. - /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise. - /// - /// We recommend using isin instead of in1d for new code. - /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences. in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]). - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. - /// - /// - /// Input array. - /// - /// - /// The values against which to test each value of ar1. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise). - /// Default is False. np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). - /// - /// - /// The values ar1[in1d] are in ar2. - /// - public static NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) - => NumPy.Instance.in1d(ar1, ar2, assume_unique:assume_unique, invert:invert); - - /// - /// Find the intersection of two arrays. - /// - /// Return the sorted, unique values that are in both of the input arrays. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned. The first instance of a value is used if there are - /// multiple. Default is False. - /// - /// - /// A tuple of: - /// intersect1d - /// Sorted 1D array of common and unique elements. - /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. - /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. - /// - public static (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) - => NumPy.Instance.intersect1d(ar2, ar1, assume_unique, return_indices); - - /// - /// Calculates element in test_elements, broadcasting over element only. - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise. - /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in. - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences. - /// - /// element and test_elements are converted to arrays if they are not - /// already. If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements. This is a consequence - /// of the array constructor’s way of handling non-sequence collections. - /// Converting the set to a list usually gives the desired behavior. - /// - /// - /// Input array. - /// - /// - /// The values against which to test each value of element. - /// This argument is flattened if it is an array or array_like. - /// See notes for behavior with non-array-like parameters. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements. Default is False. - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). - /// - /// - /// Has the same shape as element. The values element[isin] - /// are in test_elements. - /// - public static NDarray isin(NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) - => NumPy.Instance.isin(element, test_elements, assume_unique:assume_unique, invert:invert); - - /// - /// Find the set difference of two arrays. - /// - /// Return the unique values in ar1 that are not in ar2. - /// - /// - /// Input array. - /// - /// - /// Input comparison array. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. - /// - public static NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = false) - => NumPy.Instance.setdiff1d(ar1, ar2, assume_unique); - - /// - /// Find the set exclusive-or of two arrays. - /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. - /// - /// - /// Input arrays. - /// - /// - /// Input arrays. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. - /// - public static NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = false) - => NumPy.Instance.setxor1d(ar2, ar1, assume_unique); - - /// - /// Find the union of two arrays. - /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Unique, sorted union of the input arrays. - /// - public static NDarray union1d(NDarray ar2, NDarray ar1) - => NumPy.Instance.union1d(ar2, ar1); - - - } -} diff --git a/src/Numpy.Bare/np.sorting.gen.cs b/src/Numpy.Bare/np.sorting.gen.cs deleted file mode 100644 index f63fe14..0000000 --- a/src/Numpy.Bare/np.sorting.gen.cs +++ /dev/null @@ -1,538 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Return a sorted copy of an array. - /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable. A - /// stable sort keeps items with the same key in the same relative - /// order. The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis. Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts. - /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour. In numpy versions >= 1.4.0 nan - /// values are sorted to the end. The extended sort order is: - /// - /// where R is a non-nan real value. Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists. - /// Non-nan values are sorted as before. - /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress. This makes its - /// worst case O(n*log(n)). - /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted. It is currently mapped to - /// merge sort. - /// - /// - /// Array to be sorted. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public static NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - => NumPy.Instance.sort(a, axis:axis, kind:kind, order:order); - - /// - /// Perform an indirect stable sort using a sequence of keys. - /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns. The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on. The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape. If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. - /// - /// - /// The k different “columns” to be sorted. The last column (or row if - /// keys is a 2D array) is the primary sort key. - /// - /// - /// Axis to be indirectly sorted. By default, sort over the last axis. - /// - /// - /// Array of indices that sort the keys along the specified axis. - /// - public static NDarray lexsort(NDarray keys, int? axis = -1) - => NumPy.Instance.lexsort(keys, axis:axis); - - /// - /// Returns the indices that would sort an array. - /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword. It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// - /// Array to sort. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If None, - /// the flattened array is used. - /// - /// - /// Sorting algorithm. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of indices that sort a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a sorted a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. - /// - public static NDarray argsort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - => NumPy.Instance.argsort(a, axis:axis, kind:kind, order:order); - - /// - /// Sort an array, in-place. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// - /// Axis along which to sort. Default is -1, which means sort along the - /// last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - public static void sort(int? axis = -1, string kind = null, string order = null) - => NumPy.Instance.sort(axis:axis, kind:kind, order:order); - - /// - /// Return a copy of an array sorted along the first axis. - /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). - /// - /// - /// Array to be sorted. - /// - /// - /// Array of the same type and shape as a. - /// - public static NDarray msort(NDarray a) - => NumPy.Instance.msort(a); - - /// - /// Sort a complex array using the real part first, then the imaginary part. - /// - /// - /// Input array - /// - /// - /// Always returns a sorted complex array. - /// - public static NDarray sort_complex(NDarray a) - => NumPy.Instance.sort_complex(a); - - /// - /// Return a partitioned copy of an array. - /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array. All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it. The ordering of the elements in the two - /// partitions is undefined. - /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable. A stable sort keeps items with the same key in the same - /// relative order. The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis. Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. - /// - /// - /// Array to be sorted. - /// - /// - /// Element index to partition by. The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it. The order of all elements in the partitions is undefined. If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Selection algorithm. Default is ‘introselect’. - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string. Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public static NDarray partition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - => NumPy.Instance.partition(a, kth, axis:axis, kind:kind, order:order); - - /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword. It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order. - /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. - /// - /// - /// Array to sort. - /// - /// - /// Element index to partition by. The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it. The order all - /// elements in the partitions is undefined. If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If - /// None, the flattened array is used. - /// - /// - /// Selection algorithm. Default is ‘introselect’ - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of indices that partition a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a partitioned a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. - /// - public static NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - => NumPy.Instance.argpartition(a, kth, axis:axis, kind:kind, order:order); - - /// - /// Returns the indices of the maximum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// Input array. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public static NDarray argmax(NDarray a, int? axis = null, NDarray @out = null) - => NumPy.Instance.argmax(a, axis:axis, @out:@out); - - /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. - /// - /// - /// Input data. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public static NDarray nanargmax(NDarray a, int? axis = null) - => NumPy.Instance.nanargmax(a, axis:axis); - - /// - /// Returns the indices of the minimum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// Input array. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public static NDarray argmin(NDarray a, int? axis = null, NDarray @out = null) - => NumPy.Instance.argmin(a, axis:axis, @out:@out); - - /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. - /// - /// - /// Input data. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public static NDarray nanargmin(NDarray a, int? axis = null) - => NumPy.Instance.nanargmin(a, axis:axis); - - /// - /// Find the indices of array elements that are non-zero, grouped by element. - /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)). - /// - /// The output of argwhere is not suitable for indexing arrays. - /// For this purpose use nonzero(a) instead. - /// - /// - /// Input data. - /// - /// - /// Indices of elements that are non-zero. Indices are grouped by element. - /// - public static NDarray argwhere(NDarray a) - => NumPy.Instance.argwhere(a); - - /// - /// Return indices that are non-zero in the flattened version of a. - /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. - /// - /// - /// Input data. - /// - /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. - /// - public static NDarray flatnonzero(NDarray a) - => NumPy.Instance.flatnonzero(a); - - /// - /// Find indices where elements should be inserted to maintain order. - /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved. - /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points. - /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. - /// - /// - /// Input array. If sorter is None, then it must be sorted in - /// ascending order, otherwise sorter must be an array of indices - /// that sort it. - /// - /// - /// Values to insert into a. - /// - /// - /// If ‘left’, the index of the first suitable location found is given. - /// If ‘right’, return the last such index. If there is no suitable - /// index, return either 0 or N (where N is the length of a). - /// - /// - /// Optional array of integer indices that sort array a into ascending - /// order. They are typically the result of argsort. - /// - /// - /// Array of insertion points with the same shape as v. - /// - public static NDarray searchsorted(NDarray a, NDarray v, string side = "left", NDarray sorter = null) - => NumPy.Instance.searchsorted(a, v, side:side, sorter:sorter); - - /// - /// Return the elements of an array that satisfy some condition. - /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)). If - /// condition is boolean np.extract is equivalent to arr[condition]. - /// - /// Note that place does the exact opposite of extract. - /// - /// - /// An array whose nonzero or True entries indicate the elements of arr - /// to extract. - /// - /// - /// Input array of the same size as condition. - /// - /// - /// Rank 1 array of values from arr where condition is True. - /// - public static NDarray extract(NDarray condition, NDarray arr) - => NumPy.Instance.extract(condition, arr); - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// The array for which to count non-zeros. - /// - /// - /// Axis or tuple of axes along which to count non-zeros. - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public static NDarray count_nonzero(NDarray a, int[] axis) - => NumPy.Instance.count_nonzero(a, axis:axis); - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// The array for which to count non-zeros. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public static int count_nonzero(NDarray a) - => NumPy.Instance.count_nonzero(a); - - - } -} diff --git a/src/Numpy.Bare/np.staticstics.gen.cs b/src/Numpy.Bare/np.staticstics.gen.cs deleted file mode 100644 index 0203cef..0000000 --- a/src/Numpy.Bare/np.staticstics.gen.cs +++ /dev/null @@ -1,2598 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public static NDarray amin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amin(a, axis:axis, @out:@out, keepdims:keepdims, initial:initial); - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public static NDarray amax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amax(a, axis:axis, @out:@out, keepdims:keepdims, initial:initial); - - /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs. - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.min. - /// - /// - /// Array containing numbers whose minimum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the minimum is computed. The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis - /// removed. If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned. The same dtype as a is returned. - /// - public static NDarray nanmin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanmin(a, axis:axis, @out:@out, keepdims:keepdims); - - /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs. When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.max. - /// - /// - /// Array containing numbers whose maximum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the maximum is computed. The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis removed. - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned. The same dtype as a is returned. - /// - public static NDarray nanmax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanmax(a, axis:axis, @out:@out, keepdims:keepdims); - - /// - /// Range of values (maximum - minimum) along an axis. - /// - /// The name of the function comes from the acronym for ‘peak to peak’. - /// - /// - /// Input values. - /// - /// - /// Axis along which to find the peaks. By default, flatten the - /// array. axis may be negative, in - /// which case it counts from the last to the first axis. - /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. - /// - public static NDarray ptp(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.ptp(a, axis:axis, @out:@out, keepdims:keepdims); - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static NDarray percentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - => NumPy.Instance.percentile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static double percentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.percentile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static NDarray nanpercentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - => NumPy.Instance.nanpercentile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static double nanpercentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.nanpercentile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static NDarray quantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - => NumPy.Instance.quantile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static double quantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.quantile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static NDarray nanquantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - => NumPy.Instance.nanquantile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static double nanquantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.nanquantile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original arr. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static NDarray median(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - => NumPy.Instance.median(a, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static double median(NDarray a, NDarray @out = null, bool? overwrite_input = false) - => NumPy.Instance.median(a, @out:@out, overwrite_input:overwrite_input); - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. - /// - /// - /// Axis or axes along which to average a. The default, - /// axis=None, will average over all of the elements of the input array. - /// If axis is negative it counts from the last to the first axis. - /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public static NDarray average(NDarray a, int[] axis, NDarray weights = null, bool? returned = false) - => NumPy.Instance.average(a, axis:axis, weights:weights, returned:returned); - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public static double average(NDarray a, NDarray weights = null, bool? returned = false) - => NumPy.Instance.average(a, weights:weights, returned:returned); - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the means are computed. The default is to - /// compute the mean of the flattened array. - /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public static NDarray mean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.mean(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public static double mean(NDarray a, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.mean(a, dtype:dtype, @out:@out); - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Calculate the standard deviation of these values. - /// - /// - /// Axis or axes along which the standard deviation is computed. The - /// default is to compute the standard deviation of the flattened array. - /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public static NDarray std(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.std(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Calculate the standard deviation of these values. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public static double std(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.std(a, dtype:dtype, @out:@out, ddof:ddof); - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the variance is computed. The default is to - /// compute the variance of the flattened array. - /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public static NDarray @var(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.@var(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public static double @var(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.@var(a, dtype:dtype, @out:@out, ddof:ddof); - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static NDarray nanmedian(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - => NumPy.Instance.nanmedian(a, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public static double nanmedian(NDarray a, NDarray @out = null, bool? overwrite_input = false) - => NumPy.Instance.nanmedian(a, @out:@out, overwrite_input:overwrite_input); - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the means are computed. The default is to compute - /// the mean of the flattened array. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public static NDarray nanmean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanmean(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public static double nanmean(NDarray a, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.nanmean(a, dtype:dtype, @out:@out); - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Calculate the standard deviation of the non-NaN values. - /// - /// - /// Axis or axes along which the standard deviation is computed. The default is - /// to compute the standard deviation of the flattened array. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes. If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public static NDarray nanstd(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.nanstd(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Calculate the standard deviation of the non-NaN values. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public static double nanstd(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.nanstd(a, dtype:dtype, @out:@out, ddof:ddof); - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the variance is computed. The default is to compute - /// the variance of the flattened array. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public static NDarray nanvar(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.nanvar(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public static double nanvar(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.nanvar(a, dtype:dtype, @out:@out, ddof:ddof); - - /// - /// Return Pearson product-moment correlation coefficients. - /// - /// Please refer to the documentation for cov for more detail. The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive. - /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1. The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case. - /// - /// This function accepts but discards arguments bias and ddof. This is - /// for backwards compatibility with previous versions of this function. These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. - /// - /// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of x represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. - /// - /// - /// An additional set of variables and observations. y has the same - /// shape as x. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// The correlation coefficient matrix of the variables. - /// - public static NDarray corrcoef(NDarray x, NDarray y = null, bool? rowvar = true) - => NumPy.Instance.corrcoef(x, y:y, rowvar:rowvar); - - /// - /// Cross-correlation of two 1-dimensional sequences. - /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate. - /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently. Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. - /// - /// - /// Input sequences. - /// - /// - /// Input sequences. - /// - /// - /// Refer to the convolve docstring. Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. - /// - /// - /// Discrete cross-correlation of a and v. - /// - public static NDarray correlate(NDarray v, NDarray a, string mode = "valid") - => NumPy.Instance.correlate(v, a, mode:mode); - - /// - /// Estimate a covariance matrix, given data and weights. - /// - /// Covariance indicates the level to which two variables vary together. - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm. - /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity. The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. - /// - /// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of m represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. - /// - /// - /// An additional set of variables and observations. y has the same form - /// as that of m. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate). If bias is True, - /// then normalization is by N. These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. - /// - /// - /// If not None the default value implied by bias is overridden. - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average. See the notes for the details. The default value - /// is None. - /// - /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. - /// - /// - /// 1-D array of observation vector weights. These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. - /// - /// - /// The covariance matrix of the variables. - /// - public static NDarray cov(NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - => NumPy.Instance.cov(m, y:y, rowvar:rowvar, bias:bias, ddof:ddof, fweights:fweights, aweights:aweights); - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public static (NDarray, NDarray) histogram(NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - => NumPy.Instance.histogram(a, bins:bins, range:range, normed:normed, weights:weights, density:density); - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public static (NDarray, NDarray) histogram(NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - => NumPy.Instance.histogram(a, bins:bins, range:range, normed:normed, weights:weights, density:density); - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public static (NDarray, NDarray) histogram(NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - => NumPy.Instance.histogram(a, bins:bins, range:range, normed:normed, weights:weights, density:density); - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogram2d(x, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogram2d(x, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogram2d(x, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public static (NDarray, NDarray) histogramdd(NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogramdd(sample, bins:bins, range:range, density:density, normed:normed, weights:weights); - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public static (NDarray, NDarray) histogramdd(NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogramdd(sample, bins:bins, range:range, density:density, normed:normed, weights:weights); - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public static (NDarray, NDarray) histogramdd(NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogramdd(sample, bins:bins, range:range, density:density, normed:normed, weights:weights); - - /// - /// Count number of occurrences of each value in array of non-negative ints. - /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x. If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x). - /// Each bin gives the number of occurrences of its index value in x. - /// If weights is specified the input array is weighted by it, i.e. if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. - /// - /// - /// Input array. - /// - /// - /// Weights, array of the same shape as x. - /// - /// - /// A minimum number of bins for the output array. - /// - /// - /// The result of binning the input array. - /// The length of out is equal to np.amax(x)+1. - /// - public static NDarray bincount(NDarray x, NDarray weights = null, int? minlength = 0) - => NumPy.Instance.bincount(x, weights:weights, minlength:minlength); - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public static NDarray histogram_bin_edges(NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) - => NumPy.Instance.histogram_bin_edges(a, bins:bins, range:range, weights:weights); - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public static NDarray histogram_bin_edges(NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) - => NumPy.Instance.histogram_bin_edges(a, bins:bins, range:range, weights:weights); - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public static NDarray histogram_bin_edges(NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) - => NumPy.Instance.histogram_bin_edges(a, bins:bins, range:range, weights:weights); - - /// - /// Return the indices of the bins to which each value in input array belongs. - /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate. - /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError. - /// - /// np.digitize is implemented in terms of np.searchsorted. This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search. It also removes - /// the requirement for the input array to be 1-dimensional. - /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too. - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks. Perhaps more importantly, it supports all dtypes. - /// - /// - /// Input array to be binned. Prior to NumPy 1.10.0, this array had to - /// be 1-dimensional, but can now have any shape. - /// - /// - /// Array of bins. It has to be 1-dimensional and monotonic. - /// - /// - /// Indicating whether the intervals include the right or the left bin - /// edge. Default behavior is (right==False) indicating that the interval - /// does not include the right edge. The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. - /// - /// - /// Output array of indices, of same shape as x. - /// - public static NDarray digitize(NDarray x, NDarray bins, bool? right = false) - => NumPy.Instance.digitize(x, bins, right:right); - - - } -} diff --git a/src/Numpy.Bare/np.string.gen.cs b/src/Numpy.Bare/np.string.gen.cs deleted file mode 100644 index bb00128..0000000 --- a/src/Numpy.Bare/np.string.gen.cs +++ /dev/null @@ -1,1054 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - public static partial class core { - public static partial class defchararray { - /// - /// Return element-wise string concatenation for two arrays of str or unicode. - /// - /// Arrays x1 and x2 must have the same shape. - /// - /// - /// Input array. - /// - /// - /// Input array. - /// - /// - /// Output array of string_ or unicode_, depending on input types - /// of the same shape as x1 and x2. - /// - public static NDarray @add(string[] x1, string[] x2) - => NumPy.Instance.core_defchararray_add(x1, x2); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (a * i), that is string multiple concatenation, - /// element-wise. - /// - /// Values in i of less than 0 are treated as 0 (which yields an - /// empty string). - /// - /// - /// Output array of str or unicode, depending on input types - /// - public static NDarray multiply(string[] a, int[] i) - => NumPy.Instance.core_defchararray_multiply(a, i); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (a % i), that is pre-Python 2.6 string formatting - /// (iterpolation), element-wise for a pair of array_likes of str - /// or unicode. - /// - /// - /// These values will be element-wise interpolated into the string. - /// - /// - /// Output array of str or unicode, depending on input types - /// - public static NDarray mod(string[] a, NDarray values) - => NumPy.Instance.core_defchararray_mod(a, values); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return a copy of a with only the first character of each element - /// capitalized. - /// - /// Calls str.capitalize element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array of strings to capitalize. - /// - /// - /// Output array of str or unicode, depending on input - /// types - /// - public static NDarray capitalize(string[] a) - => NumPy.Instance.core_defchararray_capitalize(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return a copy of a with its elements centered in a string of - /// length width. - /// - /// Calls str.center element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The padding character to use (default is space). - /// - /// - /// Output array of str or unicode, depending on input - /// types - /// - public static NDarray center(string[] a, int width, string fillchar = " ") - => NumPy.Instance.core_defchararray_center(a, width, fillchar:fillchar); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Calls str.decode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the - /// codecs module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. - /// - /// - /// The name of an encoding - /// - /// - /// Specifies how to handle encoding errors - /// - public static NDarray decode(string[] a, string encoding = null, string errors = null) - => NumPy.Instance.core_defchararray_decode(a, encoding:encoding, errors:errors); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Calls str.encode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the codecs - /// module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. - /// - /// - /// The name of an encoding - /// - /// - /// Specifies how to handle encoding errors - /// - public static NDarray encode(string[] a, string encoding = null, string errors = null) - => NumPy.Instance.core_defchararray_encode(a, encoding:encoding, errors:errors); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return a string which is the concatenation of the strings in the - /// sequence seq. - /// - /// Calls str.join element-wise. - /// - /// - /// Output array of str or unicode, depending on input types - /// - public static NDarray @join(string[] sep, string[] seq) - => NumPy.Instance.core_defchararray_join(sep, seq); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return an array with the elements of a left-justified in a - /// string of length width. - /// - /// Calls str.ljust element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The character to use for padding - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray ljust(string[] a, int width, string fillchar = " ") - => NumPy.Instance.core_defchararray_ljust(a, width, fillchar:fillchar); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return an array with the elements converted to lowercase. - /// - /// Call str.lower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray lower(NDarray a) - => NumPy.Instance.core_defchararray_lower(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a copy with the leading characters - /// removed. - /// - /// Calls str.lstrip element-wise. - /// - /// - /// Input array. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix; rather, all combinations of its values are - /// stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray lstrip(NDarray a, string chars = null) - => NumPy.Instance.core_defchararray_lstrip(a, chars:chars); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Partition each element in a around sep. - /// - /// Calls str.partition element-wise. - /// - /// For each element in a, split the element as the first - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. - /// - /// - /// Input array - /// - /// - /// Separator to split each string element in a. - /// - /// - /// Output array of str or unicode, depending on input type. - /// The output array will have an extra dimension with 3 - /// elements per input element. - /// - public static NDarray partition(NDarray a, string sep) - => NumPy.Instance.core_defchararray_partition(a, sep); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a copy of the string with all - /// occurrences of substring old replaced by new. - /// - /// Calls str.replace element-wise. - /// - /// - /// If the optional argument count is given, only the first - /// count occurrences are replaced. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray replace(string[] a, string @new, string old, int? count = null) - => NumPy.Instance.core_defchararray_replace(a, @new, old, count:count); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return an array with the elements of a right-justified in a - /// string of length width. - /// - /// Calls str.rjust element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The character to use for padding - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray rjust(string[] a, int width, string fillchar = " ") - => NumPy.Instance.core_defchararray_rjust(a, width, fillchar:fillchar); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Partition (split) each element around the right-most separator. - /// - /// Calls str.rpartition element-wise. - /// - /// For each element in a, split the element as the last - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. - /// - /// - /// Input array - /// - /// - /// Right-most separator to split each element in array. - /// - /// - /// Output array of string or unicode, depending on input - /// type. The output array will have an extra dimension with - /// 3 elements per input element. - /// - public static NDarray rpartition(string[] a, string sep) - => NumPy.Instance.core_defchararray_rpartition(a, sep); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.rsplit element-wise. - /// - /// Except for splitting from the right, rsplit - /// behaves like split. - /// - /// - /// If sep is not specified or None, any whitespace string - /// is a separator. - /// - /// - /// If maxsplit is given, at most maxsplit splits are done, - /// the rightmost ones. - /// - /// - /// Array of list objects - /// - public static NDarray rsplit(string[] a, string sep = null, int? maxsplit = null) - => NumPy.Instance.core_defchararray_rsplit(a, sep:sep, maxsplit:maxsplit); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a copy with the trailing - /// characters removed. - /// - /// Calls str.rstrip element-wise. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a suffix; rather, all combinations of its values are - /// stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray rstrip(string[] a, string chars = null) - => NumPy.Instance.core_defchararray_rstrip(a, chars:chars); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.split element-wise. - /// - /// - /// If sep is not specified or None, any whitespace string is a - /// separator. - /// - /// - /// If maxsplit is given, at most maxsplit splits are done. - /// - /// - /// Array of list objects - /// - public static NDarray split(string[] a, string sep = null, int? maxsplit = null) - => NumPy.Instance.core_defchararray_split(a, sep:sep, maxsplit:maxsplit); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a list of the lines in the - /// element, breaking at line boundaries. - /// - /// Calls str.splitlines element-wise. - /// - /// - /// Line breaks are not included in the resulting list unless - /// keepends is given and true. - /// - /// - /// Array of list objects - /// - public static NDarray splitlines(string[] a, bool? keepends = null) - => NumPy.Instance.core_defchararray_splitlines(a, keepends:keepends); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a copy with the leading and - /// trailing characters removed. - /// - /// Calls str.strip element-wise. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix or suffix; rather, all combinations of its - /// values are stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray strip(string[] a, string chars = null) - => NumPy.Instance.core_defchararray_strip(a, chars:chars); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return element-wise a copy of the string with - /// uppercase characters converted to lowercase and vice versa. - /// - /// Calls str.swapcase element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray swapcase(NDarray a) - => NumPy.Instance.core_defchararray_swapcase(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return element-wise title cased version of string or unicode. - /// - /// Title case words start with uppercase characters, all remaining cased - /// characters are lowercase. - /// - /// Calls str.title element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray title(NDarray a) - => NumPy.Instance.core_defchararray_title(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return a copy of the string where all - /// characters occurring in the optional argument deletechars are - /// removed, and the remaining characters have been mapped through the - /// given translation table. - /// - /// Calls str.translate element-wise. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray translate(string[] a, string table, string deletechars) - => NumPy.Instance.core_defchararray_translate(a, table, deletechars); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return an array with the elements converted to uppercase. - /// - /// Calls str.upper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray upper(NDarray a) - => NumPy.Instance.core_defchararray_upper(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return the numeric string left-filled with zeros - /// - /// Calls str.zfill element-wise. - /// - /// - /// Input array. - /// - /// - /// Width of string to left-fill elements in a. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public static NDarray zfill(NDarray a, int width) - => NumPy.Instance.core_defchararray_zfill(a, width); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (x1 == x2) element-wise. - /// - /// Unlike numpy.equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public static NDarray equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_equal(x2, x1); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (x1 != x2) element-wise. - /// - /// Unlike numpy.not_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public static NDarray not_equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_not_equal(x2, x1); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (x1 >= x2) element-wise. - /// - /// Unlike numpy.greater_equal, this comparison is performed by - /// first stripping whitespace characters from the end of the string. - /// This behavior is provided for backward-compatibility with - /// numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public static NDarray greater_equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_greater_equal(x2, x1); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (x1 <= x2) element-wise. - /// - /// Unlike numpy.less_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public static NDarray less_equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_less_equal(x2, x1); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (x1 > x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public static NDarray greater(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_greater(x2, x1); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Return (x1 < x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public static NDarray less(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_less(x2, x1); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns an array with the number of non-overlapping occurrences of - /// substring sub in the range [start, end]. - /// - /// Calls str.count element-wise. - /// - /// - /// The substring to search for. - /// - /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. - /// - /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. - /// - /// - /// Output array of ints. - /// - public static NDarray count(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_count(a, sub, end:end, start:start); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element, return the lowest index in the string where - /// substring sub is found. - /// - /// Calls str.find element-wise. - /// - /// For each element, return the lowest index in the string where - /// substring sub is found, such that sub is contained in the - /// range [start, end]. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Output array of ints. Returns -1 if sub is not found. - /// - public static NDarray find(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_find(a, sub, end:end, start:start); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Like find, but raises ValueError when the substring is not found. - /// - /// Calls str.index element-wise. - /// - /// - /// Output array of ints. Returns -1 if sub is not found. - /// - public static NDarray index(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_index(a, sub, end:end, start:start); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns true for each element if all characters in the string are - /// alphabetic and there is at least one character, false otherwise. - /// - /// Calls str.isalpha element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public static NDarray isalpha(string[] a) - => NumPy.Instance.core_defchararray_isalpha(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element, return True if there are only decimal - /// characters in the element. - /// - /// Calls unicode.isdecimal element-wise. - /// - /// Decimal characters include digit characters, and all characters - /// that that can be used to form decimal-radix numbers, - /// e.g. U+0660, ARABIC-INDIC DIGIT ZERO. - /// - /// - /// Input array. - /// - /// - /// Array of booleans identical in shape to a. - /// - public static NDarray isdecimal(NDarray a) - => NumPy.Instance.core_defchararray_isdecimal(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns true for each element if all characters in the string are - /// digits and there is at least one character, false otherwise. - /// - /// Calls str.isdigit element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public static NDarray isdigit(string[] a) - => NumPy.Instance.core_defchararray_isdigit(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns true for each element if all cased characters in the - /// string are lowercase and there is at least one cased character, - /// false otherwise. - /// - /// Calls str.islower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public static NDarray islower(string[] a) - => NumPy.Instance.core_defchararray_islower(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element, return True if there are only numeric - /// characters in the element. - /// - /// Calls unicode.isnumeric element-wise. - /// - /// Numeric characters include digit characters, and all characters - /// that have the Unicode numeric value property, e.g. U+2155, - /// VULGAR FRACTION ONE FIFTH. - /// - /// - /// Input array. - /// - /// - /// Array of booleans of same shape as a. - /// - public static NDarray isnumeric(NDarray a) - => NumPy.Instance.core_defchararray_isnumeric(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns true for each element if there are only whitespace - /// characters in the string and there is at least one character, - /// false otherwise. - /// - /// Calls str.isspace element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public static NDarray isspace(string[] a) - => NumPy.Instance.core_defchararray_isspace(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns true for each element if the element is a titlecased - /// string and there is at least one character, false otherwise. - /// - /// Call str.istitle element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public static NDarray istitle(string[] a) - => NumPy.Instance.core_defchararray_istitle(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns true for each element if all cased characters in the - /// string are uppercase and there is at least one character, false - /// otherwise. - /// - /// Call str.isupper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public static NDarray isupper(string[] a) - => NumPy.Instance.core_defchararray_isupper(a); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// For each element in a, return the highest index in the string - /// where substring sub is found, such that sub is contained - /// within [start, end]. - /// - /// Calls str.rfind element-wise. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Output array of ints. Return -1 on failure. - /// - public static NDarray rfind(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_rfind(a, sub, end:end, start:start); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Like rfind, but raises ValueError when the substring sub is - /// not found. - /// - /// Calls str.rindex element-wise. - /// - /// - /// Output array of ints. - /// - public static NDarray rindex(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_rindex(a, sub, end:end, start:start); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Returns a boolean array which is True where the string element - /// in a starts with prefix, otherwise False. - /// - /// Calls str.startswith element-wise. - /// - /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. - /// - /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. - /// - /// - /// Array of booleans - /// - public static NDarray startswith(string[] a, string prefix, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_startswith(a, prefix, end:end, start:start); - } - } - - public static partial class core { - public static partial class defchararray { - /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. - /// - /// - /// Shape of the array. - /// - /// - /// Length of each array element, in number of characters. Default is 1. - /// - /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. - /// - /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. - /// - /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. - /// - /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. - /// - /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. - /// - public static void chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - => NumPy.Instance.core_defchararray_chararray(shape, itemsize:itemsize, unicode:unicode, buffer:buffer, offset:offset, strides:strides, order:order); - } - } - - - } -} diff --git a/src/Numpy.Bare/np.window.gen.cs b/src/Numpy.Bare/np.window.gen.cs deleted file mode 100644 index 6ee4cd6..0000000 --- a/src/Numpy.Bare/np.window.gen.cs +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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; - -namespace Numpy -{ - public static partial class np - { - - /// - /// Return the Bartlett window. - /// - /// The Bartlett window is very similar to a triangular window, except - /// that the end points are at zero. It is often used in signal - /// processing for tapering a signal, without generating too much - /// ripple in the frequency domain. - /// - /// Notes - /// - /// The Bartlett window is defined as - /// - /// Most references to the Bartlett window come from the signal - /// processing literature, where it is used as one of many windowing - /// functions for smoothing values. Note that convolution with this - /// window produces linear interpolation. It is also known as an - /// apodization (which means”removing the foot”, i.e. smoothing - /// discontinuities at the beginning and end of the sampled signal) or - /// tapering function. The fourier transform of the Bartlett is the product - /// of two sinc functions. - /// Note the excellent discussion in Kanasewich. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The triangular window, with the maximum value normalized to one - /// (the value one appears only if the number of samples is odd), with - /// the first and last samples equal to zero. - /// - public static NDarray bartlett(int M) - => NumPy.Instance.bartlett(M); - - /// - /// Return the Blackman window. - /// - /// The Blackman window is a taper formed by using the first three - /// terms of a summation of cosines. It was designed to have close to the - /// minimal leakage possible. It is close to optimal, only slightly worse - /// than a Kaiser window. - /// - /// Notes - /// - /// The Blackman window is defined as - /// - /// Most references to the Blackman window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. It is known as a - /// “near optimal” tapering function, almost as good (by some measures) - /// as the kaiser window. - /// - /// References - /// - /// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, - /// Dover Publications, New York. - /// - /// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. - /// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. - /// - /// - /// Number of points in the output window. If zero or less, an empty - /// array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value one - /// appears only if the number of samples is odd). - /// - public static NDarray blackman(int M) - => NumPy.Instance.blackman(M); - - /// - /// Return the Hamming window. - /// - /// The Hamming window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hamming window is defined as - /// - /// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey - /// and is described in Blackman and Tukey. It was recommended for - /// smoothing the truncated autocovariance function in the time domain. - /// Most references to the Hamming window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). - /// - public static NDarray hamming(int M) - => NumPy.Instance.hamming(M); - - /// - /// Return the Hanning window. - /// - /// The Hanning window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hanning window is defined as - /// - /// The Hanning was named for Julius von Hann, an Austrian meteorologist. - /// It is also known as the Cosine Bell. Some authors prefer that it be - /// called a Hann window, to help avoid confusion with the very similar - /// Hamming window. - /// - /// Most references to the Hanning window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if M is odd). - /// - public static NDarray hanning(int M) - => NumPy.Instance.hanning(M); - - /// - /// Return the Kaiser window. - /// - /// The Kaiser window is a taper formed by using a Bessel function. - /// - /// Notes - /// - /// The Kaiser window is defined as - /// - /// with - /// - /// where is the modified zeroth-order Bessel function. - /// - /// The Kaiser was named for Jim Kaiser, who discovered a simple - /// approximation to the DPSS window based on Bessel functions. The Kaiser - /// window is a very good approximation to the Digital Prolate Spheroidal - /// Sequence, or Slepian window, which is the transform which maximizes the - /// energy in the main lobe of the window relative to total energy. - /// - /// The Kaiser can approximate many other windows by varying the beta - /// parameter. - /// - /// A beta value of 14 is probably a good starting point. Note that as beta - /// gets large, the window narrows, and so the number of samples needs to be - /// large enough to sample the increasingly narrow spike, otherwise NaNs will - /// get returned. - /// - /// Most references to the Kaiser window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// Shape parameter for window. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). - /// - public static NDarray kaiser(int M, float beta) - => NumPy.Instance.kaiser(M, beta); - - - } -} diff --git a/src/Numpy/Manual/NumPy.array.cs b/src/Numpy/Manual/NumPy.array.cs deleted file mode 100644 index 159ce6c..0000000 --- a/src/Numpy/Manual/NumPy.array.cs +++ /dev/null @@ -1,147 +0,0 @@ -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 partial class NumPy - { - - public NDarray array(NDarray @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var args = ToTuple(new object[] - { - @object, - }); - var kwargs = new PyDict(); - if (dtype != null) kwargs["dtype"] = ToPython(dtype); - if (copy != null) kwargs["copy"] = ToPython(copy); - if (order != null) kwargs["order"] = ToPython(order); - if (subok != null) kwargs["subok"] = ToPython(subok); - if (ndmin != null) kwargs["ndmin"] = ToPython(ndmin); - dynamic py = self.InvokeMethod("array", args, kwargs); - return ToCsharp(py); - } - - public NDarray array(T[] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var type = @object.GetDtype(); - //if (dtype != null && !type.Equals( dtype)) - // throw new NotImplementedException("Type of the array is different from specified dtype. Data conversion is not supported (yet)"); - var ndarray = this.empty(new Shape(@object.Length), dtype: dtype??type, order:order); // todo: check out the other parameters - long ptr = ndarray.PyObject.ctypes.data; - switch ((object)@object) - { - case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; - 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 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: - var bytes = a.Select(x => (byte)(x ? 1 : 0)).ToArray(); - Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); - break; - } - return new NDarray(ndarray); - } - - public NDarray array(T[,] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var d1_array = @object.Cast().ToArray(); - var type = d1_array.GetDtype(); - //if (dtype != null && type != dtype) - // throw new NotImplementedException("Type of the array is different from specified dtype. Data conversion is not supported (yet)"); - var ndarray = this.empty(new Shape(@object.GetLength(0), @object.GetLength(1)), dtype: dtype??type, order: order); // todo: check out the other parameters - long ptr = ndarray.PyObject.ctypes.data; - switch ((object)d1_array) - { - case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; - 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 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: - var bytes = a.Select(x => (byte) (x ? 1 : 0)).ToArray(); - Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); - break; - } - return new NDarray(ndarray); - } - - public NDarray array(T[,,] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) - { - var d1_array = @object.Cast().ToArray(); - var type = d1_array.GetDtype(); - //if (dtype != null && type != dtype) - // throw new NotImplementedException("Type of the array is different from specified dtype. Data conversion is not supported (yet)"); - var ndarray = this.empty(new Shape(@object.GetLength(0), @object.GetLength(1), @object.GetLength(2)), dtype: dtype ?? type, order: order); // todo: check out the other parameters - long ptr = ndarray.PyObject.ctypes.data; - switch ((object)d1_array) - { - case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; - 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 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: - var bytes = a.Select(x => (byte)(x ? 1 : 0)).ToArray(); - Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); - break; - } - return new NDarray(ndarray); - } - - public NDarray array(string[] obj, int? itemsize = null, bool? copy = null, bool? unicode = null, string order = null) - { - var args = ToTuple(obj); - var kwargs = new PyDict(); - if (itemsize != null) kwargs["itemsize"] = ToPython(itemsize); - if (copy != null) kwargs["copy"] = ToPython(copy); - if (unicode != null) kwargs["unicode"] = ToPython(unicode); - if (order != null) kwargs["order"] = ToPython(order); - dynamic py = self.InvokeMethod("array", args, kwargs); - return ToCsharp(py); - } - - /// - /// Create a 0d array from scalar - /// - /// - /// - /// - public NDarray asarray(ValueType scalar, Dtype dtype = null) - { - var __self__ = self; - var pyargs = ToTuple(new object[] - { - scalar, - }); - var kwargs = new PyDict(); - if (dtype != null) kwargs["dtype"] = ToPython(dtype); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert an array of size 1 to its scalar equivalent. - /// - /// - /// Scalar representation of a. The output data type is the same type - /// returned by the input’s item method. - /// - public T asscalar(NDarray a) => self.InvokeMethod("asscalar", a.PyObject).As(); - - - } -} diff --git a/src/Numpy/Manual/NumPy.linalg.norm.cs b/src/Numpy/Manual/NumPy.linalg.norm.cs deleted file mode 100644 index 75c0d7d..0000000 --- a/src/Numpy/Manual/NumPy.linalg.norm.cs +++ /dev/null @@ -1,108 +0,0 @@ -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 partial class NumPy - { - - /// - /// Matrix or vector norm. - /// - /// This function is able to return one of eight different matrix norms, - /// or one of an infinite number of vector norms (described below), depending - /// on the value of the ord parameter. - /// - /// Notes - /// - /// For values of ord <= 0, the result is, strictly speaking, not a - /// mathematical ‘norm’, but it may still be useful for various numerical - /// purposes. - /// - /// The following norms can be calculated: - /// - /// The Frobenius norm is given by [1]: - /// - /// The nuclear norm is the sum of the singular values. - /// - /// References - /// - /// - /// Input array. If axis is None, x must be 1-D or 2-D. - /// - /// - /// Order of the norm (see table under Notes). inf means numpy’s - /// inf object. - /// - /// - /// If axis is an integer, it specifies the axis of x along which to - /// compute the vector norms. If axis is a 2-tuple, it specifies the - /// axes that hold 2-D matrices, and the matrix norms of these matrices - /// are computed. If axis is None then either a vector norm (when x - /// is 1-D) or a matrix norm (when x is 2-D) is returned. - /// - /// - /// If this is set to True, the axes which are normed over are left in the - /// result as dimensions with size one. With this option the result will - /// broadcast correctly against the original x. - /// - /// - /// Norm of the matrix or vector(s). - /// - public NDarray norm(NDarray x, int? ord = null, int[] axis = null, bool? keepdims = null) - { - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ToPython(ord); - if (axis != null) kwargs["axis"] = ToPython(axis); - if (keepdims != null) kwargs["keepdims"] = ToPython(keepdims); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - return ToCsharp (py); - } - - public float norm(NDarray x, int? ord = null) - { - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ToPython(ord); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - - return ToCsharp(py); - } - - public float norm(NDarray x, string ord) - { - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ToPython(ord); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - return ToCsharp(py); - } - - public float norm(NDarray x, Constants ord) - { - if (ord!=Constants.inf && ord!=Constants.neg_inf) - throw new ArgumentException("ord must be either inf or neg_inf"); - - var pyargs = ToTuple(new object[] { x, }); - var kwargs = new PyDict(); - if (ord != null) kwargs["ord"] = ord==Constants.inf ? self.inf : -(self.inf); - var linalg = self.GetAttr("linalg"); - dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/Manual/NumPy.reshape.cs b/src/Numpy/Manual/NumPy.reshape.cs deleted file mode 100644 index dc4a659..0000000 --- a/src/Numpy/Manual/NumPy.reshape.cs +++ /dev/null @@ -1,52 +0,0 @@ -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 - { - /// - /// 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 array to reshape - /// - /// 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. - /// - /// - /// 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 static NDarray reshape(NDarray a, params int[] newshape) - { - return NumPy.Instance.reshape(a, new Shape(newshape)); - } - } -} diff --git a/src/Numpy/Manual/ctypes.module.cs b/src/Numpy/Manual/ctypes.module.cs new file mode 100644 index 0000000..6d51344 --- /dev/null +++ b/src/Numpy/Manual/ctypes.module.cs @@ -0,0 +1,41 @@ +// Copyright (c) 2019 by Meinrad Recheis and the SciSharp Team +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 ctypes + { + + public static PyObject self => _lazy_self.Value; + + private static Lazy _lazy_self = new Lazy(() => + { + var x=np.self; // <-- make sure np initializes the python engine + var mod = Py.Import("ctypes"); + return mod; + }); + + public static dynamic dynamic_self => self; + private static bool IsInitialized => self != null; + + public static void Dispose() + { + self?.Dispose(); + } + + + } +} + + diff --git a/src/Numpy/Manual/np.aliases.cs b/src/Numpy/Manual/np.aliases.cs index a039cab..3ca28e5 100644 --- a/src/Numpy/Manual/np.aliases.cs +++ b/src/Numpy/Manual/np.aliases.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Numerics; using System.Text; using Numpy.Models; +using Python.Runtime; namespace Numpy { @@ -9,6 +11,41 @@ namespace Numpy public static partial class np { + /// + /// 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 array to reshape + /// + /// 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. + /// + /// + /// 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 static NDarray reshape(NDarray a, params int[] newshape) + { + return np.reshape(a, new Shape(newshape)); + } + /// /// Calculate the absolute value element-wise. /// @@ -34,7 +71,7 @@ public static partial class np /// This is a scalar if x is a scalar. /// public static NDarray abs(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.absolute(x, @out, @where); + => np.absolute(x, @out, @where); /// /// Return the minimum of an array or minimum along an axis. @@ -85,7 +122,7 @@ public static NDarray abs(NDarray x, NDarray @out = null, NDarray @where = null) /// a.ndim - 1. /// public static NDarray min(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amin(a, axis: axis, @out: @out, keepdims: keepdims, initial: initial); + => np.amin(a, axis: axis, @out: @out, keepdims: keepdims, initial: initial); /// /// Return the maximum of an array or maximum along an axis. @@ -136,7 +173,71 @@ public static NDarray min(NDarray a, int[] axis = null, NDarray @out = null, boo /// a.ndim - 1. /// public static NDarray max(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amax(a, axis: axis, @out: @out, keepdims: keepdims, initial: initial); + => np.amax(a, axis: axis, @out: @out, keepdims: keepdims, initial: initial); + + + /// + /// Return a new array of given shape and type, filled with zeros. + /// + /// + /// Shape of the new array, e.g., (2, 3) or 2. + /// + /// + /// The desired data-type for the array, e.g., numpy.int8. Default is + /// numpy.float64. + /// + /// + /// Whether to store multi-dimensional data in row-major + /// (C-style) or column-major (Fortran-style) order in + /// memory. + /// + /// + /// Array of zeros with the given shape, dtype, and order. + /// + public static NDarray zeros(params int[] shape) + => np.zeros(new Shape(shape)); + + + /// + /// Return a new array of given shape and type, filled with ones. + /// + /// + /// Shape of the new array, e.g., (2, 3) or 2. + /// + /// + /// The desired data-type for the array, e.g., numpy.int8. Default is + /// numpy.float64. + /// + /// + /// Whether to store multi-dimensional data in row-major + /// (C-style) or column-major (Fortran-style) order in + /// memory. + /// + /// + /// Array of ones with the given shape, dtype, and order. + /// + public static NDarray ones(params int[] shape) + { + return np.ones(new Shape(shape)); + } + + /// + /// Create an array. + /// + /// + /// The shape of the empty ndarray + /// + /// + /// An array object satisfying the specified requirements. + /// + public static NDarray empty(params int[] shape) + { + return np.empty(new Shape(shape)); + } + + public static NDarray imag(Complex val) => np.asarray(val.Imaginary); + + public static NDarray real(Complex val) => np.asarray(val.Real); } } diff --git a/src/Numpy/Manual/np.array.cs b/src/Numpy/Manual/np.array.cs index b76b8e8..b4348b6 100644 --- a/src/Numpy/Manual/np.array.cs +++ b/src/Numpy/Manual/np.array.cs @@ -1,6 +1,11 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Runtime.InteropServices; using System.Text; +using Numpy.Models; +using Python.Runtime; namespace Numpy { @@ -17,18 +22,177 @@ public static partial class np /// /// An array object satisfying the specified requirements. /// - public static NDarray array(params T[] data) + public static NDarray array(params T[] data) where T : struct { - return NumPy.Instance.array(data); + var __self__ = self; + return array(data, dtype:null); } - public static NDarray array(T[,,] data, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) + public static NDarray array(NDarray @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) { - return NumPy.Instance.array(data, dtype, copy, order, subok, ndmin); + var __self__ = self; + var args = ToTuple(new object[] + { + @object, + }); + var kwargs = new PyDict(); + if (dtype != null) kwargs["dtype"] = ToPython(dtype); + if (copy != null) kwargs["copy"] = ToPython(copy); + if (order != null) kwargs["order"] = ToPython(order); + 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); } - public static NDarray asarray(ValueType a, Dtype dtype = null) - => NumPy.Instance.asarray(a, dtype: dtype); + public static NDarray array(T[] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) where T : struct + { + var __self__ = self; + var type = @object.GetDtype(); + var ndarray = np.empty(new Shape(@object.Length), dtype: type, order: order); + if (@object.Length == 0) + return new NDarray(ndarray); + 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; + case byte[] a: Marshal.Copy(a, 0, new IntPtr(ptr), a.Length); break; + 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: + var bytes = a.Select(x => (byte)(x ? 1 : 0)).ToArray(); + Marshal.Copy(bytes, 0, new IntPtr(ptr), a.Length); + break; + case Complex[] a: + var real = new double[@object.Length]; + var imag = new double[@object.Length]; + for (int i = 0; i < @object.Length; i++) + { + real[i] = a[i].Real; + imag[i] = a[i].Imaginary; + } + var ndreal = np.array(real); + var ndimag = np.array(imag); + ndarray.real = ndreal; + ndarray.imag = ndimag; + break; + } + 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); + } + + public static NDarray array(T[,] @object, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) where T : struct + { + var __self__ = self; + var d1_array = @object.Cast().ToArray(); + var shape = new Shape(@object.GetLength(0), @object.GetLength(1)); + var ndarray = array(d1_array, dtype, copy, order, subok, ndmin); + return new NDarray(ndarray.reshape(shape)); + } + + public static NDarray array(T[,,] data, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) where T : struct + { + var __self__ = self; + var d1_array = data.Cast().ToArray(); + var shape = new Shape(data.GetLength(0), data.GetLength(1), data.GetLength(2)); + var ndarray = array(d1_array, dtype, copy, order, subok, ndmin); + return new NDarray(ndarray.reshape(shape)); + } + + public static NDarray array(T[,,,] data, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) where T : struct + { + var __self__ = self; + var d1_array = data.Cast().ToArray(); + var shape = new Shape(data.GetLength(0), data.GetLength(1), data.GetLength(2), data.GetLength(3)); + var ndarray = array(d1_array, dtype, copy, order, subok, ndmin); + return new NDarray(ndarray.reshape(shape)); + } + + public static NDarray array(T[,,,,] data, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) where T : struct + { + var __self__ = self; + var d1_array = data.Cast().ToArray(); + var shape = new Shape(data.GetLength(0), data.GetLength(1), data.GetLength(2), data.GetLength(3), data.GetLength(4)); + var ndarray = array(d1_array, dtype, copy, order, subok, ndmin); + return new NDarray( ndarray.reshape(shape)); + } + + public static NDarray array(T[,,,,,] data, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) where T : struct + { + var __self__ = self; + var d1_array = data.Cast().ToArray(); + var shape = new Shape(data.GetLength(0), data.GetLength(1), data.GetLength(2), data.GetLength(3), data.GetLength(4), data.GetLength(5)); + var ndarray = array(d1_array, dtype, copy, order, subok, ndmin); + return new NDarray(ndarray.reshape(shape)); + } + + public static NDarray array(string[] strings, int? itemsize = null, bool? copy = null, bool? unicode = null, string order = null) + { + var __self__ = self; + var args = new PyTuple(new PyObject[] { new PyList(strings.Select(s => new PyString(s) as PyObject).ToArray()) }); + //var args = new PyList(new PyObject[0]); + //foreach (var s in strings) + // args.Append(new PyString(s)); + var kwargs = new PyDict(); + if (itemsize != null) kwargs["itemsize"] = ToPython(itemsize); + if (copy != null) kwargs["copy"] = ToPython(copy); + if (unicode != null) kwargs["unicode"] = ToPython(unicode); + if (order != null) kwargs["order"] = ToPython(order); + dynamic py = self.InvokeMethod("array", args, kwargs); + return ToCsharp(py); + } + + public static NDarray array(NDarray[] arrays, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) + => array(arrays.OfType(), dtype, copy, order, subok, ndmin); + + public static NDarray array(IEnumerable> arrays, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) + => array(arrays.OfType(), dtype, copy, order, subok, ndmin); + + public static NDarray array(List arrays, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) + => array((IEnumerable) arrays, dtype, copy, order, subok, ndmin); + + public static NDarray array(NDarray[] arrays, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) + => array((IEnumerable)arrays, dtype, copy, order, subok, ndmin); + + public static NDarray array(IEnumerable arrays, Dtype dtype = null, bool? copy = null, string order = null, bool? subok = null, int? ndmin = null) + { + var __self__ = self; + var args = new PyTuple(new PyObject[]{ new PyList(arrays.Select(nd => nd.PyObject as PyObject).ToArray())}); + var kwargs = new PyDict(); + if (dtype != null) kwargs["dtype"] = ToPython(dtype); + if (copy != null) kwargs["copy"] = ToPython(copy); + if (order != null) kwargs["order"] = ToPython(order); + if (subok != true) kwargs["subok"] = ToPython(subok); + if (ndmin != null) kwargs["ndmin"] = ToPython(ndmin); + dynamic py = self.InvokeMethod("array", args, kwargs); + //dynamic py = dynamic_self.array(arrays, dtype, copy, order, subok, ndmin); + return ToCsharp(py); + } + + public static NDarray asarray(ValueType scalar, Dtype dtype = null) + { + var __self__ = self; + var pyargs = ToTuple(new object[] + { + scalar, + }); + var kwargs = new PyDict(); + if (dtype != null) kwargs["dtype"] = ToPython(dtype); + dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); + return ToCsharp(py); + } /// /// Convert an array of size 1 to its scalar equivalent. @@ -37,7 +201,7 @@ public static NDarray asarray(ValueType a, 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) => NumPy.Instance.asscalar(a); + 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.column_stack.cs b/src/Numpy/Manual/np.column_stack.cs new file mode 100644 index 0000000..02f24d1 --- /dev/null +++ b/src/Numpy/Manual/np.column_stack.cs @@ -0,0 +1,53 @@ +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 + { + + /// + /// Stack 1-D arrays as columns into a 2-D array.

+ /// + /// Take a sequence of 1-D arrays and stack them as columns + /// to make a single 2-D array.

+ /// 2-D arrays are stacked as-is, + /// just like with hstack.

+ /// 1-D arrays are turned into 2-D columns + /// first. + ///
+ /// + /// Arrays to stack.

+ /// All of them must have the same first dimension. + /// + /// + /// The array formed by stacking the given arrays. + /// + public static NDarray column_stack(params NDarray[] tup) + { + //auto-generated code, do not change + var __self__ = self; + PyTuple pyargs; + if (tup.Length == 1) + { + pyargs = ToTuple(new object[] { tup[0], }); + } + else + { + pyargs = ToTuple(new object[] { tup, }); + } + var kwargs = new PyDict(); + dynamic py = __self__.InvokeMethod("column_stack", pyargs, kwargs); + return ToCsharp(py); + } + } +} diff --git a/src/Numpy/Manual/np.concatenate.cs b/src/Numpy/Manual/np.concatenate.cs new file mode 100644 index 0000000..0766401 --- /dev/null +++ b/src/Numpy/Manual/np.concatenate.cs @@ -0,0 +1,121 @@ +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 + { + + /// + /// Join a sequence of arrays along an existing axis.

+ /// + /// Notes + /// + /// When one or more of the arrays to be concatenated is a MaskedArray, + /// this function will return a MaskedArray object instead of an ndarray, + /// but the input masks are not preserved.

+ /// In cases where a MaskedArray + /// is expected as input, use the ma.concatenate function from the masked + /// array module instead. + ///
+ /// + /// The arrays must have the same shape, except in the dimension + /// corresponding to axis (the first, by default). + /// + /// + /// The axis along which the arrays will be joined.

+ /// If axis is None, + /// arrays are flattened before use.

+ /// Default is 0. + /// + /// + /// If provided, the destination to place the result.

+ /// The shape must be + /// correct, matching that of what concatenate would have returned if no + /// out argument were specified. + /// + /// + /// The concatenated array. + /// + public static NDarray concatenate((NDarray,NDarray) arys, int? axis = 0, NDarray @out = null) + => concatenate(new []{arys.Item1, arys.Item2 }, axis, @out); + + /// + /// Join a sequence of arrays along an existing axis.

+ /// + /// Notes + /// + /// When one or more of the arrays to be concatenated is a MaskedArray, + /// this function will return a MaskedArray object instead of an ndarray, + /// but the input masks are not preserved.

+ /// In cases where a MaskedArray + /// is expected as input, use the ma.concatenate function from the masked + /// array module instead. + ///
+ /// + /// The arrays must have the same shape, except in the dimension + /// corresponding to axis (the first, by default). + /// + /// + /// The axis along which the arrays will be joined.

+ /// If axis is None, + /// arrays are flattened before use.

+ /// Default is 0. + /// + /// + /// If provided, the destination to place the result.

+ /// The shape must be + /// correct, matching that of what concatenate would have returned if no + /// out argument were specified. + /// + /// + /// The concatenated array. + /// + public static NDarray concatenate((NDarray, NDarray, NDarray) arys, int? axis = 0, NDarray @out = null) + => concatenate(new[] { arys.Item1, arys.Item2, arys.Item3 }, axis, @out); + + /// + /// Join a sequence of arrays along an existing axis.

+ /// + /// Notes + /// + /// When one or more of the arrays to be concatenated is a MaskedArray, + /// this function will return a MaskedArray object instead of an ndarray, + /// but the input masks are not preserved.

+ /// In cases where a MaskedArray + /// is expected as input, use the ma.concatenate function from the masked + /// array module instead. + ///
+ /// + /// The arrays must have the same shape, except in the dimension + /// corresponding to axis (the first, by default). + /// + /// + /// The axis along which the arrays will be joined.

+ /// If axis is None, + /// arrays are flattened before use.

+ /// Default is 0. + /// + /// + /// If provided, the destination to place the result.

+ /// The shape must be + /// correct, matching that of what concatenate would have returned if no + /// out argument were specified. + /// + /// + /// The concatenated array. + /// + public static NDarray concatenate((NDarray, NDarray, NDarray, NDarray) arys, int? axis = 0, NDarray @out = null) + => concatenate(new[] { arys.Item1, arys.Item2, arys.Item3, arys.Item4 }, axis, @out); + + } +} diff --git a/src/Numpy/Manual/np.constants.cs b/src/Numpy/Manual/np.constants.cs index 403dc7f..7fd8299 100644 --- a/src/Numpy/Manual/np.constants.cs +++ b/src/Numpy/Manual/np.constants.cs @@ -10,90 +10,90 @@ public static partial class np /// /// IEEE 754 floating point representation of (positive) infinity. /// - public static float inf => NumPy.Instance.self.GetAttr("inf").As(); + public static float inf => np.self.GetAttr("inf").As(); /// /// IEEE 754 floating point representation of (positive) infinity. /// /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. /// - public static float Inf => NumPy.Instance.self.GetAttr("inf").As(); + public static float Inf => np.self.GetAttr("inf").As(); /// /// IEEE 754 floating point representation of (positive) infinity. /// /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. /// - public static float Infinity => NumPy.Instance.self.GetAttr("inf").As(); + public static float Infinity => np.self.GetAttr("inf").As(); /// /// IEEE 754 floating point representation of (positive) infinity. /// /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. /// - public static float PINF => NumPy.Instance.self.GetAttr("inf").As(); + public static float PINF => np.self.GetAttr("inf").As(); /// /// IEEE 754 floating point representation of (positive) infinity. /// /// Use np.inf because Inf, Infinity, PINF and infty are aliases for inf.For more details, see inf. /// - public static float infty => NumPy.Instance.self.GetAttr("inf").As(); + public static float infty => np.self.GetAttr("inf").As(); /// /// IEEE 754 floating point representation of (positive) infinity. /// - public static float NINF => NumPy.Instance.self.GetAttr("NINF").As(); + public static float NINF => np.self.GetAttr("NINF").As(); /// /// IEEE 754 floating point representation of Not a Number(NaN). /// - public static float nan => NumPy.Instance.self.GetAttr("nan").As(); + public static float nan => np.self.GetAttr("nan").As(); /// /// IEEE 754 floating point representation of Not a Number(NaN). /// /// NaN and NAN are equivalent definitions of nan.Please use nan instead of NAN. /// - public static float NaN => NumPy.Instance.self.GetAttr("nan").As(); + public static float NaN => np.self.GetAttr("nan").As(); /// /// IEEE 754 floating point representation of Not a Number(NaN). /// /// NaN and NAN are equivalent definitions of nan.Please use nan instead of NAN. /// - public static float NAN => NumPy.Instance.self.GetAttr("nan").As(); + public static float NAN => np.self.GetAttr("nan").As(); /// /// IEEE 754 floating point representation of negative zero. /// - public static float NZERO => NumPy.Instance.self.GetAttr("NZERO").As(); + public static float NZERO => np.self.GetAttr("NZERO").As(); /// /// IEEE 754 floating point representation of positive zero. /// - public static float PZERO => NumPy.Instance.self.GetAttr("PZERO").As(); + public static float PZERO => np.self.GetAttr("PZERO").As(); /// /// Euler’s constant, base of natural logarithms, Napier’s constant. /// - public static float e => NumPy.Instance.self.GetAttr("e").As(); + public static float e => np.self.GetAttr("e").As(); /// /// γ = 0.5772156649015328606065120900824024310421... /// https://en.wikipedia.org/wiki/Euler-Mascheroni_constant /// - public static float euler_gamma => NumPy.Instance.self.GetAttr("e").As(); + public static float euler_gamma => np.self.GetAttr("e").As(); /// /// A convenient alias for None, useful for indexing arrays. /// - public static object newaxis => NumPy.Instance.self.GetAttr("newaxis"); + public static object newaxis => np.self.GetAttr("newaxis"); /// /// pi = 3.1415926535897932384626433... /// - public static float pi => NumPy.Instance.self.GetAttr("pi").As(); + public static float pi => np.self.GetAttr("pi").As(); } } diff --git a/src/Numpy/Manual/np.delete.cs b/src/Numpy/Manual/np.delete.cs new file mode 100644 index 0000000..cabc2e0 --- /dev/null +++ b/src/Numpy/Manual/np.delete.cs @@ -0,0 +1,112 @@ +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 overloads + /// + public static partial class np + { + + /// + /// 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. + ///
+ /// + /// Input array. + /// + /// + /// 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 static NDarray delete(NDarray arr, int obj, int? axis = null) + { + //auto-generated code, do not change + var __self__ = self; + var pyargs = ToTuple(new object[] + { + arr, + obj, + }); + var kwargs = new PyDict(); + if (axis != null) kwargs["axis"] = ToPython(axis); + dynamic py = __self__.InvokeMethod("delete", 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. + ///
+ /// + /// Input array. + /// + /// + /// 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 static NDarray delete(NDarray arr, int[] obj, int? axis = null) + { + //auto-generated code, do not change + var __self__ = self; + var pyargs = ToTuple(new object[] + { + arr, + obj, + }); + var kwargs = new PyDict(); + if (axis != null) kwargs["axis"] = ToPython(axis); + dynamic py = __self__.InvokeMethod("delete", pyargs, kwargs); + return ToCsharp(py); + } + } +} 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.empty.cs b/src/Numpy/Manual/np.empty.cs deleted file mode 100644 index efcb9e9..0000000 --- a/src/Numpy/Manual/np.empty.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Create an array. - /// - /// - /// The shape of the empty ndarray - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray empty(params int[] shape) - { - return NumPy.Instance.empty(new Shape(shape)); - } - } -} 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 77b43ea..98b0580 100644 --- a/src/Numpy/Manual/np.linalg.norm.cs +++ b/src/Numpy/Manual/np.linalg.norm.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Numpy.Models; +using Python.Runtime; namespace Numpy { @@ -53,17 +54,159 @@ public static partial class linalg /// /// Norm of the matrix or vector(s). /// + public static NDarray norm(NDarray x, int? ord = null, int? axis = null, bool? keepdims = null) + { + var pyargs = ToTuple(new object[] { x, }); + var kwargs = new PyDict(); + if (ord != null) kwargs["ord"] = ToPython(ord); + if (axis != null) kwargs["axis"] = ToPython(axis); + if (keepdims != null) kwargs["keepdims"] = ToPython(keepdims); + var linalg = self.GetAttr("linalg"); + dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); + return ToCsharp(py); + } + + public static NDarray norm(NDarray x, int[] axis, bool? keepdims = null) => norm(x, null, axis, keepdims); + public static NDarray norm(NDarray x, int? ord, int[] axis, bool? keepdims = null) - => NumPy.Instance.norm(x, ord, axis, keepdims); + { + var pyargs = ToTuple(new object[] { x, }); + var kwargs = new PyDict(); + if (ord != null) kwargs["ord"] = ToPython(ord); + if (axis != null) kwargs["axis"] = ToPython(axis); + if (keepdims != null) kwargs["keepdims"] = ToPython(keepdims); + var linalg = self.GetAttr("linalg"); + dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); + return ToCsharp(py); + } + - public static float norm(NDarray x, int? ord=null) - => NumPy.Instance.norm(x, ord); + //public static float norm(NDarray x, int? ord=null, int? axis = null, bool? keepdims = null) + //{ + // var pyargs = ToTuple(new object[] { x, }); + // var kwargs = new PyDict(); + // if (ord != null) kwargs["ord"] = ToPython(ord); + // var linalg = self.GetAttr("linalg"); + // dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); + + // return ToCsharp(py); + //} public static float norm(NDarray x, string ord) - => NumPy.Instance.norm(x, ord); + { + var pyargs = ToTuple(new object[] { x, }); + var kwargs = new PyDict(); + if (ord != null) kwargs["ord"] = ToPython(ord); + var linalg = self.GetAttr("linalg"); + dynamic py = linalg.InvokeMethod("norm", pyargs, kwargs); + return ToCsharp(py); + } public static float norm(NDarray x, Constants ord) - => NumPy.Instance.norm(x, ord); + { + if (ord != Constants.inf && ord != Constants.neg_inf) + throw new ArgumentException("ord must be either inf or neg_inf"); + + var pyargs = ToTuple(new object[] { x, }); + var kwargs = new PyDict(); + if (ord != null) kwargs["ord"] = ord == Constants.inf ? dynamic_self.inf : -(dynamic_self.inf); + var linalg = self.GetAttr("linalg"); + 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.linspace.cs b/src/Numpy/Manual/np.linspace.cs new file mode 100644 index 0000000..9830b3e --- /dev/null +++ b/src/Numpy/Manual/np.linspace.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Numpy.Models; +using Python.Runtime; + +namespace Numpy +{ + + public static partial class np + { + + /// + /// Return evenly spaced numbers over a specified interval.

+ /// + /// Returns num evenly spaced samples, calculated over the + /// interval [start, stop].

+ /// + /// The endpoint of the interval can optionally be excluded. + ///
+ /// + /// The starting value of the sequence. + /// + /// + /// The end value of the sequence, unless endpoint is set to False.

+ /// + /// In that case, the sequence consists of all but the last of num + 1 + /// evenly spaced samples, so that stop is excluded.

+ /// Note that the step + /// size changes when endpoint is False. + /// + /// Returns the step which is the spacing + /// between samples. + /// + /// + /// Number of samples to generate.

+ /// Default is 50. Must be non-negative. + /// + /// + /// If True, stop is the last sample.

+ /// Otherwise, it is not included.

+ /// + /// Default is True. + /// + /// + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. + /// + /// + /// The axis in the result to store the samples.

+ /// Relevant only if start + /// or stop are array-like.

+ /// By default (0), the samples will be along a + /// new axis inserted at the beginning.

+ /// Use -1 to get an axis at the end. + /// + /// + /// There are num equally spaced samples in the closed interval + /// [start, stop] or the half-open interval [start, stop) + /// + public static NDarray linspace(NDarray start, NDarray stop, out float step, int num = 50, bool endpoint = true, + Dtype dtype = null, int? axis = 0) + { + //auto-generated code, do not change + var __self__ = self; + var pyargs = ToTuple(new object[] + { + start, + stop, + }); + var kwargs = new PyDict(); + if (num != null) kwargs["num"] = ToPython(num); + if (endpoint != null) kwargs["endpoint"] = ToPython(endpoint); + kwargs["retstep"] = ToPython(true); // we want the step to be returned! + if (dtype != null) kwargs["dtype"] = ToPython(dtype); + if (axis != 0) kwargs["axis"] = ToPython(axis); + dynamic py = __self__.InvokeMethod("linspace", pyargs, kwargs); + var t = py as PyObject; + step = ToCsharp(t[1]); + return ToCsharp(t[0]); + } + + /// + /// Return evenly spaced numbers over a specified interval.

+ /// + /// Returns num evenly spaced samples, calculated over the + /// interval [start, stop].

+ /// + /// The endpoint of the interval can optionally be excluded. + ///
+ /// + /// The starting value of the sequence. + /// + /// + /// The end value of the sequence, unless endpoint is set to False.

+ /// + /// In that case, the sequence consists of all but the last of num + 1 + /// evenly spaced samples, so that stop is excluded.

+ /// Note that the step + /// size changes when endpoint is False. + /// + /// Returns the step which is the spacing + /// between samples. + /// + /// + /// Number of samples to generate.

+ /// Default is 50. Must be non-negative. + /// + /// + /// If True, stop is the last sample.

+ /// Otherwise, it is not included.

+ /// + /// Default is True. + /// + /// + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. + /// + /// + /// The axis in the result to store the samples.

+ /// Relevant only if start + /// or stop are array-like.

+ /// By default (0), the samples will be along a + /// new axis inserted at the beginning.

+ /// Use -1 to get an axis at the end. + /// + /// + /// There are num equally spaced samples in the closed interval + /// [start, stop] or the half-open interval [start, stop) + /// + public static NDarray linspace(double start, double stop, out float step, int num = 50, bool endpoint = true, Dtype dtype = null, int? axis = 0) + { + //auto-generated code, do not change + var __self__ = self; + var pyargs = ToTuple(new object[] + { + start, + stop, + }); + var kwargs = new PyDict(); + if (num != 50) kwargs["num"] = ToPython(num); + if (endpoint != true) kwargs["endpoint"] = ToPython(endpoint); + kwargs["retstep"] = ToPython(true); // we want the step to be returned! + if (dtype != null) kwargs["dtype"] = ToPython(dtype); + if (axis != 0) kwargs["axis"] = ToPython(axis); + dynamic py = __self__.InvokeMethod("linspace", pyargs, kwargs); + var t = py as PyObject; + step = ToCsharp(t[1]); + return ToCsharp(t[0]); + } + + } +} 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/Manual/np.meshgrid.cs b/src/Numpy/Manual/np.meshgrid.cs new file mode 100644 index 0000000..01e939c --- /dev/null +++ b/src/Numpy/Manual/np.meshgrid.cs @@ -0,0 +1,130 @@ +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 + { + + /// + /// Return coordinate matrices from coordinate vectors.

+ /// + /// Make N-D coordinate arrays for vectorized evaluations of + /// N-D scalar/vector fields over N-D grids, given + /// one-dimensional coordinate arrays x1, x2,…, xn.

+ /// + /// Notes + /// + /// This function supports both indexing conventions through the indexing + /// keyword argument.

+ /// Giving the string ‘ij’ returns a meshgrid with + /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing.

+ /// + /// In the 2-D case with inputs of length M and N, the outputs are of shape + /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing.

+ /// In the 3-D case + /// with inputs of length M, N and P, outputs are of shape (N, M, P) for + /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing.

+ /// The difference is + /// illustrated by the following code snippet: + /// + /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. + ///
+ /// + /// 1-D arrays representing the coordinates of a grid. + /// + /// + /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output.

+ /// + /// See Notes for more details. + /// + /// + /// If True a sparse grid is returned in order to conserve memory.

+ /// + /// Default is False. + /// + /// + /// If False, a view into the original arrays are returned in order to + /// conserve memory.

+ /// Default is True.

+ /// Please note that + /// sparse=False, copy=False will likely return non-contiguous + /// arrays.

+ /// Furthermore, more than one element of a broadcast array + /// may refer to a single memory location.

+ /// If you need to write to the + /// arrays, make copies first. + /// + /// + /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , + /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ + /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ + /// with the elements of xi repeated to fill the matrix along + /// the first dimension for x1, the second for x2 and so on. + /// + public static NDarray[] meshgrid(NDarray[] xi, string indexing = "xy", bool? sparse = null, bool? copy = null) + { + var __self__ = self; + var pyargs = ToTuple(xi); + var kwargs = new PyDict(); + if (indexing != "xy") kwargs["indexing"] = ToPython(indexing); + if (sparse != null) kwargs["sparse"] = ToPython(sparse); + if (copy != null) kwargs["copy"] = ToPython(copy); + dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Return coordinate matrices from coordinate vectors.

+ /// + /// Make N-D coordinate arrays for vectorized evaluations of + /// N-D scalar/vector fields over N-D grids, given + /// one-dimensional coordinate arrays x1, x2,…, xn.

+ /// + /// Notes + /// + /// This function supports both indexing conventions through the indexing + /// keyword argument.

+ /// Giving the string ‘ij’ returns a meshgrid with + /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing.

+ /// + /// In the 2-D case with inputs of length M and N, the outputs are of shape + /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing.

+ /// In the 3-D case + /// with inputs of length M, N and P, outputs are of shape (N, M, P) for + /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing.

+ /// The difference is + /// illustrated by the following code snippet: + /// + /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. + ///
+ /// + /// 1-D arrays representing the coordinates of a grid. + /// + /// + /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , + /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ + /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ + /// with the elements of xi repeated to fill the matrix along + /// the first dimension for x1, the second for x2 and so on. + /// + public static NDarray[] meshgrid(params NDarray[] xi) + { + var __self__ = self; + var pyargs = ToTuple(xi); + var kwargs = new PyDict(); + dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); + return ToCsharp(py); + } + + } +} diff --git a/src/Numpy/Manual/np.ones.cs b/src/Numpy/Manual/np.ones.cs deleted file mode 100644 index 6072b2c..0000000 --- a/src/Numpy/Manual/np.ones.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Return a new array of given shape and type, filled with ones. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of ones with the given shape, dtype, and order. - /// - public static NDarray ones(params int[] shape) - { - return NumPy.Instance.ones(new Shape(shape)); - } - } -} diff --git a/src/Numpy/Manual/np.random.cs b/src/Numpy/Manual/np.random.cs new file mode 100644 index 0000000..b4bb7c1 --- /dev/null +++ b/src/Numpy/Manual/np.random.cs @@ -0,0 +1,182 @@ +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 +{ + + public static partial class np + { + public static partial class random + { + /// + /// Random values in a given shape.

+ /// + /// Create an array of the given shape and populate it with + /// random samples from a uniform distribution + /// over [0, 1).

+ /// + /// Notes + /// + /// This is a convenience function.

+ /// If you want an interface that + /// takes a shape-tuple as the first argument, refer to + /// np.random.random_sample . + ///
+ /// + /// Random values. + /// + public static NDarray rand(params int[] shape) + { + var random = self.GetAttr("random"); + var __self__ = random; + var pyargs = ToTuple(shape); + var kwargs = new PyDict(); + dynamic py = __self__.InvokeMethod("rand", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Return a sample (or samples) from the “standard normal” distribution.

+ /// + /// If positive, int_like or int-convertible arguments are provided, + /// randn generates an array of shape (d0, d1, ..., dn), filled + /// with random floats sampled from a univariate “normal” (Gaussian) + /// distribution of mean 0 and variance 1 (if any of the are + /// floats, they are first converted to integers by truncation).

+ /// A single + /// float randomly sampled from the distribution is returned if no + /// argument is provided.

+ /// + /// This is a convenience function.

+ /// If you want an interface that takes a + /// tuple as the first argument, use numpy.random.standard_normal instead.

+ /// + /// Notes + /// + /// For random samples from , use: + /// + /// sigma * np.random.randn(...) + mu + ///
+ /// + /// A (d0, d1, ..., dn)-shaped array of floating-point samples from + /// the standard normal distribution, or a single such float if + /// no parameters were supplied. + /// + public static NDarray randn(params int[] shape) + { + var random = self.GetAttr("random"); + var __self__ = random; + var pyargs = ToTuple(shape); + var kwargs = new PyDict(); + dynamic py = __self__.InvokeMethod("randn", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Draw random samples from a normal (Gaussian) distribution.

+ /// + /// The probability density function of the normal distribution, first + /// derived by De Moivre and 200 years later by both Gauss and Laplace + /// independently [2], is often called the bell curve because of + /// its characteristic shape (see the example below).

+ /// + /// The normal distributions occurs often in nature.

+ /// For example, it + /// describes the commonly occurring distribution of samples influenced + /// by a large number of tiny, random disturbances, each with its own + /// unique distribution [2].

+ /// + /// Notes + /// + /// The probability density for the Gaussian distribution is + /// + /// where is the mean and the standard + /// deviation.

+ /// The square of the standard deviation, , + /// is called the variance.

+ /// + /// The function has its peak at the mean, and its “spread” increases with + /// the standard deviation (the function reaches 0.607 times its maximum at + /// and [2]).

+ /// This implies that + /// numpy.random.normal is more likely to return samples lying close to + /// the mean, rather than those far away.

+ /// + /// References + ///
+ /// + /// Mean (“centre”) of the distribution. + /// + /// + /// Standard deviation (spread or “width”) of the distribution. + /// + /// + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if loc and scale are both scalars.

+ /// + /// Otherwise, np.broadcast(loc, scale).size samples are drawn. + /// + /// + /// Drawn samples from the parameterized normal distribution. + /// + public static NDarray normal(NDarray loc, NDarray scale=null, int[] size=null) + { + var random = self.GetAttr("random"); + var __self__ = random; + var pyargs = ToTuple(new object[] + { + }); + var kwargs = new PyDict(); + if (loc != null) kwargs["loc"] = ToPython(loc); + if (scale != null) kwargs["scale"] = ToPython(scale); + if (size != null) kwargs["size"] = ToPython(size); + dynamic py = __self__.InvokeMethod("normal", pyargs, kwargs); + return ToCsharp(py); + } + + public static NDarray normal(float? loc=null, float? scale = null, int[] size = null) + { + var random = self.GetAttr("random"); + var __self__ = random; + var pyargs = ToTuple(new object[] + { + }); + var kwargs = new PyDict(); + if (loc != null) kwargs["loc"] = ToPython(loc); + if (scale != null) kwargs["scale"] = ToPython(scale); + if (size != null) kwargs["size"] = ToPython(size); + dynamic py = __self__.InvokeMethod("normal", pyargs, kwargs); + return ToCsharp(py); + } + + public static NDarray normal(float loc) => normal(loc, null, null); + + public static NDarray normal(float loc, float scale) => normal(loc, scale, null); + + public static NDarray normal(float loc, float scale, int size) + { + var random = self.GetAttr("random"); + var __self__ = random; + var pyargs = ToTuple(new object[] + { + }); + var kwargs = new PyDict(); + kwargs["loc"] = ToPython(loc); + kwargs["scale"] = ToPython(scale); + kwargs["size"] = ToPython(size); + dynamic py = __self__.InvokeMethod("normal", pyargs, kwargs); + return ToCsharp(py); + } + + } + } +} diff --git a/src/Numpy/Manual/NumPy.resize.cs b/src/Numpy/Manual/np.resize.cs similarity index 92% rename from src/Numpy/Manual/NumPy.resize.cs rename to src/Numpy/Manual/np.resize.cs index 1a770eb..af1cfbf 100644 --- a/src/Numpy/Manual/NumPy.resize.cs +++ b/src/Numpy/Manual/np.resize.cs @@ -12,7 +12,7 @@ namespace Numpy /// /// Manual type conversions /// - public partial class NumPy + public static partial class np { /// @@ -44,7 +44,7 @@ public partial class NumPy /// if necessary to fill out the required number of elements. The /// data are repeated in the order that they are stored in memory. /// - public NDarray resize(NDarray a, Shape new_shape) + public static NDarray resize(NDarray a, Shape new_shape) { var pyargs = ToTuple(new object[] { diff --git a/src/Numpy/Manual/np.save.cs b/src/Numpy/Manual/np.save.cs new file mode 100644 index 0000000..e2a62bd --- /dev/null +++ b/src/Numpy/Manual/np.save.cs @@ -0,0 +1,184 @@ +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 + { + + /// + /// Save an array to a binary file in NumPy .npy format.

+ /// + /// Notes + /// + /// For a description of the .npy format, see numpy.lib.format. + ///
+ /// + /// File or filename to which the data is saved.

+ /// If file is a file-object, + /// then the filename is unchanged.

+ /// If file is a string or Path, a .npy + /// extension will be appended to the file name if it does not already + /// have one. + /// + /// + /// Array data to be saved. + /// + /// + /// Allow saving object arrays using Python pickles.

+ /// Reasons for disallowing + /// pickles include security (loading pickled data can execute arbitrary + /// code) and portability (pickled objects may not be loadable on different + /// Python installations, for example if the stored objects require libraries + /// that are not available, and not all pickled data is compatible between + /// Python 2 and Python 3).

+ /// + /// Default: True + /// + /// + /// Only useful in forcing objects in object arrays on Python 3 to be + /// pickled in a Python 2 compatible way.

+ /// If fix_imports is True, pickle + /// will try to map the new Python 3 names to the old module names used in + /// Python 2, so that the pickle data stream is readable with Python 2. + /// + public static void save(string file, NDarray arr, bool? allow_pickle = true, bool? fix_imports = true) + { + //auto-generated code, do not change + var __self__ = self; + var pyargs = ToTuple(new object[] + { + file, + arr, + }); + var kwargs = new PyDict(); + if (allow_pickle != true) kwargs["allow_pickle"] = ToPython(allow_pickle); + if (fix_imports != true) kwargs["fix_imports"] = ToPython(fix_imports); + dynamic py = __self__.InvokeMethod("save", pyargs, kwargs); + } + + /// + /// Save several arrays into a single file in uncompressed .npz format.

+ /// + /// If arguments are passed in with no keywords, the corresponding variable + /// names, in the .npz file, are ‘arr_0’, ‘arr_1’, etc.

+ /// If keyword + /// arguments are given, the corresponding variable names, in the .npz + /// file will match the keyword names.

+ /// + /// Notes + /// + /// The .npz file format is a zipped archive of files named after the + /// variables they contain.

+ /// The archive is not compressed and each file + /// in the archive contains one variable in .npy format.

+ /// For a + /// description of the .npy format, see numpy.lib.format.

+ /// + /// When opening the saved .npz file with load a NpzFile object is + /// returned.

+ /// This is a dictionary-like object which can be queried for + /// its list of arrays (with the .files attribute), and for the arrays + /// themselves. + ///
+ /// + /// Either the file name (string) or an open file (file-like object) + /// where the data will be saved.

+ /// If file is a string or a Path, the + /// .npz extension will be appended to the file name if it is not + /// already there. + /// + /// + /// Arrays to save to the file.

+ /// Since it is not possible for Python to + /// know the names of the arrays outside savez, the arrays will be saved + /// with names “arr_0”, “arr_1”, and so on.

+ /// These arguments can be any + /// expression. + /// + /// + /// Arrays to save to the file.

+ /// Arrays will be saved in the file with the + /// keyword names. + /// + public static void savez(string file, NDarray[] args = null, Dictionary kwds = null) + { + var __self__ = self; + var pyargs = ToTuple(new object[] { file, }.Concat(args ?? new NDarray[0]).ToArray()); + var kwargs = new PyDict(); + if (kwds != null) + { + foreach(var pair in kwds) + kwargs[pair.Key] = ToPython(pair.Value); + } + dynamic py = __self__.InvokeMethod("savez", pyargs, kwargs); + } + + /// + /// Save several arrays into a single file in compressed .npz format.

+ /// + /// If keyword arguments are given, then filenames are taken from the keywords.

+ /// + /// If arguments are passed in with no keywords, then stored file names are + /// arr_0, arr_1, etc.

+ /// + /// Notes + /// + /// The .npz file format is a zipped archive of files named after the + /// variables they contain.

+ /// The archive is compressed with + /// zipfile.ZIP_DEFLATED and each file in the archive contains one variable + /// in .npy format.

+ /// For a description of the .npy format, see + /// numpy.lib.format.

+ /// + /// When opening the saved .npz file with load a NpzFile object is + /// returned.

+ /// This is a dictionary-like object which can be queried for + /// its list of arrays (with the .files attribute), and for the arrays + /// themselves. + ///
+ /// + /// Either the file name (string) or an open file (file-like object) + /// where the data will be saved.

+ /// If file is a string or a Path, the + /// .npz extension will be appended to the file name if it is not + /// already there. + /// + /// + /// Arrays to save to the file.

+ /// Since it is not possible for Python to + /// know the names of the arrays outside savez, the arrays will be saved + /// with names “arr_0”, “arr_1”, and so on.

+ /// These arguments can be any + /// expression. + /// + /// + /// Arrays to save to the file.

+ /// Arrays will be saved in the file with the + /// keyword names. + /// + public static void savez_compressed(string file, NDarray[] args = null, Dictionary kwds = null) + { + var __self__ = self; + var pyargs = ToTuple(new object[] { file, }.Concat(args ?? new NDarray[0]).ToArray()); + var kwargs = new PyDict(); + if (kwds != null) + { + foreach (var pair in kwds) + kwargs[pair.Key] = ToPython(pair.Value); + } + dynamic py = __self__.InvokeMethod("savez_compressed", pyargs, kwargs); + } + + } +} diff --git a/src/Numpy/Manual/np.zeros.cs b/src/Numpy/Manual/np.zeros.cs deleted file mode 100644 index cd359b2..0000000 --- a/src/Numpy/Manual/np.zeros.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Numpy.Models; - -namespace Numpy -{ - - public static partial class np - { - - /// - /// Return a new array of given shape and type, filled with zeros. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of zeros with the given shape, dtype, and order. - /// - public static NDarray zeros(params int[] shape) - => NumPy.Instance.zeros(new Shape(shape)); - } -} diff --git a/src/Numpy/Models/Axis.cs b/src/Numpy/Models/Axis.cs new file mode 100644 index 0000000..1fc2b81 --- /dev/null +++ b/src/Numpy/Models/Axis.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Numpy.Models +{ + /// + /// Special type for axis parameters that can be automatically cast implicitly from int or int[] + /// + public class Axis + { + /// + /// Default axis, corresponds to axis=null in Numpy + /// + public Axis() { } + + /// + /// Single axis, corresponds to axis=x in Numpy + /// + /// + public Axis(int axis) + { + Axes = new[] {axis}; + } + + /// + /// Multiple axes, corresponds to axis=(x,y, ...) in Numpy + /// + /// + public Axis(params int[] axes) + { + Axes = axes; + } + + public readonly int[] Axes = null; + + public static implicit operator Axis(int axis) + { + return new Axis(axis); + } + + public static implicit operator Axis(int[] axes) + { + return new Axis(axes); + } + + public static implicit operator Axis(ValueTuple tuple) => new Axis(tuple.Item1); + public static implicit operator Axis(ValueTuple tuple) => new Axis(tuple.Item1, tuple.Item2); + public static implicit operator Axis(ValueTuple tuple) => new Axis(tuple.Item1, tuple.Item2, tuple.Item3); + public static implicit operator Axis(ValueTuple tuple) => new Axis(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); + public static implicit operator Axis(ValueTuple tuple) => new Axis(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); + + #region Equality + + + public override bool Equals(object obj) + { + var b = obj as Axis; + if (b == null) + { + if (Axes == null) + return true; + else if (Axes.Length == 0) + return true; + return false; + } + return Enumerable.SequenceEqual(Axes, b.Axes); + } + + public static bool operator ==(Axis a, Axis b) + { + if (Object.ReferenceEquals(a, null) && Object.ReferenceEquals(b, null)) + return true; + if (Object.ReferenceEquals(a, null)) + return b.Equals(a); + return a.Equals(b); + } + + public static bool operator !=(Axis a, Axis b) + { + return !(a == b); + } + + public override int GetHashCode() + { + if (Axes == null) + return 0; + return Axes.GetHashCode(); + } + + #endregion + } + + +} diff --git a/src/Numpy/Models/Dtype.cs b/src/Numpy/Models/Dtype.cs index 5d38921..7664fff 100644 --- a/src/Numpy/Models/Dtype.cs +++ b/src/Numpy/Models/Dtype.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Net.Mail; +using System.Numerics; using System.Text; using Python.Runtime; @@ -36,6 +38,9 @@ public static Dtype GetDtype(this object obj) case ulong o: return np.uint64; case float o: return np.float32; case double o: return np.float64; + case string o: return np.unicode_; + case char o: return np.unicode_; + case Complex o: return np.complex_; case bool[] o: return np.bool8; case byte[] o: return np.@byte; case short[] o: return np.int16; @@ -43,6 +48,9 @@ public static Dtype GetDtype(this object obj) case long[] o: return np.int64; case float[] o: return np.float32; case double[] o: return np.float64; + case string[] o: return np.unicode_; + case char[] o: return np.unicode_; + case Complex[] o: return np.complex_; case bool[,] o: return np.bool8; case byte[,] o: return np.uint8; case short[,] o: return np.int16; @@ -50,6 +58,9 @@ public static Dtype GetDtype(this object obj) case long[,] o: return np.int64; case float[,] o: return np.float32; case double[,] o: return np.float64; + case string[,] o: return np.unicode_; + case char[,] o: return np.unicode_; + case Complex[,] o: return np.complex_; case bool[,,] o: return np.bool8; case byte[,,] o: return np.uint8; case short[,,] o: return np.int16; @@ -57,6 +68,39 @@ public static Dtype GetDtype(this object obj) case long[,,] o: return np.int64; case float[,,] o: return np.float32; case double[,,] o: return np.float64; + case string[,,] o: return np.unicode_; + case char[,,] o: return np.unicode_; + case Complex[ ,,] o: return np.complex_; + case bool[,,,] o: return np.bool8; + case byte[,,,] o: return np.uint8; + case short[,,,] o: return np.int16; + case int[,,,] o: return np.int32; + case long[,,,] o: return np.int64; + case float[,,,] o: return np.float32; + case double[,,,] o: return np.float64; + case string[,,,] o: return np.unicode_; + case char[,,,] o: return np.unicode_; + case Complex[,,,] o: return np.complex_; + case bool[,,,,] o: return np.bool8; + case byte[,,,,] o: return np.uint8; + case short[,,,,] o: return np.int16; + case int[,,,,] o: return np.int32; + case long[,,,,] o: return np.int64; + case float[,,,,] o: return np.float32; + case double[,,,,] o: return np.float64; + case string[,,,,] o: return np.unicode_; + case char[,,,,] o: return np.unicode_; + case Complex[,,,,] o: return np.complex_; + case bool[,,,,,] o: return np.bool8; + case byte[,,,,,] o: return np.uint8; + case short[,,,,,] o: return np.int16; + case int[,,,,,] o: return np.int32; + case long[,,,,,] o: return np.int64; + case float[,,,,,] o: return np.float32; + case double[,,,,,] o: return np.float64; + case string[,,,,,] o: return np.unicode_; + case char[,,,,,] o: return np.unicode_; + case Complex[,,,,,] o: return np.complex_; default: throw new ArgumentException("Can not convert type of given object to dtype: " + obj.GetType()); } } diff --git a/src/Numpy/Models/NDarray.CastOperators.cs b/src/Numpy/Models/NDarray.CastOperators.cs index 758c69b..c49a2a6 100644 --- a/src/Numpy/Models/NDarray.CastOperators.cs +++ b/src/Numpy/Models/NDarray.CastOperators.cs @@ -20,6 +20,7 @@ public static implicit operator NDarray(Array array) case long[] a: return np.array(a); case float[] a: return np.array(a); case double[] a: return np.array(a); + case string[] a: return np.array(a); case byte[,] a: return np.array(a); case bool[,] a: return np.array(a); case short[,] a: return np.array(a); @@ -27,6 +28,7 @@ public static implicit operator NDarray(Array array) case long[,] a: return np.array(a); case float[,] a: return np.array(a); case double[,] a: return np.array(a); + case string[,] a: return np.array(a); case byte[,,] a: return np.array(a); case bool[,,] a: return np.array(a); case short[,,] a: return np.array(a); @@ -34,17 +36,18 @@ public static implicit operator NDarray(Array array) case long[,,] a: return np.array(a); case float[,,] a: return np.array(a); case double[,,] a: return np.array(a); + case string[,,] a: return np.array(a); } throw new InvalidOperationException($"Unable to cast {array.GetType()} to NDarray"); } - // these must be explicit or we have bad side effects - public static explicit operator NDarray(bool d) => np.asarray(d); - public static explicit operator NDarray(byte d) => np.asarray(d); - public static explicit operator NDarray(short d) => np.asarray(d); - public static explicit operator NDarray(int d) => np.asarray(d); - public static explicit operator NDarray(long d) => np.asarray(d); - public static explicit operator NDarray(float d) => np.asarray(d); + // these must be explicit or we have bad side effects + public static explicit operator NDarray(bool d) => np.asarray(d); + public static explicit operator NDarray(byte d) => np.asarray(d); + public static explicit operator NDarray(short d) => np.asarray(d); + public static explicit operator NDarray(int d) => np.asarray(d); + public static explicit operator NDarray(long d) => np.asarray(d); + public static explicit operator NDarray(float d) => np.asarray(d); public static explicit operator NDarray(double d) => np.asarray(d); // these must be explicit or we have bad side effects @@ -56,7 +59,5 @@ public static implicit operator NDarray(Array array) public static explicit operator float(NDarray a) => np.asscalar(a); public static explicit operator double(NDarray a) => np.asscalar(a); - - } } diff --git a/src/Numpy/Models/NDarray.Operators.cs b/src/Numpy/Models/NDarray.Operators.cs index 6c9b9da..b54d4e7 100644 --- a/src/Numpy/Models/NDarray.Operators.cs +++ b/src/Numpy/Models/NDarray.Operators.cs @@ -7,6 +7,9 @@ namespace Numpy { public partial class NDarray { + // this is needed for arithmetic operations where we need to call the module "operator", i.e. value/ndarray + public static PyObject operator_module; + //------------------------------ // Comparison operators: //------------------------------ @@ -35,6 +38,20 @@ public static NDarray operator >(NDarray a, ValueType obj) return new NDarray(a.self.InvokeMethod("__ge__", obj.ToPython())); } + // NOTE: overloading == and != with Python's functionality would cause compile errors throughout all of the code + //// Return self==value. + //public static NDarray operator ==(NDarray a, ValueType obj) + //{ + // return new NDarray(a.self.InvokeMethod("__eq__", obj.ToPython())); + //} + + // NOTE: overloading == and != with Python's functionality would cause compile errors throughout all of the code + //// Return self==value. + //public static NDarray operator !=(NDarray a, ValueType obj) + //{ + // return new NDarray(a.self.InvokeMethod("__ne__", obj.ToPython())); + //} + /// /// Returns an array of bool where the elements of the array are == value /// @@ -153,6 +170,13 @@ public static NDarray nonzero(NDarray a) return new NDarray(a.self.InvokeMethod("__sub__", obj.ToPython())); } + // Return value-self. + public static NDarray operator -(ValueType obj, NDarray a) + { + var firstElemAsArray = np.asarray(obj); + return new NDarray(firstElemAsArray.self.InvokeMethod("__sub__", a.self)); + } + // Return self*value. public static NDarray operator *(NDarray a, ValueType obj) { @@ -171,6 +195,14 @@ public static NDarray nonzero(NDarray a) return new NDarray(a.self.InvokeMethod("__truediv__", obj.ToPython())); } + // Return value/self. + public static NDarray operator /(ValueType obj, NDarray a) + { + if (operator_module == null) + operator_module = Py.Import("operator"); + return new NDarray(operator_module.InvokeMethod("__truediv__", obj.ToPython(), a.self)); + } + // Return element-wise self+array. public static NDarray operator +(NDarray a, NDarray obj) { @@ -257,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. /// @@ -265,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. /// @@ -273,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.aliases.cs b/src/Numpy/Models/NDarray.aliases.cs index f84d614..b12a1d7 100644 --- a/src/Numpy/Models/NDarray.aliases.cs +++ b/src/Numpy/Models/NDarray.aliases.cs @@ -76,7 +76,7 @@ public NDarray abs(NDarray @out = null, NDarray @where = null) /// a.ndim - 1. /// public NDarray min(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => this.amin( axis: axis, @out: @out, keepdims: keepdims, initial: initial); + => np.amin(this, axis: axis, @out: @out, keepdims: keepdims, initial: initial); /// /// Return the maximum of an array or maximum along an axis. @@ -124,8 +124,6 @@ public NDarray min(int[] axis = null, NDarray @out = null, bool? keepdims = null /// a.ndim - 1. /// public NDarray max(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - return this.amax( axis: axis, @out: @out, keepdims: keepdims, initial: initial); - } + => np.amax(this, axis: axis, @out: @out, keepdims: keepdims, initial: initial); } } diff --git a/src/Numpy/Models/NDarray.cs b/src/Numpy/Models/NDarray.cs index d0fb8f9..e0fe058 100644 --- a/src/Numpy/Models/NDarray.cs +++ b/src/Numpy/Models/NDarray.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using System.Runtime.InteropServices; using System.Text; using Numpy.Models; @@ -11,6 +12,9 @@ namespace Numpy { public partial class NDarray : PythonObject { + // this is needed for constructors in NDarray + protected NDarray() : base() { } + // these are manual overrides of functions or properties that can not be automatically generated public NDarray(PyObject pyobj) : base(pyobj) @@ -21,12 +25,27 @@ public NDarray(NDarray t) : base((PyObject) t.PyObject) { } + /// + /// Creates an array from an unmanaged (or fixed) memory pointer without copying. + /// + /// Pointer to a block of unmanaged memory or to a block of pinned managed memory + /// The length of the block of memory in bytes + /// The data type of the resulting NDarray + public NDarray(IntPtr dataPtr, long dataLength, Dtype dtype) : base() + { + // adapted from https://pastebin.com/4hANmBNy + // thanks to Eli Belash + var g = (Numpy.ctypes.dynamic_self.c_uint8 * dataLength).from_address(dataPtr.ToInt64()); + self = np.dynamic_self.frombuffer(g, dtype.PyObject, -1); + } + /// /// Returns a copy of the array data /// public T[] GetData() { - // note: this implementation works only for device CPU + if (!PyObject.flags.c_contiguous) + return np.ascontiguousarray(this).GetData(); long ptr = PyObject.ctypes.data; int size = PyObject.size; object array = null; @@ -37,6 +56,7 @@ public T[] GetData() else if (typeof(T) == typeof(float)) array = new float[size]; else if (typeof(T) == typeof(double)) array = new double[size]; else if (typeof(T) == typeof(bool)) array = new byte[size]; + else if (typeof(T) == typeof(Complex)) array = new Complex[size]; else throw new InvalidOperationException( "Can not copy the data with data type due to limitations of Marshal.Copy: " + typeof(T).Name); @@ -60,6 +80,12 @@ public T[] GetData() case double[] a: Marshal.Copy(new IntPtr(ptr), a, 0, a.Length); break; + case Complex[] a: + var real = this.real.GetData(); + var imag = this.imag.GetData(); + for(int i =0; i true, 0 => false if (typeof(T) == typeof(bool)) return (T[])(object)((byte[])array).Select(x=>x>0).ToArray(); @@ -353,7 +379,7 @@ public NDarray reshape(params int[] newshape) { //auto-generated code, do not change var @this = this; - return NumPy.Instance.reshape(@this, new Shape(newshape)); + return np.reshape(@this, new Shape(newshape)); } /// @@ -463,7 +489,73 @@ public NDarray this[params object[] arrays_slices_or_indices] /// public T asscalar() { - return NumPy.Instance.asscalar(this); + return np.asscalar(this); + } + + public override bool Equals(object obj) + { + if (obj == null) + return false; + var array = obj as NDarray; + if (!object.ReferenceEquals(array, null)) + return np.array_equal(this, array); + return base.Equals(obj); + } + + public NDarray real + { + get + { + dynamic py = self.GetAttr("real"); + return ToCsharp(py); + } + set + { + self.SetAttr("real", value.PyObject); + } + } + + public NDarray imag + { + get + { + dynamic py = self.GetAttr("imag"); + return ToCsharp(py); + } + set + { + self.SetAttr("imag", value.PyObject); + } + } + + /// + /// Returns a view of the array with axes transposed.

+ /// + /// For a 1-D array, this has no effect.

+ /// (To change between column and + /// row vectors, first cast the 1-D array into a matrix object.) + /// For a 2-D array, this is the usual matrix transpose.

+ /// + /// For an n-D array, if axes are given, their order indicates how the + /// axes are permuted (see Examples).

+ /// If axes are not provided and + /// a.shape = (i[0], i[1], ... i[n-2], i[n-1]), then + /// a.transpose().shape = (i[n-1], i[n-2], ... i[1], i[0]). + ///
+ /// + /// View of a, with axes suitably permuted. + /// + public NDarray transpose(params int[] axes) + { + //auto-generated code, do not change + var __self__ = self; + var pyargs = ToTuple(new object[] + { + ToPython(axes), + }); + //if (axes != null) kwargs["axes"] = ToPython(axes); + dynamic py = __self__.InvokeMethod("transpose", pyargs); + return ToCsharp(py); } } @@ -477,6 +569,12 @@ public NDarray(PyObject pyobject) : base(pyobject) { } + public NDarray(T[] array) : base() + { + var nd = np.array(array); + self = nd.self; + } + /// /// Returns a copy of the array data /// @@ -572,5 +670,13 @@ public T[] GetData() self.SetItem(tuple, ToPython(value)); } } + + 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 4cad8e8..2bd1fa4 100644 --- a/src/Numpy/Models/NDarray.gen.cs +++ b/src/Numpy/Models/NDarray.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,23 +20,25 @@ public partial class NDarray { /// - /// Copy an element of an array to a standard Python scalar and return it. - /// - /// Notes - /// - /// When the data type of a is longdouble or clongdouble, item() returns - /// a scalar array object because there is no available Python scalar that - /// would not lose information. Void arrays return a buffer object for item(), - /// unless fields are defined, in which case a tuple is returned. - /// - /// item is very similar to a[args], except, instead of an array scalar, - /// a standard Python scalar is returned. This can be useful for speeding up - /// access to elements of the array and doing arithmetic on elements of the - /// array using Python’s optimized math. + /// Copy an element of an array to a standard Python scalar and return it.

+ /// + /// Notes + /// + /// When the data type of a is longdouble or clongdouble, item() returns + /// a scalar array object because there is no available Python scalar that + /// would not lose information.

+ /// Void arrays return a buffer object for item(), + /// unless fields are defined, in which case a tuple is returned.

+ /// + /// item is very similar to a[args], except, instead of an array scalar, + /// a standard Python scalar is returned.

+ /// This can be useful for speeding up + /// access to elements of the array and doing arithmetic on elements of the + /// array using Python’s optimized math. ///
/// - /// A copy of the specified element of the array as a suitable - /// Python scalar + /// A copy of the specified element of the array as a suitable + /// Python scalar /// public T item(params int[] args) { @@ -51,17 +55,18 @@ public T item(params int[] args) /* /// - /// Return the array as a (possibly nested) list. - /// - /// Return a copy of the array data as a (nested) Python list. - /// Data items are converted to the nearest compatible Python type. - /// - /// Notes - /// - /// The array may be recreated, a = np.array(a.tolist()). + /// Return the array as a (possibly nested) list.

+ /// + /// Return a copy of the array data as a (nested) Python list.

+ /// + /// Data items are converted to the nearest compatible Python type.

+ /// + /// Notes + /// + /// The array may be recreated, a = np.array(a.tolist()). ///
/// - /// The possibly nested list of array elements. + /// The possibly nested list of array elements. /// public List tolist() { @@ -73,38 +78,44 @@ public List tolist() */ /// - /// Write array to a file as text or binary (default). - /// - /// Data is always written in ‘C’ order, independent of the order of a. - /// The data produced by this method can be recovered using the function - /// fromfile(). - /// - /// Notes - /// - /// This is a convenience function for quick storage of array data. - /// Information on endianness and precision is lost, so this method is not a - /// good choice for files intended to archive data or transport data between - /// machines with different endianness. Some of these problems can be overcome - /// by outputting the data as text files, at the expense of speed and file - /// size. - /// - /// When fid is a file object, array contents are directly written to the - /// file, bypassing the file object’s write method. As a result, tofile - /// cannot be used with files objects supporting compression (e.g., GzipFile) - /// or file-like objects that do not support fileno() (e.g., BytesIO). + /// Write array to a file as text or binary (default).

+ /// + /// Data is always written in ‘C’ order, independent of the order of a.

+ /// + /// The data produced by this method can be recovered using the function + /// fromfile().

+ /// + /// Notes + /// + /// This is a convenience function for quick storage of array data.

+ /// + /// Information on endianness and precision is lost, so this method is not a + /// good choice for files intended to archive data or transport data between + /// machines with different endianness.

+ /// Some of these problems can be overcome + /// by outputting the data as text files, at the expense of speed and file + /// size.

+ /// + /// When fid is a file object, array contents are directly written to the + /// file, bypassing the file object’s write method.

+ /// As a result, tofile + /// cannot be used with files objects supporting compression (e.g., GzipFile) + /// or file-like objects that do not support fileno() (e.g., BytesIO). ///
/// - /// An open file object, or a string containing a filename. + /// An open file object, or a string containing a filename. /// /// - /// Separator between array items for text output. - /// If “” (empty), a binary file is written, equivalent to - /// file.write(a.tobytes()). + /// Separator between array items for text output.

+ /// + /// If “” (empty), a binary file is written, equivalent to + /// file.write(a.tobytes()). /// /// - /// Format string for text file output. - /// Each entry in the array is formatted to text by first converting - /// it to the closest Python type, and then using “format” % item. + /// Format string for text file output.

+ /// + /// Each entry in the array is formatted to text by first converting + /// it to the closest Python type, and then using “format” % item. /// public void tofile(string fid, string sep, string format) { @@ -121,11 +132,12 @@ public void tofile(string fid, string sep, string format) } /// - /// Dump a pickle of the array to the specified file. - /// The array can be read back with pickle.load or numpy.load. + /// Dump a pickle of the array to the specified file.

+ /// + /// The array can be read back with pickle.load or numpy.load. ///
/// - /// A string naming the dump file. + /// A string naming the dump file. /// public void dump(string file) { @@ -140,8 +152,9 @@ public void dump(string file) } /// - /// Returns the pickle of the array as a string. - /// pickle.loads or numpy.loads will convert the string back to an array. + /// Returns the pickle of the array as a string.

+ /// + /// pickle.loads or numpy.loads will convert the string back to an array. ///
public void dumps() { @@ -151,45 +164,50 @@ public void dumps() } /// - /// Copy of the array, cast to a specified type. - /// - /// Notes - /// - /// Starting in NumPy 1.9, astype method now returns an error if the string - /// dtype to cast to is not long enough in ‘safe’ casting mode to hold the max - /// value of integer/float array that is being casted. Previously the casting - /// was allowed even if the result was truncated. + /// Copy of the array, cast to a specified type.

+ /// + /// Notes + /// + /// Starting in NumPy 1.9, astype method now returns an error if the string + /// dtype to cast to is not long enough in ‘safe’ casting mode to hold the max + /// value of integer/float array that is being casted.

+ /// Previously the casting + /// was allowed even if the result was truncated. ///
/// - /// Typecode or data-type to which the array is cast. + /// Typecode or data-type to which the array is cast. /// /// - /// Controls the memory layout order of the result. - /// ‘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. - /// Default is ‘K’. + /// Controls the memory layout order of the result.

+ /// + /// ‘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.

+ /// + /// Default is ‘K’. /// /// - /// Controls what kind of data casting may occur. Defaults to ‘unsafe’ - /// for backwards compatibility. + /// Controls what kind of data casting may occur.

+ /// Defaults to ‘unsafe’ + /// for backwards compatibility. /// /// - /// If True, then sub-classes will be passed-through (default), otherwise - /// the returned array will be forced to be a base-class array. + /// If True, then sub-classes will be passed-through (default), otherwise + /// the returned array will be forced to be a base-class array. /// /// - /// By default, astype always returns a newly allocated array. If this - /// is set to false, and the dtype, order, and subok - /// requirements are satisfied, the input array is returned instead - /// of a copy. + /// By default, astype always returns a newly allocated array.

+ /// If this + /// is set to false, and the dtype, order, and subok + /// requirements are satisfied, the input array is returned instead + /// of a copy. /// /// - /// Unless copy is False and the other conditions for returning the input - /// array are satisfied (see description for copy input parameter), arr_t - /// is a new array of the same shape as the input array, with dtype, order - /// given by dtype, order. + /// Unless copy is False and the other conditions for returning the input + /// array are satisfied (see description for copy input parameter), arr_t + /// is a new array of the same shape as the input array, with dtype, order + /// given by dtype, order. /// public NDarray astype(Dtype dtype, string order = null, string casting = null, bool? subok = null, bool? copy = null) { @@ -209,17 +227,18 @@ public NDarray astype(Dtype dtype, string order = null, string casting = null, b } /// - /// Swap the bytes of the array elements - /// - /// Toggle between low-endian and big-endian data representation by - /// returning a byteswapped array, optionally swapped in-place. + /// Swap the bytes of the array elements + /// + /// Toggle between low-endian and big-endian data representation by + /// returning a byteswapped array, optionally swapped in-place. /// /// - /// If True, swap bytes in-place, default is False. + /// If True, swap bytes in-place, default is False. /// /// - /// The byteswapped array. If inplace is True, this is - /// a view to self. + /// The byteswapped array.

+ /// If inplace is True, this is + /// a view to self. ///
public NDarray byteswap(bool? inplace = null) { @@ -235,17 +254,20 @@ public NDarray byteswap(bool? inplace = null) } /// - /// Return a copy of the array. + /// Return a copy of the array. /// /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and numpy.copy are very - /// similar, but have different default values for their order= - /// arguments.) + /// Controls the memory layout of the copy.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible.

+ /// (Note that this function and numpy.copy are very + /// similar, but have different default values for their order= + /// arguments.) /// - public void copy(string order = null) + public NDarray copy(string order = null) { //auto-generated code, do not change var __self__=self; @@ -255,24 +277,29 @@ public void copy(string order = null) var kwargs=new PyDict(); if (order!=null) kwargs["order"]=ToPython(order); dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); + return ToCsharp(py); } /// - /// Returns a field of the given array as a certain type. - /// - /// A field is a view of the array data with a given data-type. The values in - /// the view are determined by the given type and the offset into the current - /// array in bytes. The offset needs to be such that the view dtype fits in the - /// array dtype; for example an array of dtype complex128 has 16-byte elements. - /// If taking a view with a 32-bit integer (4 bytes), the offset needs to be - /// between 0 and 12 bytes. + /// Returns a field of the given array as a certain type.

+ /// + /// A field is a view of the array data with a given data-type.

+ /// The values in + /// the view are determined by the given type and the offset into the current + /// array in bytes.

+ /// The offset needs to be such that the view dtype fits in the + /// array dtype; for example an array of dtype complex128 has 16-byte elements.

+ /// + /// If taking a view with a 32-bit integer (4 bytes), the offset needs to be + /// between 0 and 12 bytes. ///
/// - /// The data type of the view. The dtype size of the view can not be larger - /// than that of the array itself. + /// The data type of the view.

+ /// The dtype size of the view can not be larger + /// than that of the array itself. /// /// - /// Number of bytes to skip before beginning the element view. + /// Number of bytes to skip before beginning the element view. /// public void getfield(Dtype dtype, int offset) { @@ -288,47 +315,53 @@ public void getfield(Dtype dtype, int offset) } /// - /// Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY), - /// respectively. - /// - /// These Boolean-valued flags affect how numpy interprets the memory - /// area used by a (see Notes below). The ALIGNED flag can only - /// be set to True if the data is actually aligned according to the type. - /// The WRITEBACKIFCOPY and (deprecated) UPDATEIFCOPY flags can never be set - /// to True. The flag WRITEABLE can only be set to True if the array owns its - /// own memory, or the ultimate owner of the memory exposes a writeable buffer - /// interface, or is a string. (The exception for string is made so that - /// unpickling can be done without copying memory.) - /// - /// Notes - /// - /// Array flags provide information about how the memory area used - /// for the array is to be interpreted. There are 7 Boolean flags - /// in use, only four of which can be changed by the user: - /// WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED. - /// - /// WRITEABLE (W) the data area can be written to; - /// - /// ALIGNED (A) the data and strides are aligned appropriately for the hardware - /// (as determined by the compiler); - /// - /// UPDATEIFCOPY (U) (deprecated), replaced by WRITEBACKIFCOPY; - /// - /// WRITEBACKIFCOPY (X) this array is a copy of some other array (referenced - /// by .base). When the C-API function PyArray_ResolveWritebackIfCopy is - /// called, the base array will be updated with the contents of this array. - /// - /// All flags can be accessed using the single (upper case) letter as well - /// as the full name. + /// Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY), + /// respectively.

+ /// + /// These Boolean-valued flags affect how numpy interprets the memory + /// area used by a (see Notes below).

+ /// The ALIGNED flag can only + /// be set to True if the data is actually aligned according to the type.

+ /// + /// The WRITEBACKIFCOPY and (deprecated) UPDATEIFCOPY flags can never be set + /// to True.

+ /// The flag WRITEABLE can only be set to True if the array owns its + /// own memory, or the ultimate owner of the memory exposes a writeable buffer + /// interface, or is a string.

+ /// (The exception for string is made so that + /// unpickling can be done without copying memory.) + /// + /// Notes + /// + /// Array flags provide information about how the memory area used + /// for the array is to be interpreted.

+ /// There are 7 Boolean flags + /// in use, only four of which can be changed by the user: + /// WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED.

+ /// + /// WRITEABLE (W) the data area can be written to; + /// + /// ALIGNED (A) the data and strides are aligned appropriately for the hardware + /// (as determined by the compiler); + /// + /// UPDATEIFCOPY (U) (deprecated), replaced by WRITEBACKIFCOPY; + /// + /// WRITEBACKIFCOPY (X) this array is a copy of some other array (referenced + /// by .base).

+ /// When the C-API function PyArray_ResolveWritebackIfCopy is + /// called, the base array will be updated with the contents of this array.

+ /// + /// All flags can be accessed using the single (upper case) letter as well + /// as the full name. ///
/// - /// Describes whether or not a can be written to. + /// Describes whether or not a can be written to. /// /// - /// Describes whether or not a is aligned properly for its type. + /// Describes whether or not a is aligned properly for its type. /// /// - /// Describes whether or not a is a copy of another “base” array. + /// Describes whether or not a is a copy of another “base” array. /// public void setflags(bool? write = null, bool? align = null, bool? uic = null) { @@ -345,10 +378,10 @@ public void setflags(bool? write = null, bool? align = null, bool? uic = null) } /// - /// Fill the array with a scalar value. + /// Fill the array with a scalar value. /// - /// - /// All elements of a will be assigned this value. + /// + /// All elements of a will be assigned this value. /// public void fill(ValueType @value) { @@ -363,46 +396,23 @@ public void fill(ValueType @value) } /// - /// Returns a view of the array with axes transposed. - /// - /// For a 1-D array, this has no effect. (To change between column and - /// row vectors, first cast the 1-D array into a matrix object.) - /// For a 2-D array, this is the usual matrix transpose. - /// For an n-D array, if axes are given, their order indicates how the - /// axes are permuted (see Examples). If axes are not provided and - /// a.shape = (i[0], i[1], ... i[n-2], i[n-1]), then - /// a.transpose().shape = (i[n-1], i[n-2], ... i[1], i[0]). - /// - /// - /// View of a, with axes suitably permuted. - /// - public NDarray transpose(int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("transpose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of the array collapsed into one dimension. + /// Return a copy of the array collapsed into one dimension. /// /// - /// ‘C’ means to flatten in row-major (C-style) order. - /// ‘F’ means to flatten in column-major (Fortran- - /// style) order. ‘A’ means to flatten in column-major - /// order if a is Fortran contiguous in memory, - /// row-major order otherwise. ‘K’ means to flatten - /// a in the order the elements occur in memory. - /// The default is ‘C’. + /// ‘C’ means to flatten in row-major (C-style) order.

+ /// + /// ‘F’ means to flatten in column-major (Fortran- + /// style) order.

+ /// ‘A’ means to flatten in column-major + /// order if a is Fortran contiguous in memory, + /// row-major order otherwise.

+ /// ‘K’ means to flatten + /// a in the order the elements occur in memory.

+ /// + /// The default is ‘C’. /// /// - /// A copy of the input array, flattened to one dimension. + /// A copy of the input array, flattened to one dimension. /// public NDarray flatten(string order = null) { @@ -418,16 +428,17 @@ public NDarray flatten(string order = null) } /// - /// For unpickling. - /// - /// The state argument must be a sequence that contains the following - /// elements: + /// For unpickling.

+ /// + /// The state argument must be a sequence that contains the following + /// elements: ///
/// - /// optional pickle version. If omitted defaults to 0. + /// optional pickle version.

+ /// If omitted defaults to 0. /// /// - /// a binary string with the data (or a list if ‘a’ is an object array) + /// a binary string with the data (or a list if ‘a’ is an object array) /// public void __setstate__(int version, Shape shape, Dtype dtype, bool isFortran, string rawdata) { @@ -445,9533 +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 @this=this; - return NumPy.Instance.reshape(@this, newshape, order:order); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ravel(@this, order:order); - } - - /// - /// 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 @this=this; - return NumPy.Instance.moveaxis(@this, source, destination); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rollaxis(@this, axis, start:start); - } - - /// - /// 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 @this=this; - return NumPy.Instance.swapaxes(@this, axis1, axis2); - } - - /// - /// 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 @this=this; - return NumPy.Instance.broadcast(@this, in1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.broadcast_to(@this, shape, subok:subok); - } - - /// - /// 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 @this=this; - return NumPy.Instance.expand_dims(@this, axis); - } - - /// - /// 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(int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.squeeze(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.asfarray(@this, dtype:dtype); - } - - /// - /// 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 @this=this; - return NumPy.Instance.asfortranarray(@this, dtype:dtype); - } - - /// - /// 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 @this=this; - return NumPy.Instance.asarray_chkfinite(@this, dtype:dtype, order:order); - } - - /// - /// 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 @this=this; - return NumPy.Instance.require(@this, dtype, requirements); - } - - /// - /// 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 @this=this; - return NumPy.Instance.split(@this, indices_or_sections, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tile(@this, reps); - } - - /// - /// 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 @this=this; - return NumPy.Instance.repeat(@this, repeats, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.delete(@this, obj, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.insert(@this, obj, values, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.append(@this, values, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trim_zeros(@this, trim:trim); - } - - /// - /// 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. - /// - /// - /// A tuple of: - /// unique - /// The sorted unique values. - /// unique_indices - /// The indices of the first occurrences of the unique values in the - /// original array. Only provided if return_index is True. - /// unique_inverse - /// The indices to reconstruct the original array from the - /// unique array. Only provided if return_inverse is True. - /// unique_counts - /// The number of times each of the unique values comes up in the - /// original array. Only provided if return_counts is True. - /// - public (NDarray, NDarray, NDarray, NDarray) unique(bool? return_index = false, bool? return_inverse = false, bool? return_counts = false, int? axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.unique(@this, return_index:return_index, return_inverse:return_inverse, return_counts:return_counts, axis:axis); - } - - /// - /// 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(int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.flip(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fliplr(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.flipud(@this); - } - - /// - /// 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, int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.roll(@this, shift, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rot90(@this, k, axes); - } - - /// - /// 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 @this=this; - return NumPy.Instance.bitwise_and(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.bitwise_or(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.bitwise_xor(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.invert(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.right_shift(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.packbits(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.unpackbits(@this, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.min_scalar_type(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.common_type(@this, array1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.i0(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fv(@this, nper, pmt, pv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.pv(@this, nper, pmt, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.pmt(@this, nper, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - NumPy.Instance.ppmt(@this, per, nper, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ipmt(@this, per, nper, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - return NumPy.Instance.irr(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.mirr(@this, finance_rate, reinvest_rate); - } - - /// - /// 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 @this=this; - NumPy.Instance.nper(@this, pmt, pv, fv:fv, @when:@when); - } - - /// - /// 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 @this=this; - NumPy.Instance.rate(@this, pmt, pv, fv, @when:@when, guess:guess, tol:tol, maxiter:maxiter); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nonzero(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.@where(@this, y, x); - } - - /// - /// 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 @this=this; - return NumPy.Instance.unravel_index(@this, shape, order:order); - } - - /// - /// 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 @this=this; - NumPy.Instance.diag_indices_from(@this); - } - - /// - /// 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 @this=this; - NumPy.Instance.tril_indices_from(@this, k:k); - } - - /// - /// 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 @this=this; - return NumPy.Instance.triu_indices_from(@this, k:k); - } - - /// - /// 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 void take_along_axis(NDarray indices, int axis) - { - //auto-generated code, do not change - var @this=this; - NumPy.Instance.take_along_axis(@this, indices, axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.diagonal(@this, offset:offset, axis1:axis1, axis2:axis2); - } - - /// - /// 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 @this=this; - NumPy.Instance.place(@this, mask, vals); - } - - /// - /// 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 @this=this; - NumPy.Instance.put(@this, ind, v, mode:mode); - } - - /// - /// 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 @this=this; - NumPy.Instance.put_along_axis(@this, indices, values, axis); - } - - /// - /// 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 @this=this; - NumPy.Instance.putmask(@this, mask, values); - } - - /// - /// 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 @this=this; - NumPy.Instance.fill_diagonal(@this, val, wrap); - } - - /* - /// - /// 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 @this=this; - NumPy.Instance.nditer(@this, flags:flags, op_flags:op_flags, op_dtypes:op_dtypes, order:order, casting:casting, op_axes:op_axes, itershape:itershape, buffersize:buffersize); - } - */ - - /// - /// Multidimensional index iterator. - /// - /// Return an iterator yielding pairs of array coordinates and values. - /// - public void ndenumerate() - { - //auto-generated code, do not change - var @this=this; - NumPy.Instance.ndenumerate(@this); - } - - /* - /// - /// 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(int[] axes = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nested_iters(@this, axes); - } - */ - - /* - /// - /// 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 @this=this; - return NumPy.Instance.array2string(@this, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small, separator:separator, prefix:prefix, suffix:suffix, formatter:formatter, threshold:threshold, edgeitems:edgeitems, sign:sign, floatmode:floatmode, legacy:legacy); - } - */ - - /// - /// 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 @this=this; - return NumPy.Instance.array_repr(@this, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); - } - - /// - /// 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 @this=this; - NumPy.Instance.array_str(@this, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); - } - - /// - /// 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 @this=this; - return NumPy.Instance.dot(@this, b, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.vdot(@this, b); - } - - /// - /// 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 @this=this; - return NumPy.Instance.inner(@this, a); - } - - /// - /// 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 @this=this; - return NumPy.Instance.outer(@this, b, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.matmul(@this, x1, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tensordot(@this, a, axes); - } - - /// - /// 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 @this=this; - return NumPy.Instance.kron(@this, a); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trace(@this, offset:offset, axis2:axis2, axis1:axis1, dtype:dtype, @out:@out); - } - - /// - /// 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(int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.all(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// 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 @this=this; - return NumPy.Instance.all(@this); - } - - /// - /// 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(int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.any(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// 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 @this=this; - return NumPy.Instance.any(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isfinite(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isinf(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isnan(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isnat(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isneginf(@this, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isposinf(@this, y:y); - } - - /// - /// 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 @this=this; - return NumPy.Instance.iscomplex(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isfortran(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isreal(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_and(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_or(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_not(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logical_xor(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.allclose(@this, a, rtol, atol, equal_nan); - } - - /// - /// 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 @this=this; - return NumPy.Instance.isclose(@this, a, rtol, atol, equal_nan); - } - - /// - /// 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 @this=this; - return NumPy.Instance.array_equal(@this, a1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.array_equiv(@this, a1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.greater(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.greater_equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.less(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.less_equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.not_equal(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sin(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cos(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tan(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arcsin(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arccos(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arctan(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.hypot(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arctan2(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.degrees(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.radians(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.unwrap(@this, discont:discont, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.deg2rad(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rad2deg(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sinh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cosh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.tanh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arcsinh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arccosh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.arctanh(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.around(@this, decimals:decimals, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.rint(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fix(@this, y:y); - } - - /// - /// 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 @this=this; - return NumPy.Instance.floor(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ceil(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trunc(@this, @out:@out, @where:@where); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.prod(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.sum(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanprod(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// 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(int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nansum(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cumprod(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cumsum(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nancumprod(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nancumsum(@this, axis:axis, dtype:dtype, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.diff(@this, n:n, axis:axis, append:append, prepend:prepend); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ediff1d(@this, to_end:to_end, to_begin:to_begin); - } - - /// - /// 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, int[] axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.gradient(@this, varargs:varargs, edge_order:edge_order, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cross(@this, b, axisa:axisa, axisb:axisb, axisc:axisc, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.trapz(@this, x:x, dx:dx, axis:axis); - } - - /// - /// 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 @this=this; - return NumPy.Instance.exp(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.expm1(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.exp2(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log10(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log2(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.log1p(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logaddexp(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.logaddexp2(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sinc(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.signbit(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.copysign(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.frexp(@this, out1:out1, out2:out2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.ldexp(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nextafter(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.spacing(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.lcm(@this, x1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.gcd(@this, x1); - } - - /// - /// 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 @this=this; - return NumPy.Instance.@add(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.reciprocal(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.positive(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.negative(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.multiply(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.divide(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.power(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.subtract(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.true_divide(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.floor_divide(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.float_power(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fmod(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.mod(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.modf(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.remainder(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.divmod(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.angle(@this, deg:deg); - } - - /// - /// Return the real part of the complex argument. - /// - /// - /// The real component of the complex argument. If val is real, the type - /// of val is used for the output. If val has complex elements, the - /// returned type is float. - /// - public NDarray real() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.real(@this); - } - - /// - /// Return the imaginary part of the complex argument. - /// - /// - /// The imaginary component of the complex argument. If val is real, - /// the type of val is used for the output. If val has complex - /// elements, the returned type is float. - /// - public NDarray imag() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.imag(@this); - } - - /// - /// 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 @this=this; - return NumPy.Instance.conj(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.convolve(@this, v, mode:mode); - } - - /// - /// 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 @this=this; - return NumPy.Instance.clip(@this, a_min, a_max, @out:@out); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sqrt(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.cbrt(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.square(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.absolute(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fabs(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.sign(@this, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.heaviside(@this, x2, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.maximum(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.minimum(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fmax(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.fmin(@this, x1, @out:@out, @where:@where); - } - - /// - /// 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 @this=this; - return NumPy.Instance.nan_to_num(@this, copy:copy); - } - - /// - /// 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 @this=this; - return NumPy.Instance.real_if_close(@this, tol); - } - - /* - /// - /// One-dimensional linear interpolation. - /// - /// Returns the one-dimensional piecewise linear interpolant to a function - /// with given discrete data points (xp, fp), evaluated at x. - /// - /// Notes - /// - /// Does not check that the x-coordinate sequence xp is increasing. - /// If xp is not increasing, the results are nonsense. - /// A simple check for increasing is: - /// - /// - /// The x-coordinates of the data points, must be increasing if argument - /// period is not specified. Otherwise, xp is internally sorted after - /// normalizing the periodic boundaries with xp = xp % period. - /// - /// - /// The y-coordinates of the data points, same length as xp. - /// - /// - /// Value to return for x < xp[0], default is fp[0]. - /// - /// - /// Value to return for x > xp[-1], default is fp[-1]. - /// - /// - /// A period for the x-coordinates. This parameter allows the proper - /// interpolation of angular x-coordinates. Parameters left and right - /// are ignored if period is specified. - /// - /// - /// The interpolated values, same shape as x. - /// - public float or complex (corresponding to fp) or ndarray interp(1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.interp(@this, xp, fp, left:left, right:right, period:period); - } - */ - - /// - /// Pads an array. - /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes. This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis. - /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced. It has the - /// following signature: - /// - /// where - /// - /// - /// Number of values padded to the edges of each axis. - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis. - /// ((before, after),) yields same before and after pad for each axis. - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. - /// - /// - /// One of the following string values or a user supplied function. - /// - /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis. - /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis. - /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes. - /// - /// Default is None, to use the entire axis. - /// - /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis. - /// - /// ((before, after),) yields same before and after constants for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis. - /// - /// ((before, after),) yields same before and after end values for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value. For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. - /// - /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. - /// - public NDarray pad(NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.pad(@this, pad_width, mode, stat_length:stat_length, constant_values:constant_values, end_values:end_values, reflect_type:reflect_type); - } - - /// - /// Test whether each element of a 1-D array is also present in a second array. - /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise. - /// - /// We recommend using isin instead of in1d for new code. - /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences. in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]). - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. - /// - /// - /// The values against which to test each value of ar1. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise). - /// Default is False. np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). - /// - /// - /// The values ar1[in1d] are in ar2. - /// - public NDarray in1d(NDarray ar2, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.in1d(@this, ar2, assume_unique:assume_unique, invert:invert); - } - - /// - /// Find the intersection of two arrays. - /// - /// Return the sorted, unique values that are in both of the input arrays. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned. The first instance of a value is used if there are - /// multiple. Default is False. - /// - /// - /// A tuple of: - /// intersect1d - /// Sorted 1D array of common and unique elements. - /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. - /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. - /// - public (NDarray, NDarray, NDarray) intersect1d(NDarray ar1, bool assume_unique = false, bool return_indices = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.intersect1d(@this, ar1, assume_unique, return_indices); - } - - /// - /// Calculates element in test_elements, broadcasting over element only. - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise. - /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in. - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences. - /// - /// element and test_elements are converted to arrays if they are not - /// already. If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements. This is a consequence - /// of the array constructor’s way of handling non-sequence collections. - /// Converting the set to a list usually gives the desired behavior. - /// - /// - /// The values against which to test each value of element. - /// This argument is flattened if it is an array or array_like. - /// See notes for behavior with non-array-like parameters. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements. Default is False. - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). - /// - /// - /// Has the same shape as element. The values element[isin] - /// are in test_elements. - /// - public NDarray isin(NDarray test_elements, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.isin(@this, test_elements, assume_unique:assume_unique, invert:invert); - } - - /// - /// Find the set difference of two arrays. - /// - /// Return the unique values in ar1 that are not in ar2. - /// - /// - /// Input comparison array. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. - /// - public NDarray setdiff1d(NDarray ar2, bool assume_unique = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.setdiff1d(@this, ar2, assume_unique); - } - - /// - /// Find the set exclusive-or of two arrays. - /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. - /// - /// - /// Input arrays. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. - /// - public NDarray setxor1d(NDarray ar1, bool assume_unique = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.setxor1d(@this, ar1, assume_unique); - } - - /// - /// Find the union of two arrays. - /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Unique, sorted union of the input arrays. - /// - public NDarray union1d(NDarray ar1) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.union1d(@this, ar1); - } - - /// - /// Return a sorted copy of an array. - /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable. A - /// stable sort keeps items with the same key in the same relative - /// order. The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis. Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts. - /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour. In numpy versions >= 1.4.0 nan - /// values are sorted to the end. The extended sort order is: - /// - /// where R is a non-nan real value. Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists. - /// Non-nan values are sorted as before. - /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress. This makes its - /// worst case O(n*log(n)). - /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted. It is currently mapped to - /// merge sort. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray sort(int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.sort(@this, axis:axis, kind:kind, order:order); - } - - /// - /// Perform an indirect stable sort using a sequence of keys. - /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns. The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on. The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape. If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. - /// - /// - /// Axis to be indirectly sorted. By default, sort over the last axis. - /// - /// - /// Array of indices that sort the keys along the specified axis. - /// - public NDarray lexsort(int? axis = -1) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.lexsort(@this, axis:axis); - } - - /// - /// Returns the indices that would sort an array. - /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword. It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If None, - /// the flattened array is used. - /// - /// - /// Sorting algorithm. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of indices that sort a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a sorted a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. - /// - public NDarray argsort(int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argsort(@this, axis:axis, kind:kind, order:order); - } - - /// - /// Return a copy of an array sorted along the first axis. - /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray msort() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.msort(@this); - } - - /// - /// Sort a complex array using the real part first, then the imaginary part. - /// - /// - /// Always returns a sorted complex array. - /// - public NDarray sort_complex() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.sort_complex(@this); - } - - /// - /// Return a partitioned copy of an array. - /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array. All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it. The ordering of the elements in the two - /// partitions is undefined. - /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable. A stable sort keeps items with the same key in the same - /// relative order. The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis. Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. - /// - /// - /// Element index to partition by. The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it. The order of all elements in the partitions is undefined. If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Selection algorithm. Default is ‘introselect’. - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string. Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray partition(int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.partition(@this, kth, axis:axis, kind:kind, order:order); - } - - /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword. It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order. - /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. - /// - /// - /// Element index to partition by. The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it. The order all - /// elements in the partitions is undefined. If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If - /// None, the flattened array is used. - /// - /// - /// Selection algorithm. Default is ‘introselect’ - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of indices that partition a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a partitioned a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. - /// - public NDarray argpartition(int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argpartition(@this, kth, axis:axis, kind:kind, order:order); - } - - /// - /// Returns the indices of the maximum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmax(int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argmax(@this, axis:axis, @out:@out); - } - - /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmax(int? axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanargmax(@this, axis:axis); - } - - /// - /// Returns the indices of the minimum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmin(int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argmin(@this, axis:axis, @out:@out); - } - - /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmin(int? axis = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanargmin(@this, axis:axis); - } - - /// - /// Find the indices of array elements that are non-zero, grouped by element. - /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)). - /// - /// The output of argwhere is not suitable for indexing arrays. - /// For this purpose use nonzero(a) instead. - /// - /// - /// Indices of elements that are non-zero. Indices are grouped by element. - /// - public NDarray argwhere() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.argwhere(@this); - } - - /// - /// Return indices that are non-zero in the flattened version of a. - /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. - /// - /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. - /// - public NDarray flatnonzero() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.flatnonzero(@this); - } - - /// - /// Find indices where elements should be inserted to maintain order. - /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved. - /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points. - /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. - /// - /// - /// Values to insert into a. - /// - /// - /// If ‘left’, the index of the first suitable location found is given. - /// If ‘right’, return the last such index. If there is no suitable - /// index, return either 0 or N (where N is the length of a). - /// - /// - /// Optional array of integer indices that sort array a into ascending - /// order. They are typically the result of argsort. - /// - /// - /// Array of insertion points with the same shape as v. - /// - public NDarray searchsorted(NDarray v, string side = "left", NDarray sorter = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.searchsorted(@this, v, side:side, sorter:sorter); - } - - /// - /// Return the elements of an array that satisfy some condition. - /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)). If - /// condition is boolean np.extract is equivalent to arr[condition]. - /// - /// Note that place does the exact opposite of extract. - /// - /// - /// Input array of the same size as condition. - /// - /// - /// Rank 1 array of values from arr where condition is True. - /// - public NDarray extract(NDarray arr) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.extract(@this, arr); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// Axis or tuple of axes along which to count non-zeros. - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public NDarray count_nonzero(int[] axis) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.count_nonzero(@this, axis:axis); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public int count_nonzero() - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.count_nonzero(@this); - } - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amin(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.amin(@this, axis:axis, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amax(int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.amax(@this, axis:axis, @out:@out, keepdims:keepdims, initial:initial); - } - - /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs. - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.min. - /// - /// - /// Axis or axes along which the minimum is computed. The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis - /// removed. If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned. The same dtype as a is returned. - /// - public NDarray nanmin(int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmin(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs. When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.max. - /// - /// - /// Axis or axes along which the maximum is computed. The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis removed. - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned. The same dtype as a is returned. - /// - public NDarray nanmax(int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmax(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// Range of values (maximum - minimum) along an axis. - /// - /// The name of the function comes from the acronym for ‘peak to peak’. - /// - /// - /// Axis along which to find the peaks. By default, flatten the - /// array. axis may be negative, in - /// which case it counts from the last to the first axis. - /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. - /// - public NDarray ptp(int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.ptp(@this, axis:axis, @out:@out, keepdims:keepdims); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray percentile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.percentile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double percentile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.percentile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanpercentile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanpercentile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanpercentile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanpercentile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray quantile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.quantile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double quantile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.quantile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanquantile(NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanquantile(@this, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanquantile(NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanquantile(@this, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original arr. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray median(int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.median(@this, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double median(NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.median(@this, @out:@out, overwrite_input:overwrite_input); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Axis or axes along which to average a. The default, - /// axis=None, will average over all of the elements of the input array. - /// If axis is negative it counts from the last to the first axis. - /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public NDarray average(int[] axis, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.average(@this, axis:axis, weights:weights, returned:returned); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public double average(NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.average(@this, weights:weights, returned:returned); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Axis or axes along which the means are computed. The default is to - /// compute the mean of the flattened array. - /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public NDarray mean(int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.mean(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public double mean(Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.mean(@this, dtype:dtype, @out:@out); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Axis or axes along which the standard deviation is computed. The - /// default is to compute the standard deviation of the flattened array. - /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public NDarray std(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.std(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public double std(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.std(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Axis or axes along which the variance is computed. The default is to - /// compute the variance of the flattened array. - /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public NDarray @var(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.@var(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public double @var(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.@var(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanmedian(int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmedian(@this, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanmedian(NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmedian(@this, @out:@out, overwrite_input:overwrite_input); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Axis or axes along which the means are computed. The default is to compute - /// the mean of the flattened array. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public NDarray nanmean(int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmean(@this, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public double nanmean(Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanmean(@this, dtype:dtype, @out:@out); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Axis or axes along which the standard deviation is computed. The default is - /// to compute the standard deviation of the flattened array. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes. If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public NDarray nanstd(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanstd(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public double nanstd(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanstd(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Axis or axes along which the variance is computed. The default is to compute - /// the variance of the flattened array. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public NDarray nanvar(int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanvar(@this, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public double nanvar(Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.nanvar(@this, dtype:dtype, @out:@out, ddof:ddof); - } - - /// - /// Return Pearson product-moment correlation coefficients. - /// - /// Please refer to the documentation for cov for more detail. The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive. - /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1. The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case. - /// - /// This function accepts but discards arguments bias and ddof. This is - /// for backwards compatibility with previous versions of this function. These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. - /// - /// - /// An additional set of variables and observations. y has the same - /// shape as x. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// The correlation coefficient matrix of the variables. - /// - public NDarray corrcoef(NDarray y = null, bool? rowvar = true) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.corrcoef(@this, y:y, rowvar:rowvar); - } - - /// - /// Cross-correlation of two 1-dimensional sequences. - /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate. - /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently. Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. - /// - /// - /// Input sequences. - /// - /// - /// Refer to the convolve docstring. Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. - /// - /// - /// Discrete cross-correlation of a and v. - /// - public NDarray correlate(NDarray a, string mode = "valid") - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.correlate(@this, a, mode:mode); - } - - /// - /// Estimate a covariance matrix, given data and weights. - /// - /// Covariance indicates the level to which two variables vary together. - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm. - /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity. The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. - /// - /// - /// An additional set of variables and observations. y has the same form - /// as that of m. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate). If bias is True, - /// then normalization is by N. These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. - /// - /// - /// If not None the default value implied by bias is overridden. - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average. See the notes for the details. The default value - /// is None. - /// - /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. - /// - /// - /// 1-D array of observation vector weights. These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. - /// - /// - /// The covariance matrix of the variables. - /// - public NDarray cov(NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.cov(@this, y:y, rowvar:rowvar, bias:bias, ddof:ddof, fweights:fweights, aweights:aweights); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram(@this, bins:bins, range:range, normed:normed, weights:weights, density:density); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram(@this, bins:bins, range:range, normed:normed, weights:weights, density:density); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram(@this, bins:bins, range:range, normed:normed, weights:weights, density:density); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram2d(@this, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram2d(@this, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram2d(@this, y, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogramdd(@this, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogramdd(@this, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogramdd(@this, bins:bins, range:range, density:density, normed:normed, weights:weights); - } - - /// - /// Count number of occurrences of each value in array of non-negative ints. - /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x. If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x). - /// Each bin gives the number of occurrences of its index value in x. - /// If weights is specified the input array is weighted by it, i.e. if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. - /// - /// - /// Weights, array of the same shape as x. - /// - /// - /// A minimum number of bins for the output array. - /// - /// - /// The result of binning the input array. - /// The length of out is equal to np.amax(x)+1. - /// - public NDarray bincount(NDarray weights = null, int? minlength = 0) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.bincount(@this, weights:weights, minlength:minlength); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(int? bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram_bin_edges(@this, bins:bins, range:range, weights:weights); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram_bin_edges(@this, bins:bins, range:range, weights:weights); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(List bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.histogram_bin_edges(@this, bins:bins, range:range, weights:weights); - } - - /// - /// Return the indices of the bins to which each value in input array belongs. - /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate. - /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError. - /// - /// np.digitize is implemented in terms of np.searchsorted. This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search. It also removes - /// the requirement for the input array to be 1-dimensional. - /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too. - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks. Perhaps more importantly, it supports all dtypes. - /// - /// - /// Array of bins. It has to be 1-dimensional and monotonic. - /// - /// - /// Indicating whether the intervals include the right or the left bin - /// edge. Default behavior is (right==False) indicating that the interval - /// does not include the right edge. The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. - /// - /// - /// Output array of indices, of same shape as x. - /// - public NDarray digitize(NDarray bins, bool? right = false) - { - //auto-generated code, do not change - var @this=this; - return NumPy.Instance.digitize(@this, bins, right:right); - } - } } diff --git a/src/Numpy/Models/PythonObject.cs b/src/Numpy/Models/PythonObject.cs index a582604..220c165 100644 --- a/src/Numpy/Models/PythonObject.cs +++ b/src/Numpy/Models/PythonObject.cs @@ -7,7 +7,7 @@ namespace Numpy { public partial class PythonObject : IDisposable { - protected readonly PyObject self; + public PyObject self; // can not be made readonly because of NDarray(IntPtr ... ) public dynamic PyObject => self; public IntPtr Handle => self.Handle; @@ -22,6 +22,8 @@ public PythonObject(PythonObject t) this.self = t.PyObject; } + protected PythonObject() { } // required for some constructors + public override bool Equals(object obj) { if (obj == null) @@ -55,5 +57,16 @@ public static PythonObject Create(string python_class) { throw new NotImplementedException(); } + + public static bool IsNDarray(dynamic py) + { + return np.ToCsharp(py.__class__.__name__) == "ndarray"; + } + + public static bool IsTuple(dynamic py) + { + return np.ToCsharp(py.__class__.__name__) == "tuple"; + } + } } diff --git a/src/Numpy/Models/PythonObject.gen.cs b/src/Numpy/Models/PythonObject.gen.cs index 3e99691..ffd56b3 100644 --- a/src/Numpy/Models/PythonObject.gen.cs +++ b/src/Numpy/Models/PythonObject.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -19,7 +21,7 @@ public partial class PythonObject //auto-generated - protected PyTuple ToTuple(Array input) + public PyTuple ToTuple(Array input) { var array = new PyObject[input.Length]; for (int i = 0; i < input.Length; i++) @@ -30,28 +32,33 @@ protected PyTuple ToTuple(Array input) } //auto-generated - protected PyObject ToPython(object obj) + public PyObject ToPython(object obj) { - if (obj == null) return Runtime.GetPyNone(); + if (obj == null) return Runtime.None; switch (obj) { // basic types case int o: return new PyInt(o); + case long o: return new PyInt(o); case float o: return new PyFloat(o); case double o: return new PyFloat(o); case string o: return new PyString(o); + case bool o: return ConverterExtension.ToPython(o); + case PyObject o: return o; // sequence types case Array o: return ToTuple(o); // special types from 'ToPythonConversions' + case Axis o: return o.Axes==null ? null : ToTuple(o.Axes); case Shape o: return ToTuple(o.Dimensions); case Slice o: return o.ToPython(); case PythonObject o: return o.PyObject; + case Dictionary o: return ToDict(o); default: throw new NotImplementedException($"Type is not yet supported: { obj.GetType().Name}. Add it to 'ToPythonConversions'"); } } //auto-generated - protected T ToCsharp(dynamic pyobj) + public T ToCsharp(dynamic pyobj) { switch (typeof(T).Name) { @@ -71,13 +78,38 @@ protected T ToCsharp(dynamic pyobj) default: throw new NotImplementedException($"Type NDarray<{typeof(T).GenericTypeArguments[0].Name}> missing. Add it to 'ToCsharpConversions'"); } break; + case "NDarray[]": + var po = pyobj as PyObject; + var len = po.Length(); + var rv = new NDarray[len]; + for (int i = 0; i < len; i++) + rv[i] = ToCsharp(po[i]); + return (T) (object) rv; case "Matrix": return (T)(object)new Matrix(pyobj); - default: return (T)pyobj; + default: + var pyClass = $"{pyobj.__class__}"; + if (pyClass == "") + { + return (T)(object)pyobj.ToString(); + } + if (pyClass.StartsWith("(); + } + try + { + return pyobj.As(); + } + catch (Exception e) + { + throw new NotImplementedException($"conversion from {pyobj.__class__} to {typeof(T).Name} not implemented", e); + return default(T); + } } } //auto-generated - protected T SharpToSharp(object obj) + public T SharpToSharp(object obj) { if (obj == null) return default(T); switch (obj) @@ -91,11 +123,14 @@ protected T SharpToSharp(object obj) } //auto-generated: SpecialConversions - protected NDarray ConvertArrayToNDarray(Array a) + private static NDarray ConvertArrayToNDarray(Array a) { switch(a) { case bool[] arr: return np.array(arr); + case int[] arr: return np.array(arr); + case float[] arr: return np.array(arr); + case double[] arr: return np.array(arr); case int[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); case float[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); case double[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); @@ -103,5 +138,14 @@ protected NDarray ConvertArrayToNDarray(Array a) default: throw new NotImplementedException($"Type {a.GetType()} not supported yet in ConvertArrayToNDarray."); } } + + //auto-generated: SpecialConversions + private static PyDict ToDict(Dictionary d) + { + var dict = new PyDict(); + foreach (var pair in d) + dict[new PyString(pair.Key)] = pair.Value.self; + return dict; + } } } diff --git a/src/Numpy/Models/Shape.cs b/src/Numpy/Models/Shape.cs index 9da4fbd..0665226 100644 --- a/src/Numpy/Models/Shape.cs +++ b/src/Numpy/Models/Shape.cs @@ -16,6 +16,12 @@ public Shape(params int[] shape) public int this[int n] => Dimensions[n]; + public static implicit operator Shape(ValueTuple tuple) => new Shape(tuple.Item1); + public static implicit operator Shape(ValueTuple tuple) => new Shape(tuple.Item1, tuple.Item2); + public static implicit operator Shape(ValueTuple tuple) => new Shape(tuple.Item1, tuple.Item2,tuple.Item3); + public static implicit operator Shape(ValueTuple tuple) => new Shape(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); + public static implicit operator Shape(ValueTuple tuple) => new Shape(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); + #region Equality public static bool operator ==(Shape a, Shape b) diff --git a/src/Numpy/Models/Slice.cs b/src/Numpy/Models/Slice.cs index 87015fd..a0a320d 100644 --- a/src/Numpy/Models/Slice.cs +++ b/src/Numpy/Models/Slice.cs @@ -233,7 +233,7 @@ public int GetAbsStop(int dim) public PyObject ToPython() { - var inst=NumPy.Instance; // <--- this is important, to make sure PythonEngine is initialized! + var inst=np.self; // <--- this is important, to make sure PythonEngine is initialized! var f = new Func(FormatNullableIntForPython); return PythonEngine.Eval($"slice({f(Start)},{f(Stop)},{f(Step)})"); } diff --git a/src/Numpy/NumPy.array_creation.gen.cs b/src/Numpy/NumPy.array_creation.gen.cs deleted file mode 100644 index 3bf8d03..0000000 --- a/src/Numpy/NumPy.array_creation.gen.cs +++ /dev/null @@ -1,3769 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return a new array of given shape and type, without initializing entries. - /// - /// Notes - /// - /// empty, unlike zeros, does not set the array values to zero, - /// and may therefore be marginally faster. On the other hand, it requires - /// the user to manually set all the values in the array, and should be - /// used with caution. - /// - /// - /// Shape of the empty array, e.g., (2, 3) or 2. - /// - /// - /// Desired output data-type for the array, e.g, numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of uninitialized (arbitrary) data of the given shape, dtype, and - /// order. Object arrays will be initialized to None. - /// - public NDarray empty(Shape shape, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("empty", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public NDarray empty_like(NDarray prototype, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - prototype, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public NDarray empty_like(T[] prototype, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(prototype), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. - /// - /// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. - /// - public NDarray empty_like(T[,] prototype, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(prototype), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a 2-D array with ones on the diagonal and zeros elsewhere. - /// - /// - /// Number of rows in the output. - /// - /// - /// Number of columns in the output. If None, defaults to N. - /// - /// - /// Index of the diagonal: 0 (the default) refers to the main diagonal, - /// a positive value refers to an upper diagonal, and a negative value - /// to a lower diagonal. - /// - /// - /// Data-type of the returned array. - /// - /// - /// Whether the output should be stored in row-major (C-style) or - /// column-major (Fortran-style) order in memory. - /// - /// - /// An array where all elements are equal to zero, except for the k-th - /// diagonal, whose values are equal to one. - /// - public NDarray eye(int N, int? M = null, int? k = 0, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - N, - }); - var kwargs=new PyDict(); - if (M!=null) kwargs["M"]=ToPython(M); - if (k!=0) kwargs["k"]=ToPython(k); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("eye", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the identity array. - /// - /// The identity array is a square array with ones on - /// the main diagonal. - /// - /// - /// Number of rows (and columns) in n x n output. - /// - /// - /// Data-type of the output. Defaults to float. - /// - /// - /// n x n array with its main diagonal set to one, - /// and all other elements 0. - /// - public NDarray identity(int n, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("identity", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a new array of given shape and type, filled with ones. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of ones with the given shape, dtype, and order. - /// - public NDarray ones(Shape shape, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ones", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public NDarray ones_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public NDarray ones_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return an array of ones with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of ones with the same shape and type as a. - /// - public NDarray ones_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a new array of given shape and type, filled with zeros. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. - /// - /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. - /// - /// - /// Array of zeros with the given shape, dtype, and order. - /// - public NDarray zeros(Shape shape, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("zeros", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public NDarray zeros_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public NDarray zeros_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return an array of zeros with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of zeros with the same shape and type as a. - /// - public NDarray zeros_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a new array of given shape and type, filled with fill_value. - /// - /// - /// Shape of the new array, e.g., (2, 3) or 2. - /// - /// - /// Fill value. - /// - /// - /// Whether to store multidimensional data in C- or Fortran-contiguous - /// (row- or column-wise) order in memory. - /// - /// - /// Array of fill_value with the given shape, dtype, and order. - /// - public NDarray full(Shape shape, ValueType fill_value, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("full", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public NDarray full_like(NDarray a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public NDarray full_like(T[] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a full array with the same shape and type as a given array. - /// - /// - /// The shape and data-type of a define these same attributes of - /// the returned array. - /// - /// - /// Fill value. - /// - /// - /// Overrides the data type of the result. - /// - /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. - /// - /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. - /// - /// - /// Array of fill_value with the same shape and type as a. - /// - public NDarray full_like(T[,] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - fill_value, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - if (subok!=true) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public NDarray asarray(NDarray a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public NDarray asarray(T[] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an array. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. - /// - /// - /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. - /// - public NDarray asarray(T[,] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public NDarray asanyarray(NDarray a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public NDarray asanyarray(T[] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. - /// - /// - /// 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. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. - /// - public NDarray asanyarray(T[,] a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public NDarray ascontiguousarray(NDarray a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public NDarray ascontiguousarray(T[] a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return a contiguous array (ndim >= 1) in memory (C order). - /// - /// - /// Input array. - /// - /// - /// Data-type of returned array. - /// - /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. - /// - public NDarray ascontiguousarray(T[,] a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix asmatrix(NDarray data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - data, - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix asmatrix(T[] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix asmatrix(T[,] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public NDarray copy(NDarray a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public NDarray copy(T[] a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: - /// - /// - /// Input data. - /// - /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) - /// - /// - /// Array interpretation of a. - /// - public NDarray copy(T[,] a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(a), - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); - return ToCsharp>(py); - } - - /* - /// - /// Interpret a buffer as a 1-dimensional array. - /// - /// Notes - /// - /// If the buffer has data that is not in machine byte-order, this should - /// be specified as part of the data-type, e.g.: - /// - /// The data of the resulting array will not be byteswapped, but will be - /// interpreted correctly. - /// - /// - /// An object that exposes the buffer interface. - /// - /// - /// Data-type of the returned array; default: float. - /// - /// - /// Number of items to read. -1 means all data in the buffer. - /// - /// - /// Start reading the buffer from this offset (in bytes); default: 0. - /// - public void frombuffer(buffer_like buffer, Dtype dtype = null, int? count = -1, int? offset = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - buffer, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (count!=-1) kwargs["count"]=ToPython(count); - if (offset!=0) kwargs["offset"]=ToPython(offset); - dynamic py = __self__.InvokeMethod("frombuffer", pyargs, kwargs); - } - */ - - /// - /// Construct an array from data in a text or binary file. - /// - /// A highly efficient way of reading binary data with a known data-type, - /// as well as parsing simply formatted text files. Data written using the - /// tofile method can be read using this function. - /// - /// Notes - /// - /// Do not rely on the combination of tofile and fromfile for - /// data storage, as the binary files generated are are not platform - /// independent. In particular, no byte-order or data-type information is - /// saved. Data can be stored in the platform independent .npy format - /// using save and load instead. - /// - /// - /// Open file object or filename. - /// - /// - /// Data type of the returned array. - /// For binary files, it is used to determine the size and byte-order - /// of the items in the file. - /// - /// - /// Number of items to read. -1 means all items (i.e., the complete - /// file). - /// - /// - /// Separator between items if file is a text file. - /// Empty (“”) separator means the file should be treated as binary. - /// Spaces (” “) in the separator match zero or more whitespace characters. - /// A separator consisting only of spaces must match at least one - /// whitespace. - /// - public void fromfile(string file, Dtype dtype = null, int count = -1, string sep = "") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - dtype, - count, - sep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("fromfile", pyargs, kwargs); - } - - /// - /// Construct an array by executing a function over each coordinate. - /// - /// The resulting array therefore has a value fn(x, y, z) at - /// coordinate (x, y, z). - /// - /// Notes - /// - /// Keywords other than dtype are passed to function. - /// - /// - /// The function is called with N parameters, where N is the rank of - /// shape. Each parameter represents the coordinates of the array - /// varying along a specific axis. For example, if shape - /// were (2, 2), then the parameters would be - /// array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]]) - /// - /// - /// Shape of the output array, which also determines the shape of - /// the coordinate arrays passed to function. - /// - /// - /// Data-type of the coordinate arrays passed to function. - /// By default, dtype is float. - /// - /// - /// The result of the call to function is passed back directly. - /// Therefore the shape of fromfunction is completely determined by - /// function. If function returns a scalar value, the shape of - /// fromfunction would not match the shape parameter. - /// - public object fromfunction(Delegate function, Shape shape, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - function, - shape, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("fromfunction", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a new 1-dimensional array from an iterable object. - /// - /// Notes - /// - /// Specify count to improve performance. It allows fromiter to - /// pre-allocate the output array, instead of resizing it on demand. - /// - /// - /// An iterable object providing data for the array. - /// - /// - /// The data-type of the returned array. - /// - /// - /// The number of items to read from iterable. The default is -1, - /// which means all data is read. - /// - /// - /// The output array. - /// - public NDarray fromiter(IEnumerable iterable, Dtype dtype, int? count = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - iterable, - dtype, - }); - var kwargs=new PyDict(); - if (count!=-1) kwargs["count"]=ToPython(count); - dynamic py = __self__.InvokeMethod("fromiter", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// A new 1-D array initialized from text data in a string. - /// - /// - /// A string containing the data. - /// - /// - /// The data type of the array; default: float. For binary input data, - /// the data must be in exactly this format. - /// - /// - /// Read this number of dtype elements from the data. If this is - /// negative (the default), the count will be determined from the - /// length of the data. - /// - /// - /// The string separating numbers in the data; extra whitespace between - /// elements is also ignored. - /// - /// - /// The constructed array. - /// - public NDarray fromstring(string @string, Dtype dtype = null, int? count = -1, string sep = "") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - @string, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (count!=-1) kwargs["count"]=ToPython(count); - if (sep!="") kwargs["sep"]=ToPython(sep); - dynamic py = __self__.InvokeMethod("fromstring", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Load data from a text file. - /// - /// Each row in the text file must have the same number of values. - /// - /// Notes - /// - /// This function aims to be a fast reader for simply formatted files. The - /// genfromtxt function provides more sophisticated handling of, e.g., - /// lines with missing values. - /// - /// The strings produced by the Python float.hex method can be used as - /// input for floats. - /// - /// - /// File, filename, or generator to read. If the filename extension is - /// .gz or .bz2, the file is first decompressed. Note that - /// generators should return byte strings for Python 3k. - /// - /// - /// Data-type of the resulting array; default: float. If this is a - /// structured data-type, the resulting array will be 1-dimensional, and - /// each row will be interpreted as an element of the array. In this - /// case, the number of columns used must match the number of fields in - /// the data-type. - /// - /// - /// The characters or list of characters used to indicate the start of a - /// comment. None implies no comments. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is ‘#’. - /// - /// - /// The string used to separate values. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is whitespace. - /// - /// - /// A dictionary mapping column number to a function that will parse the - /// column string into the desired value. E.g., if column 0 is a date - /// string: converters = {0: datestr2num}. Converters can also be - /// used to provide a default value for missing data (but see also - /// genfromtxt): converters = {3: lambda s: float(s.strip() or 0)}. - /// Default: None. - /// - /// - /// Skip the first skiprows lines; default: 0. - /// - /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1,4,5) will extract the 2nd, 5th and 6th columns. - /// The default, None, results in all columns being read. - /// - /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...). When used with a structured - /// data-type, arrays are returned for each field. Default is False. - /// - /// - /// The returned array will have at least ndmin dimensions. - /// Otherwise mono-dimensional axes will be squeezed. - /// Legal values: 0 (default), 1 or 2. - /// - /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// The special value ‘bytes’ enables backward compatibility workarounds - /// that ensures you receive byte arrays as results if possible and passes - /// ‘latin1’ encoded strings to converters. Override this value to receive - /// unicode arrays and pass strings as input to converters. If set to None - /// the system default is used. The default value is ‘bytes’. - /// - /// - /// Read max_rows lines of content after skiprows lines. The default - /// is to read all the lines. - /// - /// - /// Data read from the text file. - /// - public NDarray loadtxt(string fname, Dtype dtype = null, string[] comments = null, string delimiter = null, Hashtable converters = null, int? skiprows = 0, int[] usecols = null, bool? unpack = false, int? ndmin = 0, string encoding = "bytes", int? max_rows = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fname, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (comments!=null) kwargs["comments"]=ToPython(comments); - if (delimiter!=null) kwargs["delimiter"]=ToPython(delimiter); - if (converters!=null) kwargs["converters"]=ToPython(converters); - if (skiprows!=0) kwargs["skiprows"]=ToPython(skiprows); - if (usecols!=null) kwargs["usecols"]=ToPython(usecols); - if (unpack!=false) kwargs["unpack"]=ToPython(unpack); - if (ndmin!=0) kwargs["ndmin"]=ToPython(ndmin); - if (encoding!="bytes") kwargs["encoding"]=ToPython(encoding); - if (max_rows!=null) kwargs["max_rows"]=ToPython(max_rows); - dynamic py = __self__.InvokeMethod("loadtxt", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a chararray. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy - /// will only be made if __array__ returns a copy, if obj is a - /// nested sequence, or if a copy is needed to satisfy any of the other - /// requirements (itemsize, unicode, order, etc.). - /// - /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. - /// - /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). If order is ‘A’, then the returned array may - /// be in any order (either C-, Fortran-contiguous, or even - /// discontiguous). - /// - public void core_defchararray_array(string[] obj, int? itemsize = null, bool? copy = true, bool? unicode = null, string order = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (copy!=true) kwargs["copy"]=ToPython(copy); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("array", pyargs, kwargs); - } - - /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. - /// - /// - /// Shape of the array. - /// - /// - /// Length of each array element, in number of characters. Default is 1. - /// - /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. - /// - /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. - /// - /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. - /// - /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. - /// - /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. - /// - public void chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (buffer!=null) kwargs["buffer"]=ToPython(buffer); - if (offset!=null) kwargs["offset"]=ToPython(offset); - if (strides!=null) kwargs["strides"]=ToPython(strides); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("chararray", pyargs, kwargs); - } - - /// - /// Convert the input to a chararray, copying the data only if - /// necessary. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. - /// - /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. - /// - /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). - /// - public void core_defchararray_asarray(string[] obj, int? itemsize = null, bool? unicode = null, string order = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(byte start, byte stop, byte step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(byte stop, byte step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(short start, short stop, short step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(short stop, short step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(int start, int stop, int step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(int stop, int step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(long start, long stop, long step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(long stop, long step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(float start, float stop, float step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(float stop, float step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// Start of interval. The interval includes this value. The default - /// start value is 0. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(double start, double stop, double step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. - /// - /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. - /// - /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. - /// - public NDarray arange(double stop, double step = 1, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - stop, - }); - var kwargs=new PyDict(); - if (step!=1) kwargs["step"]=ToPython(step); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return evenly spaced numbers over a specified interval. - /// - /// Returns num evenly spaced samples, calculated over the - /// interval [start, stop]. - /// - /// The endpoint of the interval can optionally be excluded. - /// - /// - /// The starting value of the sequence. - /// - /// - /// The end value of the sequence, unless endpoint is set to False. - /// In that case, the sequence consists of all but the last of num + 1 - /// evenly spaced samples, so that stop is excluded. Note that the step - /// size changes when endpoint is False. - /// - /// - /// Number of samples to generate. Default is 50. Must be non-negative. - /// - /// - /// If True, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// If True, return (samples, step), where step is the spacing - /// between samples. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// A tuple of: - /// samples - /// There are num equally spaced samples in the closed interval - /// [start, stop] or the half-open interval [start, stop) - /// (depending on whether endpoint is True or False). - /// step - /// Only returned if retstep is True - /// - /// Size of spacing between samples. - /// - public (NDarray, float) linspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, bool? retstep = false, Dtype dtype = null, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (num!=50) kwargs["num"]=ToPython(num); - if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); - if (retstep!=false) kwargs["retstep"]=ToPython(retstep); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("linspace", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Return numbers spaced evenly on a log scale. - /// - /// In linear space, the sequence starts at base ** start - /// (base to the power of start) and ends with base ** stop - /// (see endpoint below). - /// - /// Notes - /// - /// Logspace is equivalent to the code - /// - /// - /// base ** start is the starting value of the sequence. - /// - /// - /// base ** stop is the final value of the sequence, unless endpoint - /// is False. In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. - /// - /// - /// Number of samples to generate. Default is 50. - /// - /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// The base of the log space. The step size between the elements in - /// ln(samples) / ln(base) (or log_base(samples)) is uniform. - /// Default is 10.0. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// num samples, equally spaced on a log scale. - /// - public NDarray logspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, float? @base = 10.0f, Dtype dtype = null, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (num!=50) kwargs["num"]=ToPython(num); - if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); - if (@base!=10.0f) kwargs["base"]=ToPython(@base); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("logspace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return numbers spaced evenly on a log scale (a geometric progression). - /// - /// This is similar to logspace, but with endpoints specified directly. - /// Each output sample is a constant multiple of the previous. - /// - /// Notes - /// - /// If the inputs or dtype are complex, the output will follow a logarithmic - /// spiral in the complex plane. (There are an infinite number of spirals - /// passing through two points; the output will follow the shortest such path.) - /// - /// - /// The starting value of the sequence. - /// - /// - /// The final value of the sequence, unless endpoint is False. - /// In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. - /// - /// - /// Number of samples to generate. Default is 50. - /// - /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. - /// - /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. - /// - /// - /// num samples, equally spaced on a log scale. - /// - public NDarray geomspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, Dtype dtype = null, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - start, - stop, - }); - var kwargs=new PyDict(); - if (num!=50) kwargs["num"]=ToPython(num); - if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("geomspace", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(NDarray x2, NDarray x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - x1, - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[,] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - x1, - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(NDarray x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(NDarray x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[,] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public NDarray meshgrid(T[,] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x2), - SharpToSharp(x1), - }); - var kwargs=new PyDict(); - if (indexing!=null) kwargs["indexing"]=ToPython(indexing); - if (sparse!=null) kwargs["sparse"]=ToPython(sparse); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("meshgrid", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /// - /// nd_grid instance which returns a dense multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an dense - /// (or fleshed out) mesh-grid when indexed, so that each returned argument - /// has the same shape. The dimensions and number of the output arrays are - /// equal to the number of indexing dimensions. If the step length is not a - /// complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public void mgrid() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("mgrid"); - } - - /* - /// - /// nd_grid instance which returns an open multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an open - /// (i.e. not fleshed out) mesh-grid when indexed, so that only one dimension - /// of each returned array is greater than 1. The dimension and number of the - /// output arrays are equal to the number of indexing dimensions. If the step - /// length is not a complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public void ogrid(math mesh-grid `ndarrays` with only one dimension) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - mesh-grid `ndarrays` with only one dimension, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ogrid", pyargs, kwargs); - } - */ - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public NDarray diag(NDarray v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public NDarray diag(T[] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. - /// - /// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. - /// - /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. - /// - /// - /// The extracted diagonal or constructed diagonal array. - /// - public NDarray diag(T[,] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public NDarray diagflat(NDarray v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public NDarray diagflat(T[] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Create a two-dimensional array with the flattened input as a diagonal. - /// - /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. - /// - /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. - /// - /// - /// The 2-D output array. - /// - public NDarray diagflat(T[,] v, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(v), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// An array with ones at and below the given diagonal and zeros elsewhere. - /// - /// - /// Number of rows in the array. - /// - /// - /// Number of columns in the array. - /// By default, M is taken equal to N. - /// - /// - /// The sub-diagonal at and below which the array is filled. - /// k = 0 is the main diagonal, while k < 0 is below it, - /// and k > 0 is above. The default is 0. - /// - /// - /// Data type of the returned array. The default is float. - /// - /// - /// Array with its lower triangle filled with ones and zero elsewhere; - /// in other words T[i,j] == 1 for i <= j + k, 0 otherwise. - /// - public NDarray tri(int N, int? M = null, int? k = 0, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - N, - }); - var kwargs=new PyDict(); - if (M!=null) kwargs["M"]=ToPython(M); - if (k!=0) kwargs["k"]=ToPython(k); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("tri", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public NDarray tril(NDarray m, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public NDarray tril(T[] m, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(m), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. - /// - /// - /// Input array. - /// - /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. - /// - /// - /// Lower triangle of m, of same shape and data-type as m. - /// - public NDarray tril(T[,] m, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(m), - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public NDarray vander(NDarray x, int? N = null, bool? increasing = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (N!=null) kwargs["N"]=ToPython(N); - if (increasing!=false) kwargs["increasing"]=ToPython(increasing); - dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public NDarray vander(T[] x, int? N = null, bool? increasing = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x), - }); - var kwargs=new PyDict(); - if (N!=null) kwargs["N"]=ToPython(N); - if (increasing!=false) kwargs["increasing"]=ToPython(increasing); - dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. - /// - /// - /// 1-D input array. - /// - /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). - /// - /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. - /// - /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). - /// - public NDarray vander(T[,] x, int? N = null, bool? increasing = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(x), - }); - var kwargs=new PyDict(); - if (N!=null) kwargs["N"]=ToPython(N); - if (increasing!=false) kwargs["increasing"]=ToPython(increasing); - dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); - return ToCsharp>(py); - } - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix mat(NDarray data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - data, - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix mat(T[] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). - /// - /// - /// Input data. - /// - /// - /// Data-type of the output matrix. - /// - /// - /// data interpreted as a matrix. - /// - public Matrix mat(T[,] data, Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(data), - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Build a matrix object from a string, nested sequence, or array. - /// - /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. - /// - /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. - /// - /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. - /// - /// - /// Returns a matrix object, which is a specialized 2-D array. - /// - public Matrix bmat(string obj, Hashtable ldict = null, Hashtable gdict = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - obj, - }); - var kwargs=new PyDict(); - if (ldict!=null) kwargs["ldict"]=ToPython(ldict); - if (gdict!=null) kwargs["gdict"]=ToPython(gdict); - dynamic py = __self__.InvokeMethod("bmat", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Build a matrix object from a string, nested sequence, or array. - /// - /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. - /// - /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. - /// - /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. - /// - /// - /// Returns a matrix object, which is a specialized 2-D array. - /// - public Matrix bmat(T[] obj, Hashtable ldict = null, Hashtable gdict = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - SharpToSharp(obj), - }); - var kwargs=new PyDict(); - if (ldict!=null) kwargs["ldict"]=ToPython(ldict); - if (gdict!=null) kwargs["gdict"]=ToPython(gdict); - dynamic py = __self__.InvokeMethod("bmat", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - } -} diff --git a/src/Numpy/NumPy.array_manipulation.gen.cs b/src/Numpy/NumPy.array_manipulation.gen.cs deleted file mode 100644 index 4972ebd..0000000 --- a/src/Numpy/NumPy.array_manipulation.gen.cs +++ /dev/null @@ -1,1539 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. - /// - /// - /// The array into which values are copied. - /// - /// - /// The array from which values are copied. - /// - /// - /// Controls what kind of data casting may occur when copying. - /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. - /// - public void copyto(NDarray dst, NDarray src, string casting = "same_kind", NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dst, - src, - }); - var kwargs=new PyDict(); - if (casting!="same_kind") kwargs["casting"]=ToPython(casting); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("copyto", pyargs, kwargs); - } - - /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. - /// - /// - /// The array into which values are copied. - /// - /// - /// The array from which values are copied. - /// - /// - /// Controls what kind of data casting may occur when copying. - /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. - /// - public void copyto(NDarray dst, NDarray src, string casting = "same_kind", bool[] @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dst, - src, - }); - var kwargs=new PyDict(); - if (casting!="same_kind") kwargs["casting"]=ToPython(casting); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("copyto", 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. - /// - /// - /// Array to be reshaped. - /// - /// - /// 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(NDarray a, Shape newshape, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input array. The elements in a are read in the order specified by - /// order, and packed as a 1-D array. - /// - /// - /// 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(NDarray a, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ravel", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of the array collapsed into one dimension. - /// - /// - /// ‘C’ means to flatten in row-major (C-style) order. - /// ‘F’ means to flatten in column-major (Fortran- - /// style) order. ‘A’ means to flatten in column-major - /// order if a is Fortran contiguous in memory, - /// row-major order otherwise. ‘K’ means to flatten - /// a in the order the elements occur in memory. - /// The default is ‘C’. - /// - /// - /// A copy of the input array, flattened to one dimension. - /// - public NDarray flatten(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("flatten", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Move axes of an array to new positions. - /// - /// Other axes remain in their original order. - /// - /// - /// The array whose axes should be reordered. - /// - /// - /// 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(NDarray a, int[] source, int[] destination) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int axis, int? start = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input 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(NDarray a, int axis1, int axis2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - axis1, - axis2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("swapaxes", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Permute the dimensions of an array. - /// - /// Notes - /// - /// Use transpose(a, argsort(axes)) to invert the transposition of tensors - /// when using the axes keyword argument. - /// - /// Transposing a 1-D array returns an unchanged view of the original array. - /// - /// - /// Input array. - /// - /// - /// By default, reverse the dimensions, otherwise permute the axes - /// according to the values given. - /// - /// - /// a with its axes permuted. A view is returned whenever - /// possible. - /// - public NDarray transpose(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("transpose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Convert inputs to arrays with at least one dimension. - /// - /// Scalar inputs are converted to 1-dimensional arrays, whilst - /// higher-dimensional inputs are preserved. - /// - /// - /// One or more input arrays. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 1. - /// Copies are made only if necessary. - /// - public NDarray atleast_1d(params NDarray[] arys) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("atleast_1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// View inputs as arrays with at least two dimensions. - /// - /// - /// One or more array-like sequences. Non-array inputs are converted - /// to arrays. Arrays that already have two or more dimensions are - /// preserved. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 2. - /// Copies are avoided where possible, and views with two or more - /// dimensions are returned. - /// - public NDarray atleast_2d(params NDarray[] arys) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("atleast_2d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// View inputs as arrays with at least three dimensions. - /// - /// - /// One or more array-like sequences. Non-array inputs are converted to - /// arrays. Arrays that already have three or more dimensions are - /// preserved. - /// - /// - /// An array, or list of arrays, each with a.ndim >= 3. Copies are - /// avoided where possible, and views with three or more dimensions are - /// returned. For example, a 1-D array of shape (N,) becomes a view - /// of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a - /// view of shape (M, N, 1). - /// - public NDarray atleast_3d(params NDarray[] arys) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("atleast_3d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Produce an object that mimics broadcasting. - /// - /// - /// Input parameters. - /// - /// - /// 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 in2, NDarray in1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - in2, - in1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("broadcast", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Broadcast an array to a new shape. - /// - /// Notes - /// - /// - /// The array to broadcast. - /// - /// - /// 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(NDarray array, Shape shape, bool? subok = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array, - shape, - }); - var kwargs=new PyDict(); - if (subok!=false) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("broadcast_to", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Broadcast any number of arrays against each other. - /// - /// - /// The arrays to broadcast. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned arrays will be forced to be a base-class array (default). - /// - /// - /// These arrays are views on the original arrays. They are typically - /// not contiguous. Furthermore, more than one element of a - /// broadcasted array may refer to a single memory location. If you - /// need to write to the arrays, make copies first. - /// - public NDarray[] broadcast_arrays(NDarray[] args, bool? subok = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - if (subok!=null) kwargs["subok"]=ToPython(subok); - dynamic py = __self__.InvokeMethod("broadcast_arrays", 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input data. - /// - /// - /// 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(NDarray a, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// The input array. - /// - /// - /// 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(NDarray a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// By default, the data-type is inferred from the input data. - /// - /// - /// The input a in Fortran, or column-major, order. - /// - public NDarray asfortranarray(NDarray a, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. Success requires no 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(NDarray a, Dtype dtype = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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 object to be converted to a type-and-requirement-satisfying array. - /// - /// - /// 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(NDarray a, Dtype dtype, string[] requirements = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - dtype, - requirements, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("require", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Join a sequence of arrays along an existing axis. - /// - /// Notes - /// - /// When one or more of the arrays to be concatenated is a MaskedArray, - /// this function will return a MaskedArray object instead of an ndarray, - /// but the input masks are not preserved. In cases where a MaskedArray - /// is expected as input, use the ma.concatenate function from the masked - /// array module instead. - /// - /// - /// The arrays must have the same shape, except in the dimension - /// corresponding to axis (the first, by default). - /// - /// - /// The axis along which the arrays will be joined. If axis is None, - /// arrays are flattened before use. Default is 0. - /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what concatenate would have returned if no - /// out argument were specified. - /// - /// - /// The concatenated array. - /// - public NDarray concatenate(NDarray[] arys, int? axis = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arys, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("concatenate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Join a sequence of arrays along a new axis. - /// - /// The axis parameter specifies the index of the new axis in the dimensions - /// of the result. For example, if axis=0 it will be the first dimension - /// and if axis=-1 it will be the last dimension. - /// - /// - /// Each array must have the same shape. - /// - /// - /// The axis in the result array along which the input arrays are stacked. - /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what stack would have returned if no - /// out argument were specified. - /// - /// - /// The stacked array has one more dimension than the input arrays. - /// - public NDarray stack(NDarray[] arrays, int? axis = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arrays, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("stack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack 1-D arrays as columns into a 2-D array. - /// - /// Take a sequence of 1-D arrays and stack them as columns - /// to make a single 2-D array. 2-D arrays are stacked as-is, - /// just like with hstack. 1-D arrays are turned into 2-D columns - /// first. - /// - /// - /// Arrays to stack. All of them must have the same first dimension. - /// - /// - /// The array formed by stacking the given arrays. - /// - public NDarray column_stack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("column_stack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack arrays in sequence depth wise (along third axis). - /// - /// This is equivalent to concatenation along the third axis after 2-D arrays - /// of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape - /// (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by - /// dsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the third axis. - /// 1-D or 2-D arrays must have the same shape. - /// - /// - /// The array formed by stacking the given arrays, will be at least 3-D. - /// - public NDarray dstack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("dstack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack arrays in sequence horizontally (column wise). - /// - /// This is equivalent to concatenation along the second axis, except for 1-D - /// arrays where it concatenates along the first axis. Rebuilds arrays divided - /// by hsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the second axis, - /// except 1-D arrays which can be any length. - /// - /// - /// The array formed by stacking the given arrays. - /// - public NDarray hstack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("hstack", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Stack arrays in sequence vertically (row wise). - /// - /// This is equivalent to concatenation along the first axis after 1-D arrays - /// of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by - /// vsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the first axis. - /// 1-D arrays must have the same length. - /// - /// - /// The array formed by stacking the given arrays, will be at least 2-D. - /// - public NDarray vstack(NDarray[] tup) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - tup, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("vstack", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Assemble an nd-array from nested lists of blocks. - /// - /// Blocks in the innermost lists are concatenated (see concatenate) along - /// the last dimension (-1), then these are concatenated along the - /// second-last dimension (-2), and so on until the outermost list is reached. - /// - /// Blocks can be of any dimension, but will not be broadcasted using the normal - /// rules. Instead, leading axes of size 1 are inserted, to make block.ndim - /// the same for all blocks. This is primarily useful for working with scalars, - /// and means that code like np.block([v, 1]) is valid, where - /// v.ndim == 1. - /// - /// When the nested list is two levels deep, this allows block matrices to be - /// constructed from their components. - /// - /// Notes - /// - /// When called with only scalars, np.block is equivalent to an ndarray - /// call. So np.block([[1, 2], [3, 4]]) is equivalent to - /// np.array([[1, 2], [3, 4]]). - /// - /// This function does not enforce that the blocks lie on a fixed grid. - /// np.block([[a, b], [c, d]]) is not restricted to arrays of the form: - /// - /// But is also allowed to produce, for some a, b, c, d: - /// - /// Since concatenation happens along the last axis first, block is _not_ - /// capable of producing the following directly: - /// - /// Matlab’s “square bracket stacking”, [A, B, ...; p, q, ...], is - /// equivalent to np.block([[A, B, ...], [p, q, ...]]). - /// - /// - /// If passed a single ndarray or scalar (a nested list of depth 0), this - /// is returned unmodified (and not copied). - /// - /// Elements shapes must match along the appropriate axes (without - /// broadcasting), but leading 1s will be prepended to the shape as - /// necessary to make the dimensions match. - /// - /// - /// The array assembled from the given blocks. - /// - /// The dimensionality of the output is equal to the greatest of: - /// * the dimensionality of all the inputs - /// * the depth to which the input list is nested - /// - public NDarray block(nested list of array_like or scalars (but not tuples) arrays) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arrays, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("block", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Split an array into multiple sub-arrays. - /// - /// - /// Array to be divided into sub-arrays. - /// - /// - /// If indices_or_sections is an integer, N, the array will be divided - /// into N equal arrays along axis. If such a split is not possible, - /// an error is raised. - /// - /// If indices_or_sections is a 1-D array of sorted integers, the entries - /// indicate where along axis the array is split. For example, - /// [2, 3] would, for axis=0, result in - /// - /// If an index exceeds the dimension of the array along axis, - /// an empty sub-array is returned correspondingly. - /// - /// - /// The axis along which to split, default is 0. - /// - /// - /// A list of sub-arrays. - /// - public NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ary, - indices_or_sections, - }); - var kwargs=new PyDict(); - if (axis!=0) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Construct an array by repeating A the number of times given by reps. - /// - /// 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 input array. - /// - /// - /// The number of repetitions of A along each axis. - /// - /// - /// The tiled output array. - /// - public NDarray tile(NDarray A, NDarray reps) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - A, - reps, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Repeat elements of an array. - /// - /// - /// Input 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(NDarray a, int[] repeats, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray arr, Slice obj, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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. - /// - /// - /// 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 NDarray insert(NDarray arr, int obj = 0, NDarray values = null, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - obj, - values, - }); - var kwargs=new PyDict(); - 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. - /// - /// - /// Values are appended to a copy of this 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 arr, NDarray values, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray filt, string trim = "fb") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - filt, - }); - 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. - /// - /// - /// Input array. Unless axis is specified, this will be flattened if it - /// is not already 1-D. - /// - /// - /// 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. - /// - /// - /// A tuple of: - /// unique - /// The sorted unique values. - /// unique_indices - /// The indices of the first occurrences of the unique values in the - /// original array. Only provided if return_index is True. - /// unique_inverse - /// The indices to reconstruct the original array from the - /// unique array. Only provided if return_inverse is True. - /// unique_counts - /// The number of times each of the unique values comes up in the - /// original array. Only provided if return_counts is True. - /// - public (NDarray, NDarray, NDarray, NDarray) unique(NDarray ar, bool? return_index = false, bool? return_inverse = false, bool? return_counts = false, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar, - }); - var kwargs=new PyDict(); - if (return_index!=false) kwargs["return_index"]=ToPython(return_index); - if (return_inverse!=false) kwargs["return_inverse"]=ToPython(return_inverse); - if (return_counts!=false) kwargs["return_counts"]=ToPython(return_counts); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unique", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2]), ToCsharp(t[3])); - } - - /// - /// 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray m, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - 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. - /// - /// - /// Input array, must be at least 2-D. - /// - /// - /// A view of m with the columns reversed. Since a view - /// is returned, this operation is . - /// - public NDarray fliplr(NDarray m) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("fliplr", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - /// - /// A view of m with the rows reversed. Since a view is - /// returned, this operation is . - /// - public NDarray flipud(NDarray m) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("flipud", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int[] shift, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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)) - /// - /// - /// Array of two or more dimensions. - /// - /// - /// 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(NDarray m, int k = 1, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - k, - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("rot90", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.bitwise.gen.cs b/src/Numpy/NumPy.bitwise.gen.cs deleted file mode 100644 index f84e4cc..0000000 --- a/src/Numpy/NumPy.bitwise.gen.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// 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 x is a scalar. - /// - public NDarray invert(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 left. - /// - /// Bits are shifted to the left by appending x2 0s at the right of x1. - /// Since the internal representation of numbers is in binary format, this - /// operation is equivalent to multiplying x1 by 2**x2. - /// - /// - /// Input values. - /// - /// - /// Number of zeros to append to x1. Has to be non-negative. - /// - /// - /// 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 left. - /// This is a scalar if both x1 and x2 are scalars. - /// - public NDarray left_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - x2, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (@where!=null) kwargs["where"]=ToPython(@where); - dynamic py = __self__.InvokeMethod("left_shift", 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. - /// - /// - /// Input values. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// An array of integers or booleans whose elements should be packed to - /// bits. - /// - /// - /// 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(NDarray myarray, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - myarray, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray myarray, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - myarray, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("unpackbits", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the binary representation of the input number as a string. - /// - /// For negative numbers, if width is not given, a minus sign is added to the - /// front. If width is given, the two’s complement of the number is - /// returned, with respect to that width. - /// - /// 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 - /// - /// binary_repr is equivalent to using base_repr with base 2, but about 25x - /// faster. - /// - /// References - /// - /// - /// Only an integer decimal number can be used. - /// - /// - /// The length of the returned string if num is positive, or the length - /// of the two’s complement if num is negative, provided that width is - /// at least a sufficient number of bits for num to be represented in the - /// designated form. - /// - /// If the width value is insufficient, it will be ignored, and num will - /// be returned in binary (num > 0) or two’s complement (num < 0) form - /// with its width equal to the minimum number of bits needed to represent - /// the number in the designated form. This behavior is deprecated and will - /// later raise an error. - /// - /// - /// Binary representation of num or two’s complement of num. - /// - public string binary_repr(int num, int? width = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - num, - }); - var kwargs=new PyDict(); - if (width!=null) kwargs["width"]=ToPython(width); - dynamic py = __self__.InvokeMethod("binary_repr", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.conv.gen.cs b/src/Numpy/NumPy.conv.gen.cs deleted file mode 100644 index 299c720..0000000 --- a/src/Numpy/NumPy.conv.gen.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy : IDisposable - { - - private PyObject _pyobj = null; - public static NumPy Instance => _instance.Value; - - private static Lazy _instance = new Lazy(() => - { - var instance=new NumPy(); - try - { - instance._pyobj = InstallAndImport(); - } - catch (Exception) - { - // retry to fix the installation by forcing a repair. - instance._pyobj = InstallAndImport(force: true); - } - return instance; - } - ); - - private static PyObject InstallAndImport(bool force = false) - { - var installer = new Installer(); - installer.SetupPython(force).Wait(); - installer.InstallWheel(typeof(NumPy).Assembly, "numpy-1.16.3-cp37-cp37m-win_amd64.whl").Wait(); - PythonEngine.Initialize(); - var mod = Py.Import("numpy"); - return mod; - } - - public dynamic self => _pyobj; - private bool IsInitialized => _pyobj != null; - - private NumPy() { } - - public void Dispose() - { - self?.Dispose(); - } - - - //auto-generated - protected PyTuple ToTuple(Array input) - { - var array = new PyObject[input.Length]; - for (int i = 0; i < input.Length; i++) - { - array[i]=ToPython(input.GetValue(i)); - } - return new PyTuple(array); - } - - //auto-generated - protected PyObject ToPython(object obj) - { - if (obj == null) return Runtime.GetPyNone(); - switch (obj) - { - // basic types - case int o: return new PyInt(o); - case float o: return new PyFloat(o); - case double o: return new PyFloat(o); - case string o: return new PyString(o); - // sequence types - case Array o: return ToTuple(o); - // special types from 'ToPythonConversions' - case Shape o: return ToTuple(o.Dimensions); - case Slice o: return o.ToPython(); - case PythonObject o: return o.PyObject; - default: throw new NotImplementedException($"Type is not yet supported: { obj.GetType().Name}. Add it to 'ToPythonConversions'"); - } - } - - //auto-generated - protected T ToCsharp(dynamic pyobj) - { - switch (typeof(T).Name) - { - // types from 'ToCsharpConversions' - case "Dtype": return (T)(object)new Dtype(pyobj); - case "NDarray": return (T)(object)new NDarray(pyobj); - case "NDarray`1": - switch (typeof(T).GenericTypeArguments[0].Name) - { - case "Byte": return (T)(object)new NDarray(pyobj); - case "Short": return (T)(object)new NDarray(pyobj); - case "Boolean": return (T)(object)new NDarray(pyobj); - case "Int32": return (T)(object)new NDarray(pyobj); - case "Int64": return (T)(object)new NDarray(pyobj); - case "Single": return (T)(object)new NDarray(pyobj); - case "Double": return (T)(object)new NDarray(pyobj); - default: throw new NotImplementedException($"Type NDarray<{typeof(T).GenericTypeArguments[0].Name}> missing. Add it to 'ToCsharpConversions'"); - } - break; - case "Matrix": return (T)(object)new Matrix(pyobj); - default: return (T)pyobj; - } - } - - //auto-generated - protected T SharpToSharp(object obj) - { - if (obj == null) return default(T); - switch (obj) - { - // from 'SharpToSharpConversions': - case Array a: - if (typeof(T)==typeof(NDarray)) return (T)(object)ConvertArrayToNDarray(a); - break; - } - throw new NotImplementedException($"Type is not yet supported: { obj.GetType().Name}. Add it to 'SharpToSharpConversions'"); - } - - //auto-generated: SpecialConversions - protected NDarray ConvertArrayToNDarray(Array a) - { - switch(a) - { - case bool[] arr: return np.array(arr); - case int[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - case float[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - case double[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - case bool[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); - default: throw new NotImplementedException($"Type {a.GetType()} not supported yet in ConvertArrayToNDarray."); - } - } - } -} diff --git a/src/Numpy/NumPy.datetime.gen.cs b/src/Numpy/NumPy.datetime.gen.cs deleted file mode 100644 index 1eada51..0000000 --- a/src/Numpy/NumPy.datetime.gen.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Convert an array of datetimes into an array of strings. - /// - /// - /// The array of UTC timestamps to format. - /// - /// - /// One of None, ‘auto’, or a datetime unit. - /// - /// - /// Timezone information to use when displaying the datetime. If ‘UTC’, end - /// with a Z to indicate UTC time. If ‘local’, convert to the local timezone - /// first, and suffix with a +-#### timezone offset. If a tzinfo object, - /// then do as with ‘local’, but use the specified timezone. - /// - /// - /// Casting to allow when changing between datetime units. - /// - /// - /// An array of strings the same shape as arr. - /// - public NDarray datetime_as_string(string[] arr, string unit, string timezone = "naive", string casting = "same_kind") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - unit, - timezone, - casting, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("datetime_as_string", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Get information about the step size of a date or time type. - /// - /// The returned tuple can be passed as the second argument of numpy.datetime64 and - /// numpy.timedelta64. - /// - /// - /// The dtype object, which must be a datetime64 or timedelta64 type. - /// - /// - /// A tuple of: - /// unit - /// The datetime unit on which this dtype - /// is based. - /// count - /// The number of base units in a step. - /// - public (string, int) datetime_data(Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("datetime_data", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /* - /// - /// A business day calendar object that efficiently stores information - /// defining valid days for the busday family of functions. - /// - /// The default valid days are Monday through Friday (“business days”). - /// A busdaycalendar object can be specified with any set of weekly - /// valid days, plus an optional “holiday” dates that always will be invalid. - /// - /// Once a busdaycalendar object is created, the weekmask and holidays - /// cannot be modified. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates, no matter which - /// weekday they fall upon. Holiday dates may be specified in any - /// order, and NaT (not-a-time) dates are ignored. This list is - /// saved in a normalized form that is suited for fast calculations - /// of valid days. - /// - /// - /// A business day calendar object containing the specified - /// weekmask and holidays values. - /// - public busdaycalendar busdaycalendar(string weekmask = null, string[] holidays = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (weekmask!=null) kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=null) kwargs["holidays"]=ToPython(holidays); - dynamic py = __self__.InvokeMethod("busdaycalendar", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Calculates which of the given dates are valid days, and which are not. - /// - /// - /// The array of dates to process. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with the same shape as dates, containing True for - /// each valid day, and False for each invalid day. - /// - public NDarray is_busday(string[] dates, string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dates, - }); - var kwargs=new PyDict(); - if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=null) kwargs["holidays"]=ToPython(holidays); - if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("is_busday", pyargs, kwargs); - return ToCsharp>(py); - } - */ - - /* - /// - /// First adjusts the date to fall on a valid day according to - /// the roll rule, then applies offsets to the given dates - /// counted in valid days. - /// - /// - /// The array of dates to process. - /// - /// - /// The array of offsets, which is broadcast with dates. - /// - /// - /// How to treat dates that do not fall on a valid day. The default - /// is ‘raise’. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with a shape from broadcasting dates and offsets - /// together, containing the dates with offsets applied. - /// - public array of datetime64[D] busday_offset(string[] dates, array_like of int offsets, string roll = "raise", string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, array of datetime64[D] @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dates, - offsets, - }); - var kwargs=new PyDict(); - if (roll!="raise") kwargs["roll"]=ToPython(roll); - if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=null) kwargs["holidays"]=ToPython(holidays); - if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("busday_offset", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Counts the number of valid days between begindates and - /// enddates, not including the day of enddates. - /// - /// If enddates specifies a date value that is earlier than the - /// corresponding begindates date value, the count will be negative. - /// - /// - /// The array of the first dates for counting. - /// - /// - /// The array of the end dates for counting, which are excluded - /// from the count themselves. - /// - /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun - /// - /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. - /// - /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. - /// - /// - /// If provided, this array is filled with the result. - /// - /// - /// An array with a shape from broadcasting begindates and enddates - /// together, containing the number of valid days between - /// the begin and end dates. - /// - public array of int busday_count(string[] begindates, string[] enddates, string weekmask = "1111100", string[] holidays = [], busdaycalendar busdaycal = null, array of int @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - begindates, - enddates, - }); - var kwargs=new PyDict(); - if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); - if (holidays!=[]) kwargs["holidays"]=ToPython(holidays); - if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("busday_count", pyargs, kwargs); - return ToCsharp(py); - } - */ - - } -} diff --git a/src/Numpy/NumPy.dtype.gen.cs b/src/Numpy/NumPy.dtype.gen.cs deleted file mode 100644 index b8fd2ac..0000000 --- a/src/Numpy/NumPy.dtype.gen.cs +++ /dev/null @@ -1,582 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// compatible: Python bool - /// - public Dtype bool_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("bool_"); - return ToCsharp(py); - } - } - - /// - /// 8 bits - /// - public Dtype bool8 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("bool8"); - return ToCsharp(py); - } - } - - /// - /// compatible: C char - /// - public Dtype @byte - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("byte"); - return ToCsharp(py); - } - } - - /// - /// compatible: C short - /// - public Dtype @short - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("short"); - return ToCsharp(py); - } - } - - /// - /// compatible: C int - /// - public Dtype intc - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("intc"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python int - /// - public Dtype int_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int_"); - return ToCsharp(py); - } - } - - /// - /// compatible: C long long - /// - public Dtype longlong - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("longlong"); - return ToCsharp(py); - } - } - - /// - /// large enough to fit a pointer - /// - public Dtype intp - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("intp"); - return ToCsharp(py); - } - } - - /// - /// 8 bits - /// - public Dtype int8 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int8"); - return ToCsharp(py); - } - } - - /// - /// 16 bits - /// - public Dtype int16 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int16"); - return ToCsharp(py); - } - } - - /// - /// 32 bits - /// - public Dtype int32 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int32"); - return ToCsharp(py); - } - } - - /// - /// 64 bits - /// - public Dtype int64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("int64"); - return ToCsharp(py); - } - } - - /// - /// compatible: C unsigned char - /// - public Dtype ubyte - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("ubyte"); - return ToCsharp(py); - } - } - - /// - /// compatible: C unsigned short - /// - public Dtype @ushort - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("ushort"); - return ToCsharp(py); - } - } - - /// - /// compatible: C unsigned int - /// - public Dtype uintc - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uintc"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python int - /// - public Dtype @uint - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint"); - return ToCsharp(py); - } - } - - /// - /// compatible: C long long - /// - public Dtype ulonglong - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("ulonglong"); - return ToCsharp(py); - } - } - - /// - /// large enough to fit a pointer - /// - public Dtype uintp - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uintp"); - return ToCsharp(py); - } - } - - /// - /// 8 bits - /// - public Dtype uint8 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint8"); - return ToCsharp(py); - } - } - - /// - /// 16 bits - /// - public Dtype uint16 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint16"); - return ToCsharp(py); - } - } - - /// - /// 32 bits - /// - public Dtype uint32 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint32"); - return ToCsharp(py); - } - } - - /// - /// 64 bits - /// - public Dtype uint64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("uint64"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype half - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("half"); - return ToCsharp(py); - } - } - - /// - /// compatible: C float - /// - public Dtype single - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("single"); - return ToCsharp(py); - } - } - - /// - /// compatible: C double - /// - public Dtype @double - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("double"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python float - /// - public Dtype float_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float_"); - return ToCsharp(py); - } - } - - /// - /// compatible: C long float - /// - public Dtype longfloat - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("longfloat"); - return ToCsharp(py); - } - } - - /// - /// 16 bits - /// - public Dtype float16 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float16"); - return ToCsharp(py); - } - } - - /// - /// 32 bits - /// - public Dtype float32 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float32"); - return ToCsharp(py); - } - } - - /// - /// 64 bits - /// - public Dtype float64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float64"); - return ToCsharp(py); - } - } - - /// - /// 96 bits, platform? - /// - public Dtype float96 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float96"); - return ToCsharp(py); - } - } - - /// - /// 128 bits, platform? - /// - public Dtype float128 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("float128"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype csingle - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("csingle"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python complex - /// - public Dtype complex_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex_"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype clongfloat - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("clongfloat"); - return ToCsharp(py); - } - } - - /// - /// two 32-bit floats - /// - public Dtype complex64 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex64"); - return ToCsharp(py); - } - } - - /// - /// two 64-bit floats - /// - public Dtype complex128 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex128"); - return ToCsharp(py); - } - } - - /// - /// two 96-bit floats, - /// platform? - /// - public Dtype complex192 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex192"); - return ToCsharp(py); - } - } - - /// - /// two 128-bit floats, - /// platform? - /// - public Dtype complex256 - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("complex256"); - return ToCsharp(py); - } - } - - /// - /// any Python object - /// - public Dtype object_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("object_"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python bytes - /// - public Dtype bytes_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("bytes_"); - return ToCsharp(py); - } - } - - /// - /// compatible: Python unicode/str - /// - public Dtype unicode_ - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("unicode_"); - return ToCsharp(py); - } - } - - /// - ///   - /// - public Dtype @void - { - get - { - //auto-generated code, do not change - dynamic py = self.GetAttr("void"); - return ToCsharp(py); - } - } - - } -} diff --git a/src/Numpy/NumPy.dtype.routines.gen.cs b/src/Numpy/NumPy.dtype.routines.gen.cs deleted file mode 100644 index cb4f99a..0000000 --- a/src/Numpy/NumPy.dtype.routines.gen.cs +++ /dev/null @@ -1,632 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Returns True if cast between data types can occur according to the - /// casting rule. If from is a scalar or array scalar, also returns - /// True if the scalar value can be cast without overflow or truncation - /// to an integer. - /// - /// Notes - /// - /// Starting in NumPy 1.9, can_cast function now returns False in ‘safe’ - /// casting mode for integer/float dtype and string dtype if the string dtype - /// length is not long enough to store the max integer/float value converted - /// to a string. Previously can_cast in ‘safe’ mode returned True for - /// integer/float dtype and a string dtype of any length. - /// - /// - /// Data type, scalar, or array to cast from. - /// - /// - /// Data type to cast to. - /// - /// - /// Controls what kind of data casting may occur. - /// - /// - /// True if cast can occur according to the casting rule. - /// - public bool can_cast(Dtype from_, Dtype to, string casting = "safe") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - from_, - to, - }); - var kwargs=new PyDict(); - if (casting!="safe") kwargs["casting"]=ToPython(casting); - dynamic py = __self__.InvokeMethod("can_cast", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the data type with the smallest size and smallest scalar - /// kind to which both type1 and type2 may be safely cast. - /// The returned data type is always in native byte order. - /// - /// This function is symmetric, but rarely associative. - /// - /// Notes - /// - /// Starting in NumPy 1.9, promote_types function now returns a valid string - /// length when given an integer or float dtype as one argument and a string - /// dtype as another argument. Previously it always returned the input string - /// dtype, even if it wasn’t long enough to store the max integer/float value - /// converted to a string. - /// - /// - /// First data type. - /// - /// - /// Second data type. - /// - /// - /// The promoted data type. - /// - public Dtype promote_types(Dtype type1, Dtype type2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - type1, - type2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("promote_types", 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 value whose minimal data type is to be found. - /// - /// - /// The minimal data type. - /// - public Dtype min_scalar_type(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("min_scalar_type", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Returns the type that results from applying the NumPy - /// type promotion rules to the arguments. - /// - /// Type promotion in NumPy works similarly to the rules in languages - /// like C++, with some slight differences. When both scalars and - /// arrays are used, the array’s type takes precedence and the actual value - /// of the scalar is taken into account. - /// - /// For example, calculating 3*a, where a is an array of 32-bit floats, - /// intuitively should result in a 32-bit float output. If the 3 is a - /// 32-bit integer, the NumPy rules indicate it can’t convert losslessly - /// into a 32-bit float, so a 64-bit float should be the result type. - /// By examining the value of the constant, ‘3’, we see that it fits in - /// an 8-bit integer, which can be cast losslessly into the 32-bit float. - /// - /// Notes - /// - /// The specific algorithm used is as follows. - /// - /// Categories are determined by first checking which of boolean, - /// integer (int/uint), or floating point (float/complex) the maximum - /// kind of all the arrays and the scalars are. - /// - /// If there are only scalars or the maximum category of the scalars - /// is higher than the maximum category of the arrays, - /// the data types are combined with promote_types - /// to produce the return value. - /// - /// Otherwise, min_scalar_type is called on each array, and - /// the resulting data types are all combined with promote_types - /// to produce the return value. - /// - /// The set of int values is not a subset of the uint values for types - /// with the same number of bits, something not reflected in - /// min_scalar_type, but handled as a special case in result_type. - /// - /// - /// The operands of some operation whose result type is needed. - /// - /// - /// The result type. - /// - public Dtype result_type(list of arrays and dtypes arrays_and_dtypes) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arrays_and_dtypes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("result_type", pyargs, kwargs); - 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. - /// - /// - /// Input arrays. - /// - /// - /// Data type code. - /// - public Dtype common_type(NDarray array2, NDarray array1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array2, - array1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("common_type", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the scalar dtype or NumPy equivalent of Python type of an object. - /// - /// - /// The object of which the type is returned. - /// - /// - /// If given, this is returned for objects whose types can not be - /// determined. If not given, None is returned for those objects. - /// - /// - /// The data type of rep. - /// - public Dtype obj2sctype(object rep, object @default = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rep, - }); - var kwargs=new PyDict(); - if (@default!=null) kwargs["default"]=ToPython(@default); - dynamic py = __self__.InvokeMethod("obj2sctype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a data type object. - /// - /// A numpy array is homogeneous, and contains elements described by a - /// dtype object. A dtype object can be constructed from different - /// combinations of fundamental numeric types. - /// - /// - /// Add padding to the fields to match what a C compiler would output - /// for a similar C-struct. Can be True only if obj is a dictionary - /// or a comma-separated string. If a struct dtype is being created, - /// this also sets a sticky alignment flag isalignedstruct. - /// - /// - /// Make a new copy of the data-type object. If False, the result - /// may just be a reference to a built-in data-type object. - /// - public void dtype(bool? align = null, bool? copy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (align!=null) kwargs["align"]=ToPython(align); - if (copy!=null) kwargs["copy"]=ToPython(copy); - dynamic py = __self__.InvokeMethod("dtype", pyargs, kwargs); - } - - /// - /// Class to convert formats, names, titles description to a dtype. - /// - /// After constructing the format_parser object, the dtype attribute is - /// the converted data-type: - /// dtype = format_parser(formats, names, titles).dtype - /// - /// - /// The format description, either specified as a string with - /// comma-separated format descriptions in the form 'f8, i4, a5', or - /// a list of format description strings in the form - /// ['f8', 'i4', 'a5']. - /// - /// - /// The field names, either specified as a comma-separated string in the - /// form 'col1, col2, col3', or as a list or tuple of strings in the - /// form ['col1', 'col2', 'col3']. - /// An empty list can be used, in that case default field names - /// (‘f0’, ‘f1’, …) are used. - /// - /// - /// Sequence of title strings. An empty list can be used to leave titles - /// out. - /// - /// - /// If True, align the fields by padding as the C-compiler would. - /// Default is False. - /// - /// - /// If specified, all the fields will be changed to the - /// provided byte-order. Otherwise, the default byte-order is - /// used. For all available string specifiers, see dtype.newbyteorder. - /// - public void format_parser(string[] formats, string[] names, string[] titles, bool? aligned = null, string byteorder = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - formats, - names, - titles, - }); - var kwargs=new PyDict(); - if (aligned!=null) kwargs["aligned"]=ToPython(aligned); - if (byteorder!=null) kwargs["byteorder"]=ToPython(byteorder); - dynamic py = __self__.InvokeMethod("format_parser", pyargs, kwargs); - } - - /// - /// Machine limits for floating point types. - /// - /// Notes - /// - /// For developers of NumPy: do not instantiate this at the module level. - /// The initial calculation of these parameters is expensive and negatively - /// impacts import times. These objects are cached, so calling finfo() - /// repeatedly inside your functions is not a problem. - /// - /// - /// Kind of floating point data-type about which to get information. - /// - public void finfo(Dtype dtype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dtype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("finfo", pyargs, kwargs); - } - - /// - /// Machine limits for integer types. - /// - /// - /// The kind of integer data type to get information about. - /// - public void iinfo(Dtype int_type) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - int_type, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("iinfo", pyargs, kwargs); - } - - /// - /// Diagnosing machine parameters. - /// - /// References - /// - /// - /// Function that converts an integer or integer array to a float - /// or float array. Default is float. - /// - /// - /// Function that converts a float or float array to an integer or - /// integer array. Default is int. - /// - /// - /// Function that converts a float array to float. Default is float. - /// Note that this does not seem to do anything useful in the current - /// implementation. - /// - /// - /// Function that converts a single float to a string. Default is - /// lambda v:'%24.16e' %v. - /// - /// - /// Title that is printed in the string representation of MachAr. - /// - public void MachAr(Delegate float_conv = null, Delegate int_conv = null, Delegate float_to_float = null, Delegate float_to_str = null, string title = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (float_conv!=null) kwargs["float_conv"]=ToPython(float_conv); - if (int_conv!=null) kwargs["int_conv"]=ToPython(int_conv); - if (float_to_float!=null) kwargs["float_to_float"]=ToPython(float_to_float); - if (float_to_str!=null) kwargs["float_to_str"]=ToPython(float_to_str); - if (title!=null) kwargs["title"]=ToPython(title); - dynamic py = __self__.InvokeMethod("MachAr", pyargs, kwargs); - } - - /// - /// Determines whether the given object represents a scalar data-type. - /// - /// - /// If rep is an instance of a scalar dtype, True is returned. If not, - /// False is returned. - /// - /// - /// Boolean result of check whether rep is a scalar dtype. - /// - public bool issctype(object rep) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issctype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns True if first argument is a typecode lower/equal in type hierarchy. - /// - /// - /// dtype or string representing a typecode. - /// - /// - /// dtype or string representing a typecode. - /// - public bool issubdtype(Dtype arg2, Dtype arg1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arg2, - arg1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issubdtype", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Determine if the first argument is a subclass of the second argument. - /// - /// - /// Data-types. - /// - /// - /// Data-types. - /// - /// - /// The result. - /// - public bool issubsctype(Dtype arg2, Dtype arg1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arg2, - arg1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issubsctype", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Determine if a class is a subclass of a second class. - /// - /// issubclass_ is equivalent to the Python built-in issubclass, - /// except that it returns False instead of raising a TypeError if one - /// of the arguments is not a class. - /// - /// - /// Input class. True is returned if arg1 is a subclass of arg2. - /// - /// - /// Input class. If a tuple of classes, True is returned if arg1 is a - /// subclass of any of the tuple elements. - /// - /// - /// Whether arg1 is a subclass of arg2 or not. - /// - public bool issubclass_(class arg1, class or tuple of classes. arg2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arg1, - arg2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("issubclass_", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Determine common type following standard coercion rules. - /// - /// - /// A list of dtypes or dtype convertible objects representing arrays. - /// - /// - /// A list of dtypes or dtype convertible objects representing scalars. - /// - /// - /// The common data type, which is the maximum of array_types ignoring - /// scalar_types, unless the maximum of scalar_types is of a - /// different kind (dtype.kind). If the kind is not understood, then - /// None is returned. - /// - public Dtype find_common_type(sequence array_types, sequence scalar_types) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array_types, - scalar_types, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("find_common_type", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Return a description for the given data type code. - /// - /// - /// Data type code. - /// - /// - /// Description of the input data type code. - /// - public string typename(string @char) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - @char, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("typename", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the string representation of a scalar dtype. - /// - /// - /// If a scalar dtype, the corresponding string character is - /// returned. If an object, sctype2char tries to infer its scalar type - /// and then return the corresponding string character. - /// - /// - /// The string character corresponding to the scalar type. - /// - public string sctype2char(object sctype) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sctype, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("sctype2char", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the character for the minimum-size type to which given types can - /// be safely cast. - /// - /// The returned type character must represent the smallest size dtype such - /// that an array of the returned type can handle the data from an array of - /// all types in typechars (or if typechars is an array, then its - /// dtype.char). - /// - /// - /// If a list of strings, each string should represent a dtype. - /// If array_like, the character representation of the array dtype is used. - /// - /// - /// The set of characters that the returned character is chosen from. - /// The default set is ‘GDFgdf’. - /// - /// - /// The default character, this is returned if none of the characters in - /// typechars matches a character in typeset. - /// - /// - /// The character representing the minimum-size type that was found. - /// - public string mintypecode(string[] typechars, string[] typeset = null, string @default = "d") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - typechars, - }); - var kwargs=new PyDict(); - if (typeset!=null) kwargs["typeset"]=ToPython(typeset); - if (@default!="d") kwargs["default"]=ToPython(@default); - dynamic py = __self__.InvokeMethod("mintypecode", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.fft.gen.cs b/src/Numpy/NumPy.fft.gen.cs deleted file mode 100644 index c655187..0000000 --- a/src/Numpy/NumPy.fft.gen.cs +++ /dev/null @@ -1,599 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Compute the one-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) of a real-valued array by means of an efficient algorithm - /// called the Fast Fourier Transform (FFT). - /// - /// Notes - /// - /// When the DFT is computed for purely real input, the output is - /// Hermitian-symmetric, i.e. the negative frequency terms are just the complex - /// conjugates of the corresponding positive-frequency terms, and the - /// negative-frequency terms are therefore redundant. This function does not - /// compute the negative frequency terms, and the length of the transformed - /// axis of the output is therefore n//2 + 1. - /// - /// When A = rfft(a) and fs is the sampling frequency, A[0] contains - /// the zero-frequency term 0*fs, which is real due to Hermitian symmetry. - /// - /// If n is even, A[-1] contains the term representing both positive - /// and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely - /// real. If n is odd, there is no term at fs/2; A[-1] contains - /// the largest positive frequency (fs/2*(n-1)/n), and is complex in the - /// general case. - /// - /// If the input a contains an imaginary part, it is silently discarded. - /// - /// - /// Input array - /// - /// - /// Number of points along transformation axis in the input to use. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// If n is even, the length of the transformed axis is (n/2)+1. - /// If n is odd, the length is (n+1)/2. - /// - public NDarray fft_rfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("rfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the inverse of the n-point DFT for real input. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier Transform of real input computed by rfft. - /// In other words, irfft(rfft(a), len(a)) == a to within numerical - /// accuracy. (See Notes below for why len(a) is necessary here.) - /// - /// The input is expected to be in the form returned by rfft, i.e. the - /// real zero-frequency term followed by the complex positive frequency terms - /// in order of increasing frequency. Since the discrete Fourier Transform of - /// real input is Hermitian-symmetric, the negative frequency terms are taken - /// to be the complex conjugates of the corresponding positive frequency terms. - /// - /// Notes - /// - /// Returns the real valued n-point inverse discrete Fourier transform - /// of a, where a contains the non-negative frequency terms of a - /// Hermitian-symmetric sequence. n is the length of the result, not the - /// input. - /// - /// If you specify an n such that a must be zero-padded or truncated, the - /// extra/removed values will be added/removed at high frequencies. One can - /// thus resample a series to m points via Fourier interpolation by: - /// a_resamp = irfft(rfft(a), m). - /// - /// - /// The input array. - /// - /// - /// Length of the transformed axis of the output. - /// For n output points, n//2+1 input points are necessary. If the - /// input is longer than this, it is cropped. If it is shorter than this, - /// it is padded with zeros. If n is not given, it is determined from - /// the length of the input along the axis specified by axis. - /// - /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*(m-1) where m is the length of the transformed axis of the - /// input. To get an odd number of output points, n must be specified. - /// - public NDarray fft_irfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("irfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional FFT of a real array. - /// - /// Notes - /// - /// This is really just rfftn with different default behavior. - /// For more details see rfftn. - /// - /// - /// Input array, taken to be real. - /// - /// - /// Shape of the FFT. - /// - /// - /// Axes over which to compute the FFT. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The result of the real 2-D FFT. - /// - public NDarray fft_rfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("rfft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional inverse FFT of a real array. - /// - /// Notes - /// - /// This is really irfftn with different defaults. - /// For more details see irfftn. - /// - /// - /// The input array - /// - /// - /// Shape of the inverse FFT. - /// - /// - /// The axes over which to compute the inverse fft. - /// Default is the last two axes. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The result of the inverse real 2-D FFT. - /// - public NDarray fft_irfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("irfft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the N-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional real array by means of the Fast - /// Fourier Transform (FFT). By default, all axes are transformed, with the - /// real transform performed over the last axis, while the remaining - /// transforms are complex. - /// - /// Notes - /// - /// The transform for real input is performed over the last transformation - /// axis, as by rfft, then the transform over the remaining axes is - /// performed as by fftn. The order of the output is as for rfft for the - /// final transformation axis, and as for fftn for the remaining - /// transformation axes. - /// - /// See fft for details, definitions and conventions used. - /// - /// - /// Input array, taken to be real. - /// - /// - /// Shape (length along each transformed axis) to use from the input. - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// The final element of s corresponds to n for rfft(x, n), while - /// for the remaining axes, it corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// The length of the last axis transformed will be s[-1]//2+1, - /// while the remaining transformed axes will have lengths according to - /// s, or unchanged from the input. - /// - public NDarray fft_rfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("rfftn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the inverse of the N-dimensional FFT of real input. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform for real input over any number of axes in an - /// M-dimensional array by means of the Fast Fourier Transform (FFT). In - /// other words, irfftn(rfftn(a), a.shape) == a to within numerical - /// accuracy. (The a.shape is necessary like len(a) is for irfft, - /// and for the same reason.) - /// - /// The input should be ordered in the same way as is returned by rfftn, - /// i.e. as for irfft for the final transformation axis, and as for ifftn - /// along all the other axes. - /// - /// Notes - /// - /// See fft for definitions and conventions used. - /// - /// See rfft for definitions and conventions used for real input. - /// - /// - /// Input array. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). s is also the - /// number of input points used along this axis, except for the last axis, - /// where s[-1]//2+1 points of the input are used. - /// Along any axis, if the shape indicated by s is smaller than that of - /// the input, the input is cropped. If it is larger, the input is padded - /// with zeros. If s is not given, the shape of the input along the - /// axes specified by axes is used. - /// - /// - /// Axes over which to compute the inverse FFT. If not given, the last - /// len(s) axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// The length of each transformed axis is as given by the corresponding - /// element of s, or the length of the input in every axis except for the - /// last one if s is not given. In the final transformed axis the length - /// of the output when s is not given is 2*(m-1) where m is the - /// length of the final transformed axis of the input. To get an odd - /// number of output points in the final axis, s must be specified. - /// - public NDarray fft_irfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("irfftn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the FFT of a signal that has Hermitian symmetry, i.e., a real - /// spectrum. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd. - /// - /// - /// The input array. - /// - /// - /// Length of the transformed axis of the output. For n output - /// points, n//2 + 1 input points are necessary. If the input is - /// longer than this, it is cropped. If it is shorter than this, it is - /// padded with zeros. If n is not given, it is determined from the - /// length of the input along the axis specified by axis. - /// - /// - /// Axis over which to compute the FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*m - 2 where m is the length of the transformed axis of - /// the input. To get an odd number of output points, n must be - /// specified, for instance as 2*m - 1 in the typical case, - /// - public NDarray fft_hfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("hfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the inverse FFT of a signal that has Hermitian symmetry. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd: - /// - /// - /// Input array. - /// - /// - /// Length of the inverse FFT, the number of points along - /// transformation axis in the input to use. If n is smaller than - /// the length of the input, the input is cropped. If it is larger, - /// the input is padded with zeros. If n is not given, the length of - /// the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n//2 + 1. - /// - public NDarray fft_ihfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ihfft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Discrete Fourier Transform sample frequencies. - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// - /// Window length. - /// - /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. - /// - /// - /// Array of length n containing the sample frequencies. - /// - public NDarray fft_fftfreq(int n, float? d = 1.0f) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (d!=1.0f) kwargs["d"]=ToPython(d); - dynamic py = __self__.InvokeMethod("fftfreq", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Discrete Fourier Transform sample frequencies - /// (for usage with rfft, irfft). - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// Unlike fftfreq (but like scipy.fftpack.rfftfreq) - /// the Nyquist frequency component is considered to be positive. - /// - /// - /// Window length. - /// - /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. - /// - /// - /// Array of length n//2 + 1 containing the sample frequencies. - /// - public NDarray fft_rfftfreq(int n, float? d = 1.0f) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (d!=1.0f) kwargs["d"]=ToPython(d); - dynamic py = __self__.InvokeMethod("rfftfreq", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Shift the zero-frequency component to the center of the spectrum. - /// - /// This function swaps half-spaces for all axes listed (defaults to all). - /// Note that y[0] is the Nyquist component only if len(x) is even. - /// - /// - /// Input array. - /// - /// - /// Axes over which to shift. Default is None, which shifts all axes. - /// - /// - /// The shifted array. - /// - public NDarray fft_fftshift(NDarray x, int[] axes = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("fftshift", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// The inverse of fftshift. Although identical for even-length x, the - /// functions differ by one sample for odd-length x. - /// - /// - /// Input array. - /// - /// - /// Axes over which to calculate. Defaults to None, which shifts all axes. - /// - /// - /// The shifted array. - /// - public NDarray fft_ifftshift(NDarray x, int[] axes = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("ifftshift", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.financial.gen.cs b/src/Numpy/NumPy.financial.gen.cs deleted file mode 100644 index 44d43af..0000000 --- a/src/Numpy/NumPy.financial.gen.cs +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Compute the future value. - /// - /// Notes - /// - /// The future value is computed by solving the equation: - /// - /// or, when rate == 0: - /// - /// References - /// - /// - /// Rate of interest as decimal (not per cent) per period - /// - /// - /// 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 rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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 - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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); - } - - /// - /// Returns the NPV (Net Present Value) of a cash flow series. - /// - /// Notes - /// - /// Returns the result of: [G] - /// - /// References - /// - /// - /// The discount rate. - /// - /// - /// The values of the time series of cash flows. The (fixed) time - /// interval between cash flow “events” must be the same as that for - /// which rate is given (i.e., if rate is per year, then precisely - /// a year is understood to elapse between each cash flow event). By - /// convention, investments or “deposits” are negative, income or - /// “withdrawals” are positive; values must begin with the initial - /// investment, thus values[0] will typically be negative. - /// - /// - /// The NPV of the input cash flow series values at the discount - /// rate. - /// - public float npv(ValueType rate, NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("npv", 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 - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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. - /// - /// - /// Rate of interest (per period) - /// - /// - /// 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 rate, 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[] - { - rate, - 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 - /// - /// - /// Rate of interest as decimal (not per cent) per period - /// - /// - /// 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 rate, 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[] - { - rate, - 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 - /// - /// - /// Input cash flows per time period. By convention, net “deposits” - /// are negative and net “withdrawals” are positive. Thus, for - /// example, at least the first element of values, which represents - /// the initial investment, will typically be negative. - /// - /// - /// Internal Rate of Return for periodic input values. - /// - public float irr(NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("irr", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Modified internal rate of return. - /// - /// - /// Cash flows (must contain at least one positive and one negative - /// value) or nan is returned. The first value is considered a sunk - /// cost at time zero. - /// - /// - /// Interest rate paid on the cash flows - /// - /// - /// Interest rate received on the cash flows upon reinvestment - /// - /// - /// Modified internal rate of return - /// - public float mirr(NDarray values, ValueType finance_rate, ValueType reinvest_rate) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - values, - 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: - /// - /// - /// Rate of interest (per period) - /// - /// - /// Payment - /// - /// - /// Present value - /// - /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public void nper(NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - rate, - 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 - /// - /// - /// Number of compounding periods - /// - /// - /// 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 nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - nper, - 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); - } - - } -} diff --git a/src/Numpy/NumPy.indexing.gen.cs b/src/Numpy/NumPy.indexing.gen.cs deleted file mode 100644 index 0dde291..0000000 --- a/src/Numpy/NumPy.indexing.gen.cs +++ /dev/null @@ -1,1349 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Translates slice objects to concatenation along the first axis. - /// - /// This is a simple way to build up arrays quickly. There are two use cases. - /// - /// If slice notation is used, the syntax start:stop:step is equivalent - /// to np.arange(start, stop, step) inside of the brackets. However, if - /// step is an imaginary number (i.e. 100j) then its integer portion is - /// interpreted as a number-of-points desired and the start and stop are - /// inclusive. In other words start:stop:stepj is interpreted as - /// np.linspace(start, stop, step, endpoint=1) inside of the brackets. - /// After expansion of slice notation, all comma separated sequences are - /// concatenated together. - /// - /// Optional character strings placed as the first element of the index - /// expression can be used to change the output. The strings ‘r’ or ‘c’ result - /// in matrix output. If the result is 1-D and ‘r’ is specified a 1 x N (row) - /// matrix is produced. If the result is 1-D and ‘c’ is specified, then a N x 1 - /// (column) matrix is produced. If the result is 2-D then both provide the - /// same matrix result. - /// - /// A string integer specifies which axis to stack multiple comma separated - /// arrays along. A string of two comma-separated integers allows indication - /// of the minimum number of dimensions to force each entry into as the - /// second integer (the axis to concatenate along is still the first integer). - /// - /// A string with three comma-separated integers allows specification of the - /// axis to concatenate along, the minimum number of dimensions to force the - /// entries to, and which axis should contain the start of the arrays which - /// are less than the specified number of dimensions. In other words the third - /// integer allows you to specify where the 1’s should be placed in the shape - /// of the arrays that have their shapes upgraded. By default, they are placed - /// in the front of the shape tuple. The third argument allows you to specify - /// where the start of the array should be instead. Thus, a third argument of - /// ‘0’ would place the 1’s at the end of the array shape. Negative integers - /// specify where in the new shape tuple the last dimension of upgraded arrays - /// should be placed, so the default is ‘-1’. - /// - public void r_() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("r_"); - } - - /// - /// A nicer way to build up index tuples for arrays. - /// - /// For any index combination, including slicing and axis insertion, - /// a[indices] is the same as a[np.index_exp[indices]] for any - /// array a. However, np.index_exp[indices] can be used anywhere - /// in Python code and returns a tuple of slice objects that can be - /// used in the construction of complex index expressions. - /// - /// Notes - /// - /// You can do all this with slice() plus a few special objects, - /// but there’s a lot to remember and this version is simpler because - /// it uses the standard array indexing syntax. - /// - /// - /// If True, always returns a tuple. - /// - public void s_(bool maketuple) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - maketuple, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("s_", 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. - /// - /// - /// Input array. - /// - /// - /// Indices of elements that are non-zero. - /// - public NDarray[] nonzero(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("nonzero", 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: - /// - /// - /// Where True, yield x, otherwise yield y. - /// - /// - /// 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 condition, NDarray y, NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condition, - y, - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("where", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array representing the indices of a grid. - /// - /// Compute an array where the subarrays contain index values 0,1,… - /// varying only along the corresponding axis. - /// - /// Notes - /// - /// The output shape is obtained by prepending the number of dimensions - /// in front of the tuple of dimensions, i.e. if dimensions is a tuple - /// (r0, ..., rN-1) of length N, the output shape is - /// (N,r0,...,rN-1). - /// - /// The subarrays grid[k] contains the N-D array of indices along the - /// k-th axis. Explicitly: - /// - /// - /// The shape of the grid. - /// - /// - /// Data type of the result. - /// - /// - /// The array of grid indices, - /// grid.shape = (len(dimensions),) + tuple(dimensions). - /// - public NDarray indices(int[] dimensions, Dtype dtype = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - dimensions, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Construct an open mesh from multiple sequences. - /// - /// This function takes N 1-D sequences and returns N outputs with N - /// dimensions each, such that the shape is 1 in all but one dimension - /// and the dimension with the non-unit shape value cycles through all - /// N dimensions. - /// - /// Using ix_ one can quickly construct index arrays that will index - /// the cross product. a[np.ix_([1,3],[2,5])] returns the array - /// [[a[1,2] a[1,5]], [a[3,2] a[3,5]]]. - /// - /// - /// Each sequence should be of integer or boolean type. - /// Boolean sequences will be interpreted as boolean masks for the - /// corresponding dimension (equivalent to passing in - /// np.nonzero(boolean_sequence)). - /// - /// - /// N arrays with N dimensions each, with N the number of input - /// sequences. Together these arrays form an open mesh. - /// - public NDarray[] ix_(NDarray[] args) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ix_", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Converts a tuple of index arrays into an array of flat - /// indices, applying boundary modes to the multi-index. - /// - /// Notes - /// - /// - /// A tuple of integer arrays, one array for each dimension. - /// - /// - /// The shape of array into which the indices from multi_index apply. - /// - /// - /// Specifies how out-of-bounds indices are handled. Can specify - /// either one mode or a tuple of modes, one mode per index. - /// - /// In ‘clip’ mode, a negative index which would normally - /// wrap will clip to 0 instead. - /// - /// - /// Determines whether the multi-index should be viewed as - /// indexing in row-major (C-style) or column-major - /// (Fortran-style) order. - /// - /// - /// An array of indices into the flattened version of an array - /// of dimensions dims. - /// - public NDarray ravel_multi_index(tuple of array_like multi_index, tuple of ints dims, string mode = "raise", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - multi_index, - dims, - }); - var kwargs=new PyDict(); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("ravel_multi_index", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Converts a flat index or array of flat indices into a tuple - /// of coordinate arrays. - /// - /// - /// An integer array whose elements are indices into the flattened - /// version of an array of dimensions shape. Before version 1.6.0, - /// this function accepted just one index value. - /// - /// - /// 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(NDarray indices, Shape shape, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - indices, - 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 array. - /// - /// This returns a tuple of indices that can be used to access the main - /// diagonal of an array a with a.ndim >= 2 dimensions and shape - /// (n, n, …, n). For a.ndim = 2 this is the usual diagonal, for - /// a.ndim > 2 this is the set of indices to access a[i, i, ..., i] - /// for i = [0..n-1]. - /// - /// Notes - /// - /// - /// The size, along each dimension, of the arrays for which the returned - /// indices can be used. - /// - /// - /// The number of dimensions. - /// - public void diag_indices(int n, int? ndim = 2) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (ndim!=2) kwargs["ndim"]=ToPython(ndim); - dynamic py = __self__.InvokeMethod("diag_indices", pyargs, kwargs); - } - - /// - /// 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(NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("diag_indices_from", pyargs, kwargs); - } - - /// - /// Return the indices to access (n, n) arrays, given a masking function. - /// - /// Assume mask_func is a function that, for a square array a of size - /// (n, n) with a possible offset argument k, when called as - /// mask_func(a, k) returns a new array with zeros in certain locations - /// (functions like triu or tril do precisely this). Then this function - /// returns the indices where the non-zero values would be located. - /// - /// Notes - /// - /// - /// The returned indices will be valid to access arrays of shape (n, n). - /// - /// - /// A function whose call signature is similar to that of triu, tril. - /// That is, mask_func(x, k) returns a boolean array, shaped like x. - /// k is an optional argument to the function. - /// - /// - /// An optional argument which is passed through to mask_func. Functions - /// like triu, tril take a second argument that is interpreted as an - /// offset. - /// - /// - /// The n arrays of indices corresponding to the locations where - /// mask_func(np.ones((n, n)), k) is True. - /// - public NDarray[] mask_indices(int n, Delegate mask_func, int k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - mask_func, - k, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mask_indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices for the lower-triangle of an (n, m) array. - /// - /// Notes - /// - /// - /// The row dimension of the arrays for which the returned - /// indices will be valid. - /// - /// - /// Diagonal offset (see tril for details). - /// - /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. - /// - /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. - /// - public NDarray[] tril_indices(int n, int? k = 0, int? m = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - if (m!=null) kwargs["m"]=ToPython(m); - dynamic py = __self__.InvokeMethod("tril_indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices for the lower-triangle of arr. - /// - /// See tril_indices for full details. - /// - /// Notes - /// - /// - /// The indices will be valid for square arrays whose dimensions are - /// the same as arr. - /// - /// - /// Diagonal offset (see tril for details). - /// - public void tril_indices_from(NDarray arr, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - 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 an (n, m) array. - /// - /// Notes - /// - /// - /// The size of the arrays for which the returned indices will - /// be valid. - /// - /// - /// Diagonal offset (see triu for details). - /// - /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. - /// - /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. Can be used - /// to slice a ndarray of shape(n, n). - /// - public NDarray[] triu_indices(int n, int? k = 0, int? m = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - n, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - if (m!=null) kwargs["m"]=ToPython(m); - dynamic py = __self__.InvokeMethod("triu_indices", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices for the upper-triangle of arr. - /// - /// See triu_indices for full details. - /// - /// Notes - /// - /// - /// The indices will be valid for square arrays. - /// - /// - /// Diagonal offset (see triu for details). - /// - /// - /// Indices for the upper-triangle of arr. - /// - public NDarray[] triu_indices_from(NDarray arr, int? k = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - if (k!=0) kwargs["k"]=ToPython(k); - dynamic py = __self__.InvokeMethod("triu_indices_from", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Take elements from an array along an axis. - /// - /// When axis is not None, this function does the same thing as “fancy” - /// indexing (indexing arrays using arrays); however, it can be easier to use - /// if you need elements along a given axis. A call such as - /// np.take(arr, indices, axis=3) is equivalent to - /// arr[:,:,:,indices,...]. - /// - /// Explained without fancy indexing, this is equivalent to the following use - /// of ndindex, which sets each of ii, jj, and kk to a tuple of - /// indices: - /// - /// Notes - /// - /// By eliminating the inner loop in the description above, and using s_ to - /// build simple slice objects, take can be expressed in terms of applying - /// fancy indexing to each 1-d slice: - /// - /// For this reason, it is equivalent to (but faster than) the following use - /// of apply_along_axis: - /// - /// - /// The source array. - /// - /// - /// The indices of the values to extract. - /// - /// Also allow scalars for indices. - /// - /// - /// The axis over which to select values. By default, the flattened - /// input array is used. - /// - /// - /// If provided, the result will be placed in this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// 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. - /// - /// - /// The returned array has the same type as a. - /// - public NDarray take(NDarray[] a, NDarray[] indices, int? axis = null, NDarray @out = null, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - indices, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("take", 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: - /// - /// - /// Source array - /// - /// - /// 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 void take_along_axis(NDarray arr, NDarray indices, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - indices, - axis, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("take_along_axis", pyargs, kwargs); - } - - /// - /// Construct an array from an index array and a set of arrays to choose from. - /// - /// First of all, if confused or uncertain, definitely look at the Examples - - /// in its full generality, this function is less simple than it might - /// seem from the following code description (below ndi = - /// numpy.lib.index_tricks): - /// - /// np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)]). - /// - /// But this omits some subtleties. Here is a fully general summary: - /// - /// Given an “index” array (a) of integers and a sequence of n arrays - /// (choices), a and each choice array are first broadcast, as necessary, - /// to arrays of a common shape; calling these Ba and Bchoices[i], i = - /// 0,…,n-1 we have that, necessarily, Ba.shape == Bchoices[i].shape - /// for each i. Then, a new array with shape Ba.shape is created as - /// follows: - /// - /// Notes - /// - /// To reduce the chance of misinterpretation, even though the following - /// “abuse” is nominally supported, choices should neither be, nor be - /// thought of as, a single array, i.e., the outermost sequence-like container - /// should be either a list or a tuple. - /// - /// - /// This array must contain integers in [0, n-1], where n is the number - /// of choices, unless mode=wrap or mode=clip, in which cases any - /// integers are permissible. - /// - /// - /// Choice arrays. a and all of the choices must be broadcastable to the - /// same shape. If choices is itself an array (not recommended), then - /// its outermost dimension (i.e., the one corresponding to - /// choices.shape[0]) is taken as defining the “sequence”. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Specifies how indices outside [0, n-1] will be treated: - /// - /// - /// The merged result. - /// - public NDarray choose(NDarray a, NDarray[] choices, NDarray @out = null, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - choices, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (mode!="raise") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("choose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return selected slices of an array along given axis. - /// - /// When working along a given axis, a slice along that axis is returned in - /// output for each index where condition evaluates to True. When - /// working on a 1-D array, compress is equivalent to extract. - /// - /// - /// Array that selects which entries to return. If len(condition) - /// is less than the size of a along the given axis, then output is - /// truncated to the length of the condition array. - /// - /// - /// Array from which to extract a part. - /// - /// - /// Axis along which to take slices. If None (default), work on the - /// flattened array. - /// - /// - /// Output array. Its type is preserved and it must be of the right - /// shape to hold the output. - /// - /// - /// A copy of a without the slices along axis for which condition - /// is false. - /// - public NDarray compress(NDarray condition, NDarray a, int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condition, - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("compress", 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. - /// - /// - /// Array from which the diagonals are taken. - /// - /// - /// 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(NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - } - - /// - /// Return an array drawn from elements in choicelist, depending on conditions. - /// - /// - /// The list of conditions which determine from which array in choicelist - /// the output elements are taken. When multiple conditions are satisfied, - /// the first one encountered in condlist is used. - /// - /// - /// The list of arrays from which the output elements are taken. It has - /// to be of the same length as condlist. - /// - /// - /// The element inserted in output when all conditions evaluate to False. - /// - /// - /// The output at position m is the m-th element of the array in - /// choicelist where the m-th element of the corresponding array in - /// condlist is True. - /// - public NDarray @select(NDarray[] condlist, NDarray[] choicelist, object @default = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condlist, - choicelist, - }); - var kwargs=new PyDict(); - if (@default!=null) kwargs["default"]=ToPython(@default); - dynamic py = __self__.InvokeMethod("select", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Create a view into the array with the given shape and strides. - /// - /// Notes - /// - /// as_strided creates a view into the array given the exact strides - /// and shape. This means it manipulates the internal data structure of - /// ndarray and, if done incorrectly, the array elements can point to - /// invalid memory and can corrupt results or crash your program. - /// It is advisable to always use the original x.strides when - /// calculating new strides to avoid reliance on a contiguous memory - /// layout. - /// - /// Furthermore, arrays created with this function often contain self - /// overlapping memory, so that two elements are identical. - /// Vectorized write operations on such arrays will typically be - /// unpredictable. They may even give different results for small, large, - /// or transposed arrays. - /// Since writing to these arrays has to be tested and done with great - /// care, you may want to use writeable=False to avoid accidental write - /// operations. - /// - /// For these reasons it is advisable to avoid as_strided when - /// possible. - /// - /// - /// Array to create a new. - /// - /// - /// The shape of the new array. Defaults to x.shape. - /// - /// - /// The strides of the new array. Defaults to x.strides. - /// - /// - /// If True, subclasses are preserved. - /// - /// - /// If set to False, the returned array will always be readonly. - /// Otherwise it will be writable if the original array was. It - /// is advisable to set this to False if possible (see Notes). - /// - public NDarray lib_stride_tricks_as_strided(NDarray x, Shape shape = null, int[] strides = null, bool? subok = false, bool? writeable = true) - { - //auto-generated code, do not change - var lib = self.GetAttr("lib"); - var stride_tricks = lib.GetAttr("stride_tricks"); - var __self__=stride_tricks; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (shape!=null) kwargs["shape"]=ToPython(shape); - if (strides!=null) kwargs["strides"]=ToPython(strides); - if (subok!=false) kwargs["subok"]=ToPython(subok); - if (writeable!=true) kwargs["writeable"]=ToPython(writeable); - dynamic py = __self__.InvokeMethod("as_strided", 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. - /// - /// - /// Array to put data into. - /// - /// - /// 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 arr, NDarray mask, NDarray vals) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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 array. - /// - /// - /// 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 a, NDarray ind, NDarray v, string mode = "raise") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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: - /// - /// - /// Destination array. - /// - /// - /// 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 arr, NDarray indices, NDarray[] values, int axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - 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. - /// - /// - /// Target array. - /// - /// - /// 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 a, NDarray mask, NDarray values) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Array whose diagonal is to be filled, it gets modified in-place. - /// - /// - /// 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(NDarray a, ValueType val, bool wrap = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - val, - wrap, - }); - var kwargs=new PyDict(); - 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. - /// - /// - /// The array(s) to iterate over. - /// - /// - /// 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(NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - op, - }); - 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. - /// - /// - /// Input array. - /// - public void ndenumerate(NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ndenumerate", pyargs, kwargs); - } - - /// - /// An N-dimensional iterator object to index arrays. - /// - /// Given the shape of an array, an ndindex instance iterates over - /// the N-dimensional index of the array. At each iteration a tuple - /// of indices is returned, the last dimension is iterated over first. - /// - /// - /// The size of each dimension of the array. - /// - public void ndindex(int[] args) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - args, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("ndindex", pyargs, kwargs); - } - - /* - /// - /// 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. - /// - /// - /// The array(s) to iterate over. - /// - /// - /// 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(NDarray op, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - op, - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("nested_iters", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Flat iterator object to iterate over arrays. - /// - /// A flatiter iterator is returned by x.flat for any array x. - /// It allows iterating over the array as if it were a 1-D array, - /// either in a for-loop or by calling its next method. - /// - /// Iteration is done in row-major, C-style order (the last - /// index varying the fastest). The iterator can also be indexed using - /// basic slicing or advanced indexing. - /// - /// Notes - /// - /// A flatiter iterator can not be constructed directly from Python code - /// by calling the flatiter constructor. - /// - public void flatiter() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("flatiter"); - } - - /// - /// Buffered iterator for big arrays. - /// - /// Arrayterator creates a buffered iterator for reading big arrays in small - /// contiguous blocks. The class is useful for objects stored in the - /// file system. It allows iteration over the object without reading - /// everything in memory; instead, small blocks are read and iterated over. - /// - /// Arrayterator can be used with any object that supports multidimensional - /// slices. This includes NumPy arrays, but also variables from - /// Scientific.IO.NetCDF or pynetcdf for example. - /// - /// Notes - /// - /// The algorithm works by first finding a “running dimension”, along which - /// the blocks will be extracted. Given an array of dimensions - /// (d1, d2, ..., dn), e.g. if buf_size is smaller than d1, the - /// first dimension will be used. If, on the other hand, - /// d1 < buf_size < d1*d2 the second dimension will be used, and so on. - /// Blocks are extracted along this dimension, and when the last block is - /// returned the process continues from the next dimension, until all - /// elements have been read. - /// - /// - /// The object to iterate over. - /// - /// - /// The buffer size. If buf_size is supplied, the maximum amount of - /// data that will be read into memory is buf_size elements. - /// Default is None, which will read as many element as possible - /// into memory. - /// - public void lib_Arrayterator(NDarray @var, int? buf_size = null) - { - //auto-generated code, do not change - var lib = self.GetAttr("lib"); - var __self__=lib; - var pyargs=ToTuple(new object[] - { - @var, - }); - var kwargs=new PyDict(); - if (buf_size!=null) kwargs["buf_size"]=ToPython(buf_size); - dynamic py = __self__.InvokeMethod("Arrayterator", pyargs, kwargs); - } - - } -} diff --git a/src/Numpy/NumPy.io.gen.cs b/src/Numpy/NumPy.io.gen.cs deleted file mode 100644 index 4b7629e..0000000 --- a/src/Numpy/NumPy.io.gen.cs +++ /dev/null @@ -1,1175 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Load arrays or pickled objects from .npy, .npz or pickled files. - /// - /// Notes - /// - /// - /// The file to read. File-like objects must support the - /// seek() and read() methods. Pickled files require that the - /// file-like object support the readline() method as well. - /// - /// - /// If not None, then memory-map the file, using the given mode (see - /// numpy.memmap for a detailed description of the modes). A - /// memory-mapped array is kept on disk. However, it can be accessed - /// and sliced like any ndarray. Memory mapping is especially useful - /// for accessing small fragments of large files without reading the - /// entire file into memory. - /// - /// - /// Allow loading pickled object arrays stored in npy files. Reasons for - /// disallowing pickles include security, as loading pickled data can - /// execute arbitrary code. If pickles are disallowed, loading object - /// arrays will fail. - /// Default: True - /// - /// - /// Only useful when loading Python 2 generated pickled files on Python 3, - /// which includes npy/npz files containing object arrays. If fix_imports - /// is True, pickle will try to map the old Python 2 names to the new names - /// used in Python 3. - /// - /// - /// What encoding to use when reading Python 2 strings. Only useful when - /// loading Python 2 generated pickled files in Python 3, which includes - /// npy/npz files containing object arrays. Values other than ‘latin1’, - /// ‘ASCII’, and ‘bytes’ are not allowed, as they can corrupt numerical - /// data. Default: ‘ASCII’ - /// - /// - /// Data stored in the file. For .npz files, the returned instance - /// of NpzFile class must be closed to avoid leaking file descriptors. - /// - public NDarray load(string file, MemMapMode mmap_mode = null, bool? allow_pickle = true, bool? fix_imports = true, string encoding = "ASCII") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - if (mmap_mode!=null) kwargs["mmap_mode"]=ToPython(mmap_mode); - if (allow_pickle!=true) kwargs["allow_pickle"]=ToPython(allow_pickle); - if (fix_imports!=true) kwargs["fix_imports"]=ToPython(fix_imports); - if (encoding!="ASCII") kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("load", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Save an array to a binary file in NumPy .npy format. - /// - /// Notes - /// - /// For a description of the .npy format, see numpy.lib.format. - /// - /// - /// File or filename to which the data is saved. If file is a file-object, - /// then the filename is unchanged. If file is a string or Path, a .npy - /// extension will be appended to the file name if it does not already - /// have one. - /// - /// - /// Array data to be saved. - /// - /// - /// Allow saving object arrays using Python pickles. Reasons for disallowing - /// pickles include security (loading pickled data can execute arbitrary - /// code) and portability (pickled objects may not be loadable on different - /// Python installations, for example if the stored objects require libraries - /// that are not available, and not all pickled data is compatible between - /// Python 2 and Python 3). - /// Default: True - /// - /// - /// Only useful in forcing objects in object arrays on Python 3 to be - /// pickled in a Python 2 compatible way. If fix_imports is True, pickle - /// will try to map the new Python 3 names to the old module names used in - /// Python 2, so that the pickle data stream is readable with Python 2. - /// - public void save(string file, NDarray arr, bool? allow_pickle = true, bool? fix_imports = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - arr, - }); - var kwargs=new PyDict(); - if (allow_pickle!=true) kwargs["allow_pickle"]=ToPython(allow_pickle); - if (fix_imports!=true) kwargs["fix_imports"]=ToPython(fix_imports); - dynamic py = __self__.InvokeMethod("save", pyargs, kwargs); - } - - /// - /// Save several arrays into a single file in uncompressed .npz format. - /// - /// If arguments are passed in with no keywords, the corresponding variable - /// names, in the .npz file, are ‘arr_0’, ‘arr_1’, etc. If keyword - /// arguments are given, the corresponding variable names, in the .npz - /// file will match the keyword names. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is not compressed and each file - /// in the archive contains one variable in .npy format. For a - /// description of the .npy format, see numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public void savez(string file, NDarray[] args = null, Dictionary kwds = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - if (args!=null) kwargs["args"]=ToPython(args); - if (kwds!=null) kwargs["kwds"]=ToPython(kwds); - dynamic py = __self__.InvokeMethod("savez", pyargs, kwargs); - } - - /// - /// Save several arrays into a single file in compressed .npz format. - /// - /// If keyword arguments are given, then filenames are taken from the keywords. - /// If arguments are passed in with no keywords, then stored file names are - /// arr_0, arr_1, etc. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is compressed with - /// zipfile.ZIP_DEFLATED and each file in the archive contains one variable - /// in .npy format. For a description of the .npy format, see - /// numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public void savez_compressed(string file, NDarray[] args = null, Dictionary kwds = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - }); - var kwargs=new PyDict(); - if (args!=null) kwargs["args"]=ToPython(args); - if (kwds!=null) kwargs["kwds"]=ToPython(kwds); - dynamic py = __self__.InvokeMethod("savez_compressed", pyargs, kwargs); - } - - /// - /// Save an array to a text file. - /// - /// Notes - /// - /// Further explanation of the fmt parameter - /// (%[flag]width[.precision]specifier): - /// - /// This explanation of fmt is not complete, for an exhaustive - /// specification see [1]. - /// - /// References - /// - /// - /// If the filename ends in .gz, the file is automatically saved in - /// compressed gzip format. loadtxt understands gzipped files - /// transparently. - /// - /// - /// Data to be saved to a text file. - /// - /// - /// A single format (%10.5f), a sequence of formats, or a - /// multi-format string, e.g. ‘Iteration %d – %10.5f’, in which - /// case delimiter is ignored. For complex X, the legal options - /// for fmt are: - /// - /// - /// String or character separating columns. - /// - /// - /// String or character separating lines. - /// - /// - /// String that will be written at the beginning of the file. - /// - /// - /// String that will be written at the end of the file. - /// - /// - /// String that will be prepended to the header and footer strings, - /// to mark them as comments. Default: ‘# ‘, as expected by e.g. - /// numpy.loadtxt. - /// - /// - /// Encoding used to encode the outputfile. Does not apply to output - /// streams. If the encoding is something other than ‘bytes’ or ‘latin1’ - /// you will not be able to load the file in NumPy versions < 1.14. Default - /// is ‘latin1’. - /// - public void savetxt(string fname, NDarray X, string[] fmt = null, string delimiter = " ", string newline = "\n", string header = "", string footer = "", string comments = null, string encoding = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fname, - X, - }); - var kwargs=new PyDict(); - if (fmt!=null) kwargs["fmt"]=ToPython(fmt); - if (delimiter!=" ") kwargs["delimiter"]=ToPython(delimiter); - if (newline!="\n") kwargs["newline"]=ToPython(newline); - if (header!="") kwargs["header"]=ToPython(header); - if (footer!="") kwargs["footer"]=ToPython(footer); - if (comments!=null) kwargs["comments"]=ToPython(comments); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("savetxt", pyargs, kwargs); - } - - /* - /// - /// Load data from a text file, with missing values handled as specified. - /// - /// Each line past the first skip_header lines is split at the delimiter - /// character, and characters following the comments character are discarded. - /// - /// Notes - /// - /// References - /// - /// - /// File, filename, list, or generator to read. If the filename - /// extension is gz or bz2, the file is first decompressed. Note - /// that generators must return byte strings in Python 3k. The strings - /// in a list or produced by a generator are treated as lines. - /// - /// - /// Data type of the resulting array. - /// If None, the dtypes will be determined by the contents of each - /// column, individually. - /// - /// - /// The character used to indicate the start of a comment. - /// All the characters occurring on a line after a comment are discarded - /// - /// - /// The string used to separate values. By default, any consecutive - /// whitespaces act as delimiter. An integer or sequence of integers - /// can also be provided as width(s) of each field. - /// - /// - /// skiprows was removed in numpy 1.10. Please use skip_header instead. - /// - /// - /// The number of lines to skip at the beginning of the file. - /// - /// - /// The number of lines to skip at the end of the file. - /// - /// - /// The set of functions that convert the data of a column to a value. - /// The converters can also be used to provide a default value - /// for missing data: converters = {3: lambda s: float(s or 0)}. - /// - /// - /// missing was removed in numpy 1.10. Please use missing_values - /// instead. - /// - /// - /// The set of strings corresponding to missing data. - /// - /// - /// The set of values to be used as default when the data are missing. - /// - /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1, 4, 5) will extract the 2nd, 5th and 6th columns. - /// - /// - /// If names is True, the field names are read from the first line after - /// the first skip_header lines. This line can optionally be proceeded - /// by a comment delimiter. If names is a sequence or a single-string of - /// comma-separated names, the names will be used to define the field names - /// in a structured dtype. If names is None, the names of the dtype - /// fields will be used, if any. - /// - /// - /// A list of names to exclude. This list is appended to the default list - /// [‘return’,’file’,’print’]. Excluded names are appended an underscore: - /// for example, file would become file_. - /// - /// - /// A string combining invalid characters that must be deleted from the - /// names. - /// - /// - /// A format used to define default field names, such as “f%i” or “f_%02i”. - /// - /// - /// Whether to automatically strip white spaces from the variables. - /// - /// - /// Character(s) used in replacement of white spaces in the variables - /// names. By default, use a ‘_’. - /// - /// - /// If True, field names are case sensitive. - /// If False or ‘upper’, field names are converted to upper case. - /// If ‘lower’, field names are converted to lower case. - /// - /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...) - /// - /// - /// If True, return a masked array. - /// If False, return a regular array. - /// - /// - /// If True, do not raise errors for invalid values. - /// - /// - /// If True, an exception is raised if an inconsistency is detected in the - /// number of columns. - /// If False, a warning is emitted and the offending lines are skipped. - /// - /// - /// The maximum number of rows to read. Must not be used with skip_footer - /// at the same time. If given, the value must be at least 1. Default is - /// to read the entire file. - /// - /// - /// Encoding used to decode the inputfile. Does not apply when fname is - /// a file object. The special value ‘bytes’ enables backward compatibility - /// workarounds that ensure that you receive byte arrays when possible - /// and passes latin1 encoded strings to converters. Override this value to - /// receive unicode arrays and pass strings as input to converters. If set - /// to None the system default is used. The default value is ‘bytes’. - /// - /// - /// Data read from the text file. If usemask is True, this is a - /// masked array. - /// - public NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, char replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fname, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (comments!=null) kwargs["comments"]=ToPython(comments); - if (delimiter!=null) kwargs["delimiter"]=ToPython(delimiter); - if (skiprows!=null) kwargs["skiprows"]=ToPython(skiprows); - if (skip_header!=0) kwargs["skip_header"]=ToPython(skip_header); - if (skip_footer!=0) kwargs["skip_footer"]=ToPython(skip_footer); - if (converters!=null) kwargs["converters"]=ToPython(converters); - if (missing!=null) kwargs["missing"]=ToPython(missing); - if (missing_values!=null) kwargs["missing_values"]=ToPython(missing_values); - if (filling_values!=null) kwargs["filling_values"]=ToPython(filling_values); - if (usecols!=null) kwargs["usecols"]=ToPython(usecols); - if (names!=null) kwargs["names"]=ToPython(names); - if (excludelist!=null) kwargs["excludelist"]=ToPython(excludelist); - if (deletechars!=null) kwargs["deletechars"]=ToPython(deletechars); - if (defaultfmt!="f%i") kwargs["defaultfmt"]=ToPython(defaultfmt); - if (autostrip!=false) kwargs["autostrip"]=ToPython(autostrip); - if (replace_space!="_") kwargs["replace_space"]=ToPython(replace_space); - if (case_sensitive!=true) kwargs["case_sensitive"]=ToPython(case_sensitive); - if (unpack!=null) kwargs["unpack"]=ToPython(unpack); - if (usemask!=false) kwargs["usemask"]=ToPython(usemask); - if (loose!=true) kwargs["loose"]=ToPython(loose); - if (invalid_raise!=true) kwargs["invalid_raise"]=ToPython(invalid_raise); - if (max_rows!=null) kwargs["max_rows"]=ToPython(max_rows); - if (encoding!="bytes") kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("genfromtxt", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Construct an array from a text file, using regular expression parsing. - /// - /// The returned array is always a structured array, and is constructed from - /// all matches of the regular expression in the file. Groups in the regular - /// expression are converted to fields of the structured array. - /// - /// Notes - /// - /// Dtypes for structured arrays can be specified in several forms, but all - /// forms specify at least the data type and field name. For details see - /// doc.structured_arrays. - /// - /// - /// File name or file object to read. - /// - /// - /// Regular expression used to parse the file. - /// Groups in the regular expression correspond to fields in the dtype. - /// - /// - /// Dtype for the structured array. - /// - /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// - /// - /// The output array, containing the part of the content of file that - /// was matched by regexp. output is always a structured array. - /// - public NDarray fromregex(string file, string regexp, Dtype dtype, string encoding = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - file, - regexp, - dtype, - }); - var kwargs=new PyDict(); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - dynamic py = __self__.InvokeMethod("fromregex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Write array to a file as text or binary (default). - /// - /// Data is always written in ‘C’ order, independent of the order of a. - /// The data produced by this method can be recovered using the function - /// fromfile(). - /// - /// Notes - /// - /// This is a convenience function for quick storage of array data. - /// Information on endianness and precision is lost, so this method is not a - /// good choice for files intended to archive data or transport data between - /// machines with different endianness. Some of these problems can be overcome - /// by outputting the data as text files, at the expense of speed and file - /// size. - /// - /// When fid is a file object, array contents are directly written to the - /// file, bypassing the file object’s write method. As a result, tofile - /// cannot be used with files objects supporting compression (e.g., GzipFile) - /// or file-like objects that do not support fileno() (e.g., BytesIO). - /// - /// - /// An open file object, or a string containing a filename. - /// - /// - /// Separator between array items for text output. - /// If “” (empty), a binary file is written, equivalent to - /// file.write(a.tobytes()). - /// - /// - /// Format string for text file output. - /// Each entry in the array is formatted to text by first converting - /// it to the closest Python type, and then using “format” % item. - /// - public void tofile(string fid, string sep, string format) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - fid, - sep, - format, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tofile", pyargs, kwargs); - } - - /* - /// - /// Return the array as a (possibly nested) list. - /// - /// Return a copy of the array data as a (nested) Python list. - /// Data items are converted to the nearest compatible Python type. - /// - /// Notes - /// - /// The array may be recreated, a = np.array(a.tolist()). - /// - /// - /// The possibly nested list of array elements. - /// - public List tolist() - { - //auto-generated code, do not change - var __self__=self; - dynamic py = __self__.InvokeMethod("tolist"); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input 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(NDarray arr, 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[] - { - arr, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, 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[] - { - a, - }); - 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); - } - - /* - /// - /// Format a floating-point scalar as a decimal string in positional notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. - /// - /// - /// Value to format. - /// - /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. - /// - /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print out all necessary digits, otherwise digit generation - /// is cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. - /// - /// - /// If True, the cutoff of precision digits refers to the total number - /// of digits after the decimal point, including leading zeros. - /// If False, precision refers to the total number of significant - /// digits, before or after the decimal point, ignoring leading zeros. - /// - /// - /// Controls post-processing trimming of trailing digits, as follows: - /// - /// - /// Whether to show the sign for positive values. - /// - /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. - /// - /// - /// Pad the right side of the string with whitespace until at least that - /// many characters are to the right of the decimal point. - /// - /// - /// The string representation of the floating point value - /// - public string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (unique!=true) kwargs["unique"]=ToPython(unique); - if (fractional!=true) kwargs["fractional"]=ToPython(fractional); - if (trim!="k") kwargs["trim"]=ToPython(trim); - if (sign!=false) kwargs["sign"]=ToPython(sign); - if (pad_left!=null) kwargs["pad_left"]=ToPython(pad_left); - if (pad_right!=null) kwargs["pad_right"]=ToPython(pad_right); - dynamic py = __self__.InvokeMethod("format_float_positional", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Format a floating-point scalar as a decimal string in scientific notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. - /// - /// - /// Value to format. - /// - /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. - /// - /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print all necessary digits, otherwise digit generation is - /// cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. - /// - /// - /// Controls post-processing trimming of trailing digits, as follows: - /// - /// - /// Whether to show the sign for positive values. - /// - /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. - /// - /// - /// Pad the exponent with zeros until it contains at least this many digits. - /// If omitted, the exponent will be at least 2 digits. - /// - /// - /// The string representation of the floating point value - /// - public string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (precision!=null) kwargs["precision"]=ToPython(precision); - if (unique!=true) kwargs["unique"]=ToPython(unique); - if (trim!="k") kwargs["trim"]=ToPython(trim); - if (sign!=false) kwargs["sign"]=ToPython(sign); - if (pad_left!=null) kwargs["pad_left"]=ToPython(pad_left); - if (exp_digits!=null) kwargs["exp_digits"]=ToPython(exp_digits); - dynamic py = __self__.InvokeMethod("format_float_scientific", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /// - /// Create a memory-map to an array stored in a binary file on disk. - /// - /// Memory-mapped files are used for accessing small segments of large files - /// on disk, without reading the entire file into memory. NumPy’s - /// memmap’s are array-like objects. This differs from Python’s mmap - /// module, which uses file-like objects. - /// - /// This subclass of ndarray has some unpleasant interactions with - /// some operations, because it doesn’t quite fit properly as a subclass. - /// An alternative to using this subclass is to create the mmap - /// object yourself, then create an ndarray with ndarray.__new__ directly, - /// passing the object created in its ‘buffer=’ parameter. - /// - /// This class may at some point be turned into a factory function - /// which returns a view into an mmap buffer. - /// - /// Delete the memmap instance to close the memmap file. - /// - /// Notes - /// - /// The memmap object can be used anywhere an ndarray is accepted. - /// Given a memmap fp, isinstance(fp, numpy.ndarray) returns - /// True. - /// - /// Memory-mapped files cannot be larger than 2GB on 32-bit systems. - /// - /// When a memmap causes a file to be created or extended beyond its - /// current size in the filesystem, the contents of the new part are - /// unspecified. On systems with POSIX filesystem semantics, the extended - /// part will be filled with zero bytes. - /// - /// - /// The file name or file object to be used as the array data buffer. - /// - /// - /// The data-type used to interpret the file contents. - /// Default is uint8. - /// - /// - /// The file is opened in this mode: - /// - /// Default is ‘r+’. - /// - /// - /// In the file, array data starts at this offset. Since offset is - /// measured in bytes, it should normally be a multiple of the byte-size - /// of dtype. When mode != 'r', even positive offsets beyond end of - /// file are valid; The file will be extended to accommodate the - /// additional data. By default, memmap will start at the beginning of - /// the file, even if filename is a file pointer fp and - /// fp.tell() != 0. - /// - /// - /// The desired shape of the array. If mode == 'r' and the number - /// of remaining bytes after offset is not a multiple of the byte-size - /// of dtype, you must specify shape. By default, the returned array - /// will be 1-D with the number of elements determined by file size - /// and data-type. - /// - /// - /// Specify the order of the ndarray memory layout: - /// row-major, C-style or column-major, - /// Fortran-style. This only has an effect if the shape is - /// greater than 1-D. The default order is ‘C’. - /// - public void memmap(string filename, Dtype dtype = null, string mode = null, int? offset = null, Shape shape = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - filename, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (mode!=null) kwargs["mode"]=ToPython(mode); - if (offset!=null) kwargs["offset"]=ToPython(offset); - if (shape!=null) kwargs["shape"]=ToPython(shape); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("memmap", pyargs, kwargs); - } - - /* - /// - /// Set printing options. - /// - /// These options determine the way floating point numbers, arrays and - /// other NumPy objects are displayed. - /// - /// Notes - /// - /// formatter is always reset with a call to set_printoptions. - /// - /// - /// Number of digits of precision for floating point output (default 8). - /// May be None if floatmode is not fixed, to print as many digits as - /// necessary to uniquely specify the value. - /// - /// - /// Total number of array elements which trigger summarization - /// rather than full repr (default 1000). - /// - /// - /// Number of array items in summary at beginning and end of - /// each dimension (default 3). - /// - /// - /// The number of characters per line for the purpose of inserting - /// line breaks (default 75). - /// - /// - /// If True, always print floating point numbers using fixed point - /// notation, in which case numbers equal to zero in the current precision - /// will print as zero. If False, then scientific notation is used when - /// absolute value of the smallest number is < 1e-4 or the ratio of the - /// maximum absolute value to the minimum is > 1e3. The default is False. - /// - /// - /// String representation of floating point not-a-number (default nan). - /// - /// - /// String representation of floating point infinity (default inf). - /// - /// - /// 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. (default ‘-‘) - /// - /// - /// 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: - /// - /// - /// 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. - /// - public void set_printoptions(int? precision = null, int? threshold = null, int? edgeitems = null, int? linewidth = null, bool? suppress = null, string nanstr = null, string infstr = null, string sign = null, dict of callables formatter = 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 (precision!=null) kwargs["precision"]=ToPython(precision); - if (threshold!=null) kwargs["threshold"]=ToPython(threshold); - if (edgeitems!=null) kwargs["edgeitems"]=ToPython(edgeitems); - if (linewidth!=null) kwargs["linewidth"]=ToPython(linewidth); - if (suppress!=null) kwargs["suppress"]=ToPython(suppress); - if (nanstr!=null) kwargs["nanstr"]=ToPython(nanstr); - if (infstr!=null) kwargs["infstr"]=ToPython(infstr); - if (sign!=null) kwargs["sign"]=ToPython(sign); - if (formatter!=null) kwargs["formatter"]=ToPython(formatter); - if (floatmode!=null) kwargs["floatmode"]=ToPython(floatmode); - if (legacy!=null) kwargs["legacy"]=ToPython(legacy); - dynamic py = __self__.InvokeMethod("set_printoptions", pyargs, kwargs); - } - */ - - /// - /// Return the current print options. - /// - /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. - /// - /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. - /// - public Hashtable get_printoptions(Hashtable print_opts) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - print_opts, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("get_printoptions", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// Set a Python function to be used when pretty printing arrays. - /// - /// - /// Function to be used to pretty print arrays. The function should expect - /// a single array argument and return a string of the representation of - /// the array. If None, the function is reset to the default NumPy function - /// to print arrays. - /// - /// - /// If True (default), the function for pretty printing (__repr__) - /// is set, if False the function that returns the default string - /// representation (__str__) is set. - /// - public void set_string_function(function or None f, bool? repr = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - f, - }); - var kwargs=new PyDict(); - if (repr!=true) kwargs["repr"]=ToPython(repr); - dynamic py = __self__.InvokeMethod("set_string_function", pyargs, kwargs); - } - */ - - /// - /// Return a string representation of a number in the given base system. - /// - /// - /// The value to convert. Positive and negative values are handled. - /// - /// - /// Convert number to the base number system. The valid range is 2-36, - /// the default value is 2. - /// - /// - /// Number of zeros padded on the left. Default is 0 (no padding). - /// - /// - /// String representation of number in base system. - /// - public string base_repr(int number, int? @base = 2, int? padding = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - number, - }); - var kwargs=new PyDict(); - if (@base!=2) kwargs["base"]=ToPython(@base); - if (padding!=0) kwargs["padding"]=ToPython(padding); - dynamic py = __self__.InvokeMethod("base_repr", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// A generic data source file (file, http, ftp, …). - /// - /// DataSources can be local files or remote files/URLs. The files may - /// also be compressed or uncompressed. DataSource hides some of the - /// low-level details of downloading the file, allowing you to simply pass - /// in a valid file path (or URL) and obtain a file object. - /// - /// Notes - /// - /// URLs require a scheme string (http://) to be used, without it they - /// will fail: - /// - /// Temporary directories are deleted when the DataSource is deleted. - /// - /// - /// Path to the directory where the source file gets downloaded to for - /// use. If destpath is None, a temporary directory will be created. - /// The default path is the current directory. - /// - public void DataSource(string destpath = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (destpath!=null) kwargs["destpath"]=ToPython(destpath); - dynamic py = __self__.InvokeMethod("DataSource", pyargs, kwargs); - } - - } -} diff --git a/src/Numpy/NumPy.linalg.gen.cs b/src/Numpy/NumPy.linalg.gen.cs deleted file mode 100644 index 969f894..0000000 --- a/src/Numpy/NumPy.linalg.gen.cs +++ /dev/null @@ -1,964 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Dot product of two arrays. Specifically, - /// - /// - /// First argument. - /// - /// - /// 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 a, NDarray b, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("dot", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the dot product of two or more arrays in a single function call, - /// while automatically selecting the fastest evaluation order. - /// - /// multi_dot chains numpy.dot and uses optimal parenthesization - /// of the matrices [1] [2]. Depending on the shapes of the matrices, - /// this can speed up the multiplication a lot. - /// - /// If the first argument is 1-D it is treated as a row vector. - /// If the last argument is 1-D it is treated as a column vector. - /// The other arguments must be 2-D. - /// - /// Think of multi_dot as: - /// - /// Notes - /// - /// The cost for a matrix multiplication can be calculated with the - /// following function: - /// - /// Let’s assume we have three matrices - /// . - /// - /// The costs for the two different parenthesizations are as follows: - /// - /// References - /// - /// - /// If the first argument is 1-D it is treated as row vector. - /// If the last argument is 1-D it is treated as column vector. - /// The other arguments must be 2-D. - /// - /// - /// Returns the dot product of the supplied arrays. - /// - public NDarray linalg_multi_dot(NDarray[] arrays) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - arrays, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("multi_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. - /// - /// - /// If a is complex the complex conjugate is taken before calculation - /// of the dot product. - /// - /// - /// 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 a, NDarray b) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// If a and b are nonscalar, their last dimensions must match. - /// - /// - /// out.shape = a.shape[:-1] + b.shape[:-1] - /// - public NDarray inner(NDarray b, NDarray a) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - 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 - /// - /// - /// First input vector. Input is flattened if - /// not already 1-dimensional. - /// - /// - /// 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 a, NDarray b, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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”. - /// - /// - /// Tensors to “dot”. - /// - public NDarray tensordot(NDarray b, NDarray a, int[] axes = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - a, - axes, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("tensordot", 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 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, - operands, - }); - 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 lowest cost contraction order for an einsum expression by - /// considering the creation of intermediate arrays. - /// - /// Notes - /// - /// The resulting path indicates which terms of the input contraction should be - /// contracted first, the result of this contraction is then appended to the - /// end of the contraction list. This list can then be iterated over until all - /// intermediate contractions are complete. - /// - /// - /// Specifies the subscripts for summation. - /// - /// - /// These are the arrays for the operation. - /// - /// - /// Choose the type of path. If a tuple is provided, the second argument is - /// assumed to be the maximum intermediate size created. If only a single - /// argument is provided the largest input or output array size is used - /// as a maximum intermediate size. - /// - /// Default is ‘greedy’. - /// - /// - /// A tuple of: - /// path - /// A list representation of the einsum path. - /// string_repr - /// A printable representation of the einsum path. - /// - public (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, {bool optimize = "greedy") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - subscripts, - operands, - optimize, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("einsum_path", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - */ - - /// - /// Raise a square matrix to the (integer) power n. - /// - /// For positive integers n, the power is computed by repeated matrix - /// squarings and matrix multiplications. If n == 0, the identity matrix - /// of the same shape as M is returned. If n < 0, the inverse - /// is computed and then raised to the abs(n). - /// - /// - /// Matrix to be “powered.” - /// - /// - /// The exponent can be any integer or long integer, positive, - /// negative, or zero. - /// - /// - /// The return value is the same shape and type as M; - /// if the exponent is positive or zero then the type of the - /// elements is the same as those of M. If the exponent is - /// negative the elements are floating-point. - /// - public NDarray linalg_matrix_power(NDarray a, int n) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - n, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("matrix_power", 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 b, NDarray a) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - b, - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("kron", 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 (NDarray, NDarray, NDarray) linalg_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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /* - /// - /// Compute the condition number of a matrix. - /// - /// This function is capable of returning the condition number using - /// one of seven different norms, depending on the value of p (see - /// Parameters below). - /// - /// Notes - /// - /// The condition number of x is defined as the norm of x times the - /// norm of the inverse of x [1]; the norm can be the usual L2-norm - /// (root-of-sum-of-squares) or one of a number of other matrix norms. - /// - /// References - /// - /// - /// The matrix whose condition number is sought. - /// - /// - /// Order of the norm: - /// - /// inf means the numpy.inf object, and the Frobenius norm is - /// the root-of-sum-of-squares norm. - /// - /// - /// The condition number of the matrix. May be infinite. - /// - public {float linalg_cond(NDarray x, {None p = null) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (p!=null) kwargs["p"]=ToPython(p); - dynamic py = __self__.InvokeMethod("cond", pyargs, kwargs); - return ToCsharp<{float>(py); - } - */ - - /// - /// Return matrix rank of array using SVD method - /// - /// Rank of the array is the number of singular values of the array that are - /// greater than tol. - /// - /// Notes - /// - /// The default threshold to detect rank deficiency is a test on the magnitude - /// of the singular values of M. By default, we identify singular values less - /// than S.max() * max(M.shape) * eps as indicating rank deficiency (with - /// the symbols defined above). This is the algorithm MATLAB uses [1]. It also - /// appears in Numerical recipes in the discussion of SVD solutions for linear - /// least squares [2]. - /// - /// This default threshold is designed to detect rank deficiency accounting for - /// the numerical errors of the SVD computation. Imagine that there is a column - /// in M that is an exact (in floating point) linear combination of other - /// columns in M. Computing the SVD on M will not produce a singular value - /// exactly equal to 0 in general: any difference of the smallest SVD value from - /// 0 will be caused by numerical imprecision in the calculation of the SVD. - /// Our threshold for small SVD values takes this numerical imprecision into - /// account, and the default threshold will detect such numerical rank - /// deficiency. The threshold may declare a matrix M rank deficient even if - /// the linear combination of some columns of M is not exactly equal to - /// another column of M but only numerically very close to another column of - /// M. - /// - /// We chose our default threshold because it is in wide use. Other thresholds - /// are possible. For example, elsewhere in the 2007 edition of Numerical - /// recipes there is an alternative threshold of S.max() * - /// np.finfo(M.dtype).eps / 2. * np.sqrt(m + n + 1.). The authors describe - /// this threshold as being based on “expected roundoff error” (p 71). - /// - /// The thresholds above deal with floating point roundoff error in the - /// calculation of the SVD. However, you may have more information about the - /// sources of error in M that would make you consider other tolerance values - /// to detect effective rank deficiency. The most useful measure of the - /// tolerance depends on the operations you intend to use on your matrix. For - /// example, if your data come from uncertain measurements with uncertainties - /// greater than floating point epsilon, choosing a tolerance near that - /// uncertainty may be preferable. The tolerance may be absolute if the - /// uncertainties are absolute rather than relative. - /// - /// References - /// - /// - /// input vector or stack of matrices - /// - /// - /// threshold below which SVD values are considered zero. If tol is - /// None, and S is an array with singular values for M, and - /// eps is the epsilon value for datatype of S, then tol is - /// set to S.max() * max(M.shape) * eps. - /// - /// - /// If True, M is assumed to be Hermitian (symmetric if real-valued), - /// enabling a more efficient method for finding singular values. - /// Defaults to False. - /// - public int linalg_matrix_rank(NDarray M, NDarray tol = null, bool? hermitian = false) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - if (tol!=null) kwargs["tol"]=ToPython(tol); - if (hermitian!=false) kwargs["hermitian"]=ToPython(hermitian); - dynamic py = __self__.InvokeMethod("matrix_rank", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the sign and (natural) logarithm of the determinant of an array. - /// - /// If an array has a very small or very large determinant, then a call to - /// det may overflow or underflow. This routine is more robust against such - /// issues, because it computes the logarithm of the determinant rather than - /// the determinant itself. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. - /// - /// - /// Input array, has to be a square 2-D array. - /// - /// - /// A tuple of: - /// sign - /// A number representing the sign of the determinant. For a real matrix, - /// this is 1, 0, or -1. For a complex matrix, this is a complex number - /// with absolute value 1 (i.e., it is on the unit circle), or else 0. - /// logdet - /// The natural log of the absolute value of the determinant. - /// - public (NDarray, NDarray) linalg_slogdet(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("slogdet", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// 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. - /// - /// - /// Input array, from which the diagonals are taken. - /// - /// - /// 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(NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - } - - /// - /// Solve the tensor equation a x = b for x. - /// - /// It is assumed that all indices of x are summed over in the product, - /// together with the rightmost indices of a, as is done in, for example, - /// tensordot(a, x, axes=b.ndim). - /// - /// - /// Coefficient tensor, of shape b.shape + Q. Q, a tuple, equals - /// the shape of that sub-tensor of a consisting of the appropriate - /// number of its rightmost indices, and must be such that - /// prod(Q) == prod(b.shape) (in which sense a is said to be - /// ‘square’). - /// - /// - /// Right-hand tensor, which can be of any shape. - /// - /// - /// Axes in a to reorder to the right, before inversion. - /// If None (default), no reordering is done. - /// - public NDarray linalg_tensorsolve(NDarray a, NDarray b, int[] axes = null) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (axes!=null) kwargs["axes"]=ToPython(axes); - dynamic py = __self__.InvokeMethod("tensorsolve", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the ‘inverse’ of an N-dimensional array. - /// - /// The result is an inverse for a relative to the tensordot operation - /// tensordot(a, b, ind), i. e., up to floating-point accuracy, - /// tensordot(tensorinv(a), a, ind) is the “identity” tensor for the - /// tensordot operation. - /// - /// - /// Tensor to ‘invert’. Its shape must be ‘square’, i. e., - /// prod(a.shape[:ind]) == prod(a.shape[ind:]). - /// - /// - /// Number of first indices that are involved in the inverse sum. - /// Must be a positive integer, default is 2. - /// - /// - /// a’s tensordot inverse, shape a.shape[ind:] + a.shape[:ind]. - /// - public NDarray linalg_tensorinv(NDarray a, int? ind = 2) - { - //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 (ind!=2) kwargs["ind"]=ToPython(ind); - dynamic py = __self__.InvokeMethod("tensorinv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Generic Python-exception-derived object raised by linalg functions. - /// - /// General purpose exception class, derived from Python’s exception.Exception - /// class, programmatically raised in linalg functions when a Linear - /// Algebra-related condition would prevent further correct execution of the - /// function. - /// - public void linalg_LinAlgError() - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - dynamic py = __self__.InvokeMethod("LinAlgError"); - } - - } -} diff --git a/src/Numpy/NumPy.linalg_fft.gen.cs b/src/Numpy/NumPy.linalg_fft.gen.cs deleted file mode 100644 index 939b97d..0000000 --- a/src/Numpy/NumPy.linalg_fft.gen.cs +++ /dev/null @@ -1,989 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Cholesky decomposition. - /// - /// Return the Cholesky decomposition, L * L.H, of the square matrix a, - /// where L is lower-triangular and .H is the conjugate transpose operator - /// (which is the ordinary transpose if a is real-valued). a must be - /// Hermitian (symmetric if real-valued) and positive-definite. Only L is - /// actually returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The Cholesky decomposition is often used as a fast way of solving - /// - /// (when A is both Hermitian/symmetric and positive-definite). - /// - /// First, we solve for in - /// - /// and then for in - /// - /// - /// Hermitian (symmetric if all elements are real), positive-definite - /// input matrix. - /// - /// - /// Upper or lower-triangular Cholesky factor of a. Returns a - /// matrix object if a is a matrix object. - /// - public NDarray linalg_cholesky(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("cholesky", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the determinant of an array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. - /// - /// - /// Input array to compute determinants for. - /// - /// - /// Determinant of a. - /// - public NDarray linalg_det(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("det", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the eigenvalues and right eigenvectors of a square array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// The number w is an eigenvalue of a if there exists a vector - /// v such that dot(a,v) = w * v. Thus, the arrays a, w, and - /// v satisfy the equations dot(a[:,:], v[:,i]) = w[i] * v[:,i] - /// for . - /// - /// The array v of eigenvectors may not be of maximum rank, that is, some - /// of the columns may be linearly dependent, although round-off error may - /// obscure that fact. If the eigenvalues are all different, then theoretically - /// the eigenvectors are linearly independent. Likewise, the (complex-valued) - /// matrix of eigenvectors v is unitary if the matrix a is normal, i.e., - /// if dot(a, a.H) = dot(a.H, a), where a.H denotes the conjugate - /// transpose of a. - /// - /// Finally, it is emphasized that v consists of the right (as in - /// right-hand side) eigenvectors of a. A vector y satisfying - /// dot(y.T, a) = z * y.T for some number z is called a left - /// eigenvector of a, and, in general, the left and right eigenvectors - /// of a matrix are not necessarily the (perhaps conjugate) transposes - /// of each other. - /// - /// References - /// - /// G. Strang, Linear Algebra and Its Applications, 2nd Ed., Orlando, FL, - /// Academic Press, Inc., 1980, Various pp. - /// - /// - /// Matrices for which the eigenvalues and right eigenvectors will - /// be computed - /// - /// - /// A tuple of: - /// w - /// The eigenvalues, each repeated according to its multiplicity. - /// The eigenvalues are not necessarily ordered. The resulting - /// array will be of complex type, unless the imaginary part is - /// zero in which case it will be cast to a real type. When a - /// is real the resulting eigenvalues will be real (0 imaginary - /// part) or occur in conjugate pairs - /// v - /// The normalized (unit “length”) eigenvectors, such that the - /// column v[:,i] is the eigenvector corresponding to the - /// eigenvalue w[i]. - /// - public (NDarray, NDarray) linalg_eig(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("eig", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Return the eigenvalues and eigenvectors of a complex Hermitian - /// (conjugate symmetric) or a real symmetric matrix. - /// - /// Returns two objects, a 1-D array containing the eigenvalues of a, and - /// a 2-D square array or matrix (depending on the input type) of the - /// corresponding eigenvectors (in columns). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues/eigenvectors are computed using LAPACK routines _syevd, - /// _heevd - /// - /// The eigenvalues of real symmetric or complex Hermitian matrices are - /// always real. [1] The array v of (column) eigenvectors is unitary - /// and a, w, and v satisfy the equations - /// dot(a, v[:, i]) = w[i] * v[:, i]. - /// - /// References - /// - /// - /// Hermitian or real symmetric matrices whose eigenvalues and - /// eigenvectors are to be computed. - /// - /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. - /// - /// - /// A tuple of: - /// w - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. - /// v - /// The column v[:, i] is the normalized eigenvector corresponding - /// to the eigenvalue w[i]. Will return a matrix object if a is - /// a matrix object. - /// - public (NDarray, NDarray) linalg_eigh(NDarray a, string UPLO = "L") - { - //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 (UPLO!="L") kwargs["UPLO"]=ToPython(UPLO); - dynamic py = __self__.InvokeMethod("eigh", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the eigenvalues of a general matrix. - /// - /// Main difference between eigvals and eig: the eigenvectors aren’t - /// returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// - /// A complex- or real-valued matrix whose eigenvalues will be computed. - /// - /// - /// The eigenvalues, each repeated according to its multiplicity. - /// They are not necessarily ordered, nor are they necessarily - /// real for real matrices. - /// - public NDarray linalg_eigvals(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("eigvals", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the eigenvalues of a complex Hermitian or real symmetric matrix. - /// - /// Main difference from eigh: the eigenvectors are not computed. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues are computed using LAPACK routines _syevd, _heevd - /// - /// - /// A complex- or real-valued matrix whose eigenvalues are to be - /// computed. - /// - /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. - /// - /// - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. - /// - public NDarray linalg_eigvalsh(NDarray a, string UPLO = "L") - { - //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 (UPLO!="L") kwargs["UPLO"]=ToPython(UPLO); - dynamic py = __self__.InvokeMethod("eigvalsh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the (multiplicative) inverse of a matrix. - /// - /// Given a square matrix a, return the matrix ainv satisfying - /// dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// - /// Matrix to be inverted. - /// - /// - /// (Multiplicative) inverse of the matrix a. - /// - public NDarray linalg_inv(NDarray a) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("inv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the least-squares solution to a linear matrix equation. - /// - /// Solves the equation a x = b by computing a vector x that - /// minimizes the Euclidean 2-norm || b - a x ||^2. The equation may - /// be under-, well-, or over- determined (i.e., the number of - /// linearly independent rows of a can be less than, equal to, or - /// greater than its number of linearly independent columns). If a - /// is square and of full rank, then x (but for round-off error) is - /// the “exact” solution of the equation. - /// - /// Notes - /// - /// If b is a matrix, then all array results are returned as matrices. - /// - /// - /// “Coefficient” matrix. - /// - /// - /// Ordinate or “dependent variable” values. If b is two-dimensional, - /// the least-squares solution is calculated for each of the K columns - /// of b. - /// - /// - /// Cut-off ratio for small singular values of a. - /// For the purposes of rank determination, singular values are treated - /// as zero if they are smaller than rcond times the largest singular - /// value of a. - /// - /// - /// A tuple of: - /// x - /// Least-squares solution. If b is two-dimensional, - /// the solutions are in the K columns of x. - /// residuals - /// Sums of residuals; squared Euclidean 2-norm for each column in - /// b - a*x. - /// If the rank of a is < N or M <= N, this is an empty array. - /// If b is 1-dimensional, this is a (1,) shape array. - /// Otherwise the shape is (K,). - /// rank - /// Rank of matrix a. - /// s - /// Singular values of a. - /// - public (NDarray, NDarray, int, NDarray) linalg_lstsq(NDarray a, NDarray b, float? rcond = null) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (rcond!=null) kwargs["rcond"]=ToPython(rcond); - dynamic py = __self__.InvokeMethod("lstsq", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2]), ToCsharp(t[3])); - } - - /// - /// Compute the (Moore-Penrose) pseudo-inverse of a matrix. - /// - /// Calculate the generalized inverse of a matrix using its - /// singular-value decomposition (SVD) and including all - /// large singular values. - /// - /// Notes - /// - /// The pseudo-inverse of a matrix A, denoted , is - /// defined as: “the matrix that ‘solves’ [the least-squares problem] - /// ,” i.e., if is said solution, then - /// is that matrix such that . - /// - /// It can be shown that if is the singular - /// value decomposition of A, then - /// , where are - /// orthogonal matrices, is a diagonal matrix consisting - /// of A’s so-called singular values, (followed, typically, by - /// zeros), and then is simply the diagonal matrix - /// consisting of the reciprocals of A’s singular values - /// (again, followed by zeros). [1] - /// - /// References - /// - /// - /// Matrix or stack of matrices to be pseudo-inverted. - /// - /// - /// Cutoff for small singular values. - /// Singular values smaller (in modulus) than - /// rcond * largest_singular_value (again, in modulus) - /// are set to zero. Broadcasts against the stack of matrices - /// - /// - /// The pseudo-inverse of a. If a is a matrix instance, then so - /// is B. - /// - public NDarray linalg_pinv(NDarray a, float rcond = 1e-15f) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - rcond, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("pinv", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Solve a linear matrix equation, or system of linear scalar equations. - /// - /// Computes the “exact” solution, x, of the well-determined, i.e., full - /// rank, linear matrix equation ax = b. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The solutions are computed using LAPACK routine _gesv - /// - /// a must be square and of full-rank, i.e., all rows (or, equivalently, - /// columns) must be linearly independent; if either is not true, use - /// lstsq for the least-squares best “solution” of the - /// system/equation. - /// - /// References - /// - /// - /// Coefficient matrix. - /// - /// - /// Ordinate or “dependent variable” values. - /// - /// - /// Solution to the system a x = b. Returned shape is identical to b. - /// - public NDarray linalg_solve(NDarray a, NDarray b) - { - //auto-generated code, do not change - var linalg = self.GetAttr("linalg"); - var __self__=linalg; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("solve", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Singular Value Decomposition. - /// - /// When a is a 2D array, it is factorized as u @ np.diag(s) @ vh - /// = (u * s) @ vh, where u and vh are 2D unitary arrays and s is a 1D - /// array of a’s singular values. When a is higher-dimensional, SVD is - /// applied in stacked mode as explained below. - /// - /// Notes - /// - /// The decomposition is performed using LAPACK routine _gesdd. - /// - /// SVD is usually described for the factorization of a 2D matrix . - /// The higher-dimensional case will be discussed below. In the 2D case, SVD is - /// written as , where , , - /// and . The 1D array s - /// contains the singular values of a and u and vh are unitary. The rows - /// of vh are the eigenvectors of and the columns of u are - /// the eigenvectors of . In both cases the corresponding - /// (possibly non-zero) eigenvalues are given by s**2. - /// - /// If a has more than two dimensions, then broadcasting rules apply, as - /// explained in Linear algebra on several matrices at once. This means that SVD is - /// working in “stacked” mode: it iterates over all indices of the first - /// a.ndim - 2 dimensions and for each combination SVD is applied to the - /// last two indices. The matrix a can be reconstructed from the - /// decomposition with either (u * s[..., None, :]) @ vh or - /// u @ (s[..., None] * vh). (The @ operator can be replaced by the - /// function np.matmul for python versions below 3.5.) - /// - /// If a is a matrix object (as opposed to an ndarray), then so are - /// all the return values. - /// - /// - /// A real or complex array with a.ndim >= 2. - /// - /// - /// If True (default), u and vh have the shapes (..., M, M) and - /// (..., N, N), respectively. Otherwise, the shapes are - /// (..., M, K) and (..., K, N), respectively, where - /// K = min(M, N). - /// - /// - /// Whether or not to compute u and vh in addition to s. True - /// by default. - /// - /// - /// A tuple of: - /// u - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. - /// s - /// Vector(s) with the singular values, within each vector sorted in - /// descending order. The first a.ndim - 2 dimensions have the same - /// size as those of the input a. - /// vh - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. - /// - public (NDarray, NDarray, NDarray) linalg_svd(NDarray a, bool? full_matrices = true, bool? compute_uv = true) - { - //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 (full_matrices!=true) kwargs["full_matrices"]=ToPython(full_matrices); - if (compute_uv!=true) kwargs["compute_uv"]=ToPython(compute_uv); - dynamic py = __self__.InvokeMethod("svd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the one-dimensional discrete Fourier Transform. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) with the efficient Fast Fourier Transform (FFT) - /// algorithm [CT]. - /// - /// Notes - /// - /// FFT (Fast Fourier Transform) refers to a way the discrete Fourier - /// Transform (DFT) can be calculated efficiently, by using symmetries in the - /// calculated terms. The symmetry is highest when n is a power of 2, and - /// the transform is therefore most efficient for these sizes. - /// - /// The DFT is defined, with the conventions used in this implementation, in - /// the documentation for the numpy.fft module. - /// - /// References - /// - /// - /// Input array, can be complex. - /// - /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// - /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// - public NDarray fft_fft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("fft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional discrete Fourier Transform - /// - /// This function computes the n-dimensional discrete Fourier Transform - /// over any axes in an M-dimensional array by means of the - /// Fast Fourier Transform (FFT). By default, the transform is computed over - /// the last two axes of the input array, i.e., a 2-dimensional FFT. - /// - /// Notes - /// - /// fft2 is just fftn with a different default for axes. - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of the transformed axes, the positive frequency terms - /// in the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// the axes, in order of decreasingly negative frequency. - /// - /// See fftn for details and a plotting example, and numpy.fft for - /// definitions and conventions used. - /// - /// - /// Input array, can be complex - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. - /// - public NDarray fft_fft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("fft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the N-dimensional discrete Fourier Transform. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional array by means of the Fast Fourier - /// Transform (FFT). - /// - /// Notes - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of all axes, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// See numpy.fft for details, definitions and conventions used. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. - /// - /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the transform over that axis is - /// performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// - public NDarray fft_fftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("fftn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the one-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier transform computed by fft. In other words, - /// ifft(fft(a)) == a to within numerical accuracy. - /// For a general description of the algorithm and definitions, - /// see numpy.fft. - /// - /// The input should be ordered in the same way as is returned by fft, - /// i.e., - /// - /// For an even number of input points, A[n//2] represents the sum of - /// the values at the positive and negative Nyquist frequencies, as the two - /// are aliased together. See numpy.fft for details. - /// - /// Notes - /// - /// If the input parameter n is larger than the size of the input, the input - /// is padded by appending zeros at the end. Even though this is the common - /// approach, it might lead to surprising results. If a different padding is - /// desired, it must be performed before calling ifft. - /// - /// - /// Input array, can be complex. - /// - /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// See notes about padding issues. - /// - /// - /// Axis over which to compute the inverse DFT. If not given, the last - /// axis is used. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// - public NDarray fft_ifft(NDarray a, int? n = null, int? axis = -1, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (n!=null) kwargs["n"]=ToPython(n); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ifft", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the 2-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the 2-dimensional discrete Fourier - /// Transform over any number of axes in an M-dimensional array by means of - /// the Fast Fourier Transform (FFT). In other words, ifft2(fft2(a)) == a - /// to within numerical accuracy. By default, the inverse transform is - /// computed over the last two axes of the input array. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fft2, i.e. it should have the term for zero frequency - /// in the low-order corner of the two axes, the positive frequency terms in - /// the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// both axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// ifft2 is just ifftn with a different default for axes. - /// - /// See ifftn for details and a plotting example, and numpy.fft for - /// definition and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifft2 is called. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each axis) of the output (s[0] refers to axis 0, - /// s[1] to axis 1, etc.). This corresponds to n for ifft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. - /// - /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. - /// - public NDarray fft_ifft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ifft2", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the N-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform over any number of axes in an M-dimensional array by - /// means of the Fast Fourier Transform (FFT). In other words, - /// ifftn(fftn(a)) == a to within numerical accuracy. - /// For a description of the definitions and conventions used, see numpy.fft. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fftn, i.e. it should have the term for zero frequency - /// in all axes in the low-order corner, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// See numpy.fft for definitions and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifftn is called. - /// - /// - /// Input array, can be complex. - /// - /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for ifft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. - /// - /// - /// Axes over which to compute the IFFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. - /// - /// - /// Normalization mode (see numpy.fft). Default is None. - /// - /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// - public NDarray fft_ifftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - { - //auto-generated code, do not change - var fft = self.GetAttr("fft"); - var __self__=fft; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (s!=null) kwargs["s"]=ToPython(s); - if (axes!=null) kwargs["axes"]=ToPython(axes); - if (norm!=null) kwargs["norm"]=ToPython(norm); - dynamic py = __self__.InvokeMethod("ifftn", 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 - /// - /// - /// Argument of the Bessel function. - /// - /// - /// The modified Bessel function evaluated at each of the elements of x. - /// - public NDarray i0(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("i0", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.logic.gen.cs b/src/Numpy/NumPy.logic.gen.cs deleted file mode 100644 index 2c38c9b..0000000 --- a/src/Numpy/NumPy.logic.gen.cs +++ /dev/null @@ -1,1210 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// 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(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// A new boolean or array is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public bool all(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("all", 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// 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(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// A new boolean or ndarray is returned unless out is specified, - /// in which case a reference to out is returned. - /// - public bool any(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("any", pyargs, kwargs); - 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. - /// - /// - /// 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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. - /// - /// - /// True where x is positive or negative infinity, false otherwise. - /// This is a scalar if x is a scalar. - /// - public NDarray isinf(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 NaN, false otherwise. - /// This is a scalar if x is a scalar. - /// - public NDarray isnan(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array with datetime or timedelta data type. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// The input array. - /// - /// - /// 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 x, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// The input array. - /// - /// - /// 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 x, NDarray y = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// Output array. - /// - public NDarray iscomplex(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("iscomplex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Check for a complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. Even if the input - /// has an imaginary part equal to zero, iscomplexobj evaluates to True. - /// - /// - /// The input can be of any type and shape. - /// - /// - /// The return value, True if x is of a complex type or has at least - /// one complex element. - /// - public bool iscomplexobj(object x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("iscomplexobj", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - public bool isfortran(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("isfortran", pyargs, kwargs); - 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. - /// - /// - /// Input array. - /// - /// - /// Boolean array of same shape as x. - /// - public NDarray isreal(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isreal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return True if x is a not complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. So even if the input - /// has an imaginary part equal to zero, isrealobj evaluates to False - /// if the data type is complex. - /// - /// - /// The input can be of any type and shape. - /// - /// - /// The return value, False if x is of a complex type. - /// - public bool isrealobj(object x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isrealobj", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns True if the type of num is a scalar type. - /// - /// Notes - /// - /// In almost all cases np.ndim(x) == 0 should be used instead of this - /// function, as that will also return true for 0d arrays. This is how - /// numpy overloads functions in the style of the dx arguments to gradient - /// and the bins argument to histogram. Some key differences: - /// - /// - /// Input argument, can be of any type and shape. - /// - /// - /// True if num is a scalar type, False if it is not. - /// - public bool isscalar(object num) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - num, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isscalar", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the truth value of x1 AND x2 element-wise. - /// - /// - /// Input arrays. x1 and x2 must be of the same shape. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Logical NOT is applied to the elements 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 b, 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[] - { - b, - a, - rtol, - atol, - equal_nan, - }); - var kwargs=new PyDict(); - 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. - /// - /// - /// 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 b, 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[] - { - b, - a, - rtol, - atol, - equal_nan, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isclose", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// True if two arrays have the same shape and elements, False otherwise. - /// - /// - /// Input arrays. - /// - /// - /// Input arrays. - /// - /// - /// Returns True if the arrays are equal. - /// - public bool array_equal(NDarray a2, NDarray a1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a2, - 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. - /// - /// - /// Input arrays. - /// - /// - /// True if equivalent, False otherwise. - /// - public bool array_equiv(NDarray a2, NDarray a1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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); - } - - } -} diff --git a/src/Numpy/NumPy.math.gen.cs b/src/Numpy/NumPy.math.gen.cs deleted file mode 100644 index 00990d0..0000000 --- a/src/Numpy/NumPy.math.gen.cs +++ /dev/null @@ -1,4274 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// 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. - /// - /// - /// Angle, in radians ( rad equals 360 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 sine of each element of x. - /// This is a scalar if x is a scalar. - /// - public NDarray sin(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array in 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 cosine values. - /// This is a scalar if x is a scalar. - /// - public NDarray cos(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 corresponding tangent values. - /// This is a scalar if x is a scalar. - /// - public NDarray tan(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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/ - /// - /// - /// y-coordinate on the unit circle. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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/ - /// - /// - /// x-coordinate on the unit circle. - /// For real arguments, the domain is [-1, 1]. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// y-coordinates. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Input array in 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 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array in 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 radian values. - /// This is a scalar if x is a scalar. - /// - public NDarray radians(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// Maximum discontinuity between values, default is pi. - /// - /// - /// Axis along which unwrap will operate, default is the last axis. - /// - /// - /// Output array. - /// - public NDarray unwrap(NDarray p, float? discont = 3.141592653589793f, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - p, - }); - 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. - /// - /// - /// Angles in 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 angle in radians. - /// This is a scalar if x is a scalar. - /// - public NDarray deg2rad(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Angle in 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 angle in degrees. - /// This is a scalar if x is a scalar. - /// - public NDarray rad2deg(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 corresponding hyperbolic sine values. - /// This is a scalar if x is a scalar. - /// - public NDarray sinh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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). - /// - /// - /// Input 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. - /// - /// - /// Output array of same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray cosh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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 corresponding hyperbolic tangent values. - /// This is a scalar if x is a scalar. - /// - public NDarray tanh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray arcsinh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray arccosh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public NDarray arctanh(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input data. - /// - /// - /// 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(NDarray a, int? decimals = 0, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input 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. - /// - /// - /// Output array is same shape and type as x. - /// This is a scalar if x is a scalar. - /// - public NDarray rint(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// An array of floats to be rounded - /// - /// - /// Output array - /// - /// - /// The array of rounded numbers - /// - public NDarray fix(NDarray x, NDarray y = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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 floor of each element in x. - /// This is a scalar if x is a scalar. - /// - public NDarray floor(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 . - /// - /// - /// Input 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 ceiling of each element in x, with float dtype. - /// This is a scalar if x is a scalar. - /// - public NDarray ceil(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input 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 truncated value of each element in x. - /// This is a scalar if x is a scalar. - /// - public NDarray trunc(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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: - /// - /// - /// Input data. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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: - /// - /// - /// Elements to sum. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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. - /// - /// - /// Array containing numbers whose product is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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). - /// - /// - /// Array containing numbers whose sum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// 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(NDarray a, int[] 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[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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: - /// - /// - /// Input array - /// - /// - /// 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(NDarray a, 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[] - { - a, - }); - 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. - /// - /// - /// If necessary, will be flattened before the differences are taken. - /// - /// - /// 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 ary, NDarray to_end = null, NDarray to_begin = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ary, - }); - 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 - /// - /// - /// 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 NDarray gradient(NDarray f, NDarray varargs = null, int? edge_order = null, int[] axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - f, - }); - 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 first vector(s). - /// - /// - /// 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 a, 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[] - { - a, - 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 - /// - /// - /// Input array to integrate. - /// - /// - /// 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 y, NDarray x = null, float? dx = 1.0f, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - y, - }); - 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 - /// - /// - /// 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. - /// - /// - /// Output array, element-wise exponential of x. - /// This is a scalar if x is a scalar. - /// - public NDarray exp(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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. - /// - /// - /// Element-wise exponential minus one: out = exp(x) - 1. - /// This is a scalar if x is a scalar. - /// - public NDarray expm1(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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. - /// - /// - /// Element-wise 2 to the power x. - /// This is a scalar if x is a scalar. - /// - public NDarray exp2(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input value. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x. - /// This is a scalar if x is a scalar. - /// - public NDarray log2(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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. - /// - /// - /// Natural logarithm of 1 + x, element-wise. - /// This is a scalar if x is a scalar. - /// - public NDarray log1p(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// Array (possibly multi-dimensional) of values for which to to - /// calculate sinc(x). - /// - /// - /// sinc(x), which has the same shape as the input. - /// - public NDarray sinc(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("sinc", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns element-wise True where signbit is set (less than zero). - /// - /// - /// The input value(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. - /// - /// - /// Output array, or reference to out if that was supplied. - /// This is a scalar if x is a scalar. - /// - public NDarray signbit(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Values to change the sign of. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Array of numbers to be decomposed. - /// - /// - /// 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 x, 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[] - { - x, - }); - 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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[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 multipliers. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Values to find the next representable value of. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Values to find the spacing of. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// 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 x2, NDarray x1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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 - /// - /// - /// 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 x2, NDarray x1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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). - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Input 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. - /// - /// - /// Return array. - /// This is a scalar if x is a scalar. - /// - public NDarray reciprocal(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// Returned array or scalar: y = +x. - /// This is a scalar if x is a scalar. - /// - public NDarray positive(NDarray x) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("positive", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Numerical negative, element-wise. - /// - /// - /// Input 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. - /// - /// - /// Returned array or scalar: y = -x. - /// This is a scalar if x is a scalar. - /// - public NDarray negative(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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 bases. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Numerator. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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 bases. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Dividend. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Input 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: - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// Dividend array. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Return the angle of the complex argument. - /// - /// - /// A complex number or sequence of complex numbers. - /// - /// - /// 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(NDarray z, bool? deg = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - z, - }); - var kwargs=new PyDict(); - if (deg!=false) kwargs["deg"]=ToPython(deg); - dynamic py = __self__.InvokeMethod("angle", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the real part of the complex argument. - /// - /// - /// Input array. - /// - /// - /// The real component of the complex argument. If val is real, the type - /// of val is used for the output. If val has complex elements, the - /// returned type is float. - /// - public NDarray real(NDarray val) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - val, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("real", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the imaginary part of the complex argument. - /// - /// - /// Input array. - /// - /// - /// The imaginary component of the complex argument. If val is real, - /// the type of val is used for the output. If val has complex - /// elements, the returned type is float. - /// - public NDarray imag(NDarray val) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - val, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("imag", 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. - /// - /// - /// Input value. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// First one-dimensional input array. - /// - /// - /// Second one-dimensional input array. - /// - /// - /// Discrete, linear convolution of a and v. - /// - public NDarray convolve(NDarray a, NDarray v, string mode = "full") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// Array containing elements to clip. - /// - /// - /// 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, NDarray a_min, NDarray a_max, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - 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. - /// - /// - /// The values whose square-roots are required. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// The values whose cube-roots are required. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input 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. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// The array of numbers for which the absolute values are required. If - /// x is a scalar, the result y will also be a scalar. - /// - /// - /// 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 x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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, . - /// - /// - /// 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. - /// - /// - /// The sign of x. - /// This is a scalar if x is a scalar. - /// - public NDarray sign(NDarray x, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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 - /// - /// - /// Input values. - /// - /// - /// 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 x1, NDarray x2, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x1, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// 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 x2, NDarray x1, NDarray @out = null, NDarray @where = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x2, - 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. - /// - /// - /// Input data. - /// - /// - /// 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(NDarray x, bool? copy = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - 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. - /// - /// - /// Input array. - /// - /// - /// 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(NDarray a, float tol = 100) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - tol, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("real_if_close", pyargs, kwargs); - return ToCsharp(py); - } - - /* - /// - /// One-dimensional linear interpolation. - /// - /// Returns the one-dimensional piecewise linear interpolant to a function - /// with given discrete data points (xp, fp), evaluated at x. - /// - /// Notes - /// - /// Does not check that the x-coordinate sequence xp is increasing. - /// If xp is not increasing, the results are nonsense. - /// A simple check for increasing is: - /// - /// - /// The x-coordinates 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 float or complex (corresponding to fp) or ndarray interp(NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - { - //auto-generated code, do not change - 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); - } - */ - - } -} diff --git a/src/Numpy/NumPy.padding.gen.cs b/src/Numpy/NumPy.padding.gen.cs deleted file mode 100644 index 89b5a4e..0000000 --- a/src/Numpy/NumPy.padding.gen.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Pads an array. - /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes. This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis. - /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced. It has the - /// following signature: - /// - /// where - /// - /// - /// Input array - /// - /// - /// Number of values padded to the edges of each axis. - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis. - /// ((before, after),) yields same before and after pad for each axis. - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. - /// - /// - /// One of the following string values or a user supplied function. - /// - /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis. - /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis. - /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes. - /// - /// Default is None, to use the entire axis. - /// - /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis. - /// - /// ((before, after),) yields same before and after constants for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis. - /// - /// ((before, after),) yields same before and after end values for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes. - /// - /// Default is 0. - /// - /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value. For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. - /// - /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. - /// - public NDarray pad(NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - array, - pad_width, - mode, - }); - var kwargs=new PyDict(); - if (stat_length!=null) kwargs["stat_length"]=ToPython(stat_length); - if (constant_values!=null) kwargs["constant_values"]=ToPython(constant_values); - if (end_values!=null) kwargs["end_values"]=ToPython(end_values); - if (reflect_type!=null) kwargs["reflect_type"]=ToPython(reflect_type); - dynamic py = __self__.InvokeMethod("pad", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.random.gen.cs b/src/Numpy/NumPy.random.gen.cs deleted file mode 100644 index 1e26947..0000000 --- a/src/Numpy/NumPy.random.gen.cs +++ /dev/null @@ -1,2598 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Random values in a given shape. - /// - /// Create an array of the given shape and populate it with - /// random samples from a uniform distribution - /// over [0, 1). - /// - /// Notes - /// - /// This is a convenience function. If you want an interface that - /// takes a shape-tuple as the first argument, refer to - /// np.random.random_sample . - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// Random values. - /// - public NDarray random_rand(int? d1 = null, int? d0 = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (d1!=null) kwargs["d1"]=ToPython(d1); - if (d0!=null) kwargs["d0"]=ToPython(d0); - dynamic py = __self__.InvokeMethod("rand", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a sample (or samples) from the “standard normal” distribution. - /// - /// If positive, int_like or int-convertible arguments are provided, - /// randn generates an array of shape (d0, d1, ..., dn), filled - /// with random floats sampled from a univariate “normal” (Gaussian) - /// distribution of mean 0 and variance 1 (if any of the are - /// floats, they are first converted to integers by truncation). A single - /// float randomly sampled from the distribution is returned if no - /// argument is provided. - /// - /// This is a convenience function. If you want an interface that takes a - /// tuple as the first argument, use numpy.random.standard_normal instead. - /// - /// Notes - /// - /// For random samples from , use: - /// - /// sigma * np.random.randn(...) + mu - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// A (d0, d1, ..., dn)-shaped array of floating-point samples from - /// the standard normal distribution, or a single such float if - /// no parameters were supplied. - /// - public NDarray random_randn(int? d1 = null, int? d0 = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (d1!=null) kwargs["d1"]=ToPython(d1); - if (d0!=null) kwargs["d0"]=ToPython(d0); - dynamic py = __self__.InvokeMethod("randn", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return random integers from low (inclusive) to high (exclusive). - /// - /// Return random integers from the “discrete uniform” distribution of - /// the specified dtype in the “half-open” interval [low, high). If - /// high is None (the default), then results are from [0, low). - /// - /// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is one above the - /// highest such integer). - /// - /// - /// If provided, one above the largest (signed) integer to be drawn - /// from the distribution (see above for behavior if high=None). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Desired dtype of the result. All dtypes are determined by their - /// name, i.e., ‘int64’, ‘int’, etc, so byteorder is not available - /// and a specific precision may have different C types depending - /// on the platform. The default value is ‘np.int’. - /// - /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. - /// - public NDarray random_randint(int low, int? high = null, int[] size = null, Dtype dtype = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - low, - }); - var kwargs=new PyDict(); - if (high!=null) kwargs["high"]=ToPython(high); - if (size!=null) kwargs["size"]=ToPython(size); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - dynamic py = __self__.InvokeMethod("randint", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Random integers of type np.int between low and high, inclusive. - /// - /// Return random integers of type np.int from the “discrete uniform” - /// distribution in the closed interval [low, high]. If high is - /// None (the default), then results are from [1, low]. The np.int - /// type translates to the C long type used by Python 2 for “short” - /// integers and its precision is platform dependent. - /// - /// This function has been deprecated. Use randint instead. - /// - /// Notes - /// - /// To sample from N evenly spaced floating-point numbers between a and b, - /// use: - /// - /// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is the highest such - /// integer). - /// - /// - /// If provided, the largest (signed) integer to be drawn from the - /// distribution (see above for behavior if high=None). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. - /// - public NDarray random_random_integers(int low, int? high = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - low, - }); - var kwargs=new PyDict(); - if (high!=null) kwargs["high"]=ToPython(high); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("random_integers", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_random_sample(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("random_sample", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_random(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("random", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_ranf(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("ranf", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). - /// - public NDarray random_sample(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("sample", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Generates a random sample from a given 1-D array - /// - /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Whether the sample is with or without replacement - /// - /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. - /// - /// - /// The generated random samples - /// - public NDarray random_choice(NDarray a, int[] size = null, bool? replace = true, NDarray p = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - if (replace!=true) kwargs["replace"]=ToPython(replace); - if (p!=null) kwargs["p"]=ToPython(p); - dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Generates a random sample from a given 1-D array - /// - /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Whether the sample is with or without replacement - /// - /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. - /// - /// - /// The generated random samples - /// - public NDarray random_choice(int a, int[] size = null, bool? replace = true, NDarray p = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - if (replace!=true) kwargs["replace"]=ToPython(replace); - if (p!=null) kwargs["p"]=ToPython(p); - dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return random bytes. - /// - /// - /// Number of random bytes. - /// - /// - /// String of length length. - /// - public string random_bytes(int length) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - length, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("bytes", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Modify a sequence in-place by shuffling its contents. - /// - /// This function only shuffles the array along the first axis of a - /// multi-dimensional array. The order of sub-arrays is changed but - /// their contents remains the same. - /// - /// - /// The array or list to be shuffled. - /// - public void random_shuffle(NDarray x) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("shuffle", pyargs, kwargs); - } - - /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. - /// - /// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. - /// - /// - /// Permuted sequence or array range. - /// - public NDarray random_permutation(NDarray x) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. - /// - /// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. - /// - /// - /// Permuted sequence or array range. - /// - public NDarray random_permutation(int x) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Beta distribution. - /// - /// The Beta distribution is a special case of the Dirichlet distribution, - /// and is related to the Gamma distribution. It has the probability - /// distribution function - /// - /// where the normalisation, B, is the beta function, - /// - /// It is often seen in Bayesian inference and order statistics. - /// - /// - /// Alpha, positive (>0). - /// - /// - /// Beta, positive (>0). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a and b are both scalars. - /// Otherwise, np.broadcast(a, b).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized beta distribution. - /// - public NDarray random_beta(NDarray a, NDarray b, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - b, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("beta", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References - /// - /// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. - /// - public NDarray random_binomial(NDarray n, NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References - /// - /// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. - /// - public NDarray random_binomial(int n, NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a chi-square distribution. - /// - /// When df independent random variables, each with standard normal - /// distributions (mean 0, variance 1), are squared and summed, the - /// resulting distribution is chi-square (see Notes). This distribution - /// is often used in hypothesis testing. - /// - /// Notes - /// - /// The variable obtained by summing the squares of df independent, - /// standard normally distributed random variables: - /// - /// is chi-square distributed, denoted - /// - /// The probability density function of the chi-squared distribution is - /// - /// where is the gamma function, - /// - /// References - /// - /// - /// Number of degrees of freedom, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized chi-square distribution. - /// - public NDarray random_chisquare(NDarray df, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - df, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("chisquare", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the Dirichlet distribution. - /// - /// Draw size samples of dimension k from a Dirichlet distribution. A - /// Dirichlet-distributed random variable can be seen as a multivariate - /// generalization of a Beta distribution. Dirichlet pdf is the conjugate - /// prior of a multinomial in Bayesian inference. - /// - /// Notes - /// - /// Uses the following property for computation: for each dimension, - /// draw a random sample y_i from a standard gamma generator of shape - /// alpha_i, then - /// is - /// Dirichlet distributed. - /// - /// References - /// - /// - /// Parameter of the distribution (k dimension for sample of - /// dimension k). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples, of shape (size, alpha.ndim). - /// - public NDarray random_dirichlet(NDarray alpha, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - alpha, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("dirichlet", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from an exponential distribution. - /// - /// Its probability density function is - /// - /// for x > 0 and 0 elsewhere. is the scale parameter, - /// which is the inverse of the rate parameter . - /// The rate parameter is an alternative, widely used parameterization - /// of the exponential distribution [3]. - /// - /// The exponential distribution is a continuous analogue of the - /// geometric distribution. It describes many common situations, such as - /// the size of raindrops measured over many rainstorms [1], or the time - /// between page requests to Wikipedia [2]. - /// - /// References - /// - /// - /// The scale parameter, . - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized exponential distribution. - /// - public NDarray random_exponential(NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - scale, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("exponential", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from an F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters should be greater than - /// zero. - /// - /// The random variate of the F distribution (also known as the - /// Fisher distribution) is a continuous probability distribution - /// that arises in ANOVA tests, and is the ratio of two chi-square - /// variates. - /// - /// Notes - /// - /// The F statistic is used to compare in-group variances to between-group - /// variances. Calculating the distribution depends on the sampling, and - /// so it is a function of the respective degrees of freedom in the - /// problem. The variable dfnum is the number of samples minus one, the - /// between-groups degrees of freedom, while dfden is the within-groups - /// degrees of freedom, the sum of the number of samples in each group - /// minus the number of groups. - /// - /// References - /// - /// - /// Degrees of freedom in numerator, should be > 0. - /// - /// - /// Degrees of freedom in denominator, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum and dfden are both scalars. - /// Otherwise, np.broadcast(dfnum, dfden).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Fisher distribution. - /// - public NDarray random_f(NDarray dfnum, NDarray dfden, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - dfnum, - dfden, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("f", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale (sometimes designated - /// “theta”), where both parameters are > 0. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References - /// - /// - /// The shape of the gamma distribution. Should be greater than zero. - /// - /// - /// The scale of the gamma distribution. Should be greater than zero. - /// Default is equal to 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape and scale are both scalars. - /// Otherwise, np.broadcast(shape, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized gamma distribution. - /// - public NDarray random_gamma(Shape shape, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("gamma", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the geometric distribution. - /// - /// Bernoulli trials are experiments with one of two outcomes: - /// success or failure (an example of such an experiment is flipping - /// a coin). The geometric distribution models the number of trials - /// that must be run in order to achieve success. It is therefore - /// supported on the positive integers, k = 1, 2, .... - /// - /// The probability mass function of the geometric distribution is - /// - /// where p is the probability of success of an individual trial. - /// - /// - /// The probability of success of an individual trial. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized geometric distribution. - /// - public NDarray random_geometric(NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("geometric", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Gumbel distribution. - /// - /// Draw samples from a Gumbel distribution with specified location and - /// scale. For more information on the Gumbel distribution, see - /// Notes and References below. - /// - /// Notes - /// - /// The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme - /// Value Type I) distribution is one of a class of Generalized Extreme - /// Value (GEV) distributions used in modeling extreme value problems. - /// The Gumbel is a special case of the Extreme Value Type I distribution - /// for maximums from distributions with “exponential-like” tails. - /// - /// The probability density for the Gumbel distribution is - /// - /// where is the mode, a location parameter, and - /// is the scale parameter. - /// - /// The Gumbel (named for German mathematician Emil Julius Gumbel) was used - /// very early in the hydrology literature, for modeling the occurrence of - /// flood events. It is also used for modeling maximum wind speed and - /// rainfall rates. It is a “fat-tailed” distribution - the probability of - /// an event in the tail of the distribution is larger than if one used a - /// Gaussian, hence the surprisingly frequent occurrence of 100-year - /// floods. Floods were initially modeled as a Gaussian process, which - /// underestimated the frequency of extreme events. - /// - /// It is one of a class of extreme value distributions, the Generalized - /// Extreme Value (GEV) distributions, which also includes the Weibull and - /// Frechet. - /// - /// The function has a mean of and a variance - /// of . - /// - /// References - /// - /// - /// The location of the mode of the distribution. Default is 0. - /// - /// - /// The scale parameter of the distribution. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Gumbel distribution. - /// - public NDarray random_gumbel(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("gumbel", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Hypergeometric distribution. - /// - /// Samples are drawn from a hypergeometric distribution with specified - /// parameters, ngood (ways to make a good selection), nbad (ways to make - /// a bad selection), and nsample = number of items sampled, which is less - /// than or equal to the sum ngood + nbad. - /// - /// Notes - /// - /// The probability density for the Hypergeometric distribution is - /// - /// where and - /// - /// for P(x) the probability of x successes, g = ngood, b = nbad, and - /// n = number of samples. - /// - /// Consider an urn with black and white marbles in it, ngood of them - /// black and nbad are white. If you draw nsample balls without - /// replacement, then the hypergeometric distribution describes the - /// distribution of black balls in the drawn sample. - /// - /// Note that this distribution is very similar to the binomial - /// distribution, except that in this case, samples are drawn without - /// replacement, whereas in the Binomial case samples are drawn with - /// replacement (or the sample space is infinite). As the sample space - /// becomes large, this distribution approaches the binomial. - /// - /// References - /// - /// - /// Number of ways to make a good selection. Must be nonnegative. - /// - /// - /// Number of ways to make a bad selection. Must be nonnegative. - /// - /// - /// Number of items sampled. Must be at least 1 and at most - /// ngood + nbad. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if ngood, nbad, and nsample - /// are all scalars. Otherwise, np.broadcast(ngood, nbad, nsample).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized hypergeometric distribution. - /// - public NDarray random_hypergeometric(NDarray ngood, NDarray nbad, NDarray nsample, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - ngood, - nbad, - nsample, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("hypergeometric", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the Laplace or double exponential distribution with - /// specified location (or mean) and scale (decay). - /// - /// The Laplace distribution is similar to the Gaussian/normal distribution, - /// but is sharper at the peak and has fatter tails. It represents the - /// difference between two independent, identically distributed exponential - /// random variables. - /// - /// Notes - /// - /// It has the probability density function - /// - /// The first law of Laplace, from 1774, states that the frequency - /// of an error can be expressed as an exponential function of the - /// absolute magnitude of the error, which leads to the Laplace - /// distribution. For many problems in economics and health - /// sciences, this distribution seems to model the data better - /// than the standard Gaussian distribution. - /// - /// References - /// - /// - /// The position, , of the distribution peak. Default is 0. - /// - /// - /// , the exponential decay. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Laplace distribution. - /// - public NDarray random_laplace(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("laplace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a logistic distribution. - /// - /// Samples are drawn from a logistic distribution with specified - /// parameters, loc (location or mean, also median), and scale (>0). - /// - /// Notes - /// - /// The probability density for the Logistic distribution is - /// - /// where = location and = scale. - /// - /// The Logistic distribution is used in Extreme Value problems where it - /// can act as a mixture of Gumbel distributions, in Epidemiology, and by - /// the World Chess Federation (FIDE) where it is used in the Elo ranking - /// system, assuming the performance of each player is a logistically - /// distributed random variable. - /// - /// References - /// - /// - /// Parameter of the distribution. Default is 0. - /// - /// - /// Parameter of the distribution. Should be greater than zero. - /// Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized logistic distribution. - /// - public NDarray random_logistic(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("logistic", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a log-normal distribution. - /// - /// Draw samples from a log-normal distribution with specified mean, - /// standard deviation, and array shape. Note that the mean and standard - /// deviation are not the values for the distribution itself, but of the - /// underlying normal distribution it is derived from. - /// - /// Notes - /// - /// A variable x has a log-normal distribution if log(x) is normally - /// distributed. The probability density function for the log-normal - /// distribution is: - /// - /// where is the mean and is the standard - /// deviation of the normally distributed logarithm of the variable. - /// A log-normal distribution results if a random variable is the product - /// of a large number of independent, identically-distributed variables in - /// the same way that a normal distribution results if the variable is the - /// sum of a large number of independent, identically-distributed - /// variables. - /// - /// References - /// - /// - /// Mean value of the underlying normal distribution. Default is 0. - /// - /// - /// Standard deviation of the underlying normal distribution. Should - /// be greater than zero. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and sigma are both scalars. - /// Otherwise, np.broadcast(mean, sigma).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized log-normal distribution. - /// - public NDarray random_lognormal(NDarray mean = null, NDarray sigma = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (mean!=null) kwargs["mean"]=ToPython(mean); - if (sigma!=null) kwargs["sigma"]=ToPython(sigma); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("lognormal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a logarithmic series distribution. - /// - /// Samples are drawn from a log series distribution with specified - /// shape parameter, 0 < p < 1. - /// - /// Notes - /// - /// The probability density for the Log Series distribution is - /// - /// where p = probability. - /// - /// The log series distribution is frequently used to represent species - /// richness and occurrence, first proposed by Fisher, Corbet, and - /// Williams in 1943 [2]. It may also be used to model the numbers of - /// occupants seen in cars [3]. - /// - /// References - /// - /// - /// Shape parameter for the distribution. Must be in the range (0, 1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized logarithmic series distribution. - /// - public NDarray random_logseries(NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("logseries", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a multinomial distribution. - /// - /// The multinomial distribution is a multivariate generalisation of the - /// binomial distribution. Take an experiment with one of p - /// possible outcomes. An example of such an experiment is throwing a dice, - /// where the outcome can be 1 through 6. Each sample drawn from the - /// distribution represents n such experiments. Its values, - /// X_i = [X_0, X_1, ..., X_p], represent the number of times the - /// outcome was i. - /// - /// - /// Number of experiments. - /// - /// - /// Probabilities of each of the p different outcomes. These - /// should sum to 1 (however, the last element is always assumed to - /// account for the remaining probability, as long as - /// sum(pvals[:-1]) <= 1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. - /// - public NDarray random_multinomial(int n, NDarray pvals, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - pvals, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("multinomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw random samples from a multivariate normal distribution. - /// - /// The multivariate normal, multinormal or Gaussian distribution is a - /// generalization of the one-dimensional normal distribution to higher - /// dimensions. Such a distribution is specified by its mean and - /// covariance matrix. These parameters are analogous to the mean - /// (average or “center”) and variance (standard deviation, or “width,” - /// squared) of the one-dimensional normal distribution. - /// - /// Notes - /// - /// The mean is a coordinate in N-dimensional space, which represents the - /// location where samples are most likely to be generated. This is - /// analogous to the peak of the bell curve for the one-dimensional or - /// univariate normal distribution. - /// - /// Covariance indicates the level to which two variables vary together. - /// From the multivariate normal distribution, we draw N-dimensional - /// samples, . The covariance matrix - /// element is the covariance of and . - /// The element is the variance of (i.e. its - /// “spread”). - /// - /// Instead of specifying the full covariance matrix, popular - /// approximations include: - /// - /// This geometrical property can be seen in two dimensions by plotting - /// generated data-points: - /// - /// Diagonal covariance means that points are oriented along x or y-axis: - /// - /// Note that the covariance matrix must be positive semidefinite (a.k.a. - /// nonnegative-definite). Otherwise, the behavior of this method is - /// undefined and backwards compatibility is not guaranteed. - /// - /// References - /// - /// - /// Mean of the N-dimensional distribution. - /// - /// - /// Covariance matrix of the distribution. It must be symmetric and - /// positive-semidefinite for proper sampling. - /// - /// - /// Given a shape of, for example, (m,n,k), m*n*k samples are - /// generated, and packed in an m-by-n-by-k arrangement. Because - /// each sample is N-dimensional, the output shape is (m,n,k,N). - /// If no shape is specified, a single (N-D) sample is returned. - /// - /// - /// Behavior when the covariance matrix is not positive semidefinite. - /// - /// - /// Tolerance when checking the singular values in covariance matrix. - /// - /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. - /// - public NDarray random_multivariate_normal(NDarray mean, NDarray cov, int[] size = null, string check_valid = null, float? tol = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - mean, - cov, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - if (check_valid!=null) kwargs["check_valid"]=ToPython(check_valid); - if (tol!=null) kwargs["tol"]=ToPython(tol); - dynamic py = __self__.InvokeMethod("multivariate_normal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a negative binomial distribution. - /// - /// Samples are drawn from a negative binomial distribution with specified - /// parameters, n successes and p probability of success where n is an - /// integer > 0 and p is in the interval [0, 1]. - /// - /// Notes - /// - /// The probability density for the negative binomial distribution is - /// - /// where is the number of successes, is the - /// probability of success, and is the number of trials. - /// The negative binomial distribution gives the probability of N - /// failures given n successes, with a success on the last trial. - /// - /// If one throws a die repeatedly until the third time a “1” appears, - /// then the probability distribution of the number of non-“1”s that - /// appear before the third “1” is a negative binomial distribution. - /// - /// References - /// - /// - /// Parameter of the distribution, > 0. Floats are also accepted, - /// but they will be truncated to integers. - /// - /// - /// Parameter of the distribution, >= 0 and <=1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized negative binomial distribution, - /// where each sample is equal to N, the number of failures that - /// occurred before a total of n successes was reached. - /// - public NDarray random_negative_binomial(NDarray n, NDarray p, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - n, - p, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("negative_binomial", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a noncentral chi-square distribution. - /// - /// The noncentral distribution is a generalisation of - /// the distribution. - /// - /// Notes - /// - /// The probability density function for the noncentral Chi-square - /// distribution is - /// - /// where is the Chi-square with q degrees of freedom. - /// - /// In Delhi (2007), it is noted that the noncentral chi-square is - /// useful in bombing and coverage problems, the probability of - /// killing the point target given by the noncentral chi-squared - /// distribution. - /// - /// References - /// - /// - /// Degrees of freedom, should be > 0. - /// - /// - /// Non-centrality, should be non-negative. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df and nonc are both scalars. - /// Otherwise, np.broadcast(df, nonc).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized noncentral chi-square distribution. - /// - public NDarray random_noncentral_chisquare(NDarray df, NDarray nonc, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - df, - nonc, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("noncentral_chisquare", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the noncentral F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters > 1. - /// nonc is the non-centrality parameter. - /// - /// Notes - /// - /// When calculating the power of an experiment (power = probability of - /// rejecting the null hypothesis when a specific alternative is true) the - /// non-central F statistic becomes important. When the null hypothesis is - /// true, the F statistic follows a central F distribution. When the null - /// hypothesis is not true, then it follows a non-central F statistic. - /// - /// References - /// - /// - /// Numerator degrees of freedom, should be > 0. - /// - /// - /// Denominator degrees of freedom, should be > 0. - /// - /// - /// Non-centrality parameter, the sum of the squares of the numerator - /// means, should be >= 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum, dfden, and nonc - /// are all scalars. Otherwise, np.broadcast(dfnum, dfden, nonc).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized noncentral Fisher distribution. - /// - public NDarray random_noncentral_f(NDarray dfnum, NDarray dfden, NDarray nonc, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - dfnum, - dfden, - nonc, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("noncentral_f", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw random samples from a normal (Gaussian) distribution. - /// - /// The probability density function of the normal distribution, first - /// derived by De Moivre and 200 years later by both Gauss and Laplace - /// independently [2], is often called the bell curve because of - /// its characteristic shape (see the example below). - /// - /// The normal distributions occurs often in nature. For example, it - /// describes the commonly occurring distribution of samples influenced - /// by a large number of tiny, random disturbances, each with its own - /// unique distribution [2]. - /// - /// Notes - /// - /// The probability density for the Gaussian distribution is - /// - /// where is the mean and the standard - /// deviation. The square of the standard deviation, , - /// is called the variance. - /// - /// The function has its peak at the mean, and its “spread” increases with - /// the standard deviation (the function reaches 0.607 times its maximum at - /// and [2]). This implies that - /// numpy.random.normal is more likely to return samples lying close to - /// the mean, rather than those far away. - /// - /// References - /// - /// - /// Mean (“centre”) of the distribution. - /// - /// - /// Standard deviation (spread or “width”) of the distribution. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized normal distribution. - /// - public NDarray random_normal(NDarray loc = null, NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (loc!=null) kwargs["loc"]=ToPython(loc); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("normal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Pareto II or Lomax distribution with - /// specified shape. - /// - /// The Lomax or Pareto II distribution is a shifted Pareto - /// distribution. The classical Pareto distribution can be - /// obtained from the Lomax distribution by adding 1 and - /// multiplying by the scale parameter m (see Notes). The - /// smallest value of the Lomax distribution is zero while for the - /// classical Pareto distribution it is mu, where the standard - /// Pareto distribution has location mu = 1. Lomax can also - /// be considered as a simplified version of the Generalized - /// Pareto distribution (available in SciPy), with the scale set - /// to one and the location set to zero. - /// - /// The Pareto distribution must be greater than zero, and is - /// unbounded above. It is also known as the “80-20 rule”. In - /// this distribution, 80 percent of the weights are in the lowest - /// 20 percent of the range, while the other 20 percent fill the - /// remaining 80 percent of the range. - /// - /// Notes - /// - /// The probability density for the Pareto distribution is - /// - /// where is the shape and the scale. - /// - /// The Pareto distribution, named after the Italian economist - /// Vilfredo Pareto, is a power law probability distribution - /// useful in many real world problems. Outside the field of - /// economics it is generally referred to as the Bradford - /// distribution. Pareto developed the distribution to describe - /// the distribution of wealth in an economy. It has also found - /// use in insurance, web page access statistics, oil field sizes, - /// and many other problems, including the download frequency for - /// projects in Sourceforge [1]. It is one of the so-called - /// “fat-tailed” distributions. - /// - /// References - /// - /// - /// Shape of the distribution. Should be greater than zero. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Pareto distribution. - /// - public NDarray random_pareto(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("pareto", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Poisson distribution. - /// - /// The Poisson distribution is the limit of the binomial distribution - /// for large N. - /// - /// Notes - /// - /// The Poisson distribution - /// - /// For events with an expected separation the Poisson - /// distribution describes the probability of - /// events occurring within the observed - /// interval . - /// - /// Because the output is limited to the range of the C long type, a - /// ValueError is raised when lam is within 10 sigma of the maximum - /// representable value. - /// - /// References - /// - /// - /// Expectation of interval, should be >= 0. A sequence of expectation - /// intervals must be broadcastable over the requested size. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if lam is a scalar. Otherwise, - /// np.array(lam).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Poisson distribution. - /// - public NDarray random_poisson(NDarray lam = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (lam!=null) kwargs["lam"]=ToPython(lam); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("poisson", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draws samples in [0, 1] from a power distribution with positive - /// exponent a - 1. - /// - /// Also known as the power function distribution. - /// - /// Notes - /// - /// The probability density function is - /// - /// The power function distribution is just the inverse of the Pareto - /// distribution. It may also be seen as a special case of the Beta - /// distribution. - /// - /// It is used, for example, in modeling the over-reporting of insurance - /// claims. - /// - /// References - /// - /// - /// Parameter of the distribution. Should be greater than zero. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized power distribution. - /// - public NDarray random_power(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("power", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Rayleigh distribution. - /// - /// The and Weibull distributions are generalizations of the - /// Rayleigh. - /// - /// Notes - /// - /// The probability density function for the Rayleigh distribution is - /// - /// The Rayleigh distribution would arise, for example, if the East - /// and North components of the wind velocity had identical zero-mean - /// Gaussian distributions. Then the wind speed would have a Rayleigh - /// distribution. - /// - /// References - /// - /// - /// Scale, also equals the mode. Should be >= 0. Default is 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Rayleigh distribution. - /// - public NDarray random_rayleigh(NDarray scale = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (scale!=null) kwargs["scale"]=ToPython(scale); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("rayleigh", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Cauchy distribution with mode = 0. - /// - /// Also known as the Lorentz distribution. - /// - /// Notes - /// - /// The probability density function for the full Cauchy distribution is - /// - /// and the Standard Cauchy distribution just sets and - /// - /// - /// The Cauchy distribution arises in the solution to the driven harmonic - /// oscillator problem, and also describes spectral line broadening. It - /// also describes the distribution of values at which a line tilted at - /// a random angle will cut the x axis. - /// - /// When studying hypothesis tests that assume normality, seeing how the - /// tests perform on data from a Cauchy distribution is a good indicator of - /// their sensitivity to a heavy-tailed distribution, since the Cauchy looks - /// very much like a Gaussian distribution, but with heavier tails. - /// - /// References - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// The drawn samples. - /// - public NDarray random_standard_cauchy(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_cauchy", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the standard exponential distribution. - /// - /// standard_exponential is identical to the exponential distribution - /// with a scale parameter of 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Drawn samples. - /// - public NDarray random_standard_exponential(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_exponential", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale=1. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References - /// - /// - /// Parameter, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape is a scalar. Otherwise, - /// np.array(shape).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized standard gamma distribution. - /// - public NDarray random_standard_gamma(Shape shape, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_gamma", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Normal distribution (mean=0, stdev=1). - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. - /// - /// - /// Drawn samples. - /// - public NDarray random_standard_normal(int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_normal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a standard Student’s t distribution with df degrees - /// of freedom. - /// - /// A special case of the hyperbolic distribution. As df gets - /// large, the result resembles that of the standard normal - /// distribution (standard_normal). - /// - /// Notes - /// - /// The probability density function for the t distribution is - /// - /// The t test is based on an assumption that the data come from a - /// Normal distribution. The t test provides a way to test whether - /// the sample mean (that is the mean calculated from the data) is - /// a good estimate of the true mean. - /// - /// The derivation of the t-distribution was first published in - /// 1908 by William Gosset while working for the Guinness Brewery - /// in Dublin. Due to proprietary issues, he had to publish under - /// a pseudonym, and so he used the name Student. - /// - /// References - /// - /// - /// Degrees of freedom, should be > 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized standard Student’s t distribution. - /// - public NDarray random_standard_t(NDarray df, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - df, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("standard_t", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from the triangular distribution over the - /// interval [left, right]. - /// - /// The triangular distribution is a continuous probability - /// distribution with lower limit left, peak at mode, and upper - /// limit right. Unlike the other distributions, these parameters - /// directly define the shape of the pdf. - /// - /// Notes - /// - /// The probability density function for the triangular distribution is - /// - /// The triangular distribution is often used in ill-defined - /// problems where the underlying distribution is not known, but - /// some knowledge of the limits and mode exists. Often it is used - /// in simulations. - /// - /// References - /// - /// - /// Lower limit. - /// - /// - /// The value where the peak of the distribution occurs. - /// The value should fulfill the condition left <= mode <= right. - /// - /// - /// Upper limit, should be larger than left. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if left, mode, and right - /// are all scalars. Otherwise, np.broadcast(left, mode, right).size - /// samples are drawn. - /// - /// - /// Drawn samples from the parameterized triangular distribution. - /// - public NDarray random_triangular(NDarray left, NDarray mode, NDarray right, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - left, - mode, - right, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("triangular", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a uniform distribution. - /// - /// Samples are uniformly distributed over the half-open interval - /// [low, high) (includes low, but excludes high). In other words, - /// any value within the given interval is equally likely to be drawn - /// by uniform. - /// - /// Notes - /// - /// The probability density function of the uniform distribution is - /// - /// anywhere within the interval [a, b), and zero elsewhere. - /// - /// When high == low, values of low will be returned. - /// If high < low, the results are officially undefined - /// and may eventually raise an error, i.e. do not rely on this - /// function to behave when passed arguments satisfying that - /// inequality condition. - /// - /// - /// Lower boundary of the output interval. All values generated will be - /// greater than or equal to low. The default value is 0. - /// - /// - /// Upper boundary of the output interval. All values generated will be - /// less than high. The default value is 1.0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if low and high are both scalars. - /// Otherwise, np.broadcast(low, high).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized uniform distribution. - /// - public NDarray random_uniform(NDarray low = null, NDarray high = null, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (low!=null) kwargs["low"]=ToPython(low); - if (high!=null) kwargs["high"]=ToPython(high); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("uniform", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a von Mises distribution. - /// - /// Samples are drawn from a von Mises distribution with specified mode - /// (mu) and dispersion (kappa), on the interval [-pi, pi]. - /// - /// The von Mises distribution (also known as the circular normal - /// distribution) is a continuous probability distribution on the unit - /// circle. It may be thought of as the circular analogue of the normal - /// distribution. - /// - /// Notes - /// - /// The probability density for the von Mises distribution is - /// - /// where is the mode and the dispersion, - /// and is the modified Bessel function of order 0. - /// - /// The von Mises is named for Richard Edler von Mises, who was born in - /// Austria-Hungary, in what is now the Ukraine. He fled to the United - /// States in 1939 and became a professor at Harvard. He worked in - /// probability theory, aerodynamics, fluid mechanics, and philosophy of - /// science. - /// - /// References - /// - /// - /// Mode (“center”) of the distribution. - /// - /// - /// Dispersion of the distribution, has to be >=0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mu and kappa are both scalars. - /// Otherwise, np.broadcast(mu, kappa).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized von Mises distribution. - /// - public NDarray random_vonmises(NDarray mu, NDarray kappa, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - mu, - kappa, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("vonmises", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Wald, or inverse Gaussian, distribution. - /// - /// As the scale approaches infinity, the distribution becomes more like a - /// Gaussian. Some references claim that the Wald is an inverse Gaussian - /// with mean equal to 1, but this is by no means universal. - /// - /// The inverse Gaussian distribution was first studied in relationship to - /// Brownian motion. In 1956 M.C.K. Tweedie used the name inverse Gaussian - /// because there is an inverse relationship between the time to cover a - /// unit distance and distance covered in unit time. - /// - /// Notes - /// - /// The probability density function for the Wald distribution is - /// - /// As noted above the inverse Gaussian distribution first arise - /// from attempts to model Brownian motion. It is also a - /// competitor to the Weibull for use in reliability modeling and - /// modeling stock returns and interest rate processes. - /// - /// References - /// - /// - /// Distribution mean, should be > 0. - /// - /// - /// Scale parameter, should be >= 0. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and scale are both scalars. - /// Otherwise, np.broadcast(mean, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Wald distribution. - /// - public NDarray random_wald(NDarray mean, NDarray scale, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - mean, - scale, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("wald", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Weibull distribution. - /// - /// Draw samples from a 1-parameter Weibull distribution with the given - /// shape parameter a. - /// - /// Here, U is drawn from the uniform distribution over (0,1]. - /// - /// The more common 2-parameter Weibull, including a scale parameter - /// is just . - /// - /// Notes - /// - /// The Weibull (or Type III asymptotic extreme value distribution - /// for smallest values, SEV Type III, or Rosin-Rammler - /// distribution) is one of a class of Generalized Extreme Value - /// (GEV) distributions used in modeling extreme value problems. - /// This class includes the Gumbel and Frechet distributions. - /// - /// The probability density for the Weibull distribution is - /// - /// where is the shape and the scale. - /// - /// The function has its peak (the mode) at - /// . - /// - /// When a = 1, the Weibull distribution reduces to the exponential - /// distribution. - /// - /// References - /// - /// - /// Shape parameter of the distribution. Must be nonnegative. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Weibull distribution. - /// - public NDarray random_weibull(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("weibull", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Draw samples from a Zipf distribution. - /// - /// Samples are drawn from a Zipf distribution with specified parameter - /// a > 1. - /// - /// The Zipf distribution (also known as the zeta distribution) is a - /// continuous probability distribution that satisfies Zipf’s law: the - /// frequency of an item is inversely proportional to its rank in a - /// frequency table. - /// - /// Notes - /// - /// The probability density for the Zipf distribution is - /// - /// where is the Riemann Zeta function. - /// - /// It is named for the American linguist George Kingsley Zipf, who noted - /// that the frequency of any word in a sample of a language is inversely - /// proportional to its rank in the frequency table. - /// - /// References - /// - /// - /// Distribution parameter. Should be greater than 1. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized Zipf distribution. - /// - public NDarray random_zipf(NDarray a, int[] size = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (size!=null) kwargs["size"]=ToPython(size); - dynamic py = __self__.InvokeMethod("zipf", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods - /// - /// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. - /// - public void random_RandomState(int? seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("RandomState", pyargs, kwargs); - } - - /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods - /// - /// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. - /// - public void random_RandomState(NDarray seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("RandomState", pyargs, kwargs); - } - - /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. - /// - /// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. - /// - public void random_seed(int? seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("seed", pyargs, kwargs); - } - - /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. - /// - /// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. - /// - public void random_seed(NDarray seed = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (seed!=null) kwargs["seed"]=ToPython(seed); - dynamic py = __self__.InvokeMethod("seed", pyargs, kwargs); - } - - /* - /// - /// Return a tuple representing the internal state of the generator. - /// - /// For more details, see set_state. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// - /// The returned tuple has the following items: - /// - /// - /// The returned tuple has the following items: - /// - public tuple(str random_get_state(tuple(str @out = null) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("get_state", pyargs, kwargs); - return ToCsharp(py); - } - */ - - /* - /// - /// Set the internal state of the generator from a tuple. - /// - /// For use if one has reason to manually (re-)set the internal state of the - /// “Mersenne Twister”[1] pseudo-random number generating algorithm. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// For backwards compatibility, the form (str, array of 624 uints, int) is - /// also accepted although it is missing some information about the cached - /// Gaussian value: state = ('MT19937', keys, pos). - /// - /// References - /// - /// - /// The state tuple has the following items: - /// - /// - /// Returns ‘None’ on success. - /// - public None random_set_state(tuple(str state) - { - //auto-generated code, do not change - var random = self.GetAttr("random"); - var __self__=random; - var pyargs=ToTuple(new object[] - { - state, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("set_state", pyargs, kwargs); - return ToCsharp(py); - } - */ - - } -} diff --git a/src/Numpy/NumPy.set.gen.cs b/src/Numpy/NumPy.set.gen.cs deleted file mode 100644 index 52332ef..0000000 --- a/src/Numpy/NumPy.set.gen.cs +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Test whether each element of a 1-D array is also present in a second array. - /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise. - /// - /// We recommend using isin instead of in1d for new code. - /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences. in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]). - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. - /// - /// - /// Input array. - /// - /// - /// The values against which to test each value of ar1. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise). - /// Default is False. np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). - /// - /// - /// The values ar1[in1d] are in ar2. - /// - public NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - ar2, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (invert!=false) kwargs["invert"]=ToPython(invert); - dynamic py = __self__.InvokeMethod("in1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the intersection of two arrays. - /// - /// Return the sorted, unique values that are in both of the input arrays. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// Input arrays. Will be flattened if not already 1D. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned. The first instance of a value is used if there are - /// multiple. Default is False. - /// - /// - /// A tuple of: - /// intersect1d - /// Sorted 1D array of common and unique elements. - /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. - /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. - /// - public (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - ar1, - assume_unique, - return_indices, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("intersect1d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Calculates element in test_elements, broadcasting over element only. - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise. - /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in. - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences. - /// - /// element and test_elements are converted to arrays if they are not - /// already. If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements. This is a consequence - /// of the array constructor’s way of handling non-sequence collections. - /// Converting the set to a list usually gives the desired behavior. - /// - /// - /// Input array. - /// - /// - /// The values against which to test each value of element. - /// This argument is flattened if it is an array or array_like. - /// See notes for behavior with non-array-like parameters. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements. Default is False. - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). - /// - /// - /// Has the same shape as element. The values element[isin] - /// are in test_elements. - /// - public NDarray isin(NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - element, - test_elements, - }); - var kwargs=new PyDict(); - if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); - if (invert!=false) kwargs["invert"]=ToPython(invert); - dynamic py = __self__.InvokeMethod("isin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the set difference of two arrays. - /// - /// Return the unique values in ar1 that are not in ar2. - /// - /// - /// Input array. - /// - /// - /// Input comparison array. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. - /// - public NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar1, - ar2, - assume_unique, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("setdiff1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the set exclusive-or of two arrays. - /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. - /// - /// - /// Input arrays. - /// - /// - /// Input arrays. - /// - /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. - /// - /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. - /// - public NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - ar1, - assume_unique, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("setxor1d", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the union of two arrays. - /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Input arrays. They are flattened if they are not already 1D. - /// - /// - /// Unique, sorted union of the input arrays. - /// - public NDarray union1d(NDarray ar2, NDarray ar1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - ar2, - ar1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("union1d", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.sorting.gen.cs b/src/Numpy/NumPy.sorting.gen.cs deleted file mode 100644 index 2aae19c..0000000 --- a/src/Numpy/NumPy.sorting.gen.cs +++ /dev/null @@ -1,745 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return a sorted copy of an array. - /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable. A - /// stable sort keeps items with the same key in the same relative - /// order. The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis. Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts. - /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour. In numpy versions >= 1.4.0 nan - /// values are sorted to the end. The extended sort order is: - /// - /// where R is a non-nan real value. Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists. - /// Non-nan values are sorted as before. - /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress. This makes its - /// worst case O(n*log(n)). - /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted. It is currently mapped to - /// merge sort. - /// - /// - /// Array to be sorted. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="quicksort") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Perform an indirect stable sort using a sequence of keys. - /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns. The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on. The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape. If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. - /// - /// - /// The k different “columns” to be sorted. The last column (or row if - /// keys is a 2D array) is the primary sort key. - /// - /// - /// Axis to be indirectly sorted. By default, sort over the last axis. - /// - /// - /// Array of indices that sort the keys along the specified axis. - /// - public NDarray lexsort(NDarray keys, int? axis = -1) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - keys, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("lexsort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices that would sort an array. - /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword. It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// - /// Array to sort. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If None, - /// the flattened array is used. - /// - /// - /// Sorting algorithm. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - /// - /// Array of indices that sort a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a sorted a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. - /// - public NDarray argsort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="quicksort") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("argsort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Sort an array, in-place. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// - /// Axis along which to sort. Default is -1, which means sort along the - /// last axis. - /// - /// - /// Sorting algorithm. Default is ‘quicksort’. - /// - /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. - /// - public void sort(int? axis = -1, string kind = null, string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!=null) kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); - } - - /// - /// Return a copy of an array sorted along the first axis. - /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). - /// - /// - /// Array to be sorted. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray msort(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("msort", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Sort a complex array using the real part first, then the imaginary part. - /// - /// - /// Input array - /// - /// - /// Always returns a sorted complex array. - /// - public NDarray sort_complex(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("sort_complex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a partitioned copy of an array. - /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array. All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it. The ordering of the elements in the two - /// partitions is undefined. - /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable. A stable sort keeps items with the same key in the same - /// relative order. The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis. Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. - /// - /// - /// Array to be sorted. - /// - /// - /// Element index to partition by. The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it. The order of all elements in the partitions is undefined. If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. - /// - /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. - /// - /// - /// Selection algorithm. Default is ‘introselect’. - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string. Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of the same type and shape as a. - /// - public NDarray partition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - kth, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="introselect") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword. It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order. - /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. - /// - /// - /// Array to sort. - /// - /// - /// Element index to partition by. The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it. The order all - /// elements in the partitions is undefined. If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. - /// - /// - /// Axis along which to sort. The default is -1 (the last axis). If - /// None, the flattened array is used. - /// - /// - /// Selection algorithm. Default is ‘introselect’ - /// - /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. - /// - /// - /// Array of indices that partition a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a partitioned a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. - /// - public NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - kth, - }); - var kwargs=new PyDict(); - if (axis!=-1) kwargs["axis"]=ToPython(axis); - if (kind!="introselect") kwargs["kind"]=ToPython(kind); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("argpartition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices of the maximum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// Input array. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmax(NDarray a, int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("argmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. - /// - /// - /// Input data. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmax(NDarray a, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("nanargmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns the indices of the minimum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. - /// - /// - /// Input array. - /// - /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. - /// - /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. - /// - public NDarray argmin(NDarray a, int? axis = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("argmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. - /// - /// - /// Input data. - /// - /// - /// Axis along which to operate. By default flattened input is used. - /// - /// - /// An array of indices or a single index value. - /// - public NDarray nanargmin(NDarray a, int? axis = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("nanargmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find the indices of array elements that are non-zero, grouped by element. - /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)). - /// - /// The output of argwhere is not suitable for indexing arrays. - /// For this purpose use nonzero(a) instead. - /// - /// - /// Input data. - /// - /// - /// Indices of elements that are non-zero. Indices are grouped by element. - /// - public NDarray argwhere(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("argwhere", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return indices that are non-zero in the flattened version of a. - /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. - /// - /// - /// Input data. - /// - /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. - /// - public NDarray flatnonzero(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("flatnonzero", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Find indices where elements should be inserted to maintain order. - /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved. - /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points. - /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. - /// - /// - /// Input array. If sorter is None, then it must be sorted in - /// ascending order, otherwise sorter must be an array of indices - /// that sort it. - /// - /// - /// Values to insert into a. - /// - /// - /// If ‘left’, the index of the first suitable location found is given. - /// If ‘right’, return the last such index. If there is no suitable - /// index, return either 0 or N (where N is the length of a). - /// - /// - /// Optional array of integer indices that sort array a into ascending - /// order. They are typically the result of argsort. - /// - /// - /// Array of insertion points with the same shape as v. - /// - public NDarray searchsorted(NDarray a, NDarray v, string side = "left", NDarray sorter = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - v, - }); - var kwargs=new PyDict(); - if (side!="left") kwargs["side"]=ToPython(side); - if (sorter!=null) kwargs["sorter"]=ToPython(sorter); - dynamic py = __self__.InvokeMethod("searchsorted", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the elements of an array that satisfy some condition. - /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)). If - /// condition is boolean np.extract is equivalent to arr[condition]. - /// - /// Note that place does the exact opposite of extract. - /// - /// - /// An array whose nonzero or True entries indicate the elements of arr - /// to extract. - /// - /// - /// Input array of the same size as condition. - /// - /// - /// Rank 1 array of values from arr where condition is True. - /// - public NDarray extract(NDarray condition, NDarray arr) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - condition, - arr, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("extract", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// The array for which to count non-zeros. - /// - /// - /// Axis or tuple of axes along which to count non-zeros. - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public NDarray count_nonzero(NDarray a, int[] axis) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - dynamic py = __self__.InvokeMethod("count_nonzero", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. - /// - /// - /// The array for which to count non-zeros. - /// - /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. - /// - public int count_nonzero(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("count_nonzero", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.staticstics.gen.cs b/src/Numpy/NumPy.staticstics.gen.cs deleted file mode 100644 index 54cb356..0000000 --- a/src/Numpy/NumPy.staticstics.gen.cs +++ /dev/null @@ -1,3276 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - if (initial!=null) kwargs["initial"]=ToPython(initial); - dynamic py = __self__.InvokeMethod("amin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). - /// - /// - /// Input data. - /// - /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. - /// - /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. - /// - public NDarray amax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - 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); - if (initial!=null) kwargs["initial"]=ToPython(initial); - dynamic py = __self__.InvokeMethod("amax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs. - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.min. - /// - /// - /// Array containing numbers whose minimum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the minimum is computed. The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis - /// removed. If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned. The same dtype as a is returned. - /// - public NDarray nanmin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmin", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs. When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.max. - /// - /// - /// Array containing numbers whose maximum is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the maximum is computed. The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// An array with the same shape as a, with the specified axis removed. - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned. The same dtype as a is returned. - /// - public NDarray nanmax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmax", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Range of values (maximum - minimum) along an axis. - /// - /// The name of the function comes from the acronym for ‘peak to peak’. - /// - /// - /// Input values. - /// - /// - /// Axis along which to find the peaks. By default, flatten the - /// array. axis may be negative, in - /// which case it counts from the last to the first axis. - /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. - /// - public NDarray ptp(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("ptp", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray percentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double percentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanpercentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. - /// - /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanpercentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray quantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double quantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanquantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 - /// - /// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored - /// - /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. - /// - /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: - /// - /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanquantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - q, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); - dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original arr. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray median(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double median(NDarray a, NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. - /// - /// - /// Axis or axes along which to average a. The default, - /// axis=None, will average over all of the elements of the input array. - /// If axis is negative it counts from the last to the first axis. - /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public NDarray average(NDarray a, int[] axis, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (returned!=false) kwargs["returned"]=ToPython(returned); - dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the weighted average along the specified axis. - /// - /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. - /// - /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. - /// - /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. - /// - /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. - /// - public double average(NDarray a, NDarray weights = null, bool? returned = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (returned!=false) kwargs["returned"]=ToPython(returned); - dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the means are computed. The default is to - /// compute the mean of the flattened array. - /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public NDarray mean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. - /// - public double mean(NDarray a, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Calculate the standard deviation of these values. - /// - /// - /// Axis or axes along which the standard deviation is computed. The - /// default is to compute the standard deviation of the flattened array. - /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public NDarray std(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. - /// - /// - /// Calculate the standard deviation of these values. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. - /// - public double std(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the variance is computed. The default is to - /// compute the variance of the flattened array. - /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public NDarray @var(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. - /// - /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. - /// - public double @var(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public NDarray nanmedian(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. - /// - /// - /// Input array or object that can be converted to an array. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. - /// - /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. - /// - /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. - /// - public double nanmedian(NDarray a, NDarray @out = null, bool? overwrite_input = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); - dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the means are computed. The default is to compute - /// the mean of the flattened array. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public NDarray nanmean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. - /// - /// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. - /// - /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. - /// - public double nanmean(NDarray a, Dtype dtype = null, NDarray @out = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Calculate the standard deviation of the non-NaN values. - /// - /// - /// Axis or axes along which the standard deviation is computed. The default is - /// to compute the standard deviation of the flattened array. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes. If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public NDarray nanstd(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// - /// Calculate the standard deviation of the non-NaN values. - /// - /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. - /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. - /// - /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. - /// - public double nanstd(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Axis or axes along which the variance is computed. The default is to compute - /// the variance of the flattened array. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public NDarray nanvar(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (axis!=null) kwargs["axis"]=ToPython(axis); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); - dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims - /// - /// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. - /// - /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. - /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. - /// - /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. - /// - /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. - /// - public double nanvar(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (dtype!=null) kwargs["dtype"]=ToPython(dtype); - if (@out!=null) kwargs["out"]=ToPython(@out); - if (ddof!=0) kwargs["ddof"]=ToPython(ddof); - dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return Pearson product-moment correlation coefficients. - /// - /// Please refer to the documentation for cov for more detail. The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive. - /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1. The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case. - /// - /// This function accepts but discards arguments bias and ddof. This is - /// for backwards compatibility with previous versions of this function. These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. - /// - /// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of x represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. - /// - /// - /// An additional set of variables and observations. y has the same - /// shape as x. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// The correlation coefficient matrix of the variables. - /// - public NDarray corrcoef(NDarray x, NDarray y = null, bool? rowvar = true) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); - dynamic py = __self__.InvokeMethod("corrcoef", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Cross-correlation of two 1-dimensional sequences. - /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate. - /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently. Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. - /// - /// - /// Input sequences. - /// - /// - /// Input sequences. - /// - /// - /// Refer to the convolve docstring. Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. - /// - /// - /// Discrete cross-correlation of a and v. - /// - public NDarray correlate(NDarray v, NDarray a, string mode = "valid") - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - v, - a, - }); - var kwargs=new PyDict(); - if (mode!="valid") kwargs["mode"]=ToPython(mode); - dynamic py = __self__.InvokeMethod("correlate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Estimate a covariance matrix, given data and weights. - /// - /// Covariance indicates the level to which two variables vary together. - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm. - /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity. The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. - /// - /// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of m represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. - /// - /// - /// An additional set of variables and observations. y has the same form - /// as that of m. - /// - /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. - /// - /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate). If bias is True, - /// then normalization is by N. These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. - /// - /// - /// If not None the default value implied by bias is overridden. - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average. See the notes for the details. The default value - /// is None. - /// - /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. - /// - /// - /// 1-D array of observation vector weights. These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. - /// - /// - /// The covariance matrix of the variables. - /// - public NDarray cov(NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - m, - }); - var kwargs=new PyDict(); - if (y!=null) kwargs["y"]=ToPython(y); - if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); - if (bias!=false) kwargs["bias"]=ToPython(bias); - if (ddof!=null) kwargs["ddof"]=ToPython(ddof); - if (fweights!=null) kwargs["fweights"]=ToPython(fweights); - if (aweights!=null) kwargs["aweights"]=ToPython(aweights); - dynamic py = __self__.InvokeMethod("cov", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. - /// - /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. - /// - /// - /// A tuple of: - /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. - /// bin_edges - /// Return the bin edges (length(hist)+1). - /// - public (NDarray, NDarray) histogram(NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (density!=null) kwargs["density"]=ToPython(density); - dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. - /// - /// - /// An array containing the x coordinates of the points to be - /// histogrammed. - /// - /// - /// An array containing the y coordinates of the points to be - /// histogrammed. - /// - /// - /// The bin specification: - /// - /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. - /// xedges - /// The bin edges along the first dimension. - /// yedges - /// The bin edges along the second dimension. - /// - public (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - y, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1]), ToCsharp(t[2])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sample, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sample, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Compute the multidimensional histogram of some data. - /// - /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. - /// - /// - /// The bin specification: - /// - /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. - /// - /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. - /// - /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. - /// - /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. - /// - /// - /// A tuple of: - /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. - /// edges - /// A list of D arrays describing the bin edges for each dimension. - /// - public (NDarray, NDarray) histogramdd(NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - sample, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (density!=null) kwargs["density"]=ToPython(density); - if (normed!=null) kwargs["normed"]=ToPython(normed); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); - var t = py as PyTuple; - return (ToCsharp(t[0]), ToCsharp(t[1])); - } - - /// - /// Count number of occurrences of each value in array of non-negative ints. - /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x. If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x). - /// Each bin gives the number of occurrences of its index value in x. - /// If weights is specified the input array is weighted by it, i.e. if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. - /// - /// - /// Input array. - /// - /// - /// Weights, array of the same shape as x. - /// - /// - /// A minimum number of bins for the output array. - /// - /// - /// The result of binning the input array. - /// The length of out is equal to np.amax(x)+1. - /// - public NDarray bincount(NDarray x, NDarray weights = null, int? minlength = 0) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - }); - var kwargs=new PyDict(); - if (weights!=null) kwargs["weights"]=ToPython(weights); - if (minlength!=0) kwargs["minlength"]=ToPython(minlength); - dynamic py = __self__.InvokeMethod("bincount", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). - /// - /// - /// Input data. The histogram is computed over the flattened array. - /// - /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. - /// - /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. - /// - /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. - /// - /// - /// The edges to pass into histogram - /// - public NDarray histogram_bin_edges(NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (bins!=null) kwargs["bins"]=ToPython(bins); - if (range!=null) kwargs["range"]=ToPython(range); - if (weights!=null) kwargs["weights"]=ToPython(weights); - dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); - return ToCsharp>(py); - } - - /// - /// Return the indices of the bins to which each value in input array belongs. - /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate. - /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError. - /// - /// np.digitize is implemented in terms of np.searchsorted. This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search. It also removes - /// the requirement for the input array to be 1-dimensional. - /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too. - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks. Perhaps more importantly, it supports all dtypes. - /// - /// - /// Input array to be binned. Prior to NumPy 1.10.0, this array had to - /// be 1-dimensional, but can now have any shape. - /// - /// - /// Array of bins. It has to be 1-dimensional and monotonic. - /// - /// - /// Indicating whether the intervals include the right or the left bin - /// edge. Default behavior is (right==False) indicating that the interval - /// does not include the right edge. The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. - /// - /// - /// Output array of indices, of same shape as x. - /// - public NDarray digitize(NDarray x, NDarray bins, bool? right = false) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - x, - bins, - }); - var kwargs=new PyDict(); - if (right!=false) kwargs["right"]=ToPython(right); - dynamic py = __self__.InvokeMethod("digitize", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/NumPy.string.gen.cs b/src/Numpy/NumPy.string.gen.cs deleted file mode 100644 index e8b41c0..0000000 --- a/src/Numpy/NumPy.string.gen.cs +++ /dev/null @@ -1,1481 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return element-wise string concatenation for two arrays of str or unicode. - /// - /// Arrays x1 and x2 must have the same shape. - /// - /// - /// Input array. - /// - /// - /// Input array. - /// - /// - /// Output array of string_ or unicode_, depending on input types - /// of the same shape as x1 and x2. - /// - public NDarray core_defchararray_add(string[] x1, string[] x2) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x1, - x2, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("add", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (a * i), that is string multiple concatenation, - /// element-wise. - /// - /// Values in i of less than 0 are treated as 0 (which yields an - /// empty string). - /// - /// - /// Output array of str or unicode, depending on input types - /// - public NDarray core_defchararray_multiply(string[] a, int[] i) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - i, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("multiply", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (a % i), that is pre-Python 2.6 string formatting - /// (iterpolation), element-wise for a pair of array_likes of str - /// or unicode. - /// - /// - /// These values will be element-wise interpolated into the string. - /// - /// - /// Output array of str or unicode, depending on input types - /// - public NDarray core_defchararray_mod(string[] a, NDarray values) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - values, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("mod", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of a with only the first character of each element - /// capitalized. - /// - /// Calls str.capitalize element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array of strings to capitalize. - /// - /// - /// Output array of str or unicode, depending on input - /// types - /// - public NDarray core_defchararray_capitalize(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("capitalize", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a copy of a with its elements centered in a string of - /// length width. - /// - /// Calls str.center element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The padding character to use (default is space). - /// - /// - /// Output array of str or unicode, depending on input - /// types - /// - public NDarray core_defchararray_center(string[] a, int width, string fillchar = " ") - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); - dynamic py = __self__.InvokeMethod("center", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calls str.decode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the - /// codecs module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. - /// - /// - /// The name of an encoding - /// - /// - /// Specifies how to handle encoding errors - /// - public NDarray core_defchararray_decode(string[] a, string encoding = null, string errors = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - if (errors!=null) kwargs["errors"]=ToPython(errors); - dynamic py = __self__.InvokeMethod("decode", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Calls str.encode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the codecs - /// module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. - /// - /// - /// The name of an encoding - /// - /// - /// Specifies how to handle encoding errors - /// - public NDarray core_defchararray_encode(string[] a, string encoding = null, string errors = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (encoding!=null) kwargs["encoding"]=ToPython(encoding); - if (errors!=null) kwargs["errors"]=ToPython(errors); - dynamic py = __self__.InvokeMethod("encode", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return a string which is the concatenation of the strings in the - /// sequence seq. - /// - /// Calls str.join element-wise. - /// - /// - /// Output array of str or unicode, depending on input types - /// - public NDarray core_defchararray_join(string[] sep, string[] seq) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - sep, - seq, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("join", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements of a left-justified in a - /// string of length width. - /// - /// Calls str.ljust element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The character to use for padding - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_ljust(string[] a, int width, string fillchar = " ") - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); - dynamic py = __self__.InvokeMethod("ljust", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements converted to lowercase. - /// - /// Call str.lower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_lower(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("lower", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy with the leading characters - /// removed. - /// - /// Calls str.lstrip element-wise. - /// - /// - /// Input array. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix; rather, all combinations of its values are - /// stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_lstrip(NDarray a, string chars = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (chars!=null) kwargs["chars"]=ToPython(chars); - dynamic py = __self__.InvokeMethod("lstrip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Partition each element in a around sep. - /// - /// Calls str.partition element-wise. - /// - /// For each element in a, split the element as the first - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. - /// - /// - /// Input array - /// - /// - /// Separator to split each string element in a. - /// - /// - /// Output array of str or unicode, depending on input type. - /// The output array will have an extra dimension with 3 - /// elements per input element. - /// - public NDarray core_defchararray_partition(NDarray a, string sep) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy of the string with all - /// occurrences of substring old replaced by new. - /// - /// Calls str.replace element-wise. - /// - /// - /// If the optional argument count is given, only the first - /// count occurrences are replaced. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_replace(string[] a, string @new, string old, int? count = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - @new, - old, - }); - var kwargs=new PyDict(); - if (count!=null) kwargs["count"]=ToPython(count); - dynamic py = __self__.InvokeMethod("replace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements of a right-justified in a - /// string of length width. - /// - /// Calls str.rjust element-wise. - /// - /// - /// The length of the resulting strings - /// - /// - /// The character to use for padding - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_rjust(string[] a, int width, string fillchar = " ") - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); - dynamic py = __self__.InvokeMethod("rjust", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Partition (split) each element around the right-most separator. - /// - /// Calls str.rpartition element-wise. - /// - /// For each element in a, split the element as the last - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. - /// - /// - /// Input array - /// - /// - /// Right-most separator to split each element in array. - /// - /// - /// Output array of string or unicode, depending on input - /// type. The output array will have an extra dimension with - /// 3 elements per input element. - /// - public NDarray core_defchararray_rpartition(string[] a, string sep) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sep, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("rpartition", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.rsplit element-wise. - /// - /// Except for splitting from the right, rsplit - /// behaves like split. - /// - /// - /// If sep is not specified or None, any whitespace string - /// is a separator. - /// - /// - /// If maxsplit is given, at most maxsplit splits are done, - /// the rightmost ones. - /// - /// - /// Array of list objects - /// - public NDarray core_defchararray_rsplit(string[] a, string sep = null, int? maxsplit = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (sep!=null) kwargs["sep"]=ToPython(sep); - if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); - dynamic py = __self__.InvokeMethod("rsplit", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy with the trailing - /// characters removed. - /// - /// Calls str.rstrip element-wise. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a suffix; rather, all combinations of its values are - /// stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_rstrip(string[] a, string chars = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (chars!=null) kwargs["chars"]=ToPython(chars); - dynamic py = __self__.InvokeMethod("rstrip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.split element-wise. - /// - /// - /// If sep is not specified or None, any whitespace string is a - /// separator. - /// - /// - /// If maxsplit is given, at most maxsplit splits are done. - /// - /// - /// Array of list objects - /// - public NDarray core_defchararray_split(string[] a, string sep = null, int? maxsplit = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (sep!=null) kwargs["sep"]=ToPython(sep); - if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); - dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a list of the lines in the - /// element, breaking at line boundaries. - /// - /// Calls str.splitlines element-wise. - /// - /// - /// Line breaks are not included in the resulting list unless - /// keepends is given and true. - /// - /// - /// Array of list objects - /// - public NDarray core_defchararray_splitlines(string[] a, bool? keepends = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (keepends!=null) kwargs["keepends"]=ToPython(keepends); - dynamic py = __self__.InvokeMethod("splitlines", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy with the leading and - /// trailing characters removed. - /// - /// Calls str.strip element-wise. - /// - /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix or suffix; rather, all combinations of its - /// values are stripped. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_strip(string[] a, string chars = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - if (chars!=null) kwargs["chars"]=ToPython(chars); - dynamic py = __self__.InvokeMethod("strip", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return element-wise a copy of the string with - /// uppercase characters converted to lowercase and vice versa. - /// - /// Calls str.swapcase element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_swapcase(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("swapcase", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return element-wise title cased version of string or unicode. - /// - /// Title case words start with uppercase characters, all remaining cased - /// characters are lowercase. - /// - /// Calls str.title element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_title(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("title", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return a copy of the string where all - /// characters occurring in the optional argument deletechars are - /// removed, and the remaining characters have been mapped through the - /// given translation table. - /// - /// Calls str.translate element-wise. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_translate(string[] a, string table, string deletechars) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - table, - deletechars, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("translate", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return an array with the elements converted to uppercase. - /// - /// Calls str.upper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Input array. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_upper(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("upper", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the numeric string left-filled with zeros - /// - /// Calls str.zfill element-wise. - /// - /// - /// Input array. - /// - /// - /// Width of string to left-fill elements in a. - /// - /// - /// Output array of str or unicode, depending on input type - /// - public NDarray core_defchararray_zfill(NDarray a, int width) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - width, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("zfill", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 == x2) element-wise. - /// - /// Unlike numpy.equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 != x2) element-wise. - /// - /// Unlike numpy.not_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_not_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("not_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 >= x2) element-wise. - /// - /// Unlike numpy.greater_equal, this comparison is performed by - /// first stripping whitespace characters from the end of the string. - /// This behavior is provided for backward-compatibility with - /// numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_greater_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("greater_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 <= x2) element-wise. - /// - /// Unlike numpy.less_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_less_equal(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("less_equal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 > x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_greater(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("greater", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return (x1 < x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Input arrays of the same shape. - /// - /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. - /// - public NDarray core_defchararray_less(string[] x2, string[] x1) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - x2, - x1, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("less", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns an array with the number of non-overlapping occurrences of - /// substring sub in the range [start, end]. - /// - /// Calls str.count element-wise. - /// - /// - /// The substring to search for. - /// - /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. - /// - /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. - /// - /// - /// Output array of ints. - /// - public NDarray core_defchararray_count(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("count", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element, return the lowest index in the string where - /// substring sub is found. - /// - /// Calls str.find element-wise. - /// - /// For each element, return the lowest index in the string where - /// substring sub is found, such that sub is contained in the - /// range [start, end]. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Output array of ints. Returns -1 if sub is not found. - /// - public NDarray core_defchararray_find(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("find", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Like find, but raises ValueError when the substring is not found. - /// - /// Calls str.index element-wise. - /// - /// - /// Output array of ints. Returns -1 if sub is not found. - /// - public NDarray core_defchararray_index(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("index", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all characters in the string are - /// alphabetic and there is at least one character, false otherwise. - /// - /// Calls str.isalpha element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isalpha(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isalpha", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element, return True if there are only decimal - /// characters in the element. - /// - /// Calls unicode.isdecimal element-wise. - /// - /// Decimal characters include digit characters, and all characters - /// that that can be used to form decimal-radix numbers, - /// e.g. U+0660, ARABIC-INDIC DIGIT ZERO. - /// - /// - /// Input array. - /// - /// - /// Array of booleans identical in shape to a. - /// - public NDarray core_defchararray_isdecimal(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isdecimal", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all characters in the string are - /// digits and there is at least one character, false otherwise. - /// - /// Calls str.isdigit element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isdigit(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isdigit", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all cased characters in the - /// string are lowercase and there is at least one cased character, - /// false otherwise. - /// - /// Calls str.islower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_islower(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("islower", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element, return True if there are only numeric - /// characters in the element. - /// - /// Calls unicode.isnumeric element-wise. - /// - /// Numeric characters include digit characters, and all characters - /// that have the Unicode numeric value property, e.g. U+2155, - /// VULGAR FRACTION ONE FIFTH. - /// - /// - /// Input array. - /// - /// - /// Array of booleans of same shape as a. - /// - public NDarray core_defchararray_isnumeric(NDarray a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isnumeric", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if there are only whitespace - /// characters in the string and there is at least one character, - /// false otherwise. - /// - /// Calls str.isspace element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isspace(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isspace", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if the element is a titlecased - /// string and there is at least one character, false otherwise. - /// - /// Call str.istitle element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_istitle(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("istitle", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns true for each element if all cased characters in the - /// string are uppercase and there is at least one character, false - /// otherwise. - /// - /// Call str.isupper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. - /// - /// - /// Output array of bools - /// - public NDarray core_defchararray_isupper(string[] a) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("isupper", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// For each element in a, return the highest index in the string - /// where substring sub is found, such that sub is contained - /// within [start, end]. - /// - /// Calls str.rfind element-wise. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Optional arguments start and end are interpreted as in - /// slice notation. - /// - /// - /// Output array of ints. Return -1 on failure. - /// - public NDarray core_defchararray_rfind(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("rfind", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Like rfind, but raises ValueError when the substring sub is - /// not found. - /// - /// Calls str.rindex element-wise. - /// - /// - /// Output array of ints. - /// - public NDarray core_defchararray_rindex(string[] a, string sub, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - sub, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("rindex", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Returns a boolean array which is True where the string element - /// in a starts with prefix, otherwise False. - /// - /// Calls str.startswith element-wise. - /// - /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. - /// - /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. - /// - /// - /// Array of booleans - /// - public NDarray core_defchararray_startswith(string[] a, string prefix, int? end = null, int? start = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - a, - prefix, - }); - var kwargs=new PyDict(); - if (end!=null) kwargs["end"]=ToPython(end); - if (start!=null) kwargs["start"]=ToPython(start); - dynamic py = __self__.InvokeMethod("startswith", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. - /// - /// - /// Shape of the array. - /// - /// - /// Length of each array element, in number of characters. Default is 1. - /// - /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. - /// - /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. - /// - /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. - /// - /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. - /// - /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. - /// - public void core_defchararray_chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - { - //auto-generated code, do not change - var core = self.GetAttr("core"); - var defchararray = core.GetAttr("defchararray"); - var __self__=defchararray; - var pyargs=ToTuple(new object[] - { - shape, - }); - var kwargs=new PyDict(); - if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); - if (unicode!=null) kwargs["unicode"]=ToPython(unicode); - if (buffer!=null) kwargs["buffer"]=ToPython(buffer); - if (offset!=null) kwargs["offset"]=ToPython(offset); - if (strides!=null) kwargs["strides"]=ToPython(strides); - if (order!=null) kwargs["order"]=ToPython(order); - dynamic py = __self__.InvokeMethod("chararray", pyargs, kwargs); - } - - } -} diff --git a/src/Numpy/NumPy.window.gen.cs b/src/Numpy/NumPy.window.gen.cs deleted file mode 100644 index b80e162..0000000 --- a/src/Numpy/NumPy.window.gen.cs +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright (c) 2019 by the SciSharp Team -// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion - -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 Python.Included; -using Numpy.Models; - -namespace Numpy -{ - public partial class NumPy - { - - /// - /// Return the Bartlett window. - /// - /// The Bartlett window is very similar to a triangular window, except - /// that the end points are at zero. It is often used in signal - /// processing for tapering a signal, without generating too much - /// ripple in the frequency domain. - /// - /// Notes - /// - /// The Bartlett window is defined as - /// - /// Most references to the Bartlett window come from the signal - /// processing literature, where it is used as one of many windowing - /// functions for smoothing values. Note that convolution with this - /// window produces linear interpolation. It is also known as an - /// apodization (which means”removing the foot”, i.e. smoothing - /// discontinuities at the beginning and end of the sampled signal) or - /// tapering function. The fourier transform of the Bartlett is the product - /// of two sinc functions. - /// Note the excellent discussion in Kanasewich. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The triangular window, with the maximum value normalized to one - /// (the value one appears only if the number of samples is odd), with - /// the first and last samples equal to zero. - /// - public NDarray bartlett(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("bartlett", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Blackman window. - /// - /// The Blackman window is a taper formed by using the first three - /// terms of a summation of cosines. It was designed to have close to the - /// minimal leakage possible. It is close to optimal, only slightly worse - /// than a Kaiser window. - /// - /// Notes - /// - /// The Blackman window is defined as - /// - /// Most references to the Blackman window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. It is known as a - /// “near optimal” tapering function, almost as good (by some measures) - /// as the kaiser window. - /// - /// References - /// - /// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, - /// Dover Publications, New York. - /// - /// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. - /// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. - /// - /// - /// Number of points in the output window. If zero or less, an empty - /// array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value one - /// appears only if the number of samples is odd). - /// - public NDarray blackman(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("blackman", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Hamming window. - /// - /// The Hamming window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hamming window is defined as - /// - /// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey - /// and is described in Blackman and Tukey. It was recommended for - /// smoothing the truncated autocovariance function in the time domain. - /// Most references to the Hamming window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). - /// - public NDarray hamming(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("hamming", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Hanning window. - /// - /// The Hanning window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hanning window is defined as - /// - /// The Hanning was named for Julius von Hann, an Austrian meteorologist. - /// It is also known as the Cosine Bell. Some authors prefer that it be - /// called a Hann window, to help avoid confusion with the very similar - /// Hamming window. - /// - /// Most references to the Hanning window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if M is odd). - /// - public NDarray hanning(int M) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("hanning", pyargs, kwargs); - return ToCsharp(py); - } - - /// - /// Return the Kaiser window. - /// - /// The Kaiser window is a taper formed by using a Bessel function. - /// - /// Notes - /// - /// The Kaiser window is defined as - /// - /// with - /// - /// where is the modified zeroth-order Bessel function. - /// - /// The Kaiser was named for Jim Kaiser, who discovered a simple - /// approximation to the DPSS window based on Bessel functions. The Kaiser - /// window is a very good approximation to the Digital Prolate Spheroidal - /// Sequence, or Slepian window, which is the transform which maximizes the - /// energy in the main lobe of the window relative to total energy. - /// - /// The Kaiser can approximate many other windows by varying the beta - /// parameter. - /// - /// A beta value of 14 is probably a good starting point. Note that as beta - /// gets large, the window narrows, and so the number of samples needs to be - /// large enough to sample the increasingly narrow spike, otherwise NaNs will - /// get returned. - /// - /// Most references to the Kaiser window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References - /// - /// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. - /// - /// - /// Shape parameter for window. - /// - /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). - /// - public NDarray kaiser(int M, float beta) - { - //auto-generated code, do not change - var __self__=self; - var pyargs=ToTuple(new object[] - { - M, - beta, - }); - var kwargs=new PyDict(); - dynamic py = __self__.InvokeMethod("kaiser", pyargs, kwargs); - return ToCsharp(py); - } - - } -} diff --git a/src/Numpy/Numpy.csproj b/src/Numpy/Numpy.csproj index d0ee5da..fd803e2 100644 --- a/src/Numpy/Numpy.csproj +++ b/src/Numpy/Numpy.csproj @@ -8,27 +8,37 @@ Meinrad Recheis Numpy.NET Numpy - C# bindings for NumPy - a fundamental library for scientific computing, machine learning and AI. Does not require a local Python installation! - + C# bindings for NumPy - a fundamental library for scientific computing, machine learning and AI. Does not require a local Python installation! 2019 - Meinrad Recheis https://github.com/SciSharp/Numpy.NET https://github.com/SciSharp/Numpy.NET - Data science, Machine Learning, AI, Scientific Computing, NumPy + Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python https://github.com/SciSharp/Numpy.NET/blob/master/LICENSE - 1.0.1 + 3.11.1.35 + https://github.com/SciSharp/Numpy.NET/blob/master/doc/img/numpy.net.icon128.png?raw=true + 3.10.0.0 + 3.10.0.0 + + + + TRACE;PYTHON_INCLUDED + + + + TRACE;PYTHON_INCLUDED - + - + - - + + diff --git a/src/Numpy/Resources/numpy-1.23.5-cp311-cp311-win_amd64.whl b/src/Numpy/Resources/numpy-1.23.5-cp311-cp311-win_amd64.whl new file mode 100644 index 0000000..b7c3051 Binary files /dev/null and b/src/Numpy/Resources/numpy-1.23.5-cp311-cp311-win_amd64.whl differ diff --git a/src/Numpy/np.array_creation.gen.cs b/src/Numpy/np.array_creation.gen.cs index 1743565..91d706c 100644 --- a/src/Numpy/np.array_creation.gen.cs +++ b/src/Numpy/np.array_creation.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,2838 +20,3525 @@ public static partial class np { /// - /// Return a new array of given shape and type, without initializing entries. - /// - /// Notes - /// - /// empty, unlike zeros, does not set the array values to zero, - /// and may therefore be marginally faster. On the other hand, it requires - /// the user to manually set all the values in the array, and should be - /// used with caution. + /// Return a new array of given shape and type, without initializing entries.

+ /// + /// Notes + /// + /// empty, unlike zeros, does not set the array values to zero, + /// and may therefore be marginally faster.

+ /// On the other hand, it requires + /// the user to manually set all the values in the array, and should be + /// used with caution. ///
/// - /// Shape of the empty array, e.g., (2, 3) or 2. + /// Shape of the empty array, e.g., (2, 3) or 2. /// /// - /// Desired output data-type for the array, e.g, numpy.int8. Default is - /// numpy.float64. + /// Desired output data-type for the array, e.g, numpy.int8. Default is + /// numpy.float64. /// /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. + /// Whether to store multi-dimensional data in row-major + /// (C-style) or column-major (Fortran-style) order in + /// memory. /// /// - /// Array of uninitialized (arbitrary) data of the given shape, dtype, and - /// order. Object arrays will be initialized to None. + /// Array of uninitialized (arbitrary) data of the given shape, dtype, and + /// order.

+ /// Object arrays will be initialized to None. ///
public static NDarray empty(Shape shape, Dtype dtype = null, string order = null) - => NumPy.Instance.empty(shape, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("empty", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. + /// Return a new array with the same shape and type as a given array.

+ /// + /// Notes + /// + /// This function does not initialize the returned array; to do that use + /// zeros_like or ones_like instead.

+ /// It may be marginally faster than + /// the functions that do set the array values. ///
/// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. + /// The shape and data-type of prototype define these same attributes + /// of the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran + /// contiguous, ‘C’ otherwise.

+ /// ‘K’ means match the layout of prototype + /// as closely as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. + /// Array of uninitialized (arbitrary) data with the same + /// shape and type as prototype. /// public static NDarray empty_like(NDarray prototype, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.empty_like(prototype, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + prototype, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. + /// Return a new array with the same shape and type as a given array.

+ /// + /// Notes + /// + /// This function does not initialize the returned array; to do that use + /// zeros_like or ones_like instead.

+ /// It may be marginally faster than + /// the functions that do set the array values. ///
/// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. + /// The shape and data-type of prototype define these same attributes + /// of the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran + /// contiguous, ‘C’ otherwise.

+ /// ‘K’ means match the layout of prototype + /// as closely as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. + /// Array of uninitialized (arbitrary) data with the same + /// shape and type as prototype. /// public static NDarray empty_like(T[] prototype, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.empty_like(prototype, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(prototype), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a new array with the same shape and type as a given array. - /// - /// Notes - /// - /// This function does not initialize the returned array; to do that use - /// zeros_like or ones_like instead. It may be marginally faster than - /// the functions that do set the array values. + /// Return a new array with the same shape and type as a given array.

+ /// + /// Notes + /// + /// This function does not initialize the returned array; to do that use + /// zeros_like or ones_like instead.

+ /// It may be marginally faster than + /// the functions that do set the array values. ///
/// - /// The shape and data-type of prototype define these same attributes - /// of the returned array. + /// The shape and data-type of prototype define these same attributes + /// of the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran - /// contiguous, ‘C’ otherwise. ‘K’ means match the layout of prototype - /// as closely as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if prototype is Fortran + /// contiguous, ‘C’ otherwise.

+ /// ‘K’ means match the layout of prototype + /// as closely as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of uninitialized (arbitrary) data with the same - /// shape and type as prototype. + /// Array of uninitialized (arbitrary) data with the same + /// shape and type as prototype. /// public static NDarray empty_like(T[,] prototype, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.empty_like(prototype, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(prototype), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("empty_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a 2-D array with ones on the diagonal and zeros elsewhere. + /// Return a 2-D array with ones on the diagonal and zeros elsewhere. /// /// - /// Number of rows in the output. + /// Number of rows in the output. /// /// - /// Number of columns in the output. If None, defaults to N. + /// Number of columns in the output.

+ /// If None, defaults to N. /// /// - /// Index of the diagonal: 0 (the default) refers to the main diagonal, - /// a positive value refers to an upper diagonal, and a negative value - /// to a lower diagonal. + /// Index of the diagonal: 0 (the default) refers to the main diagonal, + /// a positive value refers to an upper diagonal, and a negative value + /// to a lower diagonal. /// /// - /// Data-type of the returned array. + /// Data-type of the returned array. /// /// - /// Whether the output should be stored in row-major (C-style) or - /// column-major (Fortran-style) order in memory. + /// Whether the output should be stored in row-major (C-style) or + /// column-major (Fortran-style) order in memory. /// /// - /// An array where all elements are equal to zero, except for the k-th - /// diagonal, whose values are equal to one. + /// An array where all elements are equal to zero, except for the k-th + /// diagonal, whose values are equal to one. /// public static NDarray eye(int N, int? M = null, int? k = 0, Dtype dtype = null, string order = null) - => NumPy.Instance.eye(N, M:M, k:k, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + N, + }); + var kwargs=new PyDict(); + if (M!=null) kwargs["M"]=ToPython(M); + if (k!=0) kwargs["k"]=ToPython(k); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("eye", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the identity array. - /// - /// The identity array is a square array with ones on - /// the main diagonal. + /// Return the identity array.

+ /// + /// The identity array is a square array with ones on + /// the main diagonal. ///
/// - /// Number of rows (and columns) in n x n output. + /// Number of rows (and columns) in n x n output. /// /// - /// Data-type of the output. Defaults to float. + /// Data-type of the output.

+ /// Defaults to float. /// /// - /// n x n array with its main diagonal set to one, - /// and all other elements 0. + /// n x n array with its main diagonal set to one, + /// and all other elements 0. /// public static NDarray identity(int n, Dtype dtype = null) - => NumPy.Instance.identity(n, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + n, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("identity", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a new array of given shape and type, filled with ones. + /// Return a new array of given shape and type, filled with ones. /// /// - /// Shape of the new array, e.g., (2, 3) or 2. + /// Shape of the new array, e.g., (2, 3) or 2. /// /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. + /// The desired data-type for the array, e.g., numpy.int8. Default is + /// numpy.float64. /// /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. + /// Whether to store multi-dimensional data in row-major + /// (C-style) or column-major (Fortran-style) order in + /// memory. /// /// - /// Array of ones with the given shape, dtype, and order. + /// Array of ones with the given shape, dtype, and order. /// public static NDarray ones(Shape shape, Dtype dtype = null, string order = null) - => NumPy.Instance.ones(shape, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("ones", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return an array of ones with the same shape and type as a given array. + /// Return an array of ones with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of ones with the same shape and type as a. + /// Array of ones with the same shape and type as a. /// public static NDarray ones_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.ones_like(a, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return an array of ones with the same shape and type as a given array. + /// Return an array of ones with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of ones with the same shape and type as a. + /// Array of ones with the same shape and type as a. /// public static NDarray ones_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.ones_like(a, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return an array of ones with the same shape and type as a given array. + /// Return an array of ones with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of ones with the same shape and type as a. + /// Array of ones with the same shape and type as a. /// public static NDarray ones_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.ones_like(a, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("ones_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a new array of given shape and type, filled with zeros. + /// Return a new array of given shape and type, filled with zeros. /// /// - /// Shape of the new array, e.g., (2, 3) or 2. + /// Shape of the new array, e.g., (2, 3) or 2. /// /// - /// The desired data-type for the array, e.g., numpy.int8. Default is - /// numpy.float64. + /// The desired data-type for the array, e.g., numpy.int8. Default is + /// numpy.float64. /// /// - /// Whether to store multi-dimensional data in row-major - /// (C-style) or column-major (Fortran-style) order in - /// memory. + /// Whether to store multi-dimensional data in row-major + /// (C-style) or column-major (Fortran-style) order in + /// memory. /// /// - /// Array of zeros with the given shape, dtype, and order. + /// Array of zeros with the given shape, dtype, and order. /// public static NDarray zeros(Shape shape, Dtype dtype = null, string order = null) - => NumPy.Instance.zeros(shape, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("zeros", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return an array of zeros with the same shape and type as a given array. + /// Return an array of zeros with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of zeros with the same shape and type as a. + /// Array of zeros with the same shape and type as a. /// public static NDarray zeros_like(NDarray a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.zeros_like(a, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return an array of zeros with the same shape and type as a given array. + /// Return an array of zeros with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of zeros with the same shape and type as a. + /// Array of zeros with the same shape and type as a. /// public static NDarray zeros_like(T[] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.zeros_like(a, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return an array of zeros with the same shape and type as a given array. + /// Return an array of zeros with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of zeros with the same shape and type as a. + /// Array of zeros with the same shape and type as a. /// public static NDarray zeros_like(T[,] a, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.zeros_like(a, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("zeros_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a new array of given shape and type, filled with fill_value. + /// Return a new array of given shape and type, filled with fill_value. /// /// - /// Shape of the new array, e.g., (2, 3) or 2. + /// Shape of the new array, e.g., (2, 3) or 2. /// /// - /// Fill value. + /// Fill value. /// /// - /// Whether to store multidimensional data in C- or Fortran-contiguous - /// (row- or column-wise) order in memory. + /// Whether to store multidimensional data in C- or Fortran-contiguous + /// (row- or column-wise) order in memory. /// /// - /// Array of fill_value with the given shape, dtype, and order. + /// Array of fill_value with the given shape, dtype, and order. /// public static NDarray full(Shape shape, ValueType fill_value, Dtype dtype = null, string order = null) - => NumPy.Instance.full(shape, fill_value, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + shape, + fill_value, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("full", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a full array with the same shape and type as a given array. + /// Return a full array with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Fill value. + /// Fill value. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of fill_value with the same shape and type as a. + /// Array of fill_value with the same shape and type as a. /// public static NDarray full_like(NDarray a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.full_like(a, fill_value, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + fill_value, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a full array with the same shape and type as a given array. + /// Return a full array with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Fill value. + /// Fill value. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of fill_value with the same shape and type as a. + /// Array of fill_value with the same shape and type as a. /// public static NDarray full_like(T[] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.full_like(a, fill_value, dtype:dtype, order:order, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + fill_value, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a full array with the same shape and type as a given array. + /// Return a full array with the same shape and type as a given array. /// /// - /// The shape and data-type of a define these same attributes of - /// the returned array. + /// The shape and data-type of a define these same attributes of + /// the returned array. /// /// - /// Fill value. + /// Fill value. /// /// - /// Overrides the data type of the result. + /// Overrides the data type of the result. /// /// - /// Overrides the memory layout of the result. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. + /// Overrides the memory layout of the result.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible. /// /// - /// If True, then the newly created array will use the sub-class - /// type of ‘a’, otherwise it will be a base-class array. Defaults - /// to True. + /// If True, then the newly created array will use the sub-class + /// type of ‘a’, otherwise it will be a base-class array.

+ /// Defaults + /// to True. /// /// - /// Array of fill_value with the same shape and type as a. + /// Array of fill_value with the same shape and type as a. /// public static NDarray full_like(T[,] a, ValueType fill_value, Dtype dtype = null, string order = null, bool? subok = true) - => NumPy.Instance.full_like(a, fill_value, dtype:dtype, order:order, subok:subok); - - /// - /// Create an array. - /// - /// Notes - /// - /// When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, - /// and a copy is forced by a change in dtype, then the order of the result is - /// not necessarily ‘C’ as expected. This is likely a bug. - /// - /// - /// An array, any object exposing the array interface, an object whose - /// __array__ method returns an array, or any (nested) sequence. - /// - /// - /// The desired data-type for the array. If not given, then the type will - /// be determined as the minimum type required to hold the objects in the - /// sequence. This argument can only be used to ‘upcast’ the array. For - /// downcasting, use the .astype(t) method. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy will - /// only be made if __array__ returns a copy, if obj is a nested sequence, - /// or if a copy is needed to satisfy any of the other requirements - /// (dtype, order, etc.). - /// - /// - /// Specify the memory layout of the array. If object is not an array, the - /// newly created array will be in C order (row major) unless ‘F’ is - /// specified, in which case it will be in Fortran order (column major). - /// If object is an array the following holds. - /// - /// When copy=False and a copy is made for other reasons, the result is - /// the same as if copy=True, with some exceptions for A, see the - /// Notes section. The default order is ‘K’. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// Specifies the minimum number of dimensions that the resulting - /// array should have. Ones will be pre-pended to the shape as - /// needed to meet this requirement. - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(NDarray @object, Dtype dtype = null, bool? copy = true, string order = null, bool? subok = false, int? ndmin = 0) - => NumPy.Instance.array(@object, dtype:dtype, copy:copy, order:order, subok:subok, ndmin:ndmin); - - /// - /// Create an array. - /// - /// Notes - /// - /// When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, - /// and a copy is forced by a change in dtype, then the order of the result is - /// not necessarily ‘C’ as expected. This is likely a bug. - /// - /// - /// An array, any object exposing the array interface, an object whose - /// __array__ method returns an array, or any (nested) sequence. - /// - /// - /// The desired data-type for the array. If not given, then the type will - /// be determined as the minimum type required to hold the objects in the - /// sequence. This argument can only be used to ‘upcast’ the array. For - /// downcasting, use the .astype(t) method. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy will - /// only be made if __array__ returns a copy, if obj is a nested sequence, - /// or if a copy is needed to satisfy any of the other requirements - /// (dtype, order, etc.). - /// - /// - /// Specify the memory layout of the array. If object is not an array, the - /// newly created array will be in C order (row major) unless ‘F’ is - /// specified, in which case it will be in Fortran order (column major). - /// If object is an array the following holds. - /// - /// When copy=False and a copy is made for other reasons, the result is - /// the same as if copy=True, with some exceptions for A, see the - /// Notes section. The default order is ‘K’. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// Specifies the minimum number of dimensions that the resulting - /// array should have. Ones will be pre-pended to the shape as - /// needed to meet this requirement. - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(T[] @object, Dtype dtype = null, bool? copy = true, string order = null, bool? subok = false, int? ndmin = 0) - => NumPy.Instance.array(@object, dtype:dtype, copy:copy, order:order, subok:subok, ndmin:ndmin); - - /// - /// Create an array. - /// - /// Notes - /// - /// When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, - /// and a copy is forced by a change in dtype, then the order of the result is - /// not necessarily ‘C’ as expected. This is likely a bug. - /// - /// - /// An array, any object exposing the array interface, an object whose - /// __array__ method returns an array, or any (nested) sequence. - /// - /// - /// The desired data-type for the array. If not given, then the type will - /// be determined as the minimum type required to hold the objects in the - /// sequence. This argument can only be used to ‘upcast’ the array. For - /// downcasting, use the .astype(t) method. - /// - /// - /// If true (default), then the object is copied. Otherwise, a copy will - /// only be made if __array__ returns a copy, if obj is a nested sequence, - /// or if a copy is needed to satisfy any of the other requirements - /// (dtype, order, etc.). - /// - /// - /// Specify the memory layout of the array. If object is not an array, the - /// newly created array will be in C order (row major) unless ‘F’ is - /// specified, in which case it will be in Fortran order (column major). - /// If object is an array the following holds. - /// - /// When copy=False and a copy is made for other reasons, the result is - /// the same as if copy=True, with some exceptions for A, see the - /// Notes section. The default order is ‘K’. - /// - /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned array will be forced to be a base-class array (default). - /// - /// - /// Specifies the minimum number of dimensions that the resulting - /// array should have. Ones will be pre-pended to the shape as - /// needed to meet this requirement. - /// - /// - /// An array object satisfying the specified requirements. - /// - public static NDarray array(T[,] @object, Dtype dtype = null, bool? copy = true, string order = null, bool? subok = false, int? ndmin = 0) - => NumPy.Instance.array(@object, dtype:dtype, copy:copy, order:order, subok:subok, ndmin:ndmin); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + fill_value, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + if (subok!=true) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("full_like", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Convert the input to an array. + /// Convert the input to an array. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes lists, lists of tuples, tuples, tuples of tuples, tuples + /// of lists and ndarrays. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. + /// Array interpretation of a.

+ /// No copy is performed if the input + /// is already an ndarray with matching dtype and order.

+ /// If a is a + /// subclass of ndarray, a base class ndarray is returned. ///
public static NDarray asarray(NDarray a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray(a, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Convert the input to an array. + /// Convert the input to an array. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes lists, lists of tuples, tuples, tuples of tuples, tuples + /// of lists and ndarrays. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. + /// Array interpretation of a.

+ /// No copy is performed if the input + /// is already an ndarray with matching dtype and order.

+ /// If a is a + /// subclass of ndarray, a base class ndarray is returned. ///
public static NDarray asarray(T[] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray(a, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Convert the input to an array. + /// Convert the input to an array. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes lists, lists of tuples, tuples, tuples of tuples, tuples + /// of lists and ndarrays. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// 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 with matching dtype and order. If a is a - /// subclass of ndarray, a base class ndarray is returned. + /// Array interpretation of a.

+ /// No copy is performed if the input + /// is already an ndarray with matching dtype and order.

+ /// If a is a + /// subclass of ndarray, a base class ndarray is returned. ///
public static NDarray asarray(T[,] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray(a, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. + /// Convert the input to an ndarray, but pass ndarray subclasses through. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, + /// tuples of lists, and ndarrays. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// Whether to use row-major (C-style) or column-major + /// (Fortran-style) memory representation.

+ /// Defaults to ‘C’. /// /// - /// Array interpretation of a. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. + /// Array interpretation of a.

+ /// If a is an ndarray or a subclass + /// of ndarray, it is returned as-is and no copy is performed. ///
public static NDarray asanyarray(NDarray a, Dtype dtype = null, string order = null) - => NumPy.Instance.asanyarray(a, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. + /// Convert the input to an ndarray, but pass ndarray subclasses through. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, + /// tuples of lists, and ndarrays. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// Whether to use row-major (C-style) or column-major + /// (Fortran-style) memory representation.

+ /// Defaults to ‘C’. /// /// - /// Array interpretation of a. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. + /// Array interpretation of a.

+ /// If a is an ndarray or a subclass + /// of ndarray, it is returned as-is and no copy is performed. ///
public static NDarray asanyarray(T[] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asanyarray(a, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Convert the input to an ndarray, but pass ndarray subclasses through. + /// Convert the input to an ndarray, but pass ndarray subclasses through. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, - /// tuples of lists, and ndarrays. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes scalars, lists, lists of tuples, tuples, tuples of tuples, + /// tuples of lists, and ndarrays. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// Whether to use row-major (C-style) or column-major + /// (Fortran-style) memory representation.

+ /// Defaults to ‘C’. /// /// - /// Array interpretation of a. If a is an ndarray or a subclass - /// of ndarray, it is returned as-is and no copy is performed. + /// Array interpretation of a.

+ /// If a is an ndarray or a subclass + /// of ndarray, it is returned as-is and no copy is performed. ///
public static NDarray asanyarray(T[,] a, Dtype dtype = null, string order = null) - => NumPy.Instance.asanyarray(a, dtype:dtype, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asanyarray", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a contiguous array (ndim >= 1) in memory (C order). + /// Return a contiguous array (ndim >= 1) in memory (C order). /// /// - /// Input array. + /// Input array. /// /// - /// Data-type of returned array. + /// Data-type of returned array. /// /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. + /// Contiguous array of same shape and content as a, with type dtype + /// if specified. /// public static NDarray ascontiguousarray(NDarray a, Dtype dtype = null) - => NumPy.Instance.ascontiguousarray(a, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a contiguous array (ndim >= 1) in memory (C order). + /// Return a contiguous array (ndim >= 1) in memory (C order). /// /// - /// Input array. + /// Input array. /// /// - /// Data-type of returned array. + /// Data-type of returned array. /// /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. + /// Contiguous array of same shape and content as a, with type dtype + /// if specified. /// public static NDarray ascontiguousarray(T[] a, Dtype dtype = null) - => NumPy.Instance.ascontiguousarray(a, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return a contiguous array (ndim >= 1) in memory (C order). + /// Return a contiguous array (ndim >= 1) in memory (C order). /// /// - /// Input array. + /// Input array. /// /// - /// Data-type of returned array. + /// Data-type of returned array. /// /// - /// Contiguous array of same shape and content as a, with type dtype - /// if specified. + /// Contiguous array of same shape and content as a, with type dtype + /// if specified. /// public static NDarray ascontiguousarray(T[,] a, Dtype dtype = null) - => NumPy.Instance.ascontiguousarray(a, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("ascontiguousarray", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). + /// Interpret the input as a matrix.

+ /// + /// Unlike matrix, asmatrix does not make a copy if the input is already + /// a matrix or an ndarray.

+ /// Equivalent to matrix(data, copy=False). ///
/// - /// Input data. + /// Input data. /// /// - /// Data-type of the output matrix. + /// Data-type of the output matrix. /// /// - /// data interpreted as a matrix. + /// data interpreted as a matrix. /// public static Matrix asmatrix(NDarray data, Dtype dtype) - => NumPy.Instance.asmatrix(data, dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + data, + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). + /// Interpret the input as a matrix.

+ /// + /// Unlike matrix, asmatrix does not make a copy if the input is already + /// a matrix or an ndarray.

+ /// Equivalent to matrix(data, copy=False). ///
/// - /// Input data. + /// Input data. /// /// - /// Data-type of the output matrix. + /// Data-type of the output matrix. /// /// - /// data interpreted as a matrix. + /// data interpreted as a matrix. /// public static Matrix asmatrix(T[] data, Dtype dtype) - => NumPy.Instance.asmatrix(data, dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(data), + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). + /// Interpret the input as a matrix.

+ /// + /// Unlike matrix, asmatrix does not make a copy if the input is already + /// a matrix or an ndarray.

+ /// Equivalent to matrix(data, copy=False). ///
/// - /// Input data. + /// Input data. /// /// - /// Data-type of the output matrix. + /// Data-type of the output matrix. /// /// - /// data interpreted as a matrix. + /// data interpreted as a matrix. /// public static Matrix asmatrix(T[,] data, Dtype dtype) - => NumPy.Instance.asmatrix(data, dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(data), + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("asmatrix", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: + /// Return an array copy of the given object.

+ /// + /// Notes + /// + /// This is equivalent to: ///
/// - /// Input data. + /// Input data. /// /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) + /// Controls the memory layout of the copy.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible.

+ /// (Note that this function and ndarray.copy are very + /// similar, but have different default values for their order= + /// arguments.) /// /// - /// Array interpretation of a. + /// Array interpretation of a. /// public static NDarray copy(NDarray a, string order = null) - => NumPy.Instance.copy(a, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: + /// Return an array copy of the given object.

+ /// + /// Notes + /// + /// This is equivalent to: ///
/// - /// Input data. + /// Input data. /// /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) + /// Controls the memory layout of the copy.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible.

+ /// (Note that this function and ndarray.copy are very + /// similar, but have different default values for their order= + /// arguments.) /// /// - /// Array interpretation of a. + /// Array interpretation of a. /// public static NDarray copy(T[] a, string order = null) - => NumPy.Instance.copy(a, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return an array copy of the given object. - /// - /// Notes - /// - /// This is equivalent to: + /// Return an array copy of the given object.

+ /// + /// Notes + /// + /// This is equivalent to: ///
/// - /// Input data. + /// Input data. /// /// - /// Controls the memory layout of the copy. ‘C’ means C-order, - /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, - /// ‘C’ otherwise. ‘K’ means match the layout of a as closely - /// as possible. (Note that this function and ndarray.copy are very - /// similar, but have different default values for their order= - /// arguments.) + /// Controls the memory layout of the copy.

+ /// ‘C’ means C-order, + /// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, + /// ‘C’ otherwise.

+ /// ‘K’ means match the layout of a as closely + /// as possible.

+ /// (Note that this function and ndarray.copy are very + /// similar, but have different default values for their order= + /// arguments.) /// /// - /// Array interpretation of a. + /// Array interpretation of a. /// public static NDarray copy(T[,] a, string order = null) - => NumPy.Instance.copy(a, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(a), + }); + var kwargs=new PyDict(); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs); + return ToCsharp>(py); + } /* /// - /// Interpret a buffer as a 1-dimensional array. - /// - /// Notes - /// - /// If the buffer has data that is not in machine byte-order, this should - /// be specified as part of the data-type, e.g.: - /// - /// The data of the resulting array will not be byteswapped, but will be - /// interpreted correctly. + /// Interpret a buffer as a 1-dimensional array.

+ /// + /// Notes + /// + /// If the buffer has data that is not in machine byte-order, this should + /// be specified as part of the data-type, e.g.: + /// + /// The data of the resulting array will not be byteswapped, but will be + /// interpreted correctly. ///
/// - /// An object that exposes the buffer interface. + /// An object that exposes the buffer interface. /// /// - /// Data-type of the returned array; default: float. + /// Data-type of the returned array; default: float. /// /// - /// Number of items to read. -1 means all data in the buffer. + /// Number of items to read.

+ /// -1 means all data in the buffer. /// /// - /// Start reading the buffer from this offset (in bytes); default: 0. + /// Start reading the buffer from this offset (in bytes); default: 0. /// public static void frombuffer(buffer_like buffer, Dtype dtype = null, int? count = -1, int? offset = 0) - => NumPy.Instance.frombuffer(buffer, dtype:dtype, count:count, offset:offset); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + buffer, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (count!=-1) kwargs["count"]=ToPython(count); + if (offset!=0) kwargs["offset"]=ToPython(offset); + dynamic py = __self__.InvokeMethod("frombuffer", pyargs, kwargs); + } */ /// - /// Construct an array from data in a text or binary file. - /// - /// A highly efficient way of reading binary data with a known data-type, - /// as well as parsing simply formatted text files. Data written using the - /// tofile method can be read using this function. - /// - /// Notes - /// - /// Do not rely on the combination of tofile and fromfile for - /// data storage, as the binary files generated are are not platform - /// independent. In particular, no byte-order or data-type information is - /// saved. Data can be stored in the platform independent .npy format - /// using save and load instead. + /// Construct an array from data in a text or binary file.

+ /// + /// A highly efficient way of reading binary data with a known data-type, + /// as well as parsing simply formatted text files.

+ /// Data written using the + /// tofile method can be read using this function.

+ /// + /// Notes + /// + /// Do not rely on the combination of tofile and fromfile for + /// data storage, as the binary files generated are are not platform + /// independent.

+ /// In particular, no byte-order or data-type information is + /// saved.

+ /// Data can be stored in the platform independent .npy format + /// using save and load instead. ///
/// - /// Open file object or filename. + /// Open file object or filename. /// /// - /// Data type of the returned array. - /// For binary files, it is used to determine the size and byte-order - /// of the items in the file. + /// Data type of the returned array.

+ /// + /// For binary files, it is used to determine the size and byte-order + /// of the items in the file. /// /// - /// Number of items to read. -1 means all items (i.e., the complete - /// file). + /// Number of items to read.

+ /// -1 means all items (i.e., the complete + /// file). /// /// - /// Separator between items if file is a text file. - /// Empty (“”) separator means the file should be treated as binary. - /// Spaces (” “) in the separator match zero or more whitespace characters. - /// A separator consisting only of spaces must match at least one - /// whitespace. - /// - public static void fromfile(string file, Dtype dtype = null, int count = -1, string sep = "") - => NumPy.Instance.fromfile(file, dtype, count, sep); + /// Separator between items if file is a text file.

+ /// + /// Empty (“”) separator means the file should be treated as binary.

+ /// + /// Spaces (” “) in the separator match zero or more whitespace characters.

+ /// + /// A separator consisting only of spaces must match at least one + /// whitespace. + /// + public static NDarray fromfile(string file, Dtype dtype = null, int count = -1, string sep = "") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + file, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (count!=-1) kwargs["count"]=ToPython(count); + if (sep!="") kwargs["sep"]=ToPython(sep); + dynamic py = __self__.InvokeMethod("fromfile", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Construct an array by executing a function over each coordinate. - /// - /// The resulting array therefore has a value fn(x, y, z) at - /// coordinate (x, y, z). - /// - /// Notes - /// - /// Keywords other than dtype are passed to function. + /// Construct an array by executing a function over each coordinate.

+ /// + /// The resulting array therefore has a value fn(x, y, z) at + /// coordinate (x, y, z).

+ /// + /// Notes + /// + /// Keywords other than dtype are passed to function. ///
/// - /// The function is called with N parameters, where N is the rank of - /// shape. Each parameter represents the coordinates of the array - /// varying along a specific axis. For example, if shape - /// were (2, 2), then the parameters would be - /// array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]]) + /// The function is called with N parameters, where N is the rank of + /// shape.

+ /// Each parameter represents the coordinates of the array + /// varying along a specific axis.

+ /// For example, if shape + /// were (2, 2), then the parameters would be + /// array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]]) /// /// - /// Shape of the output array, which also determines the shape of - /// the coordinate arrays passed to function. + /// Shape of the output array, which also determines the shape of + /// the coordinate arrays passed to function. /// /// - /// Data-type of the coordinate arrays passed to function. - /// By default, dtype is float. + /// Data-type of the coordinate arrays passed to function.

+ /// + /// By default, dtype is float. /// /// - /// The result of the call to function is passed back directly. - /// Therefore the shape of fromfunction is completely determined by - /// function. If function returns a scalar value, the shape of - /// fromfunction would not match the shape parameter. + /// The result of the call to function is passed back directly.

+ /// + /// Therefore the shape of fromfunction is completely determined by + /// function.

+ /// If function returns a scalar value, the shape of + /// fromfunction would not match the shape parameter. ///
public static object fromfunction(Delegate function, Shape shape, Dtype dtype = null) - => NumPy.Instance.fromfunction(function, shape, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + function, + shape, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("fromfunction", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Create a new 1-dimensional array from an iterable object. - /// - /// Notes - /// - /// Specify count to improve performance. It allows fromiter to - /// pre-allocate the output array, instead of resizing it on demand. + /// Create a new 1-dimensional array from an iterable object.

+ /// + /// Notes + /// + /// Specify count to improve performance.

+ /// It allows fromiter to + /// pre-allocate the output array, instead of resizing it on demand. ///
/// - /// An iterable object providing data for the array. + /// An iterable object providing data for the array. /// /// - /// The data-type of the returned array. + /// The data-type of the returned array. /// /// - /// The number of items to read from iterable. The default is -1, - /// which means all data is read. + /// The number of items to read from iterable.

+ /// The default is -1, + /// which means all data is read. /// /// - /// The output array. + /// The output array. /// public static NDarray fromiter(IEnumerable iterable, Dtype dtype, int? count = -1) - => NumPy.Instance.fromiter(iterable, dtype, count:count); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + iterable, + dtype, + }); + var kwargs=new PyDict(); + if (count!=-1) kwargs["count"]=ToPython(count); + dynamic py = __self__.InvokeMethod("fromiter", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// A new 1-D array initialized from text data in a string. + /// A new 1-D array initialized from text data in a string. /// - /// - /// A string containing the data. + /// + /// A string containing the data. /// /// - /// The data type of the array; default: float. For binary input data, - /// the data must be in exactly this format. + /// The data type of the array; default: float.

+ /// For binary input data, + /// the data must be in exactly this format. /// /// - /// Read this number of dtype elements from the data. If this is - /// negative (the default), the count will be determined from the - /// length of the data. + /// Read this number of dtype elements from the data.

+ /// If this is + /// negative (the default), the count will be determined from the + /// length of the data. /// /// - /// The string separating numbers in the data; extra whitespace between - /// elements is also ignored. + /// The string separating numbers in the data; extra whitespace between + /// elements is also ignored. /// /// - /// The constructed array. + /// The constructed array. /// public static NDarray fromstring(string @string, Dtype dtype = null, int? count = -1, string sep = "") - => NumPy.Instance.fromstring(@string, dtype:dtype, count:count, sep:sep); - - /// - /// Load data from a text file. - /// - /// Each row in the text file must have the same number of values. - /// - /// Notes - /// - /// This function aims to be a fast reader for simply formatted files. The - /// genfromtxt function provides more sophisticated handling of, e.g., - /// lines with missing values. - /// - /// The strings produced by the Python float.hex method can be used as - /// input for floats. + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + @string, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (count!=-1) kwargs["count"]=ToPython(count); + if (sep!="") kwargs["sep"]=ToPython(sep); + dynamic py = __self__.InvokeMethod("fromstring", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Load data from a text file.

+ /// + /// Each row in the text file must have the same number of values.

+ /// + /// Notes + /// + /// This function aims to be a fast reader for simply formatted files.

+ /// The + /// genfromtxt function provides more sophisticated handling of, e.g., + /// lines with missing values.

+ /// + /// The strings produced by the Python float.hex method can be used as + /// input for floats. ///
/// - /// File, filename, or generator to read. If the filename extension is - /// .gz or .bz2, the file is first decompressed. Note that - /// generators should return byte strings for Python 3k. + /// File, filename, or generator to read.

+ /// If the filename extension is + /// .gz or .bz2, the file is first decompressed.

+ /// Note that + /// generators should return byte strings for Python 3k. /// /// - /// Data-type of the resulting array; default: float. If this is a - /// structured data-type, the resulting array will be 1-dimensional, and - /// each row will be interpreted as an element of the array. In this - /// case, the number of columns used must match the number of fields in - /// the data-type. + /// Data-type of the resulting array; default: float.

+ /// If this is a + /// structured data-type, the resulting array will be 1-dimensional, and + /// each row will be interpreted as an element of the array.

+ /// In this + /// case, the number of columns used must match the number of fields in + /// the data-type. /// /// - /// The characters or list of characters used to indicate the start of a - /// comment. None implies no comments. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is ‘#’. + /// The characters or list of characters used to indicate the start of a + /// comment.

+ /// None implies no comments.

+ /// For backwards compatibility, byte + /// strings will be decoded as ‘latin1’. The default is ‘#’. /// /// - /// The string used to separate values. For backwards compatibility, byte - /// strings will be decoded as ‘latin1’. The default is whitespace. + /// The string used to separate values.

+ /// For backwards compatibility, byte + /// strings will be decoded as ‘latin1’. The default is whitespace. /// /// - /// A dictionary mapping column number to a function that will parse the - /// column string into the desired value. E.g., if column 0 is a date - /// string: converters = {0: datestr2num}. Converters can also be - /// used to provide a default value for missing data (but see also - /// genfromtxt): converters = {3: lambda s: float(s.strip() or 0)}. - /// Default: None. + /// A dictionary mapping column number to a function that will parse the + /// column string into the desired value.

+ /// E.g., if column 0 is a date + /// string: converters = {0: datestr2num}. Converters can also be + /// used to provide a default value for missing data (but see also + /// genfromtxt): converters = {3: lambda s: float(s.strip() or 0)}. + /// Default: None. /// /// - /// Skip the first skiprows lines; default: 0. + /// Skip the first skiprows lines; default: 0. /// /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1,4,5) will extract the 2nd, 5th and 6th columns. - /// The default, None, results in all columns being read. + /// Which columns to read, with 0 being the first.

+ /// For example, + /// usecols = (1,4,5) will extract the 2nd, 5th and 6th columns.

+ /// + /// The default, None, results in all columns being read. /// /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...). When used with a structured - /// data-type, arrays are returned for each field. Default is False. + /// If True, the returned array is transposed, so that arguments may be + /// unpacked using x, y, z = loadtxt(...).

+ /// When used with a structured + /// data-type, arrays are returned for each field.

+ /// Default is False. /// /// - /// The returned array will have at least ndmin dimensions. - /// Otherwise mono-dimensional axes will be squeezed. - /// Legal values: 0 (default), 1 or 2. + /// The returned array will have at least ndmin dimensions.

+ /// + /// Otherwise mono-dimensional axes will be squeezed.

+ /// + /// Legal values: 0 (default), 1 or 2. /// /// - /// Encoding used to decode the inputfile. Does not apply to input streams. - /// The special value ‘bytes’ enables backward compatibility workarounds - /// that ensures you receive byte arrays as results if possible and passes - /// ‘latin1’ encoded strings to converters. Override this value to receive - /// unicode arrays and pass strings as input to converters. If set to None - /// the system default is used. The default value is ‘bytes’. + /// Encoding used to decode the inputfile.

+ /// Does not apply to input streams.

+ /// + /// The special value ‘bytes’ enables backward compatibility workarounds + /// that ensures you receive byte arrays as results if possible and passes + /// ‘latin1’ encoded strings to converters.

+ /// Override this value to receive + /// unicode arrays and pass strings as input to converters.

+ /// If set to None + /// the system default is used.

+ /// The default value is ‘bytes’. /// /// - /// Read max_rows lines of content after skiprows lines. The default - /// is to read all the lines. + /// Read max_rows lines of content after skiprows lines.

+ /// The default + /// is to read all the lines. /// /// - /// Data read from the text file. + /// Data read from the text file. /// public static NDarray loadtxt(string fname, Dtype dtype = null, string[] comments = null, string delimiter = null, Hashtable converters = null, int? skiprows = 0, int[] usecols = null, bool? unpack = false, int? ndmin = 0, string encoding = "bytes", int? max_rows = null) - => NumPy.Instance.loadtxt(fname, dtype:dtype, comments:comments, delimiter:delimiter, converters:converters, skiprows:skiprows, usecols:usecols, unpack:unpack, ndmin:ndmin, encoding:encoding, max_rows:max_rows); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + fname, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (comments!=null) kwargs["comments"]=ToPython(comments); + if (delimiter!=null) kwargs["delimiter"]=ToPython(delimiter); + if (converters!=null) kwargs["converters"]=ToPython(converters); + if (skiprows!=0) kwargs["skiprows"]=ToPython(skiprows); + if (usecols!=null) kwargs["usecols"]=ToPython(usecols); + if (unpack!=false) kwargs["unpack"]=ToPython(unpack); + if (ndmin!=0) kwargs["ndmin"]=ToPython(ndmin); + if (encoding!="bytes") kwargs["encoding"]=ToPython(encoding); + if (max_rows!=null) kwargs["max_rows"]=ToPython(max_rows); + dynamic py = __self__.InvokeMethod("loadtxt", pyargs, kwargs); + return ToCsharp(py); + } public static partial class core { public static partial class defchararray { /// - /// Create a chararray. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: + /// Create a chararray.

+ /// + /// Versus a regular NumPy array of type str or unicode, this + /// class adds the following functionality: ///
/// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. + /// itemsize is the number of characters per scalar in the + /// resulting array.

+ /// If itemsize is None, and obj is an + /// object array or a Python list, the itemsize will be + /// automatically determined.

+ /// If itemsize is provided and obj + /// is of type str or unicode, then the obj string will be + /// chunked into itemsize pieces. /// /// - /// If true (default), then the object is copied. Otherwise, a copy - /// will only be made if __array__ returns a copy, if obj is a - /// nested sequence, or if a copy is needed to satisfy any of the other - /// requirements (itemsize, unicode, order, etc.). + /// If true (default), then the object is copied.

+ /// Otherwise, a copy + /// will only be made if __array__ returns a copy, if obj is a + /// nested sequence, or if a copy is needed to satisfy any of the other + /// requirements (itemsize, unicode, order, etc.). /// /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. + /// When true, the resulting chararray can contain Unicode + /// characters, when false only 8-bit characters.

+ /// If unicode is + /// None and obj is one of the following: + /// + /// then the unicode setting of the output array will be + /// automatically determined. /// /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). If order is ‘A’, then the returned array may - /// be in any order (either C-, Fortran-contiguous, or even - /// discontiguous). + /// Specify the order of the array.

+ /// If order is ‘C’ (default), then the + /// array will be in C-contiguous order (last-index varies the + /// fastest).

+ /// If order is ‘F’, then the returned array + /// will be in Fortran-contiguous order (first-index varies the + /// fastest).

+ /// If order is ‘A’, then the returned array may + /// be in any order (either C-, Fortran-contiguous, or even + /// discontiguous). /// public static void array(string[] obj, int? itemsize = null, bool? copy = true, bool? unicode = null, string order = null) - => NumPy.Instance.core_defchararray_array(obj, itemsize:itemsize, copy:copy, unicode:unicode, order:order); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + obj, + }); + var kwargs=new PyDict(); + if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); + if (copy!=true) kwargs["copy"]=ToPython(copy); + if (unicode!=null) kwargs["unicode"]=ToPython(unicode); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("array", pyargs, kwargs); + } } } /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. + /// Provides a convenient view on arrays of string and unicode values.

+ /// + /// Versus a regular NumPy array of type str or unicode, this + /// class adds the following functionality: + /// + /// chararrays should be created using numpy.char.array or + /// numpy.char.asarray, rather than this constructor directly.

+ /// + /// This constructor creates the array, using buffer (with offset + /// and strides) if it is not None.

+ /// If buffer is None, then + /// constructs a new array with strides in “C order”, unless both + /// len(shape) >= 2 and order='Fortran', in which case strides + /// is in “Fortran order”. ///
/// - /// Shape of the array. + /// Shape of the array. /// /// - /// Length of each array element, in number of characters. Default is 1. + /// Length of each array element, in number of characters.

+ /// Default is 1. /// /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. + /// Are the array elements of type unicode (True) or string (False).

+ /// + /// Default is False. /// /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. + /// Memory address of the start of the array data.

+ /// Default is None, + /// in which case a new array is created. /// /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. + /// Fixed stride displacement from the beginning of an axis? + /// Default is 0.

+ /// Needs to be >=0. /// /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. + /// Strides for the array (see ndarray.strides for full description).

+ /// + /// Default is None. /// /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. + /// The order in which the array data is stored in memory: ‘C’ -> + /// “row major” order (the default), ‘F’ -> “column major” + /// (Fortran) order. /// public static void chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - => NumPy.Instance.chararray(shape, itemsize:itemsize, unicode:unicode, buffer:buffer, offset:offset, strides:strides, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); + if (unicode!=null) kwargs["unicode"]=ToPython(unicode); + if (buffer!=null) kwargs["buffer"]=ToPython(buffer); + if (offset!=null) kwargs["offset"]=ToPython(offset); + if (strides!=null) kwargs["strides"]=ToPython(strides); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("chararray", pyargs, kwargs); + } public static partial class core { public static partial class defchararray { /// - /// Convert the input to a chararray, copying the data only if - /// necessary. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: + /// Convert the input to a chararray, copying the data only if + /// necessary.

+ /// + /// Versus a regular NumPy array of type str or unicode, this + /// class adds the following functionality: ///
/// - /// itemsize is the number of characters per scalar in the - /// resulting array. If itemsize is None, and obj is an - /// object array or a Python list, the itemsize will be - /// automatically determined. If itemsize is provided and obj - /// is of type str or unicode, then the obj string will be - /// chunked into itemsize pieces. + /// itemsize is the number of characters per scalar in the + /// resulting array.

+ /// If itemsize is None, and obj is an + /// object array or a Python list, the itemsize will be + /// automatically determined.

+ /// If itemsize is provided and obj + /// is of type str or unicode, then the obj string will be + /// chunked into itemsize pieces. /// /// - /// When true, the resulting chararray can contain Unicode - /// characters, when false only 8-bit characters. If unicode is - /// None and obj is one of the following: - /// - /// then the unicode setting of the output array will be - /// automatically determined. + /// When true, the resulting chararray can contain Unicode + /// characters, when false only 8-bit characters.

+ /// If unicode is + /// None and obj is one of the following: + /// + /// then the unicode setting of the output array will be + /// automatically determined. /// /// - /// Specify the order of the array. If order is ‘C’ (default), then the - /// array will be in C-contiguous order (last-index varies the - /// fastest). If order is ‘F’, then the returned array - /// will be in Fortran-contiguous order (first-index varies the - /// fastest). + /// Specify the order of the array.

+ /// If order is ‘C’ (default), then the + /// array will be in C-contiguous order (last-index varies the + /// fastest).

+ /// If order is ‘F’, then the returned array + /// will be in Fortran-contiguous order (first-index varies the + /// fastest). /// public static void asarray(string[] obj, int? itemsize = null, bool? unicode = null, string order = null) - => NumPy.Instance.core_defchararray_asarray(obj, itemsize:itemsize, unicode:unicode, order:order); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + obj, + }); + var kwargs=new PyDict(); + if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); + if (unicode!=null) kwargs["unicode"]=ToPython(unicode); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("asarray", pyargs, kwargs); + } } } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// Start of interval. The interval includes this value. The default - /// start value is 0. + /// Start of interval.

+ /// The interval includes this value.

+ /// The default + /// start value is 0. /// /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(byte start, byte stop, byte step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(byte stop, byte step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// Start of interval. The interval includes this value. The default - /// start value is 0. + /// Start of interval.

+ /// The interval includes this value.

+ /// The default + /// start value is 0. /// /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(short start, short stop, short step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(short stop, short step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// Start of interval. The interval includes this value. The default - /// start value is 0. + /// Start of interval.

+ /// The interval includes this value.

+ /// The default + /// start value is 0. /// /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(int start, int stop, int step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(int stop, int step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// Start of interval. The interval includes this value. The default - /// start value is 0. + /// Start of interval.

+ /// The interval includes this value.

+ /// The default + /// start value is 0. /// /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(long start, long stop, long step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(long stop, long step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// Start of interval. The interval includes this value. The default - /// start value is 0. + /// Start of interval.

+ /// The interval includes this value.

+ /// The default + /// start value is 0. /// /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(float start, float stop, float step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(float stop, float step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// Start of interval. The interval includes this value. The default - /// start value is 0. + /// Start of interval.

+ /// The interval includes this value.

+ /// The default + /// start value is 0. /// /// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(double start, double stop, double step = 1, Dtype dtype = null) - => NumPy.Instance.arange(start, stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced values within a given interval. - /// - /// Values are generated within the half-open interval [start, stop) - /// (in other words, the interval including start but excluding stop). - /// For integer arguments the function is equivalent to the Python built-in - /// range function, but returns an ndarray rather than a list. - /// - /// When using a non-integer step, such as 0.1, the results will often not - /// be consistent. It is better to use numpy.linspace for these cases. + /// Return evenly spaced values within a given interval.

+ /// + /// Values are generated within the half-open interval [start, stop) + /// (in other words, the interval including start but excluding stop).

+ /// + /// For integer arguments the function is equivalent to the Python built-in + /// range function, but returns an ndarray rather than a list.

+ /// + /// When using a non-integer step, such as 0.1, the results will often not + /// be consistent.

+ /// It is better to use numpy.linspace for these cases. ///
/// - /// End of interval. The interval does not include this value, except - /// in some cases where step is not an integer and floating point - /// round-off affects the length of out. + /// End of interval.

+ /// The interval does not include this value, except + /// in some cases where step is not an integer and floating point + /// round-off affects the length of out. /// /// - /// Spacing between values. For any output out, this is the distance - /// between two adjacent values, out[i+1] - out[i]. The default - /// step size is 1. If step is specified as a position argument, - /// start must also be given. + /// Spacing between values.

+ /// For any output out, this is the distance + /// between two adjacent values, out[i+1] - out[i].

+ /// The default + /// step size is 1.

+ /// If step is specified as a position argument, + /// start must also be given. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// Array of evenly spaced values. - /// - /// For floating point arguments, the length of the result is - /// ceil((stop - start)/step). Because of floating point overflow, - /// this rule may result in the last element of out being greater - /// than stop. + /// Array of evenly spaced values.

+ /// + /// For floating point arguments, the length of the result is + /// ceil((stop - start)/step).

+ /// Because of floating point overflow, + /// this rule may result in the last element of out being greater + /// than stop. ///
public static NDarray arange(double stop, double step = 1, Dtype dtype = null) - => NumPy.Instance.arange(stop, step:step, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + stop, + }); + var kwargs=new PyDict(); + if (step!=1) kwargs["step"]=ToPython(step); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("arange", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return evenly spaced numbers over a specified interval. - /// - /// Returns num evenly spaced samples, calculated over the - /// interval [start, stop]. - /// - /// The endpoint of the interval can optionally be excluded. + /// Return evenly spaced numbers over a specified interval.

+ /// + /// Returns num evenly spaced samples, calculated over the + /// interval [start, stop].

+ /// + /// The endpoint of the interval can optionally be excluded. ///
/// - /// The starting value of the sequence. + /// The starting value of the sequence. /// /// - /// The end value of the sequence, unless endpoint is set to False. - /// In that case, the sequence consists of all but the last of num + 1 - /// evenly spaced samples, so that stop is excluded. Note that the step - /// size changes when endpoint is False. + /// The end value of the sequence, unless endpoint is set to False.

+ /// + /// In that case, the sequence consists of all but the last of num + 1 + /// evenly spaced samples, so that stop is excluded.

+ /// Note that the step + /// size changes when endpoint is False. /// /// - /// Number of samples to generate. Default is 50. Must be non-negative. + /// Number of samples to generate.

+ /// Default is 50. Must be non-negative. /// /// - /// If True, stop is the last sample. Otherwise, it is not included. - /// Default is True. - /// - /// - /// If True, return (samples, step), where step is the spacing - /// between samples. + /// If True, stop is the last sample.

+ /// Otherwise, it is not included.

+ /// + /// Default is True. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. + /// The axis in the result to store the samples.

+ /// Relevant only if start + /// or stop are array-like.

+ /// By default (0), the samples will be along a + /// new axis inserted at the beginning.

+ /// Use -1 to get an axis at the end. /// /// /// A tuple of: /// samples - /// There are num equally spaced samples in the closed interval - /// [start, stop] or the half-open interval [start, stop) - /// (depending on whether endpoint is True or False). + /// There are num equally spaced samples in the closed interval + /// [start, stop] or the half-open interval [start, stop) + /// (depending on whether endpoint is True or False). /// step - /// Only returned if retstep is True - /// - /// Size of spacing between samples. - /// - public static (NDarray, float) linspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, bool? retstep = false, Dtype dtype = null, int? axis = 0) - => NumPy.Instance.linspace(start, stop, num:num, endpoint:endpoint, retstep:retstep, dtype:dtype, axis:axis); + /// Only returned if retstep is True + /// + /// Size of spacing between samples. + /// + public static (NDarray, float) linspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, Dtype dtype = null, int? axis = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (num!=50) kwargs["num"]=ToPython(num); + if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("linspace", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Return numbers spaced evenly on a log scale. - /// - /// In linear space, the sequence starts at base ** start - /// (base to the power of start) and ends with base ** stop - /// (see endpoint below). - /// - /// Notes - /// - /// Logspace is equivalent to the code + /// Return evenly spaced numbers over a specified interval.

+ /// + /// Returns num evenly spaced samples, calculated over the + /// interval [start, stop].

+ /// + /// The endpoint of the interval can optionally be excluded. ///
/// - /// base ** start is the starting value of the sequence. + /// The starting value of the sequence. /// /// - /// base ** stop is the final value of the sequence, unless endpoint - /// is False. In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. + /// The end value of the sequence, unless endpoint is set to False.

+ /// + /// In that case, the sequence consists of all but the last of num + 1 + /// evenly spaced samples, so that stop is excluded.

+ /// Note that the step + /// size changes when endpoint is False. /// /// - /// Number of samples to generate. Default is 50. + /// Number of samples to generate.

+ /// Default is 50. Must be non-negative. /// /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. + /// If True, stop is the last sample.

+ /// Otherwise, it is not included.

+ /// + /// Default is True. /// - /// - /// The base of the log space. The step size between the elements in - /// ln(samples) / ln(base) (or log_base(samples)) is uniform. - /// Default is 10.0. + /// + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. + /// + /// + /// The axis in the result to store the samples.

+ /// Relevant only if start + /// or stop are array-like.

+ /// By default (0), the samples will be along a + /// new axis inserted at the beginning.

+ /// Use -1 to get an axis at the end. + /// + /// + /// There are num equally spaced samples in the closed interval + /// [start, stop] or the half-open interval [start, stop) + /// (depending on whether endpoint is True or False). + /// + public static NDarray linspace(double start, double stop, int? num = 50, bool? endpoint = true, Dtype dtype = null, int? axis = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (num!=50) kwargs["num"]=ToPython(num); + if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("linspace", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Return numbers spaced evenly on a log scale.

+ /// + /// In linear space, the sequence starts at base ** start + /// (base to the power of start) and ends with base ** stop + /// (see endpoint below).

+ /// + /// Notes + /// + /// Logspace is equivalent to the code + ///
+ /// + /// base ** start is the starting value of the sequence. + /// + /// + /// base ** stop is the final value of the sequence, unless endpoint + /// is False.

+ /// In that case, num + 1 values are spaced over the + /// interval in log-space, of which all but the last (a sequence of + /// length num) are returned. + /// + /// + /// Number of samples to generate.

+ /// Default is 50. + /// + /// + /// If true, stop is the last sample.

+ /// Otherwise, it is not included.

+ /// + /// Default is True. + /// + /// + /// The base of the log space.

+ /// The step size between the elements in + /// ln(samples) / ln(base) (or log_base(samples)) is uniform.

+ /// + /// Default is 10.0. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. + /// The axis in the result to store the samples.

+ /// Relevant only if start + /// or stop are array-like.

+ /// By default (0), the samples will be along a + /// new axis inserted at the beginning.

+ /// Use -1 to get an axis at the end. /// /// - /// num samples, equally spaced on a log scale. + /// num samples, equally spaced on a log scale. /// public static NDarray logspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, float? @base = 10.0f, Dtype dtype = null, int? axis = 0) - => NumPy.Instance.logspace(start, stop, num:num, endpoint:endpoint, @base:@base, dtype:dtype, axis:axis); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (num!=50) kwargs["num"]=ToPython(num); + if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); + if (@base!=10.0f) kwargs["base"]=ToPython(@base); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("logspace", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return numbers spaced evenly on a log scale (a geometric progression). - /// - /// This is similar to logspace, but with endpoints specified directly. - /// Each output sample is a constant multiple of the previous. - /// - /// Notes - /// - /// If the inputs or dtype are complex, the output will follow a logarithmic - /// spiral in the complex plane. (There are an infinite number of spirals - /// passing through two points; the output will follow the shortest such path.) + /// Return numbers spaced evenly on a log scale (a geometric progression).

+ /// + /// This is similar to logspace, but with endpoints specified directly.

+ /// + /// Each output sample is a constant multiple of the previous.

+ /// + /// Notes + /// + /// If the inputs or dtype are complex, the output will follow a logarithmic + /// spiral in the complex plane.

+ /// (There are an infinite number of spirals + /// passing through two points; the output will follow the shortest such path.) ///
/// - /// The starting value of the sequence. + /// The starting value of the sequence. /// /// - /// The final value of the sequence, unless endpoint is False. - /// In that case, num + 1 values are spaced over the - /// interval in log-space, of which all but the last (a sequence of - /// length num) are returned. + /// The final value of the sequence, unless endpoint is False.

+ /// + /// In that case, num + 1 values are spaced over the + /// interval in log-space, of which all but the last (a sequence of + /// length num) are returned. /// /// - /// Number of samples to generate. Default is 50. + /// Number of samples to generate.

+ /// Default is 50. /// /// - /// If true, stop is the last sample. Otherwise, it is not included. - /// Default is True. + /// If true, stop is the last sample.

+ /// Otherwise, it is not included.

+ /// + /// Default is True. /// /// - /// The type of the output array. If dtype is not given, infer the data - /// type from the other input arguments. + /// The type of the output array.

+ /// If dtype is not given, infer the data + /// type from the other input arguments. /// /// - /// The axis in the result to store the samples. Relevant only if start - /// or stop are array-like. By default (0), the samples will be along a - /// new axis inserted at the beginning. Use -1 to get an axis at the end. + /// The axis in the result to store the samples.

+ /// Relevant only if start + /// or stop are array-like.

+ /// By default (0), the samples will be along a + /// new axis inserted at the beginning.

+ /// Use -1 to get an axis at the end. /// /// - /// num samples, equally spaced on a log scale. + /// num samples, equally spaced on a log scale. /// public static NDarray geomspace(NDarray start, NDarray stop, int? num = 50, bool? endpoint = true, Dtype dtype = null, int? axis = 0) - => NumPy.Instance.geomspace(start, stop, num:num, endpoint:endpoint, dtype:dtype, axis:axis); - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(NDarray x2, NDarray x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[,] x2, array_like x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(NDarray x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(NDarray x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[,] x2, T[] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ - - /* - /// - /// Return coordinate matrices from coordinate vectors. - /// - /// Make N-D coordinate arrays for vectorized evaluations of - /// N-D scalar/vector fields over N-D grids, given - /// one-dimensional coordinate arrays x1, x2,…, xn. - /// - /// Notes - /// - /// This function supports both indexing conventions through the indexing - /// keyword argument. Giving the string ‘ij’ returns a meshgrid with - /// matrix indexing, while ‘xy’ returns a meshgrid with Cartesian indexing. - /// In the 2-D case with inputs of length M and N, the outputs are of shape - /// (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing. In the 3-D case - /// with inputs of length M, N and P, outputs are of shape (N, M, P) for - /// ‘xy’ indexing and (M, N, P) for ‘ij’ indexing. The difference is - /// illustrated by the following code snippet: - /// - /// In the 1-D and 0-D case, the indexing and sparse keywords have no effect. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// 1-D arrays representing the coordinates of a grid. - /// - /// - /// Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. - /// See Notes for more details. - /// - /// - /// If True a sparse grid is returned in order to conserve memory. - /// Default is False. - /// - /// - /// If False, a view into the original arrays are returned in order to - /// conserve memory. Default is True. Please note that - /// sparse=False, copy=False will likely return non-contiguous - /// arrays. Furthermore, more than one element of a broadcast array - /// may refer to a single memory location. If you need to write to the - /// arrays, make copies first. - /// - /// - /// For vectors x1, x2,…, ‘xn’ with lengths Ni=len(xi) , - /// return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ - /// or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ - /// with the elements of xi repeated to fill the matrix along - /// the first dimension for x1, the second for x2 and so on. - /// - public static NDarray meshgrid(T[,] x2, T[,] x1, string indexing = null, bool? sparse = null, bool? copy = null) - => NumPy.Instance.meshgrid(x2, x1, indexing:indexing, sparse:sparse, copy:copy); - */ + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + start, + stop, + }); + var kwargs=new PyDict(); + if (num!=50) kwargs["num"]=ToPython(num); + if (endpoint!=true) kwargs["endpoint"]=ToPython(endpoint); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("geomspace", pyargs, kwargs); + return ToCsharp(py); + } /// - /// nd_grid instance which returns a dense multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an dense - /// (or fleshed out) mesh-grid when indexed, so that each returned argument - /// has the same shape. The dimensions and number of the output arrays are - /// equal to the number of indexing dimensions. If the step length is not a - /// complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public static void mgrid() - => NumPy.Instance.mgrid(); + /// nd_grid instance which returns a dense multi-dimensional “meshgrid”. + /// + /// An instance of numpy.lib.index_tricks.nd_grid which returns an dense + /// (or fleshed out) mesh-grid when indexed, so that each returned argument + /// has the same shape.

+ /// The dimensions and number of the output arrays are + /// equal to the number of indexing dimensions.

+ /// If the step length is not a + /// complex number, then the stop is not inclusive.

+ /// + /// However, if the step length is a complex number (e.g.

+ /// 5j), then + /// the integer part of its magnitude is interpreted as specifying the + /// number of points to create between the start and stop values, where + /// the stop value is inclusive. + ///
+ public static NDarray[] mgrid() + { + //auto-generated code, do not change + var __self__=self; + dynamic py = __self__.InvokeMethod("mgrid"); + return ToCsharp(py); + } - /* /// - /// nd_grid instance which returns an open multi-dimensional “meshgrid”. - /// - /// An instance of numpy.lib.index_tricks.nd_grid which returns an open - /// (i.e. not fleshed out) mesh-grid when indexed, so that only one dimension - /// of each returned array is greater than 1. The dimension and number of the - /// output arrays are equal to the number of indexing dimensions. If the step - /// length is not a complex number, then the stop is not inclusive. - /// - /// However, if the step length is a complex number (e.g. 5j), then - /// the integer part of its magnitude is interpreted as specifying the - /// number of points to create between the start and stop values, where - /// the stop value is inclusive. - /// - public static void ogrid(math mesh-grid `ndarrays` with only one dimension) - => NumPy.Instance.ogrid(mesh-grid `ndarrays` with only one dimension); - */ + /// nd_grid instance which returns an open multi-dimensional “meshgrid”. + /// + /// An instance of numpy.lib.index_tricks.nd_grid which returns an open + /// (i.e.

+ /// not fleshed out) mesh-grid when indexed, so that only one dimension + /// of each returned array is greater than 1.

+ /// The dimension and number of the + /// output arrays are equal to the number of indexing dimensions.

+ /// If the step + /// length is not a complex number, then the stop is not inclusive.

+ /// + /// However, if the step length is a complex number (e.g.

+ /// 5j), then + /// the integer part of its magnitude is interpreted as specifying the + /// number of points to create between the start and stop values, where + /// the stop value is inclusive. + /// + public static NDarray[] ogrid() + { + //auto-generated code, do not change + var __self__=self; + dynamic py = __self__.InvokeMethod("ogrid"); + return ToCsharp(py); + } /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. + /// Extract a diagonal or construct a diagonal array.

+ /// + /// See the more detailed documentation for numpy.diagonal if you use this + /// function to extract a diagonal and wish to write to the resulting array; + /// whether it returns a copy or a view depends on what version of numpy you + /// are using. ///
/// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. + /// If v is a 2-D array, return a copy of its k-th diagonal.

+ /// + /// If v is a 1-D array, return a 2-D array with v on the k-th + /// diagonal. /// /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. + /// Diagonal in question.

+ /// The default is 0.

+ /// Use k>0 for diagonals + /// above the main diagonal, and k<0 for diagonals below the main + /// diagonal. /// /// - /// The extracted diagonal or constructed diagonal array. + /// The extracted diagonal or constructed diagonal array. /// public static NDarray diag(NDarray v, int? k = 0) - => NumPy.Instance.diag(v, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + v, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. + /// Extract a diagonal or construct a diagonal array.

+ /// + /// See the more detailed documentation for numpy.diagonal if you use this + /// function to extract a diagonal and wish to write to the resulting array; + /// whether it returns a copy or a view depends on what version of numpy you + /// are using. ///
/// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. + /// If v is a 2-D array, return a copy of its k-th diagonal.

+ /// + /// If v is a 1-D array, return a 2-D array with v on the k-th + /// diagonal. /// /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. + /// Diagonal in question.

+ /// The default is 0.

+ /// Use k>0 for diagonals + /// above the main diagonal, and k<0 for diagonals below the main + /// diagonal. /// /// - /// The extracted diagonal or constructed diagonal array. + /// The extracted diagonal or constructed diagonal array. /// public static NDarray diag(T[] v, int? k = 0) - => NumPy.Instance.diag(v, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(v), + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Extract a diagonal or construct a diagonal array. - /// - /// See the more detailed documentation for numpy.diagonal if you use this - /// function to extract a diagonal and wish to write to the resulting array; - /// whether it returns a copy or a view depends on what version of numpy you - /// are using. + /// Extract a diagonal or construct a diagonal array.

+ /// + /// See the more detailed documentation for numpy.diagonal if you use this + /// function to extract a diagonal and wish to write to the resulting array; + /// whether it returns a copy or a view depends on what version of numpy you + /// are using. ///
/// - /// If v is a 2-D array, return a copy of its k-th diagonal. - /// If v is a 1-D array, return a 2-D array with v on the k-th - /// diagonal. + /// If v is a 2-D array, return a copy of its k-th diagonal.

+ /// + /// If v is a 1-D array, return a 2-D array with v on the k-th + /// diagonal. /// /// - /// Diagonal in question. The default is 0. Use k>0 for diagonals - /// above the main diagonal, and k<0 for diagonals below the main - /// diagonal. + /// Diagonal in question.

+ /// The default is 0.

+ /// Use k>0 for diagonals + /// above the main diagonal, and k<0 for diagonals below the main + /// diagonal. /// /// - /// The extracted diagonal or constructed diagonal array. + /// The extracted diagonal or constructed diagonal array. /// public static NDarray diag(T[,] v, int? k = 0) - => NumPy.Instance.diag(v, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(v), + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("diag", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Create a two-dimensional array with the flattened input as a diagonal. + /// Create a two-dimensional array with the flattened input as a diagonal. /// /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. + /// Input data, which is flattened and set as the k-th + /// diagonal of the output. /// /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. + /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, + /// a positive (negative) k giving the number of the diagonal above + /// (below) the main. /// /// - /// The 2-D output array. + /// The 2-D output array. /// public static NDarray diagflat(NDarray v, int? k = 0) - => NumPy.Instance.diagflat(v, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + v, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Create a two-dimensional array with the flattened input as a diagonal. + /// Create a two-dimensional array with the flattened input as a diagonal. /// /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. + /// Input data, which is flattened and set as the k-th + /// diagonal of the output. /// /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. + /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, + /// a positive (negative) k giving the number of the diagonal above + /// (below) the main. /// /// - /// The 2-D output array. + /// The 2-D output array. /// public static NDarray diagflat(T[] v, int? k = 0) - => NumPy.Instance.diagflat(v, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(v), + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Create a two-dimensional array with the flattened input as a diagonal. + /// Create a two-dimensional array with the flattened input as a diagonal. /// /// - /// Input data, which is flattened and set as the k-th - /// diagonal of the output. + /// Input data, which is flattened and set as the k-th + /// diagonal of the output. /// /// - /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, - /// a positive (negative) k giving the number of the diagonal above - /// (below) the main. + /// Diagonal to set; 0, the default, corresponds to the “main” diagonal, + /// a positive (negative) k giving the number of the diagonal above + /// (below) the main. /// /// - /// The 2-D output array. + /// The 2-D output array. /// public static NDarray diagflat(T[,] v, int? k = 0) - => NumPy.Instance.diagflat(v, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(v), + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("diagflat", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// An array with ones at and below the given diagonal and zeros elsewhere. + /// An array with ones at and below the given diagonal and zeros elsewhere. /// /// - /// Number of rows in the array. + /// Number of rows in the array. /// /// - /// Number of columns in the array. - /// By default, M is taken equal to N. + /// Number of columns in the array.

+ /// + /// By default, M is taken equal to N. /// /// - /// The sub-diagonal at and below which the array is filled. - /// k = 0 is the main diagonal, while k < 0 is below it, - /// and k > 0 is above. The default is 0. + /// The sub-diagonal at and below which the array is filled.

+ /// + /// k = 0 is the main diagonal, while k < 0 is below it, + /// and k > 0 is above.

+ /// The default is 0. /// /// - /// Data type of the returned array. The default is float. + /// Data type of the returned array.

+ /// The default is float. /// /// - /// Array with its lower triangle filled with ones and zero elsewhere; - /// in other words T[i,j] == 1 for i <= j + k, 0 otherwise. + /// Array with its lower triangle filled with ones and zero elsewhere; + /// in other words T[i,j] == 1 for i <= j + k, 0 otherwise. /// public static NDarray tri(int N, int? M = null, int? k = 0, Dtype dtype = null) - => NumPy.Instance.tri(N, M:M, k:k, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + N, + }); + var kwargs=new PyDict(); + if (M!=null) kwargs["M"]=ToPython(M); + if (k!=0) kwargs["k"]=ToPython(k); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("tri", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. + /// Lower triangle of an array.

+ /// + /// Return a copy of an array with elements above the k-th diagonal zeroed. ///
/// - /// Input array. + /// Input array. /// /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. + /// Diagonal above which to zero elements.

+ /// k = 0 (the default) is the + /// main diagonal, k < 0 is below it and k > 0 is above. /// /// - /// Lower triangle of m, of same shape and data-type as m. + /// Lower triangle of m, of same shape and data-type as m. /// public static NDarray tril(NDarray m, int? k = 0) - => NumPy.Instance.tril(m, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + m, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. + /// Lower triangle of an array.

+ /// + /// Return a copy of an array with elements above the k-th diagonal zeroed. ///
/// - /// Input array. + /// Input array. /// /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. + /// Diagonal above which to zero elements.

+ /// k = 0 (the default) is the + /// main diagonal, k < 0 is below it and k > 0 is above. /// /// - /// Lower triangle of m, of same shape and data-type as m. + /// Lower triangle of m, of same shape and data-type as m. /// public static NDarray tril(T[] m, int? k = 0) - => NumPy.Instance.tril(m, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(m), + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Lower triangle of an array. - /// - /// Return a copy of an array with elements above the k-th diagonal zeroed. + /// Lower triangle of an array.

+ /// + /// Return a copy of an array with elements above the k-th diagonal zeroed. ///
/// - /// Input array. + /// Input array. /// /// - /// Diagonal above which to zero elements. k = 0 (the default) is the - /// main diagonal, k < 0 is below it and k > 0 is above. + /// Diagonal above which to zero elements.

+ /// k = 0 (the default) is the + /// main diagonal, k < 0 is below it and k > 0 is above. /// /// - /// Lower triangle of m, of same shape and data-type as m. + /// Lower triangle of m, of same shape and data-type as m. /// public static NDarray tril(T[,] m, int? k = 0) - => NumPy.Instance.tril(m, k:k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(m), + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("tril", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. + /// Generate a Vandermonde matrix.

+ /// + /// The columns of the output matrix are powers of the input vector.

+ /// The + /// order of the powers is determined by the increasing boolean argument.

+ /// + /// Specifically, when increasing is False, the i-th output column is + /// the input vector raised element-wise to the power of N - i - 1.

+ /// Such + /// a matrix with a geometric progression in each row is named for Alexandre- + /// Theophile Vandermonde. ///
/// - /// 1-D input array. + /// 1-D input array. /// /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). + /// Number of columns in the output.

+ /// If N is not specified, a square + /// array is returned (N = len(x)). /// /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. + /// Order of the powers of the columns.

+ /// If True, the powers increase + /// from left to right, if False (the default) they are reversed. /// /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). + /// Vandermonde matrix.

+ /// If increasing is False, the first column is + /// x^(N-1), the second x^(N-2) and so forth.

+ /// If increasing is + /// True, the columns are x^0, x^1, ..., x^(N-1). ///
public static NDarray vander(NDarray x, int? N = null, bool? increasing = false) - => NumPy.Instance.vander(x, N:N, increasing:increasing); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (N!=null) kwargs["N"]=ToPython(N); + if (increasing!=false) kwargs["increasing"]=ToPython(increasing); + dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. + /// Generate a Vandermonde matrix.

+ /// + /// The columns of the output matrix are powers of the input vector.

+ /// The + /// order of the powers is determined by the increasing boolean argument.

+ /// + /// Specifically, when increasing is False, the i-th output column is + /// the input vector raised element-wise to the power of N - i - 1.

+ /// Such + /// a matrix with a geometric progression in each row is named for Alexandre- + /// Theophile Vandermonde. ///
/// - /// 1-D input array. + /// 1-D input array. /// /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). + /// Number of columns in the output.

+ /// If N is not specified, a square + /// array is returned (N = len(x)). /// /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. + /// Order of the powers of the columns.

+ /// If True, the powers increase + /// from left to right, if False (the default) they are reversed. /// /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). + /// Vandermonde matrix.

+ /// If increasing is False, the first column is + /// x^(N-1), the second x^(N-2) and so forth.

+ /// If increasing is + /// True, the columns are x^0, x^1, ..., x^(N-1). ///
public static NDarray vander(T[] x, int? N = null, bool? increasing = false) - => NumPy.Instance.vander(x, N:N, increasing:increasing); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(x), + }); + var kwargs=new PyDict(); + if (N!=null) kwargs["N"]=ToPython(N); + if (increasing!=false) kwargs["increasing"]=ToPython(increasing); + dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Generate a Vandermonde matrix. - /// - /// The columns of the output matrix are powers of the input vector. The - /// order of the powers is determined by the increasing boolean argument. - /// Specifically, when increasing is False, the i-th output column is - /// the input vector raised element-wise to the power of N - i - 1. Such - /// a matrix with a geometric progression in each row is named for Alexandre- - /// Theophile Vandermonde. + /// Generate a Vandermonde matrix.

+ /// + /// The columns of the output matrix are powers of the input vector.

+ /// The + /// order of the powers is determined by the increasing boolean argument.

+ /// + /// Specifically, when increasing is False, the i-th output column is + /// the input vector raised element-wise to the power of N - i - 1.

+ /// Such + /// a matrix with a geometric progression in each row is named for Alexandre- + /// Theophile Vandermonde. ///
/// - /// 1-D input array. + /// 1-D input array. /// /// - /// Number of columns in the output. If N is not specified, a square - /// array is returned (N = len(x)). + /// Number of columns in the output.

+ /// If N is not specified, a square + /// array is returned (N = len(x)). /// /// - /// Order of the powers of the columns. If True, the powers increase - /// from left to right, if False (the default) they are reversed. + /// Order of the powers of the columns.

+ /// If True, the powers increase + /// from left to right, if False (the default) they are reversed. /// /// - /// Vandermonde matrix. If increasing is False, the first column is - /// x^(N-1), the second x^(N-2) and so forth. If increasing is - /// True, the columns are x^0, x^1, ..., x^(N-1). + /// Vandermonde matrix.

+ /// If increasing is False, the first column is + /// x^(N-1), the second x^(N-2) and so forth.

+ /// If increasing is + /// True, the columns are x^0, x^1, ..., x^(N-1). ///
public static NDarray vander(T[,] x, int? N = null, bool? increasing = false) - => NumPy.Instance.vander(x, N:N, increasing:increasing); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(x), + }); + var kwargs=new PyDict(); + if (N!=null) kwargs["N"]=ToPython(N); + if (increasing!=false) kwargs["increasing"]=ToPython(increasing); + dynamic py = __self__.InvokeMethod("vander", pyargs, kwargs); + return ToCsharp>(py); + } /* /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). + /// Interpret the input as a matrix.

+ /// + /// Unlike matrix, asmatrix does not make a copy if the input is already + /// a matrix or an ndarray.

+ /// Equivalent to matrix(data, copy=False). ///
/// - /// Input data. + /// Input data. /// /// - /// Data-type of the output matrix. + /// Data-type of the output matrix. /// /// - /// data interpreted as a matrix. + /// data interpreted as a matrix. /// public static Matrix mat(NDarray data, Dtype dtype) - => NumPy.Instance.mat(data, dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + data, + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). + /// Interpret the input as a matrix.

+ /// + /// Unlike matrix, asmatrix does not make a copy if the input is already + /// a matrix or an ndarray.

+ /// Equivalent to matrix(data, copy=False). ///
/// - /// Input data. + /// Input data. /// /// - /// Data-type of the output matrix. + /// Data-type of the output matrix. /// /// - /// data interpreted as a matrix. + /// data interpreted as a matrix. /// public static Matrix mat(T[] data, Dtype dtype) - => NumPy.Instance.mat(data, dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(data), + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Interpret the input as a matrix. - /// - /// Unlike matrix, asmatrix does not make a copy if the input is already - /// a matrix or an ndarray. Equivalent to matrix(data, copy=False). + /// Interpret the input as a matrix.

+ /// + /// Unlike matrix, asmatrix does not make a copy if the input is already + /// a matrix or an ndarray.

+ /// Equivalent to matrix(data, copy=False). ///
/// - /// Input data. + /// Input data. /// /// - /// Data-type of the output matrix. + /// Data-type of the output matrix. /// /// - /// data interpreted as a matrix. + /// data interpreted as a matrix. /// public static Matrix mat(T[,] data, Dtype dtype) - => NumPy.Instance.mat(data, dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(data), + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("mat", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Build a matrix object from a string, nested sequence, or array. + /// Build a matrix object from a string, nested sequence, or array. /// /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. + /// Input data.

+ /// If a string, variables in the current scope may be + /// referenced by name. /// /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. + /// A dictionary that replaces local operands in current frame.

+ /// + /// Ignored if obj is not a string or gdict is None. /// /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. + /// A dictionary that replaces global operands in current frame.

+ /// + /// Ignored if obj is not a string. /// /// - /// Returns a matrix object, which is a specialized 2-D array. + /// Returns a matrix object, which is a specialized 2-D array. /// public static Matrix bmat(string obj, Hashtable ldict = null, Hashtable gdict = null) - => NumPy.Instance.bmat(obj, ldict:ldict, gdict:gdict); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + obj, + }); + var kwargs=new PyDict(); + if (ldict!=null) kwargs["ldict"]=ToPython(ldict); + if (gdict!=null) kwargs["gdict"]=ToPython(gdict); + dynamic py = __self__.InvokeMethod("bmat", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Build a matrix object from a string, nested sequence, or array. + /// Build a matrix object from a string, nested sequence, or array. /// /// - /// Input data. If a string, variables in the current scope may be - /// referenced by name. + /// Input data.

+ /// If a string, variables in the current scope may be + /// referenced by name. /// /// - /// A dictionary that replaces local operands in current frame. - /// Ignored if obj is not a string or gdict is None. + /// A dictionary that replaces local operands in current frame.

+ /// + /// Ignored if obj is not a string or gdict is None. /// /// - /// A dictionary that replaces global operands in current frame. - /// Ignored if obj is not a string. + /// A dictionary that replaces global operands in current frame.

+ /// + /// Ignored if obj is not a string. /// /// - /// Returns a matrix object, which is a specialized 2-D array. + /// Returns a matrix object, which is a specialized 2-D array. /// public static Matrix bmat(T[] obj, Hashtable ldict = null, Hashtable gdict = null) - => NumPy.Instance.bmat(obj, ldict:ldict, gdict:gdict); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + SharpToSharp(obj), + }); + var kwargs=new PyDict(); + if (ldict!=null) kwargs["ldict"]=ToPython(ldict); + if (gdict!=null) kwargs["gdict"]=ToPython(gdict); + dynamic py = __self__.InvokeMethod("bmat", pyargs, kwargs); + return ToCsharp>(py); + } */ diff --git a/src/Numpy/np.array_manipulation.gen.cs b/src/Numpy/np.array_manipulation.gen.cs index 4bba7ec..d032a45 100644 --- a/src/Numpy/np.array_manipulation.gen.cs +++ b/src/Numpy/np.array_manipulation.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,1091 +20,1685 @@ public static partial class np { /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. + /// Copies values from one array to another, broadcasting as necessary.

+ /// + /// Raises a TypeError if the casting rule is violated, and if + /// where is provided, it selects which elements to copy. ///
/// - /// The array into which values are copied. + /// The array into which values are copied. /// /// - /// The array from which values are copied. + /// The array from which values are copied. /// /// - /// Controls what kind of data casting may occur when copying. + /// Controls what kind of data casting may occur when copying. /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. + /// + /// A boolean array which is broadcasted to match the dimensions + /// of dst, and selects elements to copy from src to dst + /// wherever it contains the value True. /// public static void copyto(NDarray dst, NDarray src, string casting = "same_kind", NDarray @where = null) - => NumPy.Instance.copyto(dst, src, casting:casting, @where:@where); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dst, + src, + }); + var kwargs=new PyDict(); + if (casting!="same_kind") kwargs["casting"]=ToPython(casting); + if (@where!=null) kwargs["where"]=ToPython(@where); + dynamic py = __self__.InvokeMethod("copyto", pyargs, kwargs); + } /// - /// Copies values from one array to another, broadcasting as necessary. - /// - /// Raises a TypeError if the casting rule is violated, and if - /// where is provided, it selects which elements to copy. + /// Copies values from one array to another, broadcasting as necessary.

+ /// + /// Raises a TypeError if the casting rule is violated, and if + /// where is provided, it selects which elements to copy. ///
/// - /// The array into which values are copied. + /// The array into which values are copied. /// /// - /// The array from which values are copied. + /// The array from which values are copied. /// /// - /// Controls what kind of data casting may occur when copying. + /// Controls what kind of data casting may occur when copying. /// - /// - /// A boolean array which is broadcasted to match the dimensions - /// of dst, and selects elements to copy from src to dst - /// wherever it contains the value True. + /// + /// A boolean array which is broadcasted to match the dimensions + /// of dst, and selects elements to copy from src to dst + /// wherever it contains the value True. /// public static void copyto(NDarray dst, NDarray src, string casting = "same_kind", bool[] @where = null) - => NumPy.Instance.copyto(dst, src, casting:casting, @where:@where); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dst, + src, + }); + var kwargs=new PyDict(); + if (casting!="same_kind") kwargs["casting"]=ToPython(casting); + if (@where!=null) kwargs["where"]=ToPython(@where); + dynamic py = __self__.InvokeMethod("copyto", 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. + /// 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. ///
/// - /// Array to be reshaped. + /// Array to be reshaped. /// /// - /// 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. + /// 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. + /// 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. + /// 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 static NDarray reshape(NDarray a, Shape newshape, string order = null) - => NumPy.Instance.reshape(a, newshape, order:order); + public static NDarray reshape(this NDarray a, Shape newshape, string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. ///
/// - /// Input array. The elements in a are read in the order specified by - /// order, and packed as a 1-D array. + /// Input array.

+ /// The elements in a are read in the order specified by + /// order, and packed as a 1-D array. /// /// - /// 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. + /// 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. + /// 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 static NDarray ravel(NDarray a, string order = null) - => NumPy.Instance.ravel(a, order:order); + public static NDarray ravel(this NDarray a, string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("ravel", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a copy of the array collapsed into one dimension. + /// Return a copy of the array collapsed into one dimension. /// /// - /// ‘C’ means to flatten in row-major (C-style) order. - /// ‘F’ means to flatten in column-major (Fortran- - /// style) order. ‘A’ means to flatten in column-major - /// order if a is Fortran contiguous in memory, - /// row-major order otherwise. ‘K’ means to flatten - /// a in the order the elements occur in memory. - /// The default is ‘C’. + /// ‘C’ means to flatten in row-major (C-style) order.

+ /// + /// ‘F’ means to flatten in column-major (Fortran- + /// style) order.

+ /// ‘A’ means to flatten in column-major + /// order if a is Fortran contiguous in memory, + /// row-major order otherwise.

+ /// ‘K’ means to flatten + /// a in the order the elements occur in memory.

+ /// + /// The default is ‘C’. /// /// - /// A copy of the input array, flattened to one dimension. + /// A copy of the input array, flattened to one dimension. /// public static NDarray flatten(string order = null) - => NumPy.Instance.flatten(order:order); + { + //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("flatten", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Move axes of an array to new positions. - /// - /// Other axes remain in their original order. + /// Move axes of an array to new positions.

+ /// + /// Other axes remain in their original order. ///
/// - /// The array whose axes should be reordered. + /// The array whose axes should be reordered. /// /// - /// Original positions of the axes to move. These must be unique. + /// Original positions of the axes to move.

+ /// These must be unique. /// /// - /// Destination positions for each of the original axes. These must also 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. + /// Array with moved axes.

+ /// This array is a view of the input array. ///
- public static NDarray moveaxis(NDarray a, int[] source, int[] destination) - => NumPy.Instance.moveaxis(a, source, destination); + public static NDarray moveaxis(this NDarray a, int[] source, int[] destination) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// The axis to roll backwards. The positions of the other axes do not - /// change relative to one another. + /// 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. + /// 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. + /// 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 static NDarray rollaxis(NDarray a, int axis, int? start = 0) - => NumPy.Instance.rollaxis(a, axis, start:start); + public static NDarray rollaxis(this NDarray a, int axis, int? start = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// Interchange two axes of an array. /// /// - /// Input array. + /// Input array. /// /// - /// First axis. + /// First axis. /// /// - /// Second 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 static NDarray swapaxes(this NDarray a, int axis1, int axis2) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + axis1, + axis2, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("swapaxes", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Permute the dimensions of an array.

+ /// + /// Notes + /// + /// Use transpose(a, argsort(axes)) to invert the transposition of tensors + /// when using the axes keyword argument.

+ /// + /// Transposing a 1-D array returns an unchanged view of the original array. + ///
+ /// + /// Input array. + /// + /// + /// By default, reverse the dimensions, otherwise permute the axes + /// according to the values given. /// /// - /// 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. + /// a with its axes permuted.

+ /// A view is returned whenever + /// possible. ///
- public static NDarray swapaxes(NDarray a, int axis1, int axis2) - => NumPy.Instance.swapaxes(a, axis1, axis2); + public static NDarray transpose(this 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("transpose", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Permute the dimensions of an array. - /// - /// Notes - /// - /// Use transpose(a, argsort(axes)) to invert the transposition of tensors - /// when using the axes keyword argument. - /// - /// Transposing a 1-D array returns an unchanged view of the original array. + /// Permute the dimensions of an array.

+ /// + /// Notes + /// + /// Use transpose(a, argsort(axes)) to invert the transposition of tensors + /// when using the axes keyword argument.

+ /// + /// Transposing a 1-D array returns an unchanged view of the original array. ///
/// - /// Input array. + /// Input array. /// /// - /// By default, reverse the dimensions, otherwise permute the axes - /// according to the values given. + /// By default, reverse the dimensions, otherwise permute the axes + /// according to the values given. /// /// - /// a with its axes permuted. A view is returned whenever - /// possible. + /// a with its axes permuted.

+ /// A view is returned whenever + /// possible. ///
- public static NDarray transpose(NDarray a, int[] axes = null) - => NumPy.Instance.transpose(a, axes:axes); + public static NDarray transpose(this 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("transpose", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Convert inputs to arrays with at least one dimension. - /// - /// Scalar inputs are converted to 1-dimensional arrays, whilst - /// higher-dimensional inputs are preserved. + /// Convert inputs to arrays with at least one dimension.

+ /// + /// Scalar inputs are converted to 1-dimensional arrays, whilst + /// higher-dimensional inputs are preserved. ///
/// - /// One or more input arrays. + /// One or more input arrays. /// /// - /// An array, or list of arrays, each with a.ndim >= 1. - /// Copies are made only if necessary. + /// An array, or list of arrays, each with a.ndim >= 1.

+ /// + /// Copies are made only if necessary. ///
public static NDarray atleast_1d(params NDarray[] arys) - => NumPy.Instance.atleast_1d(arys); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arys, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("atleast_1d", pyargs, kwargs); + return ToCsharp(py); + } /// - /// View inputs as arrays with at least two dimensions. + /// View inputs as arrays with at least two dimensions. /// /// - /// One or more array-like sequences. Non-array inputs are converted - /// to arrays. Arrays that already have two or more dimensions are - /// preserved. + /// One or more array-like sequences.

+ /// Non-array inputs are converted + /// to arrays.

+ /// Arrays that already have two or more dimensions are + /// preserved. /// /// - /// An array, or list of arrays, each with a.ndim >= 2. - /// Copies are avoided where possible, and views with two or more - /// dimensions are returned. + /// An array, or list of arrays, each with a.ndim >= 2.

+ /// + /// Copies are avoided where possible, and views with two or more + /// dimensions are returned. ///
public static NDarray atleast_2d(params NDarray[] arys) - => NumPy.Instance.atleast_2d(arys); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arys, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("atleast_2d", pyargs, kwargs); + return ToCsharp(py); + } /// - /// View inputs as arrays with at least three dimensions. + /// View inputs as arrays with at least three dimensions. /// /// - /// One or more array-like sequences. Non-array inputs are converted to - /// arrays. Arrays that already have three or more dimensions are - /// preserved. + /// One or more array-like sequences.

+ /// Non-array inputs are converted to + /// arrays.

+ /// Arrays that already have three or more dimensions are + /// preserved. /// /// - /// An array, or list of arrays, each with a.ndim >= 3. Copies are - /// avoided where possible, and views with three or more dimensions are - /// returned. For example, a 1-D array of shape (N,) becomes a view - /// of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a - /// view of shape (M, N, 1). + /// An array, or list of arrays, each with a.ndim >= 3.

+ /// Copies are + /// avoided where possible, and views with three or more dimensions are + /// returned.

+ /// For example, a 1-D array of shape (N,) becomes a view + /// of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a + /// view of shape (M, N, 1). ///
public static NDarray atleast_3d(params NDarray[] arys) - => NumPy.Instance.atleast_3d(arys); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arys, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("atleast_3d", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Produce an object that mimics broadcasting. + /// Produce an object that mimics broadcasting. /// /// - /// Input parameters. + /// Input parameters. /// /// - /// Input parameters. + /// 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. + /// 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 static NDarray broadcast(NDarray in2, NDarray in1) - => NumPy.Instance.broadcast(in2, in1); + public static NDarray broadcast(this NDarray in2, NDarray in1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + in2, + in1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("broadcast", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Broadcast an array to a new shape. - /// - /// Notes + /// Broadcast an array to a new shape.

+ /// + /// Notes ///
/// - /// The array to broadcast. + /// The array to broadcast. /// /// - /// The shape of the desired array. + /// 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). + /// 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. + /// 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 static NDarray broadcast_to(NDarray array, Shape shape, bool? subok = false) - => NumPy.Instance.broadcast_to(array, shape, subok:subok); + public static NDarray broadcast_to(this NDarray array, Shape shape, bool? subok = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + array, + shape, + }); + var kwargs=new PyDict(); + if (subok!=false) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("broadcast_to", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Broadcast any number of arrays against each other. + /// Broadcast any number of arrays against each other. /// /// - /// The arrays to broadcast. + /// The arrays to broadcast. /// /// - /// If True, then sub-classes will be passed-through, otherwise - /// the returned arrays will be forced to be a base-class array (default). + /// If True, then sub-classes will be passed-through, otherwise + /// the returned arrays will be forced to be a base-class array (default). /// /// - /// These arrays are views on the original arrays. They are typically - /// not contiguous. Furthermore, more than one element of a - /// broadcasted array may refer to a single memory location. If you - /// need to write to the arrays, make copies first. + /// These arrays are views on the original arrays.

+ /// They are typically + /// not contiguous.

+ /// Furthermore, more than one element of a + /// broadcasted array may refer to a single memory location.

+ /// If you + /// need to write to the arrays, make copies first. ///
public static NDarray[] broadcast_arrays(NDarray[] args, bool? subok = null) - => NumPy.Instance.broadcast_arrays(args, subok:subok); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + args, + }); + var kwargs=new PyDict(); + if (subok!=null) kwargs["subok"]=ToPython(subok); + dynamic py = __self__.InvokeMethod("broadcast_arrays", 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. + /// Expand the shape of an array.

+ /// + /// Insert a new axis that will appear at the axis position in the expanded + /// array shape. ///
/// - /// Input array. + /// Input array. /// /// - /// Position in the expanded axes where the new axis is placed. + /// 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. + /// Output array.

+ /// The number of dimensions is one greater than that of + /// the input array. ///
- public static NDarray expand_dims(NDarray a, int axis) - => NumPy.Instance.expand_dims(a, axis); + public static NDarray expand_dims(this NDarray a, int axis) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// Remove single-dimensional entries from the shape of an array. /// /// - /// Input data. + /// Input data. /// /// - /// 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. + /// 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. + /// 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 static NDarray squeeze(NDarray a, int[] axis = null) - => NumPy.Instance.squeeze(a, axis:axis); + public static NDarray squeeze(this NDarray a, Axis axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// Return an array converted to a float type. /// /// - /// The input array. + /// The input array. /// /// - /// Float type code to coerce input array a. If dtype is one of the - /// ‘int’ dtypes, it is replaced with float64. + /// 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. + /// The input a as a float ndarray. /// - public static NDarray asfarray(NDarray a, Dtype dtype = null) - => NumPy.Instance.asfarray(a, dtype:dtype); + public static NDarray asfarray(this NDarray a, Dtype dtype = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// Return an array (ndim >= 1) laid out in Fortran order in memory. /// /// - /// Input array. + /// Input array. /// /// - /// By default, the data-type is inferred from the input data. + /// By default, the data-type is inferred from the input data. /// /// - /// The input a in Fortran, or column-major, order. + /// The input a in Fortran, or column-major, order. /// - public static NDarray asfortranarray(NDarray a, Dtype dtype = null) - => NumPy.Instance.asfortranarray(a, dtype:dtype); + public static NDarray asfortranarray(this NDarray a, Dtype dtype = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// Convert the input to an array, checking for NaNs or Infs. /// /// - /// Input data, in any form that can be converted to an array. This - /// includes lists, lists of tuples, tuples, tuples of tuples, tuples - /// of lists and ndarrays. Success requires no NaNs or Infs. + /// Input data, in any form that can be converted to an array.

+ /// This + /// includes lists, lists of tuples, tuples, tuples of tuples, tuples + /// of lists and ndarrays.

+ /// Success requires no NaNs or Infs. /// /// - /// By default, the data-type is inferred from the input data. + /// 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’. + /// 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. + /// 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 static NDarray asarray_chkfinite(NDarray a, Dtype dtype = null, string order = null) - => NumPy.Instance.asarray_chkfinite(a, dtype:dtype, order:order); + public static NDarray asarray_chkfinite(this NDarray a, Dtype dtype = null, string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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 object to be converted to a type-and-requirement-satisfying array. + /// The object to be converted to a type-and-requirement-satisfying array. /// /// - /// 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 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 static NDarray require(NDarray a, Dtype dtype, string[] requirements = null) - => NumPy.Instance.require(a, dtype, requirements); + /// The requirements list can be any of the following + /// + public static NDarray require(this NDarray a, Dtype dtype, string[] requirements = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + dtype, + }); + var kwargs=new PyDict(); + if (requirements!=null) kwargs["requirements"]=ToPython(requirements); + dynamic py = __self__.InvokeMethod("require", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Join a sequence of arrays along an existing axis. - /// - /// Notes - /// - /// When one or more of the arrays to be concatenated is a MaskedArray, - /// this function will return a MaskedArray object instead of an ndarray, - /// but the input masks are not preserved. In cases where a MaskedArray - /// is expected as input, use the ma.concatenate function from the masked - /// array module instead. + /// Join a sequence of arrays along an existing axis.

+ /// + /// Notes + /// + /// When one or more of the arrays to be concatenated is a MaskedArray, + /// this function will return a MaskedArray object instead of an ndarray, + /// but the input masks are not preserved.

+ /// In cases where a MaskedArray + /// is expected as input, use the ma.concatenate function from the masked + /// array module instead. ///
/// - /// The arrays must have the same shape, except in the dimension - /// corresponding to axis (the first, by default). + /// The arrays must have the same shape, except in the dimension + /// corresponding to axis (the first, by default). /// /// - /// The axis along which the arrays will be joined. If axis is None, - /// arrays are flattened before use. Default is 0. + /// The axis along which the arrays will be joined.

+ /// If axis is None, + /// arrays are flattened before use.

+ /// Default is 0. /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what concatenate would have returned if no - /// out argument were specified. + /// + /// If provided, the destination to place the result.

+ /// The shape must be + /// correct, matching that of what concatenate would have returned if no + /// out argument were specified. /// /// - /// The concatenated array. + /// The concatenated array. /// public static NDarray concatenate(NDarray[] arys, int? axis = 0, NDarray @out = null) - => NumPy.Instance.concatenate(arys, axis:axis, @out:@out); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arys, + }); + var kwargs=new PyDict(); + if (axis!=0) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("concatenate", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Join a sequence of arrays along a new axis. - /// - /// The axis parameter specifies the index of the new axis in the dimensions - /// of the result. For example, if axis=0 it will be the first dimension - /// and if axis=-1 it will be the last dimension. + /// Join a sequence of arrays along a new axis.

+ /// + /// The axis parameter specifies the index of the new axis in the dimensions + /// of the result.

+ /// For example, if axis=0 it will be the first dimension + /// and if axis=-1 it will be the last dimension. ///
/// - /// Each array must have the same shape. + /// Each array must have the same shape. /// /// - /// The axis in the result array along which the input arrays are stacked. + /// The axis in the result array along which the input arrays are stacked. /// - /// - /// If provided, the destination to place the result. The shape must be - /// correct, matching that of what stack would have returned if no - /// out argument were specified. + /// + /// If provided, the destination to place the result.

+ /// The shape must be + /// correct, matching that of what stack would have returned if no + /// out argument were specified. /// /// - /// The stacked array has one more dimension than the input arrays. + /// The stacked array has one more dimension than the input arrays. /// public static NDarray stack(NDarray[] arrays, int? axis = 0, NDarray @out = null) - => NumPy.Instance.stack(arrays, axis:axis, @out:@out); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arrays, + }); + var kwargs=new PyDict(); + if (axis!=0) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("stack", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Stack 1-D arrays as columns into a 2-D array. - /// - /// Take a sequence of 1-D arrays and stack them as columns - /// to make a single 2-D array. 2-D arrays are stacked as-is, - /// just like with hstack. 1-D arrays are turned into 2-D columns - /// first. + /// Stack arrays in sequence depth wise (along third axis).

+ /// + /// This is equivalent to concatenation along the third axis after 2-D arrays + /// of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape + /// (N,) have been reshaped to (1,N,1).

+ /// Rebuilds arrays divided by + /// dsplit.

+ /// + /// This function makes most sense for arrays with up to 3 dimensions.

+ /// For + /// instance, for pixel-data with a height (first axis), width (second axis), + /// and r/g/b channels (third axis).

+ /// The functions concatenate, stack and + /// block provide more general stacking and concatenation operations. ///
/// - /// Arrays to stack. All of them must have the same first dimension. + /// The arrays must have the same shape along all but the third axis.

+ /// + /// 1-D or 2-D arrays must have the same shape. /// /// - /// The array formed by stacking the given arrays. + /// The array formed by stacking the given arrays, will be at least 3-D. /// - public static NDarray column_stack(NDarray[] tup) - => NumPy.Instance.column_stack(tup); + public static NDarray dstack(params NDarray[] tup) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + tup, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("dstack", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Stack arrays in sequence depth wise (along third axis). - /// - /// This is equivalent to concatenation along the third axis after 2-D arrays - /// of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape - /// (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by - /// dsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. + /// Stack arrays in sequence horizontally (column wise).

+ /// + /// This is equivalent to concatenation along the second axis, except for 1-D + /// arrays where it concatenates along the first axis.

+ /// Rebuilds arrays divided + /// by hsplit.

+ /// + /// This function makes most sense for arrays with up to 3 dimensions.

+ /// For + /// instance, for pixel-data with a height (first axis), width (second axis), + /// and r/g/b channels (third axis).

+ /// The functions concatenate, stack and + /// block provide more general stacking and concatenation operations. ///
/// - /// The arrays must have the same shape along all but the third axis. - /// 1-D or 2-D arrays must have the same shape. + /// The arrays must have the same shape along all but the second axis, + /// except 1-D arrays which can be any length. /// /// - /// The array formed by stacking the given arrays, will be at least 3-D. + /// The array formed by stacking the given arrays. /// - public static NDarray dstack(NDarray[] tup) - => NumPy.Instance.dstack(tup); + public static NDarray hstack(params NDarray[] tup) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + tup, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("hstack", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Stack arrays in sequence horizontally (column wise). - /// - /// This is equivalent to concatenation along the second axis, except for 1-D - /// arrays where it concatenates along the first axis. Rebuilds arrays divided - /// by hsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. + /// Stack arrays in sequence vertically (row wise).

+ /// + /// This is equivalent to concatenation along the first axis after 1-D arrays + /// of shape (N,) have been reshaped to (1,N).

+ /// Rebuilds arrays divided by + /// vsplit.

+ /// + /// This function makes most sense for arrays with up to 3 dimensions.

+ /// For + /// instance, for pixel-data with a height (first axis), width (second axis), + /// and r/g/b channels (third axis).

+ /// The functions concatenate, stack and + /// block provide more general stacking and concatenation operations. ///
/// - /// The arrays must have the same shape along all but the second axis, - /// except 1-D arrays which can be any length. + /// The arrays must have the same shape along all but the first axis.

+ /// + /// 1-D arrays must have the same length. /// /// - /// The array formed by stacking the given arrays. + /// The array formed by stacking the given arrays, will be at least 2-D. /// - public static NDarray hstack(NDarray[] tup) - => NumPy.Instance.hstack(tup); - - /// - /// Stack arrays in sequence vertically (row wise). - /// - /// This is equivalent to concatenation along the first axis after 1-D arrays - /// of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by - /// vsplit. - /// - /// This function makes most sense for arrays with up to 3 dimensions. For - /// instance, for pixel-data with a height (first axis), width (second axis), - /// and r/g/b channels (third axis). The functions concatenate, stack and - /// block provide more general stacking and concatenation operations. - /// - /// - /// The arrays must have the same shape along all but the first axis. - /// 1-D arrays must have the same length. - /// - /// - /// The array formed by stacking the given arrays, will be at least 2-D. - /// - public static NDarray vstack(NDarray[] tup) - => NumPy.Instance.vstack(tup); + public static NDarray vstack(params NDarray[] tup) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + tup, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("vstack", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// Assemble an nd-array from nested lists of blocks. - /// - /// Blocks in the innermost lists are concatenated (see concatenate) along - /// the last dimension (-1), then these are concatenated along the - /// second-last dimension (-2), and so on until the outermost list is reached. - /// - /// Blocks can be of any dimension, but will not be broadcasted using the normal - /// rules. Instead, leading axes of size 1 are inserted, to make block.ndim - /// the same for all blocks. This is primarily useful for working with scalars, - /// and means that code like np.block([v, 1]) is valid, where - /// v.ndim == 1. - /// - /// When the nested list is two levels deep, this allows block matrices to be - /// constructed from their components. - /// - /// Notes - /// - /// When called with only scalars, np.block is equivalent to an ndarray - /// call. So np.block([[1, 2], [3, 4]]) is equivalent to - /// np.array([[1, 2], [3, 4]]). - /// - /// This function does not enforce that the blocks lie on a fixed grid. - /// np.block([[a, b], [c, d]]) is not restricted to arrays of the form: - /// - /// But is also allowed to produce, for some a, b, c, d: - /// - /// Since concatenation happens along the last axis first, block is _not_ - /// capable of producing the following directly: - /// - /// Matlab’s “square bracket stacking”, [A, B, ...; p, q, ...], is - /// equivalent to np.block([[A, B, ...], [p, q, ...]]). + /// Assemble an nd-array from nested lists of blocks.

+ /// + /// Blocks in the innermost lists are concatenated (see concatenate) along + /// the last dimension (-1), then these are concatenated along the + /// second-last dimension (-2), and so on until the outermost list is reached.

+ /// + /// Blocks can be of any dimension, but will not be broadcasted using the normal + /// rules.

+ /// Instead, leading axes of size 1 are inserted, to make block.ndim + /// the same for all blocks.

+ /// This is primarily useful for working with scalars, + /// and means that code like np.block([v, 1]) is valid, where + /// v.ndim == 1.

+ /// + /// When the nested list is two levels deep, this allows block matrices to be + /// constructed from their components.

+ /// + /// Notes + /// + /// When called with only scalars, np.block is equivalent to an ndarray + /// call.

+ /// So np.block([[1, 2], [3, 4]]) is equivalent to + /// np.array([[1, 2], [3, 4]]).

+ /// + /// This function does not enforce that the blocks lie on a fixed grid.

+ /// + /// np.block([[a, b], [c, d]]) is not restricted to arrays of the form: + /// + /// But is also allowed to produce, for some a, b, c, d: + /// + /// Since concatenation happens along the last axis first, block is _not_ + /// capable of producing the following directly: + /// + /// Matlab’s “square bracket stacking”, [A, B, ...; p, q, ...], is + /// equivalent to np.block([[A, B, ...], [p, q, ...]]). ///
/// - /// If passed a single ndarray or scalar (a nested list of depth 0), this - /// is returned unmodified (and not copied). - /// - /// Elements shapes must match along the appropriate axes (without - /// broadcasting), but leading 1s will be prepended to the shape as - /// necessary to make the dimensions match. + /// If passed a single ndarray or scalar (a nested list of depth 0), this + /// is returned unmodified (and not copied).

+ /// + /// Elements shapes must match along the appropriate axes (without + /// broadcasting), but leading 1s will be prepended to the shape as + /// necessary to make the dimensions match. /// /// - /// The array assembled from the given blocks. - /// - /// The dimensionality of the output is equal to the greatest of: - /// * the dimensionality of all the inputs - /// * the depth to which the input list is nested + /// The array assembled from the given blocks.

+ /// + /// The dimensionality of the output is equal to the greatest of: + /// * the dimensionality of all the inputs + /// * the depth to which the input list is nested ///
public static NDarray block(nested list of array_like or scalars (but not tuples) arrays) - => NumPy.Instance.block(arrays); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arrays, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("block", pyargs, kwargs); + return ToCsharp(py); + } */ /// - /// Split an array into multiple sub-arrays. + /// Split an array into multiple sub-arrays. /// /// - /// Array to be divided into sub-arrays. + /// Array to be divided into sub-arrays. /// /// - /// If indices_or_sections is an integer, N, the array will be divided - /// into N equal arrays along axis. If such a split is not possible, - /// an error is raised. - /// - /// If indices_or_sections is a 1-D array of sorted integers, the entries - /// indicate where along axis the array is split. For example, - /// [2, 3] would, for axis=0, result in - /// - /// If an index exceeds the dimension of the array along axis, - /// an empty sub-array is returned correspondingly. + /// 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. + /// The axis along which to split, default is 0. /// /// - /// A list of sub-arrays. + /// A list of sub-arrays. /// - public static NDarray[] split(NDarray ary, int[] indices_or_sections, int? axis = 0) - => NumPy.Instance.split(ary, indices_or_sections, axis:axis); + public static NDarray[] split(this NDarray ary, int[] indices_or_sections, int? axis = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ary, + indices_or_sections, + }); + var kwargs=new PyDict(); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Construct an array by repeating A the number of times given by reps. - /// - /// 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. + /// Split an array into multiple sub-arrays. /// - /// - /// The input array. + /// + /// Array to be divided into sub-arrays. /// - /// - /// The number of repetitions of A along each axis. + /// + /// 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. /// /// - /// The tiled output array. + /// A list of sub-arrays. /// - public static NDarray tile(NDarray A, NDarray reps) - => NumPy.Instance.tile(A, reps); + public static NDarray[] split(this NDarray ary, int indices_or_sections, int? axis = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ary, + indices_or_sections, + }); + var kwargs=new PyDict(); + if (axis!=0) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Repeat elements of an array. + /// 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. ///
- /// - /// Input array. - /// - /// - /// The number of repetitions for each element. repeats is broadcasted - /// to fit the shape of the given axis. + /// + /// The input array. /// - /// - /// The axis along which to repeat values. By default, use the - /// flattened input array, and return a flat output array. + /// + /// The number of repetitions of A along each axis. /// /// - /// Output array which has the same shape as a, except along - /// the given axis. + /// The tiled output array. /// - public static NDarray repeat(NDarray a, int[] repeats, int? axis = null) - => NumPy.Instance.repeat(a, repeats, axis:axis); + public static NDarray tile(this NDarray A, NDarray reps) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + A, + reps, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("tile", 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. + /// Repeat elements of an array. /// - /// - /// Input array. + /// + /// Input array. /// - /// - /// Indicate which sub-arrays to remove. + /// + /// The number of repetitions for each element.

+ /// repeats is broadcasted + /// to fit the shape of the given axis. /// /// - /// The axis along which to delete the subarray defined by obj. - /// If axis is None, obj is applied to the flattened array. + /// The axis along which to repeat values.

+ /// By default, use the + /// flattened input array, and return a flat output 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. + /// Output array which has the same shape as a, except along + /// the given axis. /// - public static NDarray delete(NDarray arr, Slice obj, int? axis = null) - => NumPy.Instance.delete(arr, obj, axis:axis); + public static NDarray repeat(this NDarray a, int[] repeats, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + repeats, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("repeat", 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. + /// 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. ///
/// - /// Input array. + /// 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. + /// Indicate which sub-arrays to remove. /// /// - /// Axis along which to insert values. If axis is None then arr - /// is flattened first. + /// 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 values inserted. Note that insert - /// does not occur in-place: a new array is returned. If - /// axis is None, out is a 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 static NDarray insert(NDarray arr, int obj = 0, NDarray values = null, int? axis = null) - => NumPy.Instance.insert(arr, obj, values, axis:axis); + public static NDarray delete(this NDarray arr, Slice obj, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + obj, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("delete", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Append values to the end of an array. + /// Append values to the end of an array. /// /// - /// Values are appended to a copy of this array. + /// Values are appended to a copy of this 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. + /// 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. + /// 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. + /// 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 static NDarray append(NDarray arr, NDarray values, int? axis = null) - => NumPy.Instance.append(arr, values, axis:axis); + public static NDarray append(this NDarray arr, NDarray values, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + values, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("append", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a new array with the specified shape. - /// - /// If the new array is larger than the original array, then the new - /// array is filled with repeated copies of a. Note that this behavior - /// is different from a.resize(new_shape) which fills with zeros instead - /// of repeated copies of a. - /// - /// Notes - /// - /// Warning: This functionality does not consider axes separately, - /// i.e. it does not apply interpolation/extrapolation. - /// It fills the return array with the required number of elements, taken - /// from a as they are laid out in memory, disregarding strides and axes. - /// (This is in case the new shape is smaller. For larger, see above.) - /// This functionality is therefore not suitable to resize images, - /// or data where each axis represents a separate and distinct entity. + /// Trim the leading and/or trailing zeros from a 1-D array or sequence. /// - /// - /// Array to be resized. + /// + /// Input array. /// - /// - /// Shape of resized array. + /// + /// 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 new array is formed from the data in the old array, repeated - /// if necessary to fill out the required number of elements. The - /// data are repeated in the order that they are stored in memory. + /// The result of trimming the input.

+ /// The input data type is preserved. ///
- public static NDarray resize(NDarray a, Shape new_shape) - => NumPy.Instance.resize(a, new_shape); + public static NDarray trim_zeros(this NDarray filt, string trim = "fb") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + filt, + }); + var kwargs=new PyDict(); + if (trim!="fb") kwargs["trim"]=ToPython(trim); + dynamic py = __self__.InvokeMethod("trim_zeros", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Trim the leading and/or trailing zeros from a 1-D array or sequence. + /// 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. ///
- /// - /// Input array. + /// + /// Input array.

+ /// Unless axis is specified, this will be flattened if it + /// is not already 1-D. /// - /// - /// 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 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 result of trimming the input. The input data type is preserved. + /// The sorted unique values. /// - public static NDarray trim_zeros(NDarray filt, string trim = "fb") - => NumPy.Instance.trim_zeros(filt, trim:trim); + public static NDarray unique(NDarray ar, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar, + }); + 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. + /// 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. ///
/// - /// Input array. Unless axis is specified, this will be flattened if it - /// is not already 1-D. + /// Input array.

+ /// Unless axis is specified, this will be flattened if it + /// is not already 1-D. /// /// - /// 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 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 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. + /// 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 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. /// /// - /// A tuple of: - /// unique - /// The sorted unique values. - /// unique_indices - /// The indices of the first occurrences of the unique values in the - /// original array. Only provided if return_index is True. - /// unique_inverse - /// The indices to reconstruct the original array from the - /// unique array. Only provided if return_inverse is True. - /// unique_counts - /// The number of times each of the unique values comes up in the - /// original array. Only provided if return_counts is True. + /// The sorted unique values. /// - public static (NDarray, NDarray, NDarray, NDarray) unique(NDarray ar, bool? return_index = false, bool? return_inverse = false, bool? return_counts = false, int? axis = null) - => NumPy.Instance.unique(ar, return_index:return_index, return_inverse:return_inverse, return_counts:return_counts, axis:axis); + public static NDarray[] unique(this NDarray ar, bool return_index, bool return_inverse, bool return_counts, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// 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. + /// 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. + /// A view of m with the entries of axis reversed.

+ /// Since a view is + /// returned, this operation is done in constant time. ///
- public static NDarray flip(NDarray m, int[] axis = null) - => NumPy.Instance.flip(m, axis:axis); + public static NDarray flip(this NDarray m, Axis axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + m, + }); + 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. + /// 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. ///
/// - /// Input array, must be at least 2-D. + /// Input array, must be at least 2-D. /// /// - /// A view of m with the columns reversed. Since a view - /// is returned, this operation is . + /// A view of m with the columns reversed.

+ /// Since a view + /// is returned, this operation is . ///
- public static NDarray fliplr(NDarray m) - => NumPy.Instance.fliplr(m); + public static NDarray fliplr(this NDarray m) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + m, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("fliplr", pyargs, kwargs); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// A view of m with the rows reversed. Since a view is - /// returned, this operation is . + /// A view of m with the rows reversed.

+ /// Since a view is + /// returned, this operation is . ///
- public static NDarray flipud(NDarray m) - => NumPy.Instance.flipud(m); + public static NDarray flipud(this NDarray m) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + m, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("flipud", pyargs, kwargs); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// 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. + /// 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. + /// 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. + /// Output array, with the same shape as a. /// - public static NDarray roll(NDarray a, int[] shift, int[] axis = null) - => NumPy.Instance.roll(a, shift, axis:axis); + public static NDarray roll(this NDarray a, int[] shift, Axis axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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)) + /// 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)) ///
/// - /// Array of two or more dimensions. + /// Array of two or more dimensions. /// /// - /// Number of times the array is rotated by 90 degrees. + /// 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. + /// The array is rotated in the plane defined by the axes.

+ /// + /// Axes must be different. /// /// - /// A rotated view of m. + /// A rotated view of m. /// - public static NDarray rot90(NDarray m, int k = 1, int[] axes = null) - => NumPy.Instance.rot90(m, k, axes); + public static NDarray rot90(this NDarray m, int k = 1, int[] axes = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + m, + }); + 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); + } } diff --git a/src/Numpy/np.bitwise.gen.cs b/src/Numpy/np.bitwise.gen.cs index d80dc7d..6e0ffbb 100644 --- a/src/Numpy/np.bitwise.gen.cs +++ b/src/Numpy/np.bitwise.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,278 +20,427 @@ public static partial class np { /// - /// 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 &. + /// 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. + /// Only integer and boolean types are handled. /// /// - /// Only integer and boolean types are handled. + /// 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. + /// + /// 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. + /// + /// 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. + /// Result.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray bitwise_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.bitwise_and(x2, x1, @out:@out, @where:@where); + public static NDarray bitwise_and(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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 |. + /// 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. + /// Only integer and boolean types are handled. /// /// - /// Only integer and boolean types are handled. + /// 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. + /// + /// 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. + /// + /// 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. + /// Result.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray bitwise_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.bitwise_or(x2, x1, @out:@out, @where:@where); + public static NDarray bitwise_or(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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 ^. + /// 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. + /// Only integer and boolean types are handled. /// /// - /// Only integer and boolean types are handled. + /// 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. + /// + /// 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. + /// + /// 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. + /// Result.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray bitwise_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.bitwise_xor(x2, x1, @out:@out, @where:@where); + public static NDarray bitwise_xor(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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 + /// 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 ///
/// - /// Only integer and boolean types are handled. + /// 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. + /// + /// 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. + /// + /// 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. + /// Result.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray invert(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.invert(x, @out:@out, @where:@where); + public static NDarray invert(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 left. - /// - /// Bits are shifted to the left by appending x2 0s at the right of x1. - /// Since the internal representation of numbers is in binary format, this - /// operation is equivalent to multiplying x1 by 2**x2. + /// Shift the bits of an integer to the left.

+ /// + /// Bits are shifted to the left by appending x2 0s at the right of x1. + /// Since the internal representation of numbers is in binary format, this + /// operation is equivalent to multiplying x1 by 2**x2. ///
/// - /// Input values. + /// Input values. /// /// - /// Number of zeros to append to x1. Has to be non-negative. + /// Number of zeros to append to x1. Has to be non-negative. /// - /// - /// 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. + /// + /// 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. + /// + /// 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 left. - /// This is a scalar if both x1 and x2 are scalars. + /// Return x1 with bits shifted x2 times to the left.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
public static NDarray left_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.left_shift(x1, x2, @out:@out, @where:@where); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + x2, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (@where!=null) kwargs["where"]=ToPython(@where); + dynamic py = __self__.InvokeMethod("left_shift", 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. + /// 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. ///
/// - /// Input values. + /// Input values. /// /// - /// Number of bits to remove at the right of x1. + /// 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. + /// + /// 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. + /// + /// 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. + /// Return x1 with bits shifted x2 times to the right.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray right_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.right_shift(x1, x2, @out:@out, @where:@where); + public static NDarray right_shift(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// An array of integers or booleans whose elements should be packed to - /// bits. + /// An array of integers or booleans whose elements should be packed to + /// bits. /// /// - /// The dimension over which bit-packing is done. - /// None implies packing the flattened array. + /// 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). + /// 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 static NDarray packbits(NDarray myarray, int? axis = null) - => NumPy.Instance.packbits(myarray, axis:axis); + public static NDarray packbits(this NDarray myarray, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + myarray, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// The dimension over which bit-unpacking is done. - /// None implies unpacking the flattened array. + /// The dimension over which bit-unpacking is done.

+ /// + /// None implies unpacking the flattened array. /// /// - /// The elements are binary-valued (0 or 1). + /// The elements are binary-valued (0 or 1). /// - public static NDarray unpackbits(NDarray myarray, int? axis = null) - => NumPy.Instance.unpackbits(myarray, axis:axis); + public static NDarray unpackbits(this NDarray myarray, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + myarray, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("unpackbits", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the binary representation of the input number as a string. - /// - /// For negative numbers, if width is not given, a minus sign is added to the - /// front. If width is given, the two’s complement of the number is - /// returned, with respect to that width. - /// - /// 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 - /// - /// binary_repr is equivalent to using base_repr with base 2, but about 25x - /// faster. - /// - /// References + /// Return the binary representation of the input number as a string.

+ /// + /// For negative numbers, if width is not given, a minus sign is added to the + /// front.

+ /// If width is given, the two’s complement of the number is + /// returned, with respect to that width.

+ /// + /// 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 + /// + /// binary_repr is equivalent to using base_repr with base 2, but about 25x + /// faster.

+ /// + /// References ///
/// - /// Only an integer decimal number can be used. + /// Only an integer decimal number can be used. /// /// - /// The length of the returned string if num is positive, or the length - /// of the two’s complement if num is negative, provided that width is - /// at least a sufficient number of bits for num to be represented in the - /// designated form. - /// - /// If the width value is insufficient, it will be ignored, and num will - /// be returned in binary (num > 0) or two’s complement (num < 0) form - /// with its width equal to the minimum number of bits needed to represent - /// the number in the designated form. This behavior is deprecated and will - /// later raise an error. + /// The length of the returned string if num is positive, or the length + /// of the two’s complement if num is negative, provided that width is + /// at least a sufficient number of bits for num to be represented in the + /// designated form.

+ /// + /// If the width value is insufficient, it will be ignored, and num will + /// be returned in binary (num > 0) or two’s complement (num < 0) form + /// with its width equal to the minimum number of bits needed to represent + /// the number in the designated form.

+ /// This behavior is deprecated and will + /// later raise an error. /// /// - /// Binary representation of num or two’s complement of num. + /// Binary representation of num or two’s complement of num. /// public static string binary_repr(int num, int? width = null) - => NumPy.Instance.binary_repr(num, width:width); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + num, + }); + var kwargs=new PyDict(); + if (width!=null) kwargs["width"]=ToPython(width); + dynamic py = __self__.InvokeMethod("binary_repr", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.datetime.gen.cs b/src/Numpy/np.datetime.gen.cs index bf0f313..cac7a1f 100644 --- a/src/Numpy/np.datetime.gen.cs +++ b/src/Numpy/np.datetime.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,211 +20,314 @@ public static partial class np { /// - /// Convert an array of datetimes into an array of strings. + /// Convert an array of datetimes into an array of strings. /// /// - /// The array of UTC timestamps to format. + /// The array of UTC timestamps to format. /// /// - /// One of None, ‘auto’, or a datetime unit. + /// One of None, ‘auto’, or a datetime unit. /// /// - /// Timezone information to use when displaying the datetime. If ‘UTC’, end - /// with a Z to indicate UTC time. If ‘local’, convert to the local timezone - /// first, and suffix with a +-#### timezone offset. If a tzinfo object, - /// then do as with ‘local’, but use the specified timezone. + /// Timezone information to use when displaying the datetime.

+ /// If ‘UTC’, end + /// with a Z to indicate UTC time.

+ /// If ‘local’, convert to the local timezone + /// first, and suffix with a +-#### timezone offset.

+ /// If a tzinfo object, + /// then do as with ‘local’, but use the specified timezone. /// /// - /// Casting to allow when changing between datetime units. + /// Casting to allow when changing between datetime units. /// /// - /// An array of strings the same shape as arr. + /// An array of strings the same shape as arr. /// public static NDarray datetime_as_string(string[] arr, string unit, string timezone = "naive", string casting = "same_kind") - => NumPy.Instance.datetime_as_string(arr, unit, timezone, casting); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + unit, + }); + var kwargs=new PyDict(); + if (timezone!="naive") kwargs["timezone"]=ToPython(timezone); + if (casting!="same_kind") kwargs["casting"]=ToPython(casting); + dynamic py = __self__.InvokeMethod("datetime_as_string", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Get information about the step size of a date or time type. - /// - /// The returned tuple can be passed as the second argument of numpy.datetime64 and - /// numpy.timedelta64. + /// Get information about the step size of a date or time type.

+ /// + /// The returned tuple can be passed as the second argument of numpy.datetime64 and + /// numpy.timedelta64. ///
/// - /// The dtype object, which must be a datetime64 or timedelta64 type. + /// The dtype object, which must be a datetime64 or timedelta64 type. /// /// /// A tuple of: /// unit - /// The datetime unit on which this dtype - /// is based. + /// The datetime unit on which this dtype + /// is based. /// count - /// The number of base units in a step. + /// The number of base units in a step. /// public static (string, int) datetime_data(Dtype dtype) - => NumPy.Instance.datetime_data(dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("datetime_data", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /* /// - /// A business day calendar object that efficiently stores information - /// defining valid days for the busday family of functions. - /// - /// The default valid days are Monday through Friday (“business days”). - /// A busdaycalendar object can be specified with any set of weekly - /// valid days, plus an optional “holiday” dates that always will be invalid. - /// - /// Once a busdaycalendar object is created, the weekmask and holidays - /// cannot be modified. + /// A business day calendar object that efficiently stores information + /// defining valid days for the busday family of functions.

+ /// + /// The default valid days are Monday through Friday (“business days”).

+ /// + /// A busdaycalendar object can be specified with any set of weekly + /// valid days, plus an optional “holiday” dates that always will be invalid.

+ /// + /// Once a busdaycalendar object is created, the weekmask and holidays + /// cannot be modified. ///
/// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun + /// A seven-element array indicating which of Monday through Sunday are + /// valid days.

+ /// May be specified as a length-seven list or array, like + /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string + /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for + /// weekdays, optionally separated by white space.

+ /// Valid abbreviations + /// are: Mon Tue Wed Thu Fri Sat Sun /// /// - /// An array of dates to consider as invalid dates, no matter which - /// weekday they fall upon. Holiday dates may be specified in any - /// order, and NaT (not-a-time) dates are ignored. This list is - /// saved in a normalized form that is suited for fast calculations - /// of valid days. + /// An array of dates to consider as invalid dates, no matter which + /// weekday they fall upon.

+ /// Holiday dates may be specified in any + /// order, and NaT (not-a-time) dates are ignored.

+ /// This list is + /// saved in a normalized form that is suited for fast calculations + /// of valid days. /// /// - /// A business day calendar object containing the specified - /// weekmask and holidays values. + /// A business day calendar object containing the specified + /// weekmask and holidays values. /// public static busdaycalendar busdaycalendar(string weekmask = null, string[] holidays = null) - => NumPy.Instance.busdaycalendar(weekmask:weekmask, holidays:holidays); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (weekmask!=null) kwargs["weekmask"]=ToPython(weekmask); + if (holidays!=null) kwargs["holidays"]=ToPython(holidays); + dynamic py = __self__.InvokeMethod("busdaycalendar", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Calculates which of the given dates are valid days, and which are not. + /// Calculates which of the given dates are valid days, and which are not. /// /// - /// The array of dates to process. + /// The array of dates to process. /// /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun + /// A seven-element array indicating which of Monday through Sunday are + /// valid days.

+ /// May be specified as a length-seven list or array, like + /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string + /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for + /// weekdays, optionally separated by white space.

+ /// Valid abbreviations + /// are: Mon Tue Wed Thu Fri Sat Sun /// /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. + /// An array of dates to consider as invalid dates.

+ /// They may be + /// specified in any order, and NaT (not-a-time) dates are ignored.

+ /// + /// This list is saved in a normalized form that is suited for + /// fast calculations of valid days. /// /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. + /// A busdaycalendar object which specifies the valid days.

+ /// If this + /// parameter is provided, neither weekmask nor holidays may be + /// provided. /// - /// - /// If provided, this array is filled with the result. + /// + /// If provided, this array is filled with the result. /// /// - /// An array with the same shape as dates, containing True for - /// each valid day, and False for each invalid day. + /// An array with the same shape as dates, containing True for + /// each valid day, and False for each invalid day. /// public static NDarray is_busday(string[] dates, string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, NDarray @out = null) - => NumPy.Instance.is_busday(dates, weekmask:weekmask, holidays:holidays, busdaycal:busdaycal, @out:@out); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dates, + }); + var kwargs=new PyDict(); + if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); + if (holidays!=null) kwargs["holidays"]=ToPython(holidays); + if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("is_busday", pyargs, kwargs); + return ToCsharp>(py); + } */ /* /// - /// First adjusts the date to fall on a valid day according to - /// the roll rule, then applies offsets to the given dates - /// counted in valid days. + /// First adjusts the date to fall on a valid day according to + /// the roll rule, then applies offsets to the given dates + /// counted in valid days. /// /// - /// The array of dates to process. + /// The array of dates to process. /// /// - /// The array of offsets, which is broadcast with dates. + /// The array of offsets, which is broadcast with dates. /// /// - /// How to treat dates that do not fall on a valid day. The default - /// is ‘raise’. + /// How to treat dates that do not fall on a valid day.

+ /// The default + /// is ‘raise’. /// /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun + /// A seven-element array indicating which of Monday through Sunday are + /// valid days.

+ /// May be specified as a length-seven list or array, like + /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string + /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for + /// weekdays, optionally separated by white space.

+ /// Valid abbreviations + /// are: Mon Tue Wed Thu Fri Sat Sun /// /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. + /// An array of dates to consider as invalid dates.

+ /// They may be + /// specified in any order, and NaT (not-a-time) dates are ignored.

+ /// + /// This list is saved in a normalized form that is suited for + /// fast calculations of valid days. /// /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. + /// A busdaycalendar object which specifies the valid days.

+ /// If this + /// parameter is provided, neither weekmask nor holidays may be + /// provided. /// - /// - /// If provided, this array is filled with the result. + /// + /// If provided, this array is filled with the result. /// /// - /// An array with a shape from broadcasting dates and offsets - /// together, containing the dates with offsets applied. + /// An array with a shape from broadcasting dates and offsets + /// together, containing the dates with offsets applied. /// public static array of datetime64[D] busday_offset(string[] dates, array_like of int offsets, string roll = "raise", string weekmask = "1111100", string[] holidays = null, busdaycalendar busdaycal = null, array of datetime64[D] @out = null) - => NumPy.Instance.busday_offset(dates, offsets, roll:roll, weekmask:weekmask, holidays:holidays, busdaycal:busdaycal, @out:@out); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dates, + offsets, + }); + var kwargs=new PyDict(); + if (roll!="raise") kwargs["roll"]=ToPython(roll); + if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); + if (holidays!=null) kwargs["holidays"]=ToPython(holidays); + if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("busday_offset", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Counts the number of valid days between begindates and - /// enddates, not including the day of enddates. - /// - /// If enddates specifies a date value that is earlier than the - /// corresponding begindates date value, the count will be negative. + /// Counts the number of valid days between begindates and + /// enddates, not including the day of enddates.

+ /// + /// If enddates specifies a date value that is earlier than the + /// corresponding begindates date value, the count will be negative. ///
/// - /// The array of the first dates for counting. + /// The array of the first dates for counting. /// /// - /// The array of the end dates for counting, which are excluded - /// from the count themselves. + /// The array of the end dates for counting, which are excluded + /// from the count themselves. /// /// - /// A seven-element array indicating which of Monday through Sunday are - /// valid days. May be specified as a length-seven list or array, like - /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string - /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for - /// weekdays, optionally separated by white space. Valid abbreviations - /// are: Mon Tue Wed Thu Fri Sat Sun + /// A seven-element array indicating which of Monday through Sunday are + /// valid days.

+ /// May be specified as a length-seven list or array, like + /// [1,1,1,1,1,0,0]; a length-seven string, like ‘1111100’; or a string + /// like “Mon Tue Wed Thu Fri”, made up of 3-character abbreviations for + /// weekdays, optionally separated by white space.

+ /// Valid abbreviations + /// are: Mon Tue Wed Thu Fri Sat Sun /// /// - /// An array of dates to consider as invalid dates. They may be - /// specified in any order, and NaT (not-a-time) dates are ignored. - /// This list is saved in a normalized form that is suited for - /// fast calculations of valid days. + /// An array of dates to consider as invalid dates.

+ /// They may be + /// specified in any order, and NaT (not-a-time) dates are ignored.

+ /// + /// This list is saved in a normalized form that is suited for + /// fast calculations of valid days. /// /// - /// A busdaycalendar object which specifies the valid days. If this - /// parameter is provided, neither weekmask nor holidays may be - /// provided. + /// A busdaycalendar object which specifies the valid days.

+ /// If this + /// parameter is provided, neither weekmask nor holidays may be + /// provided. /// - /// - /// If provided, this array is filled with the result. + /// + /// If provided, this array is filled with the result. /// /// - /// An array with a shape from broadcasting begindates and enddates - /// together, containing the number of valid days between - /// the begin and end dates. + /// An array with a shape from broadcasting begindates and enddates + /// together, containing the number of valid days between + /// the begin and end dates. /// public static array of int busday_count(string[] begindates, string[] enddates, string weekmask = "1111100", string[] holidays = [], busdaycalendar busdaycal = null, array of int @out = null) - => NumPy.Instance.busday_count(begindates, enddates, weekmask:weekmask, holidays:holidays, busdaycal:busdaycal, @out:@out); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + begindates, + enddates, + }); + var kwargs=new PyDict(); + if (weekmask!="1111100") kwargs["weekmask"]=ToPython(weekmask); + if (holidays!=[]) kwargs["holidays"]=ToPython(holidays); + if (busdaycal!=null) kwargs["busdaycal"]=ToPython(busdaycal); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("busday_count", pyargs, kwargs); + return ToCsharp(py); + } */ diff --git a/src/Numpy/np.dtype.gen.cs b/src/Numpy/np.dtype.gen.cs index 7768996..4b4f0cd 100644 --- a/src/Numpy/np.dtype.gen.cs +++ b/src/Numpy/np.dtype.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,264 +20,694 @@ public static partial class np { /// - /// compatible: Python bool - /// - public static Dtype bool_ - => NumPy.Instance.bool_; - - /// - /// 8 bits - /// - public static Dtype bool8 - => NumPy.Instance.bool8; - - /// - /// compatible: C char - /// - public static Dtype @byte - => NumPy.Instance.@byte; - - /// - /// compatible: C short - /// - public static Dtype @short - => NumPy.Instance.@short; - - /// - /// compatible: C int - /// - public static Dtype intc - => NumPy.Instance.intc; - - /// - /// compatible: Python int - /// - public static Dtype int_ - => NumPy.Instance.int_; - - /// - /// compatible: C long long - /// - public static Dtype longlong - => NumPy.Instance.longlong; - - /// - /// large enough to fit a pointer - /// - public static Dtype intp - => NumPy.Instance.intp; - - /// - /// 8 bits - /// - public static Dtype int8 - => NumPy.Instance.int8; - - /// - /// 16 bits - /// - public static Dtype int16 - => NumPy.Instance.int16; - - /// - /// 32 bits - /// - public static Dtype int32 - => NumPy.Instance.int32; - - /// - /// 64 bits - /// - public static Dtype int64 - => NumPy.Instance.int64; - - /// - /// compatible: C unsigned char - /// - public static Dtype ubyte - => NumPy.Instance.ubyte; - - /// - /// compatible: C unsigned short - /// - public static Dtype @ushort - => NumPy.Instance.@ushort; - - /// - /// compatible: C unsigned int - /// - public static Dtype uintc - => NumPy.Instance.uintc; - - /// - /// compatible: Python int - /// - public static Dtype @uint - => NumPy.Instance.@uint; - - /// - /// compatible: C long long - /// - public static Dtype ulonglong - => NumPy.Instance.ulonglong; - - /// - /// large enough to fit a pointer - /// - public static Dtype uintp - => NumPy.Instance.uintp; - - /// - /// 8 bits - /// - public static Dtype uint8 - => NumPy.Instance.uint8; - - /// - /// 16 bits - /// - public static Dtype uint16 - => NumPy.Instance.uint16; - - /// - /// 32 bits - /// - public static Dtype uint32 - => NumPy.Instance.uint32; - - /// - /// 64 bits - /// - public static Dtype uint64 - => NumPy.Instance.uint64; - - /// - ///   - /// - public static Dtype half - => NumPy.Instance.half; - - /// - /// compatible: C float - /// - public static Dtype single - => NumPy.Instance.single; - - /// - /// compatible: C double - /// - public static Dtype @double - => NumPy.Instance.@double; - - /// - /// compatible: Python float - /// - public static Dtype float_ - => NumPy.Instance.float_; - - /// - /// compatible: C long float - /// - public static Dtype longfloat - => NumPy.Instance.longfloat; - - /// - /// 16 bits - /// - public static Dtype float16 - => NumPy.Instance.float16; - - /// - /// 32 bits - /// - public static Dtype float32 - => NumPy.Instance.float32; - - /// - /// 64 bits - /// - public static Dtype float64 - => NumPy.Instance.float64; - - /// - /// 96 bits, platform? - /// - public static Dtype float96 - => NumPy.Instance.float96; - - /// - /// 128 bits, platform? - /// - public static Dtype float128 - => NumPy.Instance.float128; - - /// - ///   - /// - public static Dtype csingle - => NumPy.Instance.csingle; - - /// - /// compatible: Python complex - /// - public static Dtype complex_ - => NumPy.Instance.complex_; - - /// - ///   - /// - public static Dtype clongfloat - => NumPy.Instance.clongfloat; - - /// - /// two 32-bit floats - /// - public static Dtype complex64 - => NumPy.Instance.complex64; - - /// - /// two 64-bit floats - /// - public static Dtype complex128 - => NumPy.Instance.complex128; - - /// - /// two 96-bit floats, - /// platform? - /// - public static Dtype complex192 - => NumPy.Instance.complex192; - - /// - /// two 128-bit floats, - /// platform? - /// - public static Dtype complex256 - => NumPy.Instance.complex256; - - /// - /// any Python object - /// - public static Dtype object_ - => NumPy.Instance.object_; - - /// - /// compatible: Python bytes - /// - public static Dtype bytes_ - => NumPy.Instance.bytes_; - - /// - /// compatible: Python unicode/str - /// - public static Dtype unicode_ - => NumPy.Instance.unicode_; - - /// - ///   - /// - public static Dtype @void - => NumPy.Instance.@void; + /// compatible: Python bool + /// + public static Dtype bool_ + { + get + { + dynamic py = self.GetAttr("bool_"); + return ToCsharp(py); + } + set + { + self.SetAttr("bool_", ToPython(value)); + } + } + + /// + /// 8 bits + /// + public static Dtype bool8 + { + get + { + dynamic py = self.GetAttr("bool8"); + return ToCsharp(py); + } + set + { + self.SetAttr("bool8", ToPython(value)); + } + } + + /// + /// compatible: C char + /// + public static Dtype @byte + { + get + { + dynamic py = self.GetAttr("byte"); + return ToCsharp(py); + } + set + { + self.SetAttr("byte", ToPython(value)); + } + } + + /// + /// compatible: C short + /// + public static Dtype @short + { + get + { + dynamic py = self.GetAttr("short"); + return ToCsharp(py); + } + set + { + self.SetAttr("short", ToPython(value)); + } + } + + /// + /// compatible: C int + /// + public static Dtype intc + { + get + { + dynamic py = self.GetAttr("intc"); + return ToCsharp(py); + } + set + { + self.SetAttr("intc", ToPython(value)); + } + } + + /// + /// compatible: Python int + /// + public static Dtype int_ + { + get + { + dynamic py = self.GetAttr("int_"); + return ToCsharp(py); + } + set + { + self.SetAttr("int_", ToPython(value)); + } + } + + /// + /// compatible: C long long + /// + public static Dtype longlong + { + get + { + dynamic py = self.GetAttr("longlong"); + return ToCsharp(py); + } + set + { + self.SetAttr("longlong", ToPython(value)); + } + } + + /// + /// large enough to fit a pointer + /// + public static Dtype intp + { + get + { + dynamic py = self.GetAttr("intp"); + return ToCsharp(py); + } + set + { + self.SetAttr("intp", ToPython(value)); + } + } + + /// + /// 8 bits + /// + public static Dtype int8 + { + get + { + dynamic py = self.GetAttr("int8"); + return ToCsharp(py); + } + set + { + self.SetAttr("int8", ToPython(value)); + } + } + + /// + /// 16 bits + /// + public static Dtype int16 + { + get + { + dynamic py = self.GetAttr("int16"); + return ToCsharp(py); + } + set + { + self.SetAttr("int16", ToPython(value)); + } + } + + /// + /// 32 bits + /// + public static Dtype int32 + { + get + { + dynamic py = self.GetAttr("int32"); + return ToCsharp(py); + } + set + { + self.SetAttr("int32", ToPython(value)); + } + } + + /// + /// 64 bits + /// + public static Dtype int64 + { + get + { + dynamic py = self.GetAttr("int64"); + return ToCsharp(py); + } + set + { + self.SetAttr("int64", ToPython(value)); + } + } + + /// + /// compatible: C unsigned char + /// + public static Dtype ubyte + { + get + { + dynamic py = self.GetAttr("ubyte"); + return ToCsharp(py); + } + set + { + self.SetAttr("ubyte", ToPython(value)); + } + } + + /// + /// compatible: C unsigned short + /// + public static Dtype @ushort + { + get + { + dynamic py = self.GetAttr("ushort"); + return ToCsharp(py); + } + set + { + self.SetAttr("ushort", ToPython(value)); + } + } + + /// + /// compatible: C unsigned int + /// + public static Dtype uintc + { + get + { + dynamic py = self.GetAttr("uintc"); + return ToCsharp(py); + } + set + { + self.SetAttr("uintc", ToPython(value)); + } + } + + /// + /// compatible: Python int + /// + public static Dtype @uint + { + get + { + dynamic py = self.GetAttr("uint"); + return ToCsharp(py); + } + set + { + self.SetAttr("uint", ToPython(value)); + } + } + + /// + /// compatible: C long long + /// + public static Dtype ulonglong + { + get + { + dynamic py = self.GetAttr("ulonglong"); + return ToCsharp(py); + } + set + { + self.SetAttr("ulonglong", ToPython(value)); + } + } + + /// + /// large enough to fit a pointer + /// + public static Dtype uintp + { + get + { + dynamic py = self.GetAttr("uintp"); + return ToCsharp(py); + } + set + { + self.SetAttr("uintp", ToPython(value)); + } + } + + /// + /// 8 bits + /// + public static Dtype uint8 + { + get + { + dynamic py = self.GetAttr("uint8"); + return ToCsharp(py); + } + set + { + self.SetAttr("uint8", ToPython(value)); + } + } + + /// + /// 16 bits + /// + public static Dtype uint16 + { + get + { + dynamic py = self.GetAttr("uint16"); + return ToCsharp(py); + } + set + { + self.SetAttr("uint16", ToPython(value)); + } + } + + /// + /// 32 bits + /// + public static Dtype uint32 + { + get + { + dynamic py = self.GetAttr("uint32"); + return ToCsharp(py); + } + set + { + self.SetAttr("uint32", ToPython(value)); + } + } + + /// + /// 64 bits + /// + public static Dtype uint64 + { + get + { + dynamic py = self.GetAttr("uint64"); + return ToCsharp(py); + } + set + { + self.SetAttr("uint64", ToPython(value)); + } + } + + /// + ///   + /// + public static Dtype half + { + get + { + dynamic py = self.GetAttr("half"); + return ToCsharp(py); + } + set + { + self.SetAttr("half", ToPython(value)); + } + } + + /// + /// compatible: C float + /// + public static Dtype single + { + get + { + dynamic py = self.GetAttr("single"); + return ToCsharp(py); + } + set + { + self.SetAttr("single", ToPython(value)); + } + } + + /// + /// compatible: C double + /// + public static Dtype @double + { + get + { + dynamic py = self.GetAttr("double"); + return ToCsharp(py); + } + set + { + self.SetAttr("double", ToPython(value)); + } + } + + /// + /// compatible: Python float + /// + public static Dtype float_ + { + get + { + dynamic py = self.GetAttr("float_"); + return ToCsharp(py); + } + set + { + self.SetAttr("float_", ToPython(value)); + } + } + + /// + /// compatible: C long float + /// + public static Dtype longfloat + { + get + { + dynamic py = self.GetAttr("longfloat"); + return ToCsharp(py); + } + set + { + self.SetAttr("longfloat", ToPython(value)); + } + } + + /// + /// 16 bits + /// + public static Dtype float16 + { + get + { + dynamic py = self.GetAttr("float16"); + return ToCsharp(py); + } + set + { + self.SetAttr("float16", ToPython(value)); + } + } + + /// + /// 32 bits + /// + public static Dtype float32 + { + get + { + dynamic py = self.GetAttr("float32"); + return ToCsharp(py); + } + set + { + self.SetAttr("float32", ToPython(value)); + } + } + + /// + /// 64 bits + /// + public static Dtype float64 + { + get + { + dynamic py = self.GetAttr("float64"); + return ToCsharp(py); + } + set + { + self.SetAttr("float64", ToPython(value)); + } + } + + /// + /// 96 bits, platform? + /// + public static Dtype float96 + { + get + { + dynamic py = self.GetAttr("float96"); + return ToCsharp(py); + } + set + { + self.SetAttr("float96", ToPython(value)); + } + } + + /// + /// 128 bits, platform? + /// + public static Dtype float128 + { + get + { + dynamic py = self.GetAttr("float128"); + return ToCsharp(py); + } + set + { + self.SetAttr("float128", ToPython(value)); + } + } + + /// + ///   + /// + public static Dtype csingle + { + get + { + dynamic py = self.GetAttr("csingle"); + return ToCsharp(py); + } + set + { + self.SetAttr("csingle", ToPython(value)); + } + } + + /// + /// compatible: Python complex + /// + public static Dtype complex_ + { + get + { + dynamic py = self.GetAttr("complex_"); + return ToCsharp(py); + } + set + { + self.SetAttr("complex_", ToPython(value)); + } + } + + /// + ///   + /// + public static Dtype clongfloat + { + get + { + dynamic py = self.GetAttr("clongfloat"); + return ToCsharp(py); + } + set + { + self.SetAttr("clongfloat", ToPython(value)); + } + } + + /// + /// two 32-bit floats + /// + public static Dtype complex64 + { + get + { + dynamic py = self.GetAttr("complex64"); + return ToCsharp(py); + } + set + { + self.SetAttr("complex64", ToPython(value)); + } + } + + /// + /// two 64-bit floats + /// + public static Dtype complex128 + { + get + { + dynamic py = self.GetAttr("complex128"); + return ToCsharp(py); + } + set + { + self.SetAttr("complex128", ToPython(value)); + } + } + + /// + /// two 96-bit floats, + /// platform? + /// + public static Dtype complex192 + { + get + { + dynamic py = self.GetAttr("complex192"); + return ToCsharp(py); + } + set + { + self.SetAttr("complex192", ToPython(value)); + } + } + + /// + /// two 128-bit floats, + /// platform? + /// + public static Dtype complex256 + { + get + { + dynamic py = self.GetAttr("complex256"); + return ToCsharp(py); + } + set + { + self.SetAttr("complex256", ToPython(value)); + } + } + + /// + /// any Python object + /// + public static Dtype object_ + { + get + { + dynamic py = self.GetAttr("object_"); + return ToCsharp(py); + } + set + { + self.SetAttr("object_", ToPython(value)); + } + } + + /// + /// compatible: Python bytes + /// + public static Dtype bytes_ + { + get + { + dynamic py = self.GetAttr("bytes_"); + return ToCsharp(py); + } + set + { + self.SetAttr("bytes_", ToPython(value)); + } + } + + /// + /// compatible: Python unicode/str + /// + public static Dtype unicode_ + { + get + { + dynamic py = self.GetAttr("unicode_"); + return ToCsharp(py); + } + set + { + self.SetAttr("unicode_", ToPython(value)); + } + } + + /// + ///   + /// + public static Dtype @void + { + get + { + dynamic py = self.GetAttr("void"); + return ToCsharp(py); + } + set + { + self.SetAttr("void", ToPython(value)); + } + } } diff --git a/src/Numpy/np.dtype.routines.gen.cs b/src/Numpy/np.dtype.routines.gen.cs index 4722fa7..b02cba6 100644 --- a/src/Numpy/np.dtype.routines.gen.cs +++ b/src/Numpy/np.dtype.routines.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,410 +20,649 @@ public static partial class np { /// - /// Returns True if cast between data types can occur according to the - /// casting rule. If from is a scalar or array scalar, also returns - /// True if the scalar value can be cast without overflow or truncation - /// to an integer. - /// - /// Notes - /// - /// Starting in NumPy 1.9, can_cast function now returns False in ‘safe’ - /// casting mode for integer/float dtype and string dtype if the string dtype - /// length is not long enough to store the max integer/float value converted - /// to a string. Previously can_cast in ‘safe’ mode returned True for - /// integer/float dtype and a string dtype of any length. + /// Returns True if cast between data types can occur according to the + /// casting rule.

+ /// If from is a scalar or array scalar, also returns + /// True if the scalar value can be cast without overflow or truncation + /// to an integer.

+ /// + /// Notes + /// + /// Starting in NumPy 1.9, can_cast function now returns False in ‘safe’ + /// casting mode for integer/float dtype and string dtype if the string dtype + /// length is not long enough to store the max integer/float value converted + /// to a string.

+ /// Previously can_cast in ‘safe’ mode returned True for + /// integer/float dtype and a string dtype of any length. ///
/// - /// Data type, scalar, or array to cast from. + /// Data type, scalar, or array to cast from. /// /// - /// Data type to cast to. + /// Data type to cast to. /// /// - /// Controls what kind of data casting may occur. + /// Controls what kind of data casting may occur. /// /// - /// True if cast can occur according to the casting rule. + /// True if cast can occur according to the casting rule. /// public static bool can_cast(Dtype from_, Dtype to, string casting = "safe") - => NumPy.Instance.can_cast(from_, to, casting:casting); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + from_, + to, + }); + var kwargs=new PyDict(); + if (casting!="safe") kwargs["casting"]=ToPython(casting); + dynamic py = __self__.InvokeMethod("can_cast", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns the data type with the smallest size and smallest scalar - /// kind to which both type1 and type2 may be safely cast. - /// The returned data type is always in native byte order. - /// - /// This function is symmetric, but rarely associative. - /// - /// Notes - /// - /// Starting in NumPy 1.9, promote_types function now returns a valid string - /// length when given an integer or float dtype as one argument and a string - /// dtype as another argument. Previously it always returned the input string - /// dtype, even if it wasn’t long enough to store the max integer/float value - /// converted to a string. + /// Returns the data type with the smallest size and smallest scalar + /// kind to which both type1 and type2 may be safely cast.

+ /// + /// The returned data type is always in native byte order.

+ /// + /// This function is symmetric, but rarely associative.

+ /// + /// Notes + /// + /// Starting in NumPy 1.9, promote_types function now returns a valid string + /// length when given an integer or float dtype as one argument and a string + /// dtype as another argument.

+ /// Previously it always returned the input string + /// dtype, even if it wasn’t long enough to store the max integer/float value + /// converted to a string. ///
/// - /// First data type. + /// First data type. /// /// - /// Second data type. + /// Second data type. /// /// - /// The promoted data type. + /// The promoted data type. /// public static Dtype promote_types(Dtype type1, Dtype type2) - => NumPy.Instance.promote_types(type1, type2); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + type1, + type2, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("promote_types", 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 + /// 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 value whose minimal data type is to be found. + /// The value whose minimal data type is to be found. /// /// - /// The minimal data type. + /// The minimal data type. /// - public static Dtype min_scalar_type(NDarray a) - => NumPy.Instance.min_scalar_type(a); + public static Dtype min_scalar_type(this 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("min_scalar_type", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// Returns the type that results from applying the NumPy - /// type promotion rules to the arguments. - /// - /// Type promotion in NumPy works similarly to the rules in languages - /// like C++, with some slight differences. When both scalars and - /// arrays are used, the array’s type takes precedence and the actual value - /// of the scalar is taken into account. - /// - /// For example, calculating 3*a, where a is an array of 32-bit floats, - /// intuitively should result in a 32-bit float output. If the 3 is a - /// 32-bit integer, the NumPy rules indicate it can’t convert losslessly - /// into a 32-bit float, so a 64-bit float should be the result type. - /// By examining the value of the constant, ‘3’, we see that it fits in - /// an 8-bit integer, which can be cast losslessly into the 32-bit float. - /// - /// Notes - /// - /// The specific algorithm used is as follows. - /// - /// Categories are determined by first checking which of boolean, - /// integer (int/uint), or floating point (float/complex) the maximum - /// kind of all the arrays and the scalars are. - /// - /// If there are only scalars or the maximum category of the scalars - /// is higher than the maximum category of the arrays, - /// the data types are combined with promote_types - /// to produce the return value. - /// - /// Otherwise, min_scalar_type is called on each array, and - /// the resulting data types are all combined with promote_types - /// to produce the return value. - /// - /// The set of int values is not a subset of the uint values for types - /// with the same number of bits, something not reflected in - /// min_scalar_type, but handled as a special case in result_type. + /// Returns the type that results from applying the NumPy + /// type promotion rules to the arguments.

+ /// + /// Type promotion in NumPy works similarly to the rules in languages + /// like C++, with some slight differences.

+ /// When both scalars and + /// arrays are used, the array’s type takes precedence and the actual value + /// of the scalar is taken into account.

+ /// + /// For example, calculating 3*a, where a is an array of 32-bit floats, + /// intuitively should result in a 32-bit float output.

+ /// If the 3 is a + /// 32-bit integer, the NumPy rules indicate it can’t convert losslessly + /// into a 32-bit float, so a 64-bit float should be the result type.

+ /// + /// By examining the value of the constant, ‘3’, we see that it fits in + /// an 8-bit integer, which can be cast losslessly into the 32-bit float.

+ /// + /// Notes + /// + /// The specific algorithm used is as follows.

+ /// + /// Categories are determined by first checking which of boolean, + /// integer (int/uint), or floating point (float/complex) the maximum + /// kind of all the arrays and the scalars are.

+ /// + /// If there are only scalars or the maximum category of the scalars + /// is higher than the maximum category of the arrays, + /// the data types are combined with promote_types + /// to produce the return value.

+ /// + /// Otherwise, min_scalar_type is called on each array, and + /// the resulting data types are all combined with promote_types + /// to produce the return value.

+ /// + /// The set of int values is not a subset of the uint values for types + /// with the same number of bits, something not reflected in + /// min_scalar_type, but handled as a special case in result_type. ///
/// - /// The operands of some operation whose result type is needed. + /// The operands of some operation whose result type is needed. /// /// - /// The result type. + /// The result type. /// public static Dtype result_type(list of arrays and dtypes arrays_and_dtypes) - => NumPy.Instance.result_type(arrays_and_dtypes); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arrays_and_dtypes, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("result_type", pyargs, kwargs); + 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. + /// 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. + /// Input arrays. /// /// - /// Input arrays. + /// Input arrays. /// /// - /// Data type code. + /// Data type code. /// - public static Dtype common_type(NDarray array2, NDarray array1) - => NumPy.Instance.common_type(array2, array1); + public static Dtype common_type(this NDarray array2, NDarray array1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + array2, + array1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("common_type", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the scalar dtype or NumPy equivalent of Python type of an object. + /// Return the scalar dtype or NumPy equivalent of Python type of an object. /// /// - /// The object of which the type is returned. + /// The object of which the type is returned. /// - /// - /// If given, this is returned for objects whose types can not be - /// determined. If not given, None is returned for those objects. + /// + /// If given, this is returned for objects whose types can not be + /// determined.

+ /// If not given, None is returned for those objects. /// /// - /// The data type of rep. + /// The data type of rep. /// public static Dtype obj2sctype(object rep, object @default = null) - => NumPy.Instance.obj2sctype(rep, @default:@default); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rep, + }); + var kwargs=new PyDict(); + if (@default!=null) kwargs["default"]=ToPython(@default); + dynamic py = __self__.InvokeMethod("obj2sctype", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Create a data type object. - /// - /// A numpy array is homogeneous, and contains elements described by a - /// dtype object. A dtype object can be constructed from different - /// combinations of fundamental numeric types. + /// Create a data type object.

+ /// + /// A numpy array is homogeneous, and contains elements described by a + /// dtype object.

+ /// A dtype object can be constructed from different + /// combinations of fundamental numeric types. ///
/// - /// Add padding to the fields to match what a C compiler would output - /// for a similar C-struct. Can be True only if obj is a dictionary - /// or a comma-separated string. If a struct dtype is being created, - /// this also sets a sticky alignment flag isalignedstruct. + /// Add padding to the fields to match what a C compiler would output + /// for a similar C-struct.

+ /// Can be True only if obj is a dictionary + /// or a comma-separated string.

+ /// If a struct dtype is being created, + /// this also sets a sticky alignment flag isalignedstruct. /// /// - /// Make a new copy of the data-type object. If False, the result - /// may just be a reference to a built-in data-type object. + /// Make a new copy of the data-type object.

+ /// If False, the result + /// may just be a reference to a built-in data-type object. /// public static void dtype(bool? align = null, bool? copy = null) - => NumPy.Instance.dtype(align:align, copy:copy); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (align!=null) kwargs["align"]=ToPython(align); + if (copy!=null) kwargs["copy"]=ToPython(copy); + dynamic py = __self__.InvokeMethod("dtype", pyargs, kwargs); + } /// - /// Class to convert formats, names, titles description to a dtype. - /// - /// After constructing the format_parser object, the dtype attribute is - /// the converted data-type: - /// dtype = format_parser(formats, names, titles).dtype + /// Class to convert formats, names, titles description to a dtype.

+ /// + /// After constructing the format_parser object, the dtype attribute is + /// the converted data-type: + /// dtype = format_parser(formats, names, titles).dtype ///
/// - /// The format description, either specified as a string with - /// comma-separated format descriptions in the form 'f8, i4, a5', or - /// a list of format description strings in the form - /// ['f8', 'i4', 'a5']. + /// The format description, either specified as a string with + /// comma-separated format descriptions in the form 'f8, i4, a5', or + /// a list of format description strings in the form + /// ['f8', 'i4', 'a5']. /// /// - /// The field names, either specified as a comma-separated string in the - /// form 'col1, col2, col3', or as a list or tuple of strings in the - /// form ['col1', 'col2', 'col3']. - /// An empty list can be used, in that case default field names - /// (‘f0’, ‘f1’, …) are used. + /// The field names, either specified as a comma-separated string in the + /// form 'col1, col2, col3', or as a list or tuple of strings in the + /// form ['col1', 'col2', 'col3'].

+ /// + /// An empty list can be used, in that case default field names + /// (‘f0’, ‘f1’, …) are used. /// /// - /// Sequence of title strings. An empty list can be used to leave titles - /// out. + /// Sequence of title strings.

+ /// An empty list can be used to leave titles + /// out. /// /// - /// If True, align the fields by padding as the C-compiler would. - /// Default is False. + /// If True, align the fields by padding as the C-compiler would.

+ /// + /// Default is False. /// /// - /// If specified, all the fields will be changed to the - /// provided byte-order. Otherwise, the default byte-order is - /// used. For all available string specifiers, see dtype.newbyteorder. + /// If specified, all the fields will be changed to the + /// provided byte-order.

+ /// Otherwise, the default byte-order is + /// used.

+ /// For all available string specifiers, see dtype.newbyteorder. /// public static void format_parser(string[] formats, string[] names, string[] titles, bool? aligned = null, string byteorder = null) - => NumPy.Instance.format_parser(formats, names, titles, aligned:aligned, byteorder:byteorder); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + formats, + names, + titles, + }); + var kwargs=new PyDict(); + if (aligned!=null) kwargs["aligned"]=ToPython(aligned); + if (byteorder!=null) kwargs["byteorder"]=ToPython(byteorder); + dynamic py = __self__.InvokeMethod("format_parser", pyargs, kwargs); + } /// - /// Machine limits for floating point types. - /// - /// Notes - /// - /// For developers of NumPy: do not instantiate this at the module level. - /// The initial calculation of these parameters is expensive and negatively - /// impacts import times. These objects are cached, so calling finfo() - /// repeatedly inside your functions is not a problem. + /// Machine limits for floating point types.

+ /// + /// Notes + /// + /// For developers of NumPy: do not instantiate this at the module level.

+ /// + /// The initial calculation of these parameters is expensive and negatively + /// impacts import times.

+ /// These objects are cached, so calling finfo() + /// repeatedly inside your functions is not a problem. ///
/// - /// Kind of floating point data-type about which to get information. + /// Kind of floating point data-type about which to get information. /// public static void finfo(Dtype dtype) - => NumPy.Instance.finfo(dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dtype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("finfo", pyargs, kwargs); + } /// - /// Machine limits for integer types. + /// Machine limits for integer types. /// /// - /// The kind of integer data type to get information about. + /// The kind of integer data type to get information about. /// public static void iinfo(Dtype int_type) - => NumPy.Instance.iinfo(int_type); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + int_type, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("iinfo", pyargs, kwargs); + } /// - /// Diagnosing machine parameters. - /// - /// References + /// Diagnosing machine parameters.

+ /// + /// References ///
/// - /// Function that converts an integer or integer array to a float - /// or float array. Default is float. + /// Function that converts an integer or integer array to a float + /// or float array.

+ /// Default is float. /// /// - /// Function that converts a float or float array to an integer or - /// integer array. Default is int. + /// Function that converts a float or float array to an integer or + /// integer array.

+ /// Default is int. /// /// - /// Function that converts a float array to float. Default is float. - /// Note that this does not seem to do anything useful in the current - /// implementation. + /// Function that converts a float array to float.

+ /// Default is float.

+ /// + /// Note that this does not seem to do anything useful in the current + /// implementation. /// /// - /// Function that converts a single float to a string. Default is - /// lambda v:'%24.16e' %v. + /// Function that converts a single float to a string.

+ /// Default is + /// lambda v:'%24.16e' %v. /// /// - /// Title that is printed in the string representation of MachAr. + /// Title that is printed in the string representation of MachAr. /// public static void MachAr(Delegate float_conv = null, Delegate int_conv = null, Delegate float_to_float = null, Delegate float_to_str = null, string title = null) - => NumPy.Instance.MachAr(float_conv:float_conv, int_conv:int_conv, float_to_float:float_to_float, float_to_str:float_to_str, title:title); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (float_conv!=null) kwargs["float_conv"]=ToPython(float_conv); + if (int_conv!=null) kwargs["int_conv"]=ToPython(int_conv); + if (float_to_float!=null) kwargs["float_to_float"]=ToPython(float_to_float); + if (float_to_str!=null) kwargs["float_to_str"]=ToPython(float_to_str); + if (title!=null) kwargs["title"]=ToPython(title); + dynamic py = __self__.InvokeMethod("MachAr", pyargs, kwargs); + } /// - /// Determines whether the given object represents a scalar data-type. + /// Determines whether the given object represents a scalar data-type. /// /// - /// If rep is an instance of a scalar dtype, True is returned. If not, - /// False is returned. + /// If rep is an instance of a scalar dtype, True is returned.

+ /// If not, + /// False is returned. /// /// - /// Boolean result of check whether rep is a scalar dtype. + /// Boolean result of check whether rep is a scalar dtype. /// public static bool issctype(object rep) - => NumPy.Instance.issctype(rep); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rep, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("issctype", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns True if first argument is a typecode lower/equal in type hierarchy. + /// Returns True if first argument is a typecode lower/equal in type hierarchy. /// /// - /// dtype or string representing a typecode. + /// dtype or string representing a typecode. /// /// - /// dtype or string representing a typecode. + /// dtype or string representing a typecode. /// public static bool issubdtype(Dtype arg2, Dtype arg1) - => NumPy.Instance.issubdtype(arg2, arg1); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arg2, + arg1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("issubdtype", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Determine if the first argument is a subclass of the second argument. + /// Determine if the first argument is a subclass of the second argument. /// /// - /// Data-types. + /// Data-types. /// /// - /// Data-types. + /// Data-types. /// /// - /// The result. + /// The result. /// public static bool issubsctype(Dtype arg2, Dtype arg1) - => NumPy.Instance.issubsctype(arg2, arg1); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arg2, + arg1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("issubsctype", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// Determine if a class is a subclass of a second class. - /// - /// issubclass_ is equivalent to the Python built-in issubclass, - /// except that it returns False instead of raising a TypeError if one - /// of the arguments is not a class. + /// Determine if a class is a subclass of a second class.

+ /// + /// issubclass_ is equivalent to the Python built-in issubclass, + /// except that it returns False instead of raising a TypeError if one + /// of the arguments is not a class. ///
/// - /// Input class. True is returned if arg1 is a subclass of arg2. + /// Input class.

+ /// True is returned if arg1 is a subclass of arg2. /// /// - /// Input class. If a tuple of classes, True is returned if arg1 is a - /// subclass of any of the tuple elements. + /// Input class.

+ /// If a tuple of classes, True is returned if arg1 is a + /// subclass of any of the tuple elements. /// /// - /// Whether arg1 is a subclass of arg2 or not. + /// Whether arg1 is a subclass of arg2 or not. /// public static bool issubclass_(class arg1, class or tuple of classes. arg2) - => NumPy.Instance.issubclass_(arg1, arg2); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arg1, + arg2, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("issubclass_", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Determine common type following standard coercion rules. + /// Determine common type following standard coercion rules. /// /// - /// A list of dtypes or dtype convertible objects representing arrays. + /// A list of dtypes or dtype convertible objects representing arrays. /// /// - /// A list of dtypes or dtype convertible objects representing scalars. + /// A list of dtypes or dtype convertible objects representing scalars. /// /// - /// The common data type, which is the maximum of array_types ignoring - /// scalar_types, unless the maximum of scalar_types is of a - /// different kind (dtype.kind). If the kind is not understood, then - /// None is returned. + /// The common data type, which is the maximum of array_types ignoring + /// scalar_types, unless the maximum of scalar_types is of a + /// different kind (dtype.kind).

+ /// If the kind is not understood, then + /// None is returned. ///
public static Dtype find_common_type(sequence array_types, sequence scalar_types) - => NumPy.Instance.find_common_type(array_types, scalar_types); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + array_types, + scalar_types, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("find_common_type", pyargs, kwargs); + return ToCsharp(py); + } */ /// - /// Return a description for the given data type code. + /// Return a description for the given data type code. /// - /// - /// Data type code. + /// + /// Data type code. /// /// - /// Description of the input data type code. + /// Description of the input data type code. /// public static string typename(string @char) - => NumPy.Instance.typename(@char); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + @char, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("typename", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the string representation of a scalar dtype. + /// Return the string representation of a scalar dtype. /// /// - /// If a scalar dtype, the corresponding string character is - /// returned. If an object, sctype2char tries to infer its scalar type - /// and then return the corresponding string character. + /// If a scalar dtype, the corresponding string character is + /// returned.

+ /// If an object, sctype2char tries to infer its scalar type + /// and then return the corresponding string character. /// /// - /// The string character corresponding to the scalar type. + /// The string character corresponding to the scalar type. /// public static string sctype2char(object sctype) - => NumPy.Instance.sctype2char(sctype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + sctype, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("sctype2char", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the character for the minimum-size type to which given types can - /// be safely cast. - /// - /// The returned type character must represent the smallest size dtype such - /// that an array of the returned type can handle the data from an array of - /// all types in typechars (or if typechars is an array, then its - /// dtype.char). + /// Return the character for the minimum-size type to which given types can + /// be safely cast.

+ /// + /// The returned type character must represent the smallest size dtype such + /// that an array of the returned type can handle the data from an array of + /// all types in typechars (or if typechars is an array, then its + /// dtype.char). ///
/// - /// If a list of strings, each string should represent a dtype. - /// If array_like, the character representation of the array dtype is used. + /// If a list of strings, each string should represent a dtype.

+ /// + /// If array_like, the character representation of the array dtype is used. /// /// - /// The set of characters that the returned character is chosen from. - /// The default set is ‘GDFgdf’. + /// The set of characters that the returned character is chosen from.

+ /// + /// The default set is ‘GDFgdf’. /// - /// - /// The default character, this is returned if none of the characters in - /// typechars matches a character in typeset. + /// + /// The default character, this is returned if none of the characters in + /// typechars matches a character in typeset. /// /// - /// The character representing the minimum-size type that was found. + /// The character representing the minimum-size type that was found. /// public static string mintypecode(string[] typechars, string[] typeset = null, string @default = "d") - => NumPy.Instance.mintypecode(typechars, typeset:typeset, @default:@default); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + typechars, + }); + var kwargs=new PyDict(); + if (typeset!=null) kwargs["typeset"]=ToPython(typeset); + if (@default!="d") kwargs["default"]=ToPython(@default); + dynamic py = __self__.InvokeMethod("mintypecode", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.fft.gen.cs b/src/Numpy/np.fft.gen.cs index 0ffec84..b75ebe4 100644 --- a/src/Numpy/np.fft.gen.cs +++ b/src/Numpy/np.fft.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -19,444 +21,679 @@ public static partial class np public static partial class fft { /// - /// Compute the one-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) of a real-valued array by means of an efficient algorithm - /// called the Fast Fourier Transform (FFT). - /// - /// Notes - /// - /// When the DFT is computed for purely real input, the output is - /// Hermitian-symmetric, i.e. the negative frequency terms are just the complex - /// conjugates of the corresponding positive-frequency terms, and the - /// negative-frequency terms are therefore redundant. This function does not - /// compute the negative frequency terms, and the length of the transformed - /// axis of the output is therefore n//2 + 1. - /// - /// When A = rfft(a) and fs is the sampling frequency, A[0] contains - /// the zero-frequency term 0*fs, which is real due to Hermitian symmetry. - /// - /// If n is even, A[-1] contains the term representing both positive - /// and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely - /// real. If n is odd, there is no term at fs/2; A[-1] contains - /// the largest positive frequency (fs/2*(n-1)/n), and is complex in the - /// general case. - /// - /// If the input a contains an imaginary part, it is silently discarded. + /// Compute the one-dimensional discrete Fourier Transform for real input.

+ /// + /// This function computes the one-dimensional n-point discrete Fourier + /// Transform (DFT) of a real-valued array by means of an efficient algorithm + /// called the Fast Fourier Transform (FFT).

+ /// + /// Notes + /// + /// When the DFT is computed for purely real input, the output is + /// Hermitian-symmetric, i.e.

+ /// the negative frequency terms are just the complex + /// conjugates of the corresponding positive-frequency terms, and the + /// negative-frequency terms are therefore redundant.

+ /// This function does not + /// compute the negative frequency terms, and the length of the transformed + /// axis of the output is therefore n//2 + 1.

+ /// + /// When A = rfft(a) and fs is the sampling frequency, A[0] contains + /// the zero-frequency term 0*fs, which is real due to Hermitian symmetry.

+ /// + /// If n is even, A[-1] contains the term representing both positive + /// and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely + /// real.

+ /// If n is odd, there is no term at fs/2; A[-1] contains + /// the largest positive frequency (fs/2*(n-1)/n), and is complex in the + /// general case.

+ /// + /// If the input a contains an imaginary part, it is silently discarded. ///
/// - /// Input array + /// Input array /// /// - /// Number of points along transformation axis in the input to use. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. + /// Number of points along transformation axis in the input to use.

+ /// + /// If n is smaller than the length of the input, the input is cropped.

+ /// + /// If it is larger, the input is padded with zeros.

+ /// If n is not given, + /// the length of the input along the axis specified by axis is used. /// /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. + /// Axis over which to compute the FFT.

+ /// If not given, the last axis is + /// used. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// If n is even, the length of the transformed axis is (n/2)+1. - /// If n is odd, the length is (n+1)/2. + /// The truncated or zero-padded input, transformed along the axis + /// indicated by axis, or the last one if axis is not specified.

+ /// + /// If n is even, the length of the transformed axis is (n/2)+1. + /// If n is odd, the length is (n+1)/2. ///
public static NDarray rfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_rfft(a, n:n, axis:axis, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (n!=null) kwargs["n"]=ToPython(n); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("rfft", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the inverse of the n-point DFT for real input. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier Transform of real input computed by rfft. - /// In other words, irfft(rfft(a), len(a)) == a to within numerical - /// accuracy. (See Notes below for why len(a) is necessary here.) - /// - /// The input is expected to be in the form returned by rfft, i.e. the - /// real zero-frequency term followed by the complex positive frequency terms - /// in order of increasing frequency. Since the discrete Fourier Transform of - /// real input is Hermitian-symmetric, the negative frequency terms are taken - /// to be the complex conjugates of the corresponding positive frequency terms. - /// - /// Notes - /// - /// Returns the real valued n-point inverse discrete Fourier transform - /// of a, where a contains the non-negative frequency terms of a - /// Hermitian-symmetric sequence. n is the length of the result, not the - /// input. - /// - /// If you specify an n such that a must be zero-padded or truncated, the - /// extra/removed values will be added/removed at high frequencies. One can - /// thus resample a series to m points via Fourier interpolation by: - /// a_resamp = irfft(rfft(a), m). + /// Compute the inverse of the n-point DFT for real input.

+ /// + /// This function computes the inverse of the one-dimensional n-point + /// discrete Fourier Transform of real input computed by rfft.

+ /// + /// In other words, irfft(rfft(a), len(a)) == a to within numerical + /// accuracy.

+ /// (See Notes below for why len(a) is necessary here.) + /// + /// The input is expected to be in the form returned by rfft, i.e.

+ /// the + /// real zero-frequency term followed by the complex positive frequency terms + /// in order of increasing frequency.

+ /// Since the discrete Fourier Transform of + /// real input is Hermitian-symmetric, the negative frequency terms are taken + /// to be the complex conjugates of the corresponding positive frequency terms.

+ /// + /// Notes + /// + /// Returns the real valued n-point inverse discrete Fourier transform + /// of a, where a contains the non-negative frequency terms of a + /// Hermitian-symmetric sequence.

+ /// n is the length of the result, not the + /// input.

+ /// + /// If you specify an n such that a must be zero-padded or truncated, the + /// extra/removed values will be added/removed at high frequencies.

+ /// One can + /// thus resample a series to m points via Fourier interpolation by: + /// a_resamp = irfft(rfft(a), m). ///
/// - /// The input array. + /// The input array. /// /// - /// Length of the transformed axis of the output. - /// For n output points, n//2+1 input points are necessary. If the - /// input is longer than this, it is cropped. If it is shorter than this, - /// it is padded with zeros. If n is not given, it is determined from - /// the length of the input along the axis specified by axis. + /// Length of the transformed axis of the output.

+ /// + /// For n output points, n//2+1 input points are necessary.

+ /// If the + /// input is longer than this, it is cropped.

+ /// If it is shorter than this, + /// it is padded with zeros.

+ /// If n is not given, it is determined from + /// the length of the input along the axis specified by axis. /// /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. + /// Axis over which to compute the inverse FFT.

+ /// If not given, the last + /// axis is used. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*(m-1) where m is the length of the transformed axis of the - /// input. To get an odd number of output points, n must be specified. + /// The truncated or zero-padded input, transformed along the axis + /// indicated by axis, or the last one if axis is not specified.

+ /// + /// The length of the transformed axis is n, or, if n is not given, + /// 2*(m-1) where m is the length of the transformed axis of the + /// input.

+ /// To get an odd number of output points, n must be specified. ///
public static NDarray irfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_irfft(a, n:n, axis:axis, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (n!=null) kwargs["n"]=ToPython(n); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("irfft", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the 2-dimensional FFT of a real array. - /// - /// Notes - /// - /// This is really just rfftn with different default behavior. - /// For more details see rfftn. + /// Compute the 2-dimensional FFT of a real array.

+ /// + /// Notes + /// + /// This is really just rfftn with different default behavior.

+ /// + /// For more details see rfftn. ///
/// - /// Input array, taken to be real. + /// Input array, taken to be real. /// /// - /// Shape of the FFT. + /// Shape of the FFT. /// /// - /// Axes over which to compute the FFT. + /// Axes over which to compute the FFT. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The result of the real 2-D FFT. + /// The result of the real 2-D FFT. /// public static NDarray rfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_rfft2(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("rfft2", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the 2-dimensional inverse FFT of a real array. - /// - /// Notes - /// - /// This is really irfftn with different defaults. - /// For more details see irfftn. + /// Compute the 2-dimensional inverse FFT of a real array.

+ /// + /// Notes + /// + /// This is really irfftn with different defaults.

+ /// + /// For more details see irfftn. ///
/// - /// The input array + /// The input array /// /// - /// Shape of the inverse FFT. + /// Shape of the inverse FFT. /// /// - /// The axes over which to compute the inverse fft. - /// Default is the last two axes. + /// The axes over which to compute the inverse fft.

+ /// + /// Default is the last two axes. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The result of the inverse real 2-D FFT. + /// The result of the inverse real 2-D FFT. /// public static NDarray irfft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_irfft2(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("irfft2", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the N-dimensional discrete Fourier Transform for real input. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional real array by means of the Fast - /// Fourier Transform (FFT). By default, all axes are transformed, with the - /// real transform performed over the last axis, while the remaining - /// transforms are complex. - /// - /// Notes - /// - /// The transform for real input is performed over the last transformation - /// axis, as by rfft, then the transform over the remaining axes is - /// performed as by fftn. The order of the output is as for rfft for the - /// final transformation axis, and as for fftn for the remaining - /// transformation axes. - /// - /// See fft for details, definitions and conventions used. + /// Compute the N-dimensional discrete Fourier Transform for real input.

+ /// + /// This function computes the N-dimensional discrete Fourier Transform over + /// any number of axes in an M-dimensional real array by means of the Fast + /// Fourier Transform (FFT).

+ /// By default, all axes are transformed, with the + /// real transform performed over the last axis, while the remaining + /// transforms are complex.

+ /// + /// Notes + /// + /// The transform for real input is performed over the last transformation + /// axis, as by rfft, then the transform over the remaining axes is + /// performed as by fftn.

+ /// The order of the output is as for rfft for the + /// final transformation axis, and as for fftn for the remaining + /// transformation axes.

+ /// + /// See fft for details, definitions and conventions used. ///
/// - /// Input array, taken to be real. + /// Input array, taken to be real. /// /// - /// Shape (length along each transformed axis) to use from the input. - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// The final element of s corresponds to n for rfft(x, n), while - /// for the remaining axes, it corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. + /// Shape (length along each transformed axis) to use from the input.

+ /// + /// (s[0] refers to axis 0, s[1] to axis 1, etc.).

+ /// + /// The final element of s corresponds to n for rfft(x, n), while + /// for the remaining axes, it corresponds to n for fft(x, n).

+ /// + /// Along any axis, if the given shape is smaller than that of the input, + /// the input is cropped.

+ /// If it is larger, the input is padded with zeros.

+ /// + /// if s is not given, the shape of the input along the axes specified + /// by axes is used. /// /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. + /// Axes over which to compute the FFT.

+ /// If not given, the last len(s) + /// axes are used, or all axes if s is also not specified. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. - /// The length of the last axis transformed will be s[-1]//2+1, - /// while the remaining transformed axes will have lengths according to - /// s, or unchanged from the input. + /// The truncated or zero-padded input, transformed along the axes + /// indicated by axes, or by a combination of s and a, + /// as explained in the parameters section above.

+ /// + /// The length of the last axis transformed will be s[-1]//2+1, + /// while the remaining transformed axes will have lengths according to + /// s, or unchanged from the input. ///
public static NDarray rfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_rfftn(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("rfftn", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the inverse of the N-dimensional FFT of real input. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform for real input over any number of axes in an - /// M-dimensional array by means of the Fast Fourier Transform (FFT). In - /// other words, irfftn(rfftn(a), a.shape) == a to within numerical - /// accuracy. (The a.shape is necessary like len(a) is for irfft, - /// and for the same reason.) - /// - /// The input should be ordered in the same way as is returned by rfftn, - /// i.e. as for irfft for the final transformation axis, and as for ifftn - /// along all the other axes. - /// - /// Notes - /// - /// See fft for definitions and conventions used. - /// - /// See rfft for definitions and conventions used for real input. + /// Compute the inverse of the N-dimensional FFT of real input.

+ /// + /// This function computes the inverse of the N-dimensional discrete + /// Fourier Transform for real input over any number of axes in an + /// M-dimensional array by means of the Fast Fourier Transform (FFT).

+ /// In + /// other words, irfftn(rfftn(a), a.shape) == a to within numerical + /// accuracy.

+ /// (The a.shape is necessary like len(a) is for irfft, + /// and for the same reason.) + /// + /// The input should be ordered in the same way as is returned by rfftn, + /// i.e.

+ /// as for irfft for the final transformation axis, and as for ifftn + /// along all the other axes.

+ /// + /// Notes + /// + /// See fft for definitions and conventions used.

+ /// + /// See rfft for definitions and conventions used for real input. ///
/// - /// Input array. + /// Input array. /// /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). s is also the - /// number of input points used along this axis, except for the last axis, - /// where s[-1]//2+1 points of the input are used. - /// Along any axis, if the shape indicated by s is smaller than that of - /// the input, the input is cropped. If it is larger, the input is padded - /// with zeros. If s is not given, the shape of the input along the - /// axes specified by axes is used. + /// Shape (length of each transformed axis) of the output + /// (s[0] refers to axis 0, s[1] to axis 1, etc.).

+ /// s is also the + /// number of input points used along this axis, except for the last axis, + /// where s[-1]//2+1 points of the input are used.

+ /// + /// Along any axis, if the shape indicated by s is smaller than that of + /// the input, the input is cropped.

+ /// If it is larger, the input is padded + /// with zeros.

+ /// If s is not given, the shape of the input along the + /// axes specified by axes is used. /// /// - /// Axes over which to compute the inverse FFT. If not given, the last - /// len(s) axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. + /// Axes over which to compute the inverse FFT.

+ /// If not given, the last + /// len(s) axes are used, or all axes if s is also not specified.

+ /// + /// Repeated indices in axes means that the inverse transform over that + /// axis is performed multiple times. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. - /// The length of each transformed axis is as given by the corresponding - /// element of s, or the length of the input in every axis except for the - /// last one if s is not given. In the final transformed axis the length - /// of the output when s is not given is 2*(m-1) where m is the - /// length of the final transformed axis of the input. To get an odd - /// number of output points in the final axis, s must be specified. + /// The truncated or zero-padded input, transformed along the axes + /// indicated by axes, or by a combination of s or a, + /// as explained in the parameters section above.

+ /// + /// The length of each transformed axis is as given by the corresponding + /// element of s, or the length of the input in every axis except for the + /// last one if s is not given.

+ /// In the final transformed axis the length + /// of the output when s is not given is 2*(m-1) where m is the + /// length of the final transformed axis of the input.

+ /// To get an odd + /// number of output points in the final axis, s must be specified. ///
public static NDarray irfftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_irfftn(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("irfftn", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the FFT of a signal that has Hermitian symmetry, i.e., a real - /// spectrum. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd. + /// Compute the FFT of a signal that has Hermitian symmetry, i.e., a real + /// spectrum.

+ /// + /// Notes + /// + /// hfft/ihfft are a pair analogous to rfft/irfft, but for the + /// opposite case: here the signal has Hermitian symmetry in the time + /// domain and is real in the frequency domain.

+ /// So here it’s hfft for + /// which you must supply the length of the result if it is to be odd. ///
/// - /// The input array. + /// The input array. /// /// - /// Length of the transformed axis of the output. For n output - /// points, n//2 + 1 input points are necessary. If the input is - /// longer than this, it is cropped. If it is shorter than this, it is - /// padded with zeros. If n is not given, it is determined from the - /// length of the input along the axis specified by axis. + /// Length of the transformed axis of the output.

+ /// For n output + /// points, n//2 + 1 input points are necessary.

+ /// If the input is + /// longer than this, it is cropped.

+ /// If it is shorter than this, it is + /// padded with zeros.

+ /// If n is not given, it is determined from the + /// length of the input along the axis specified by axis. /// /// - /// Axis over which to compute the FFT. If not given, the last - /// axis is used. + /// Axis over which to compute the FFT.

+ /// If not given, the last + /// axis is used. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n, or, if n is not given, - /// 2*m - 2 where m is the length of the transformed axis of - /// the input. To get an odd number of output points, n must be - /// specified, for instance as 2*m - 1 in the typical case, + /// The truncated or zero-padded input, transformed along the axis + /// indicated by axis, or the last one if axis is not specified.

+ /// + /// The length of the transformed axis is n, or, if n is not given, + /// 2*m - 2 where m is the length of the transformed axis of + /// the input.

+ /// To get an odd number of output points, n must be + /// specified, for instance as 2*m - 1 in the typical case, ///
public static NDarray hfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_hfft(a, n:n, axis:axis, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (n!=null) kwargs["n"]=ToPython(n); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("hfft", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the inverse FFT of a signal that has Hermitian symmetry. - /// - /// Notes - /// - /// hfft/ihfft are a pair analogous to rfft/irfft, but for the - /// opposite case: here the signal has Hermitian symmetry in the time - /// domain and is real in the frequency domain. So here it’s hfft for - /// which you must supply the length of the result if it is to be odd: + /// Compute the inverse FFT of a signal that has Hermitian symmetry.

+ /// + /// Notes + /// + /// hfft/ihfft are a pair analogous to rfft/irfft, but for the + /// opposite case: here the signal has Hermitian symmetry in the time + /// domain and is real in the frequency domain.

+ /// So here it’s hfft for + /// which you must supply the length of the result if it is to be odd: ///
/// - /// Input array. + /// Input array. /// /// - /// Length of the inverse FFT, the number of points along - /// transformation axis in the input to use. If n is smaller than - /// the length of the input, the input is cropped. If it is larger, - /// the input is padded with zeros. If n is not given, the length of - /// the input along the axis specified by axis is used. + /// Length of the inverse FFT, the number of points along + /// transformation axis in the input to use.

+ /// If n is smaller than + /// the length of the input, the input is cropped.

+ /// If it is larger, + /// the input is padded with zeros.

+ /// If n is not given, the length of + /// the input along the axis specified by axis is used. /// /// - /// Axis over which to compute the inverse FFT. If not given, the last - /// axis is used. + /// Axis over which to compute the inverse FFT.

+ /// If not given, the last + /// axis is used. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. - /// The length of the transformed axis is n//2 + 1. + /// The truncated or zero-padded input, transformed along the axis + /// indicated by axis, or the last one if axis is not specified.

+ /// + /// The length of the transformed axis is n//2 + 1. ///
public static NDarray ihfft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_ihfft(a, n:n, axis:axis, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (n!=null) kwargs["n"]=ToPython(n); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("ihfft", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Return the Discrete Fourier Transform sample frequencies. - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: + /// Return the Discrete Fourier Transform sample frequencies.

+ /// + /// The returned float array f contains the frequency bin centers in cycles + /// per unit of the sample spacing (with zero at the start).

+ /// For instance, if + /// the sample spacing is in seconds, then the frequency unit is cycles/second.

+ /// + /// Given a window length n and a sample spacing d: ///
/// - /// Window length. + /// Window length. /// /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. + /// Sample spacing (inverse of the sampling rate).

+ /// Defaults to 1. /// /// - /// Array of length n containing the sample frequencies. + /// Array of length n containing the sample frequencies. /// public static NDarray fftfreq(int n, float? d = 1.0f) - => NumPy.Instance.fft_fftfreq(n, d:d); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + n, + }); + var kwargs=new PyDict(); + if (d!=1.0f) kwargs["d"]=ToPython(d); + dynamic py = __self__.InvokeMethod("fftfreq", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Return the Discrete Fourier Transform sample frequencies - /// (for usage with rfft, irfft). - /// - /// The returned float array f contains the frequency bin centers in cycles - /// per unit of the sample spacing (with zero at the start). For instance, if - /// the sample spacing is in seconds, then the frequency unit is cycles/second. - /// - /// Given a window length n and a sample spacing d: - /// - /// Unlike fftfreq (but like scipy.fftpack.rfftfreq) - /// the Nyquist frequency component is considered to be positive. + /// Return the Discrete Fourier Transform sample frequencies + /// (for usage with rfft, irfft).

+ /// + /// The returned float array f contains the frequency bin centers in cycles + /// per unit of the sample spacing (with zero at the start).

+ /// For instance, if + /// the sample spacing is in seconds, then the frequency unit is cycles/second.

+ /// + /// Given a window length n and a sample spacing d: + /// + /// Unlike fftfreq (but like scipy.fftpack.rfftfreq) + /// the Nyquist frequency component is considered to be positive. ///
/// - /// Window length. + /// Window length. /// /// - /// Sample spacing (inverse of the sampling rate). Defaults to 1. + /// Sample spacing (inverse of the sampling rate).

+ /// Defaults to 1. /// /// - /// Array of length n//2 + 1 containing the sample frequencies. + /// Array of length n//2 + 1 containing the sample frequencies. /// public static NDarray rfftfreq(int n, float? d = 1.0f) - => NumPy.Instance.fft_rfftfreq(n, d:d); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + n, + }); + var kwargs=new PyDict(); + if (d!=1.0f) kwargs["d"]=ToPython(d); + dynamic py = __self__.InvokeMethod("rfftfreq", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Shift the zero-frequency component to the center of the spectrum. - /// - /// This function swaps half-spaces for all axes listed (defaults to all). - /// Note that y[0] is the Nyquist component only if len(x) is even. + /// Shift the zero-frequency component to the center of the spectrum.

+ /// + /// This function swaps half-spaces for all axes listed (defaults to all).

+ /// + /// Note that y[0] is the Nyquist component only if len(x) is even. ///
/// - /// Input array. + /// Input array. /// /// - /// Axes over which to shift. Default is None, which shifts all axes. + /// Axes over which to shift.

+ /// Default is None, which shifts all axes. /// /// - /// The shifted array. + /// The shifted array. /// public static NDarray fftshift(NDarray x, int[] axes = null) - => NumPy.Instance.fft_fftshift(x, axes:axes); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (axes!=null) kwargs["axes"]=ToPython(axes); + dynamic py = __self__.InvokeMethod("fftshift", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// The inverse of fftshift. Although identical for even-length x, the - /// functions differ by one sample for odd-length x. + /// The inverse of fftshift.

+ /// Although identical for even-length x, the + /// functions differ by one sample for odd-length x. ///
/// - /// Input array. + /// Input array. /// /// - /// Axes over which to calculate. Defaults to None, which shifts all axes. + /// Axes over which to calculate.

+ /// Defaults to None, which shifts all axes. /// /// - /// The shifted array. + /// The shifted array. /// public static NDarray ifftshift(NDarray x, int[] axes = null) - => NumPy.Instance.fft_ifftshift(x, axes:axes); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (axes!=null) kwargs["axes"]=ToPython(axes); + dynamic py = __self__.InvokeMethod("ifftshift", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.financial.gen.cs b/src/Numpy/np.financial.gen.cs index 0ddd18c..9210c0b 100644 --- a/src/Numpy/np.financial.gen.cs +++ b/src/Numpy/np.financial.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,341 +20,501 @@ public static partial class np { /// - /// Compute the future value. - /// - /// Notes - /// - /// The future value is computed by solving the equation: - /// - /// or, when rate == 0: - /// - /// References + /// Compute the future value.

+ /// + /// Notes + /// + /// The future value is computed by solving the equation: + /// + /// or, when rate == 0: + /// + /// References ///
/// - /// Rate of interest as decimal (not per cent) per period + /// Rate of interest as decimal (not per cent) per period /// /// - /// Number of compounding periods + /// Number of compounding periods /// /// - /// Payment + /// Payment /// /// - /// Present value + /// Present value /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)). - /// Defaults to {‘end’, 0}. + /// + /// 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. + /// 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 static NDarray fv(NDarray rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") - => NumPy.Instance.fv(rate, nper, pmt, pv, @when:@when); + public static NDarray fv(this NDarray rate, NDarray nper, NDarray pmt, NDarray pv, string @when = "end") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + 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 + /// 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 ///
/// - /// Rate of interest (per period) + /// Rate of interest (per period) /// /// - /// Number of compounding periods + /// Number of compounding periods /// /// - /// Payment + /// Payment /// /// - /// Future value + /// Future value /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) + /// + /// When payments are due (‘begin’ (1) or ‘end’ (0)) /// /// - /// Present value of a series of payments or investments. + /// Present value of a series of payments or investments. /// - public static NDarray pv(NDarray rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") - => NumPy.Instance.pv(rate, nper, pmt, fv:fv, @when:@when); + public static NDarray pv(this NDarray rate, NDarray nper, NDarray pmt, NDarray fv = null, string @when = "end") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + 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); + } /// - /// Returns the NPV (Net Present Value) of a cash flow series. - /// - /// Notes - /// - /// Returns the result of: [G] - /// - /// References + /// Returns the NPV (Net Present Value) of a cash flow series.

+ /// + /// Notes + /// + /// Returns the result of: [G] + /// + /// References ///
/// - /// The discount rate. + /// The discount rate. /// /// - /// The values of the time series of cash flows. The (fixed) time - /// interval between cash flow “events” must be the same as that for - /// which rate is given (i.e., if rate is per year, then precisely - /// a year is understood to elapse between each cash flow event). By - /// convention, investments or “deposits” are negative, income or - /// “withdrawals” are positive; values must begin with the initial - /// investment, thus values[0] will typically be negative. + /// The values of the time series of cash flows.

+ /// The (fixed) time + /// interval between cash flow “events” must be the same as that for + /// which rate is given (i.e., if rate is per year, then precisely + /// a year is understood to elapse between each cash flow event).

+ /// By + /// convention, investments or “deposits” are negative, income or + /// “withdrawals” are positive; values must begin with the initial + /// investment, thus values[0] will typically be negative. /// /// - /// The NPV of the input cash flow series values at the discount - /// rate. + /// The NPV of the input cash flow series values at the discount + /// rate. /// public static float npv(ValueType rate, NDarray values) - => NumPy.Instance.npv(rate, values); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + values, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("npv", 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 + /// 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 ///
/// - /// Rate of interest (per period) + /// Rate of interest (per period) /// /// - /// Number of compounding periods + /// Number of compounding periods /// /// - /// Present value + /// Present value /// /// - /// Future value (default = 0) + /// Future value (default = 0) /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (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. + /// 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 static NDarray pmt(NDarray rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.pmt(rate, nper, pv, fv:fv, @when:@when); + public static NDarray pmt(this NDarray rate, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + 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. + /// Compute the payment against loan principal. /// /// - /// Rate of interest (per period) + /// Rate of interest (per period) /// /// - /// Amount paid against the loan changes. The per is the period of - /// interest. + /// Amount paid against the loan changes.

+ /// The per is the period of + /// interest. /// /// - /// Number of compounding periods + /// Number of compounding periods /// /// - /// Present value + /// Present value /// /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public static void ppmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.ppmt(rate, per, nper, pv, fv:fv, @when:@when); + /// Future value + /// + /// + /// When payments are due (‘begin’ (1) or ‘end’ (0)) + /// + public static void ppmt(this NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + 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 + /// Compute the interest portion of a payment.

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

+ /// + /// pmt = ppmt + ipmt ///
/// - /// Rate of interest as decimal (not per cent) per period + /// Rate of interest as decimal (not per cent) per period /// /// - /// Interest paid against the loan changes during the life or the loan. - /// The per is the payment period to calculate the interest amount. + /// 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 + /// Number of compounding periods /// /// - /// Present value + /// Present value /// /// - /// Future value + /// Future value /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)). - /// Defaults to {‘end’, 0}. + /// + /// 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. + /// 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 static NDarray ipmt(NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.ipmt(rate, per, nper, pv, fv:fv, @when:@when); + public static NDarray ipmt(this NDarray rate, NDarray per, NDarray nper, NDarray pv, NDarray fv = null, string @when = "end") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + 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 + /// 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 ///
/// - /// Input cash flows per time period. By convention, net “deposits” - /// are negative and net “withdrawals” are positive. Thus, for - /// example, at least the first element of values, which represents - /// the initial investment, will typically be negative. + /// Input cash flows per time period.

+ /// By convention, net “deposits” + /// are negative and net “withdrawals” are positive.

+ /// Thus, for + /// example, at least the first element of values, which represents + /// the initial investment, will typically be negative. /// /// - /// Internal Rate of Return for periodic input values. + /// Internal Rate of Return for periodic input values. /// - public static float irr(NDarray values) - => NumPy.Instance.irr(values); + public static float irr(this NDarray values) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + values, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("irr", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Modified internal rate of return. + /// Modified internal rate of return. /// /// - /// Cash flows (must contain at least one positive and one negative - /// value) or nan is returned. The first value is considered a sunk - /// cost at time zero. + /// Cash flows (must contain at least one positive and one negative + /// value) or nan is returned.

+ /// The first value is considered a sunk + /// cost at time zero. /// /// - /// Interest rate paid on the cash flows + /// Interest rate paid on the cash flows /// /// - /// Interest rate received on the cash flows upon reinvestment + /// Interest rate received on the cash flows upon reinvestment /// /// - /// Modified internal rate of return + /// Modified internal rate of return /// - public static float mirr(NDarray values, ValueType finance_rate, ValueType reinvest_rate) - => NumPy.Instance.mirr(values, finance_rate, reinvest_rate); + public static float mirr(this NDarray values, ValueType finance_rate, ValueType reinvest_rate) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + values, + 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: + /// 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: ///
/// - /// Rate of interest (per period) + /// Rate of interest (per period) /// /// - /// Payment + /// Payment /// /// - /// Present value + /// Present value /// /// - /// Future value - /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) - /// - public static void nper(NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") - => NumPy.Instance.nper(rate, pmt, pv, fv:fv, @when:@when); + /// Future value + /// + /// + /// When payments are due (‘begin’ (1) or ‘end’ (0)) + /// + public static void nper(this NDarray rate, NDarray pmt, NDarray pv, NDarray fv = null, string @when = "end") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + rate, + 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 + /// 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 ///
/// - /// Number of compounding periods + /// Number of compounding periods /// /// - /// Payment + /// Payment /// /// - /// Present value + /// Present value /// /// - /// Future value + /// Future value /// - /// - /// When payments are due (‘begin’ (1) or ‘end’ (0)) + /// + /// When payments are due (‘begin’ (1) or ‘end’ (0)) /// /// - /// Starting guess for solving the rate of interest, default 0.1 + /// Starting guess for solving the rate of interest, default 0.1 /// /// - /// Required tolerance for the solution, default 1e-6 + /// Required tolerance for the solution, default 1e-6 /// /// - /// Maximum iterations in finding the solution - /// - public static void rate(NDarray nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) - => NumPy.Instance.rate(nper, pmt, pv, fv, @when:@when, guess:guess, tol:tol, maxiter:maxiter); + /// Maximum iterations in finding the solution + /// + public static void rate(this NDarray nper, NDarray pmt, NDarray pv, NDarray fv, string @when = "end", double? guess = null, double? tol = null, int? maxiter = 100) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + nper, + 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); + } } diff --git a/src/Numpy/np.indexing.gen.cs b/src/Numpy/np.indexing.gen.cs index da0cda8..1d2d8b5 100644 --- a/src/Numpy/np.indexing.gen.cs +++ b/src/Numpy/np.indexing.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,970 +20,1482 @@ public static partial class np { /// - /// Translates slice objects to concatenation along the first axis. - /// - /// This is a simple way to build up arrays quickly. There are two use cases. - /// - /// If slice notation is used, the syntax start:stop:step is equivalent - /// to np.arange(start, stop, step) inside of the brackets. However, if - /// step is an imaginary number (i.e. 100j) then its integer portion is - /// interpreted as a number-of-points desired and the start and stop are - /// inclusive. In other words start:stop:stepj is interpreted as - /// np.linspace(start, stop, step, endpoint=1) inside of the brackets. - /// After expansion of slice notation, all comma separated sequences are - /// concatenated together. - /// - /// Optional character strings placed as the first element of the index - /// expression can be used to change the output. The strings ‘r’ or ‘c’ result - /// in matrix output. If the result is 1-D and ‘r’ is specified a 1 x N (row) - /// matrix is produced. If the result is 1-D and ‘c’ is specified, then a N x 1 - /// (column) matrix is produced. If the result is 2-D then both provide the - /// same matrix result. - /// - /// A string integer specifies which axis to stack multiple comma separated - /// arrays along. A string of two comma-separated integers allows indication - /// of the minimum number of dimensions to force each entry into as the - /// second integer (the axis to concatenate along is still the first integer). - /// - /// A string with three comma-separated integers allows specification of the - /// axis to concatenate along, the minimum number of dimensions to force the - /// entries to, and which axis should contain the start of the arrays which - /// are less than the specified number of dimensions. In other words the third - /// integer allows you to specify where the 1’s should be placed in the shape - /// of the arrays that have their shapes upgraded. By default, they are placed - /// in the front of the shape tuple. The third argument allows you to specify - /// where the start of the array should be instead. Thus, a third argument of - /// ‘0’ would place the 1’s at the end of the array shape. Negative integers - /// specify where in the new shape tuple the last dimension of upgraded arrays - /// should be placed, so the default is ‘-1’. + /// Translates slice objects to concatenation along the first axis.

+ /// + /// This is a simple way to build up arrays quickly.

+ /// There are two use cases.

+ /// + /// If slice notation is used, the syntax start:stop:step is equivalent + /// to np.arange(start, stop, step) inside of the brackets.

+ /// However, if + /// step is an imaginary number (i.e.

+ /// 100j) then its integer portion is + /// interpreted as a number-of-points desired and the start and stop are + /// inclusive.

+ /// In other words start:stop:stepj is interpreted as + /// np.linspace(start, stop, step, endpoint=1) inside of the brackets.

+ /// + /// After expansion of slice notation, all comma separated sequences are + /// concatenated together.

+ /// + /// Optional character strings placed as the first element of the index + /// expression can be used to change the output.

+ /// The strings ‘r’ or ‘c’ result + /// in matrix output.

+ /// If the result is 1-D and ‘r’ is specified a 1 x N (row) + /// matrix is produced.

+ /// If the result is 1-D and ‘c’ is specified, then a N x 1 + /// (column) matrix is produced.

+ /// If the result is 2-D then both provide the + /// same matrix result.

+ /// + /// A string integer specifies which axis to stack multiple comma separated + /// arrays along.

+ /// A string of two comma-separated integers allows indication + /// of the minimum number of dimensions to force each entry into as the + /// second integer (the axis to concatenate along is still the first integer).

+ /// + /// A string with three comma-separated integers allows specification of the + /// axis to concatenate along, the minimum number of dimensions to force the + /// entries to, and which axis should contain the start of the arrays which + /// are less than the specified number of dimensions.

+ /// In other words the third + /// integer allows you to specify where the 1’s should be placed in the shape + /// of the arrays that have their shapes upgraded.

+ /// By default, they are placed + /// in the front of the shape tuple.

+ /// The third argument allows you to specify + /// where the start of the array should be instead.

+ /// Thus, a third argument of + /// ‘0’ would place the 1’s at the end of the array shape.

+ /// Negative integers + /// specify where in the new shape tuple the last dimension of upgraded arrays + /// should be placed, so the default is ‘-1’. ///
public static void r_() - => NumPy.Instance.r_(); - - /// - /// A nicer way to build up index tuples for arrays. - /// - /// For any index combination, including slicing and axis insertion, - /// a[indices] is the same as a[np.index_exp[indices]] for any - /// array a. However, np.index_exp[indices] can be used anywhere - /// in Python code and returns a tuple of slice objects that can be - /// used in the construction of complex index expressions. - /// - /// Notes - /// - /// You can do all this with slice() plus a few special objects, - /// but there’s a lot to remember and this version is simpler because - /// it uses the standard array indexing syntax. + { + //auto-generated code, do not change + var __self__=self; + dynamic py = __self__.InvokeMethod("r_"); + } + + /// + /// A nicer way to build up index tuples for arrays.

+ /// + /// For any index combination, including slicing and axis insertion, + /// a[indices] is the same as a[np.index_exp[indices]] for any + /// array a.

+ /// However, np.index_exp[indices] can be used anywhere + /// in Python code and returns a tuple of slice objects that can be + /// used in the construction of complex index expressions.

+ /// + /// Notes + /// + /// You can do all this with slice() plus a few special objects, + /// but there’s a lot to remember and this version is simpler because + /// it uses the standard array indexing syntax. ///
/// - /// If True, always returns a tuple. + /// If True, always returns a tuple. /// public static void s_(bool maketuple) - => NumPy.Instance.s_(maketuple); - - /// - /// 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. + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + maketuple, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("s_", 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Indices of elements that are non-zero. + /// Indices of elements that are non-zero. /// - public static NDarray[] nonzero(NDarray a) - => NumPy.Instance.nonzero(a); + public static NDarray[] nonzero(this 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("nonzero", 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: + /// Return elements chosen from x or y depending on condition.

+ /// + /// Notes + /// + /// If all the arrays are 1-D, where is equivalent to: ///
/// - /// Where True, yield x, otherwise yield y. + /// Where True, yield x, otherwise yield y. /// /// - /// 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. /// /// - /// 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 static NDarray @where(this NDarray condition, NDarray y, NDarray x) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + condition, + 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: + ///
+ /// + /// Where True, yield x, otherwise yield y. /// /// - /// An array with elements from x where condition is True, and elements - /// from y elsewhere. + /// An array with elements from x where condition is True, and elements + /// from y elsewhere. /// - public static NDarray @where(NDarray condition, NDarray y, NDarray x) - => NumPy.Instance.@where(condition, y, x); - - /// - /// Return an array representing the indices of a grid. - /// - /// Compute an array where the subarrays contain index values 0,1,… - /// varying only along the corresponding axis. - /// - /// Notes - /// - /// The output shape is obtained by prepending the number of dimensions - /// in front of the tuple of dimensions, i.e. if dimensions is a tuple - /// (r0, ..., rN-1) of length N, the output shape is - /// (N,r0,...,rN-1). - /// - /// The subarrays grid[k] contains the N-D array of indices along the - /// k-th axis. Explicitly: + public static NDarray[] @where(this NDarray condition) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + condition, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("where", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Return an array representing the indices of a grid.

+ /// + /// Compute an array where the subarrays contain index values 0,1,… + /// varying only along the corresponding axis.

+ /// + /// Notes + /// + /// The output shape is obtained by prepending the number of dimensions + /// in front of the tuple of dimensions, i.e.

+ /// if dimensions is a tuple + /// (r0, ..., rN-1) of length N, the output shape is + /// (N,r0,...,rN-1).

+ /// + /// The subarrays grid[k] contains the N-D array of indices along the + /// k-th axis.

+ /// Explicitly: ///
/// - /// The shape of the grid. + /// The shape of the grid. /// /// - /// Data type of the result. + /// Data type of the result. /// /// - /// The array of grid indices, - /// grid.shape = (len(dimensions),) + tuple(dimensions). + /// The array of grid indices, + /// grid.shape = (len(dimensions),) + tuple(dimensions). /// public static NDarray indices(int[] dimensions, Dtype dtype = null) - => NumPy.Instance.indices(dimensions, dtype:dtype); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + dimensions, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("indices", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Construct an open mesh from multiple sequences. - /// - /// This function takes N 1-D sequences and returns N outputs with N - /// dimensions each, such that the shape is 1 in all but one dimension - /// and the dimension with the non-unit shape value cycles through all - /// N dimensions. - /// - /// Using ix_ one can quickly construct index arrays that will index - /// the cross product. a[np.ix_([1,3],[2,5])] returns the array - /// [[a[1,2] a[1,5]], [a[3,2] a[3,5]]]. + /// Construct an open mesh from multiple sequences.

+ /// + /// This function takes N 1-D sequences and returns N outputs with N + /// dimensions each, such that the shape is 1 in all but one dimension + /// and the dimension with the non-unit shape value cycles through all + /// N dimensions.

+ /// + /// Using ix_ one can quickly construct index arrays that will index + /// the cross product.

+ /// a[np.ix_([1,3],[2,5])] returns the array + /// [[a[1,2] a[1,5]], [a[3,2] a[3,5]]]. ///
/// - /// Each sequence should be of integer or boolean type. - /// Boolean sequences will be interpreted as boolean masks for the - /// corresponding dimension (equivalent to passing in - /// np.nonzero(boolean_sequence)). + /// Each sequence should be of integer or boolean type.

+ /// + /// Boolean sequences will be interpreted as boolean masks for the + /// corresponding dimension (equivalent to passing in + /// np.nonzero(boolean_sequence)). /// /// - /// N arrays with N dimensions each, with N the number of input - /// sequences. Together these arrays form an open mesh. + /// N arrays with N dimensions each, with N the number of input + /// sequences.

+ /// Together these arrays form an open mesh. ///
- public static NDarray[] ix_(NDarray[] args) - => NumPy.Instance.ix_(args); + public static NDarray[] ix_(params NDarray[] args) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + args, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("ix_", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// Converts a tuple of index arrays into an array of flat - /// indices, applying boundary modes to the multi-index. - /// - /// Notes + /// Converts a tuple of index arrays into an array of flat + /// indices, applying boundary modes to the multi-index.

+ /// + /// Notes ///
/// - /// A tuple of integer arrays, one array for each dimension. + /// A tuple of integer arrays, one array for each dimension. /// /// - /// The shape of array into which the indices from multi_index apply. + /// The shape of array into which the indices from multi_index apply. /// /// - /// Specifies how out-of-bounds indices are handled. Can specify - /// either one mode or a tuple of modes, one mode per index. - /// - /// In ‘clip’ mode, a negative index which would normally - /// wrap will clip to 0 instead. + /// Specifies how out-of-bounds indices are handled.

+ /// Can specify + /// either one mode or a tuple of modes, one mode per index.

+ /// + /// In ‘clip’ mode, a negative index which would normally + /// wrap will clip to 0 instead. /// /// - /// Determines whether the multi-index should be viewed as - /// indexing in row-major (C-style) or column-major - /// (Fortran-style) order. + /// Determines whether the multi-index should be viewed as + /// indexing in row-major (C-style) or column-major + /// (Fortran-style) order. /// /// - /// An array of indices into the flattened version of an array - /// of dimensions dims. + /// An array of indices into the flattened version of an array + /// of dimensions dims. /// public static NDarray ravel_multi_index(tuple of array_like multi_index, tuple of ints dims, string mode = "raise", string order = null) - => NumPy.Instance.ravel_multi_index(multi_index, dims, mode:mode, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + multi_index, + dims, + }); + var kwargs=new PyDict(); + if (mode!="raise") kwargs["mode"]=ToPython(mode); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("ravel_multi_index", pyargs, kwargs); + return ToCsharp(py); + } */ /// - /// Converts a flat index or array of flat indices into a tuple - /// of coordinate arrays. + /// Converts a flat index or array of flat indices into a tuple + /// of coordinate arrays. /// /// - /// An integer array whose elements are indices into the flattened - /// version of an array of dimensions shape. Before version 1.6.0, - /// this function accepted just one index value. + /// An integer array whose elements are indices into the flattened + /// version of an array of dimensions shape.

+ /// Before version 1.6.0, + /// this function accepted just one index value. /// /// - /// The shape of the array to use for unraveling indices. + /// 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. + /// 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. + /// Each array in the tuple has the same shape as the indices + /// array. /// - public static NDarray[] unravel_index(NDarray indices, Shape shape, string order = null) - => NumPy.Instance.unravel_index(indices, shape, order:order); + public static NDarray[] unravel_index(this NDarray indices, Shape shape, string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + indices, + 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 array. - /// - /// This returns a tuple of indices that can be used to access the main - /// diagonal of an array a with a.ndim >= 2 dimensions and shape - /// (n, n, …, n). For a.ndim = 2 this is the usual diagonal, for - /// a.ndim > 2 this is the set of indices to access a[i, i, ..., i] - /// for i = [0..n-1]. - /// - /// Notes + /// Return the indices to access the main diagonal of an array.

+ /// + /// This returns a tuple of indices that can be used to access the main + /// diagonal of an array a with a.ndim >= 2 dimensions and shape + /// (n, n, …, n).

+ /// For a.ndim = 2 this is the usual diagonal, for + /// a.ndim > 2 this is the set of indices to access a[i, i, ..., i] + /// for i = [0..n-1].

+ /// + /// Notes ///
/// - /// The size, along each dimension, of the arrays for which the returned - /// indices can be used. + /// The size, along each dimension, of the arrays for which the returned + /// indices can be used. /// /// - /// The number of dimensions. + /// The number of dimensions. /// public static void diag_indices(int n, int? ndim = 2) - => NumPy.Instance.diag_indices(n, ndim:ndim); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + n, + }); + var kwargs=new PyDict(); + if (ndim!=2) kwargs["ndim"]=ToPython(ndim); + dynamic py = __self__.InvokeMethod("diag_indices", pyargs, kwargs); + } /// - /// Return the indices to access the main diagonal of an n-dimensional array. - /// - /// See diag_indices for full details. - /// - /// Notes + /// Return the indices to access the main diagonal of an n-dimensional array.

+ /// + /// See diag_indices for full details.

+ /// + /// Notes ///
- public static void diag_indices_from(NDarray arr) - => NumPy.Instance.diag_indices_from(arr); + public static void diag_indices_from(this NDarray arr) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("diag_indices_from", pyargs, kwargs); + } /// - /// Return the indices to access (n, n) arrays, given a masking function. - /// - /// Assume mask_func is a function that, for a square array a of size - /// (n, n) with a possible offset argument k, when called as - /// mask_func(a, k) returns a new array with zeros in certain locations - /// (functions like triu or tril do precisely this). Then this function - /// returns the indices where the non-zero values would be located. - /// - /// Notes + /// Return the indices to access (n, n) arrays, given a masking function.

+ /// + /// Assume mask_func is a function that, for a square array a of size + /// (n, n) with a possible offset argument k, when called as + /// mask_func(a, k) returns a new array with zeros in certain locations + /// (functions like triu or tril do precisely this).

+ /// Then this function + /// returns the indices where the non-zero values would be located.

+ /// + /// Notes ///
/// - /// The returned indices will be valid to access arrays of shape (n, n). + /// The returned indices will be valid to access arrays of shape (n, n). /// /// - /// A function whose call signature is similar to that of triu, tril. - /// That is, mask_func(x, k) returns a boolean array, shaped like x. - /// k is an optional argument to the function. + /// A function whose call signature is similar to that of triu, tril.

+ /// + /// That is, mask_func(x, k) returns a boolean array, shaped like x.

+ /// + /// k is an optional argument to the function. /// /// - /// An optional argument which is passed through to mask_func. Functions - /// like triu, tril take a second argument that is interpreted as an - /// offset. + /// An optional argument which is passed through to mask_func.

+ /// Functions + /// like triu, tril take a second argument that is interpreted as an + /// offset. /// /// - /// The n arrays of indices corresponding to the locations where - /// mask_func(np.ones((n, n)), k) is True. + /// The n arrays of indices corresponding to the locations where + /// mask_func(np.ones((n, n)), k) is True. /// public static NDarray[] mask_indices(int n, Delegate mask_func, int k = 0) - => NumPy.Instance.mask_indices(n, mask_func, k); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + n, + mask_func, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("mask_indices", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the indices for the lower-triangle of an (n, m) array. - /// - /// Notes + /// Return the indices for the lower-triangle of an (n, m) array.

+ /// + /// Notes ///
/// - /// The row dimension of the arrays for which the returned - /// indices will be valid. + /// The row dimension of the arrays for which the returned + /// indices will be valid. /// /// - /// Diagonal offset (see tril for details). + /// Diagonal offset (see tril for details). /// /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. + /// The column dimension of the arrays for which the returned + /// arrays will be valid.

+ /// + /// By default m is taken equal to n. /// /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. + /// The indices for the triangle.

+ /// The returned tuple contains two arrays, + /// each with the indices along one dimension of the array. ///
public static NDarray[] tril_indices(int n, int? k = 0, int? m = null) - => NumPy.Instance.tril_indices(n, k:k, m:m); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + n, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + if (m!=null) kwargs["m"]=ToPython(m); + dynamic py = __self__.InvokeMethod("tril_indices", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the indices for the lower-triangle of arr. - /// - /// See tril_indices for full details. - /// - /// Notes + /// Return the indices for the lower-triangle of arr.

+ /// + /// See tril_indices for full details.

+ /// + /// Notes ///
/// - /// The indices will be valid for square arrays whose dimensions are - /// the same as arr. + /// The indices will be valid for square arrays whose dimensions are + /// the same as arr. /// /// - /// Diagonal offset (see tril for details). - /// - public static void tril_indices_from(NDarray arr, int? k = 0) - => NumPy.Instance.tril_indices_from(arr, k:k); + /// Diagonal offset (see tril for details). + /// + public static void tril_indices_from(this NDarray arr, int? k = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + }); + 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 an (n, m) array. - /// - /// Notes + /// Return the indices for the upper-triangle of an (n, m) array.

+ /// + /// Notes ///
/// - /// The size of the arrays for which the returned indices will - /// be valid. + /// The size of the arrays for which the returned indices will + /// be valid. /// /// - /// Diagonal offset (see triu for details). + /// Diagonal offset (see triu for details). /// /// - /// The column dimension of the arrays for which the returned - /// arrays will be valid. - /// By default m is taken equal to n. + /// The column dimension of the arrays for which the returned + /// arrays will be valid.

+ /// + /// By default m is taken equal to n. /// /// - /// The indices for the triangle. The returned tuple contains two arrays, - /// each with the indices along one dimension of the array. Can be used - /// to slice a ndarray of shape(n, n). + /// The indices for the triangle.

+ /// The returned tuple contains two arrays, + /// each with the indices along one dimension of the array.

+ /// Can be used + /// to slice a ndarray of shape(n, n). ///
public static NDarray[] triu_indices(int n, int? k = 0, int? m = null) - => NumPy.Instance.triu_indices(n, k:k, m:m); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + n, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + if (m!=null) kwargs["m"]=ToPython(m); + dynamic py = __self__.InvokeMethod("triu_indices", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the indices for the upper-triangle of arr. - /// - /// See triu_indices for full details. - /// - /// Notes + /// Return the indices for the upper-triangle of arr.

+ /// + /// See triu_indices for full details.

+ /// + /// Notes ///
/// - /// The indices will be valid for square arrays. + /// The indices will be valid for square arrays. /// /// - /// Diagonal offset (see triu for details). + /// Diagonal offset (see triu for details). /// /// - /// Indices for the upper-triangle of arr. + /// Indices for the upper-triangle of arr. /// - public static NDarray[] triu_indices_from(NDarray arr, int? k = 0) - => NumPy.Instance.triu_indices_from(arr, k:k); - - /// - /// Take elements from an array along an axis. - /// - /// When axis is not None, this function does the same thing as “fancy” - /// indexing (indexing arrays using arrays); however, it can be easier to use - /// if you need elements along a given axis. A call such as - /// np.take(arr, indices, axis=3) is equivalent to - /// arr[:,:,:,indices,...]. - /// - /// Explained without fancy indexing, this is equivalent to the following use - /// of ndindex, which sets each of ii, jj, and kk to a tuple of - /// indices: - /// - /// Notes - /// - /// By eliminating the inner loop in the description above, and using s_ to - /// build simple slice objects, take can be expressed in terms of applying - /// fancy indexing to each 1-d slice: - /// - /// For this reason, it is equivalent to (but faster than) the following use - /// of apply_along_axis: + public static NDarray[] triu_indices_from(this NDarray arr, int? k = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + }); + var kwargs=new PyDict(); + if (k!=0) kwargs["k"]=ToPython(k); + dynamic py = __self__.InvokeMethod("triu_indices_from", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Take elements from an array along an axis.

+ /// + /// When axis is not None, this function does the same thing as “fancy” + /// indexing (indexing arrays using arrays); however, it can be easier to use + /// if you need elements along a given axis.

+ /// A call such as + /// np.take(arr, indices, axis=3) is equivalent to + /// arr[:,:,:,indices,...].

+ /// + /// Explained without fancy indexing, this is equivalent to the following use + /// of ndindex, which sets each of ii, jj, and kk to a tuple of + /// indices: + /// + /// Notes + /// + /// By eliminating the inner loop in the description above, and using s_ to + /// build simple slice objects, take can be expressed in terms of applying + /// fancy indexing to each 1-d slice: + /// + /// For this reason, it is equivalent to (but faster than) the following use + /// of apply_along_axis: ///
/// - /// The source array. + /// The source array. /// /// - /// The indices of the values to extract. - /// - /// Also allow scalars for indices. + /// The indices of the values to extract.

+ /// + /// Also allow scalars for indices. /// /// - /// The axis over which to select values. By default, the flattened - /// input array is used. + /// The axis over which to select values.

+ /// By default, the flattened + /// input array is used. /// - /// - /// If provided, the result will be placed in this array. It should - /// be of the appropriate shape and dtype. + /// + /// If provided, the result will be placed in this array.

+ /// It should + /// be of the appropriate shape and dtype. /// /// - /// 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. + /// 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. /// /// - /// The returned array has the same type as a. + /// The returned array has the same type as a. /// public static NDarray take(NDarray[] a, NDarray[] indices, int? axis = null, NDarray @out = null, string mode = "raise") - => NumPy.Instance.take(a, indices, axis:axis, @out:@out, mode:mode); - - /// - /// 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: + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + indices, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (mode!="raise") kwargs["mode"]=ToPython(mode); + dynamic py = __self__.InvokeMethod("take", 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: ///
/// - /// Source array + /// Source array /// /// - /// 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. + /// 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 static void take_along_axis(NDarray arr, NDarray indices, int axis) - => NumPy.Instance.take_along_axis(arr, indices, axis); - - /// - /// Construct an array from an index array and a set of arrays to choose from. - /// - /// First of all, if confused or uncertain, definitely look at the Examples - - /// in its full generality, this function is less simple than it might - /// seem from the following code description (below ndi = - /// numpy.lib.index_tricks): - /// - /// np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)]). - /// - /// But this omits some subtleties. Here is a fully general summary: - /// - /// Given an “index” array (a) of integers and a sequence of n arrays - /// (choices), a and each choice array are first broadcast, as necessary, - /// to arrays of a common shape; calling these Ba and Bchoices[i], i = - /// 0,…,n-1 we have that, necessarily, Ba.shape == Bchoices[i].shape - /// for each i. Then, a new array with shape Ba.shape is created as - /// follows: - /// - /// Notes - /// - /// To reduce the chance of misinterpretation, even though the following - /// “abuse” is nominally supported, choices should neither be, nor be - /// thought of as, a single array, i.e., the outermost sequence-like container - /// should be either a list or a tuple. + /// 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 static NDarray take_along_axis(this NDarray arr, NDarray indices, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + indices, + axis, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("take_along_axis", pyargs, kwargs); + return ToCsharp(py); + } + + /// + /// Construct an array from an index array and a set of arrays to choose from.

+ /// + /// First of all, if confused or uncertain, definitely look at the Examples - + /// in its full generality, this function is less simple than it might + /// seem from the following code description (below ndi = + /// numpy.lib.index_tricks): + /// + /// np.choose(a,c) == np.array([c[a[I]][I] for I in ndi.ndindex(a.shape)]).

+ /// + /// But this omits some subtleties.

+ /// Here is a fully general summary: + /// + /// Given an “index” array (a) of integers and a sequence of n arrays + /// (choices), a and each choice array are first broadcast, as necessary, + /// to arrays of a common shape; calling these Ba and Bchoices[i], i = + /// 0,…,n-1 we have that, necessarily, Ba.shape == Bchoices[i].shape + /// for each i.

+ /// Then, a new array with shape Ba.shape is created as + /// follows: + /// + /// Notes + /// + /// To reduce the chance of misinterpretation, even though the following + /// “abuse” is nominally supported, choices should neither be, nor be + /// thought of as, a single array, i.e., the outermost sequence-like container + /// should be either a list or a tuple. ///
/// - /// This array must contain integers in [0, n-1], where n is the number - /// of choices, unless mode=wrap or mode=clip, in which cases any - /// integers are permissible. + /// This array must contain integers in [0, n-1], where n is the number + /// of choices, unless mode=wrap or mode=clip, in which cases any + /// integers are permissible. /// /// - /// Choice arrays. a and all of the choices must be broadcastable to the - /// same shape. If choices is itself an array (not recommended), then - /// its outermost dimension (i.e., the one corresponding to - /// choices.shape[0]) is taken as defining the “sequence”. - /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. + /// Choice arrays.

+ /// a and all of the choices must be broadcastable to the + /// same shape.

+ /// If choices is itself an array (not recommended), then + /// its outermost dimension (i.e., the one corresponding to + /// choices.shape[0]) is taken as defining the “sequence”. + /// + /// + /// If provided, the result will be inserted into this array.

+ /// It should + /// be of the appropriate shape and dtype. /// /// - /// Specifies how indices outside [0, n-1] will be treated: + /// Specifies how indices outside [0, n-1] will be treated: /// /// - /// The merged result. + /// The merged result. /// public static NDarray choose(NDarray a, NDarray[] choices, NDarray @out = null, string mode = "raise") - => NumPy.Instance.choose(a, choices, @out:@out, mode:mode); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + choices, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (mode!="raise") kwargs["mode"]=ToPython(mode); + dynamic py = __self__.InvokeMethod("choose", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return selected slices of an array along given axis. - /// - /// When working along a given axis, a slice along that axis is returned in - /// output for each index where condition evaluates to True. When - /// working on a 1-D array, compress is equivalent to extract. + /// Return selected slices of an array along given axis.

+ /// + /// When working along a given axis, a slice along that axis is returned in + /// output for each index where condition evaluates to True.

+ /// When + /// working on a 1-D array, compress is equivalent to extract. ///
/// - /// Array that selects which entries to return. If len(condition) - /// is less than the size of a along the given axis, then output is - /// truncated to the length of the condition array. + /// Array that selects which entries to return.

+ /// If len(condition) + /// is less than the size of a along the given axis, then output is + /// truncated to the length of the condition array. /// /// - /// Array from which to extract a part. + /// Array from which to extract a part. /// /// - /// Axis along which to take slices. If None (default), work on the - /// flattened array. + /// Axis along which to take slices.

+ /// If None (default), work on the + /// flattened array. /// - /// - /// Output array. Its type is preserved and it must be of the right - /// shape to hold the output. + /// + /// Output array.

+ /// Its type is preserved and it must be of the right + /// shape to hold the output. /// /// - /// A copy of a without the slices along axis for which condition - /// is false. + /// A copy of a without the slices along axis for which condition + /// is false. /// public static NDarray compress(NDarray condition, NDarray a, int? axis = null, NDarray @out = null) - => NumPy.Instance.compress(condition, a, axis:axis, @out:@out); - - /// - /// 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. + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + condition, + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("compress", 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. ///
/// - /// Array from which the diagonals are taken. + /// Array from which the diagonals are taken. /// /// - /// Offset of the diagonal from the main diagonal. Can be positive or - /// negative. Defaults to main diagonal (0). + /// 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 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). + /// 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. + /// 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 static NDarray diagonal(NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) - => NumPy.Instance.diagonal(a, offset:offset, axis1:axis1, axis2:axis2); + public static NDarray diagonal(this NDarray a, int? offset = 0, int? axis1 = 0, int? axis2 = 1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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); + } /// - /// Return an array drawn from elements in choicelist, depending on conditions. + /// Return an array drawn from elements in choicelist, depending on conditions. /// /// - /// The list of conditions which determine from which array in choicelist - /// the output elements are taken. When multiple conditions are satisfied, - /// the first one encountered in condlist is used. + /// The list of conditions which determine from which array in choicelist + /// the output elements are taken.

+ /// When multiple conditions are satisfied, + /// the first one encountered in condlist is used. /// /// - /// The list of arrays from which the output elements are taken. It has - /// to be of the same length as condlist. + /// The list of arrays from which the output elements are taken.

+ /// It has + /// to be of the same length as condlist. /// - /// - /// The element inserted in output when all conditions evaluate to False. + /// + /// The element inserted in output when all conditions evaluate to False. /// /// - /// The output at position m is the m-th element of the array in - /// choicelist where the m-th element of the corresponding array in - /// condlist is True. + /// The output at position m is the m-th element of the array in + /// choicelist where the m-th element of the corresponding array in + /// condlist is True. /// public static NDarray @select(NDarray[] condlist, NDarray[] choicelist, object @default = null) - => NumPy.Instance.@select(condlist, choicelist, @default:@default); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + condlist, + choicelist, + }); + var kwargs=new PyDict(); + if (@default!=null) kwargs["default"]=ToPython(@default); + dynamic py = __self__.InvokeMethod("select", pyargs, kwargs); + return ToCsharp(py); + } public static partial class lib { public static partial class stride_tricks { /// - /// Create a view into the array with the given shape and strides. - /// - /// Notes - /// - /// as_strided creates a view into the array given the exact strides - /// and shape. This means it manipulates the internal data structure of - /// ndarray and, if done incorrectly, the array elements can point to - /// invalid memory and can corrupt results or crash your program. - /// It is advisable to always use the original x.strides when - /// calculating new strides to avoid reliance on a contiguous memory - /// layout. - /// - /// Furthermore, arrays created with this function often contain self - /// overlapping memory, so that two elements are identical. - /// Vectorized write operations on such arrays will typically be - /// unpredictable. They may even give different results for small, large, - /// or transposed arrays. - /// Since writing to these arrays has to be tested and done with great - /// care, you may want to use writeable=False to avoid accidental write - /// operations. - /// - /// For these reasons it is advisable to avoid as_strided when - /// possible. + /// Create a view into the array with the given shape and strides.

+ /// + /// Notes + /// + /// as_strided creates a view into the array given the exact strides + /// and shape.

+ /// This means it manipulates the internal data structure of + /// ndarray and, if done incorrectly, the array elements can point to + /// invalid memory and can corrupt results or crash your program.

+ /// + /// It is advisable to always use the original x.strides when + /// calculating new strides to avoid reliance on a contiguous memory + /// layout.

+ /// + /// Furthermore, arrays created with this function often contain self + /// overlapping memory, so that two elements are identical.

+ /// + /// Vectorized write operations on such arrays will typically be + /// unpredictable.

+ /// They may even give different results for small, large, + /// or transposed arrays.

+ /// + /// Since writing to these arrays has to be tested and done with great + /// care, you may want to use writeable=False to avoid accidental write + /// operations.

+ /// + /// For these reasons it is advisable to avoid as_strided when + /// possible. ///
/// - /// Array to create a new. + /// Array to create a new. /// /// - /// The shape of the new array. Defaults to x.shape. + /// The shape of the new array.

+ /// Defaults to x.shape. /// /// - /// The strides of the new array. Defaults to x.strides. + /// The strides of the new array.

+ /// Defaults to x.strides. /// /// - /// If True, subclasses are preserved. + /// If True, subclasses are preserved. /// /// - /// If set to False, the returned array will always be readonly. - /// Otherwise it will be writable if the original array was. It - /// is advisable to set this to False if possible (see Notes). + /// If set to False, the returned array will always be readonly.

+ /// + /// Otherwise it will be writable if the original array was.

+ /// It + /// is advisable to set this to False if possible (see Notes). /// public static NDarray as_strided(NDarray x, Shape shape = null, int[] strides = null, bool? subok = false, bool? writeable = true) - => NumPy.Instance.lib_stride_tricks_as_strided(x, shape:shape, strides:strides, subok:subok, writeable:writeable); + { + //auto-generated code, do not change + var lib = self.GetAttr("lib"); + var stride_tricks = lib.GetAttr("stride_tricks"); + var __self__=stride_tricks; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (shape!=null) kwargs["shape"]=ToPython(shape); + if (strides!=null) kwargs["strides"]=ToPython(strides); + if (subok!=false) kwargs["subok"]=ToPython(subok); + if (writeable!=true) kwargs["writeable"]=ToPython(writeable); + dynamic py = __self__.InvokeMethod("as_strided", 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. + /// 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. ///
/// - /// Array to put data into. + /// Array to put data into. /// /// - /// Boolean mask array. Must have the same size as a. + /// 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 static void place(NDarray arr, NDarray mask, NDarray vals) - => NumPy.Instance.place(arr, mask, vals); + /// 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 static void place(this NDarray arr, NDarray mask, NDarray vals) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + 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: + /// Replaces specified elements of an array with given values.

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

+ /// put is roughly + /// equivalent to: ///
/// - /// Target array. + /// Target array. /// /// - /// Target indices, interpreted as integers. + /// 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. + /// 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 static void put(NDarray a, NDarray ind, NDarray v, string mode = "raise") - => NumPy.Instance.put(a, ind, v, mode:mode); - - /// - /// 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: + /// 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 static void put(this NDarray a, NDarray ind, NDarray v, string mode = "raise") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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: ///
/// - /// Destination array. + /// Destination array. /// /// - /// 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. + /// 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. + /// 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 static void put_along_axis(NDarray arr, NDarray indices, NDarray[] values, int axis) - => NumPy.Instance.put_along_axis(arr, indices, values, axis); + /// 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 static void put_along_axis(this NDarray arr, NDarray indices, NDarray[] values, int axis) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + 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. + /// 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. ///
/// - /// Target array. + /// Target array. /// /// - /// Boolean mask array. It has to be the same shape as a. + /// 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 static void putmask(NDarray a, NDarray mask, NDarray values) - => NumPy.Instance.putmask(a, mask, values); + /// Values to put into a where mask is True.

+ /// If values is smaller + /// than a it will be repeated. + /// + public static void putmask(this NDarray a, NDarray mask, NDarray values) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. ///
/// - /// Array whose diagonal is to be filled, it gets modified in-place. + /// Array whose diagonal is to be filled, it gets modified in-place. /// /// - /// Value to be written on the diagonal, its type must be compatible with - /// that of the array a. + /// 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 static void fill_diagonal(NDarray a, ValueType val, bool wrap = false) - => NumPy.Instance.fill_diagonal(a, val, wrap); + /// 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 static void fill_diagonal(this NDarray a, ValueType val, bool wrap = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. ///
/// - /// The array(s) to iterate over. + /// The array(s) to iterate over. /// /// - /// Flags to control the behavior of the iterator. + /// 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. + /// 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. + /// 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 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. + /// 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”. + /// 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. + /// 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 static void nditer(NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) - => NumPy.Instance.nditer(op, flags:flags, op_flags:op_flags, op_dtypes:op_dtypes, order:order, casting:casting, op_axes:op_axes, itershape:itershape, buffersize:buffersize); + /// When buffering is enabled, controls the size of the temporary + /// buffers.

+ /// Set to 0 for the default value. + /// + public static void nditer(this NDarray op, string[] flags = null, list of list of str op_flags = null, dtype or tuple of dtype(s) op_dtypes = null, string order = null, string casting = null, list of list of ints op_axes = null, tuple of ints itershape = null, int? buffersize = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + op, + }); + 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. + /// Multidimensional index iterator.

+ /// + /// Return an iterator yielding pairs of array coordinates and values. ///
/// - /// Input array. - /// - public static void ndenumerate(NDarray arr) - => NumPy.Instance.ndenumerate(arr); + /// Input array. + /// + public static void ndenumerate(this NDarray arr) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("ndenumerate", pyargs, kwargs); + } /// - /// An N-dimensional iterator object to index arrays. - /// - /// Given the shape of an array, an ndindex instance iterates over - /// the N-dimensional index of the array. At each iteration a tuple - /// of indices is returned, the last dimension is iterated over first. + /// An N-dimensional iterator object to index arrays.

+ /// + /// Given the shape of an array, an ndindex instance iterates over + /// the N-dimensional index of the array.

+ /// At each iteration a tuple + /// of indices is returned, the last dimension is iterated over first. ///
/// - /// The size of each dimension of the array. - /// - public static void ndindex(int[] args) - => NumPy.Instance.ndindex(args); + /// The size of each dimension of the array. + /// + public static void ndindex(params int[] args) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + args, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("ndindex", pyargs, kwargs); + } /* /// - /// 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. + /// 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. ///
/// - /// The array(s) to iterate over. + /// The array(s) to iterate over. /// /// - /// Each item is used as an “op_axes” argument to an nditer + /// Each item is used as an “op_axes” argument to an nditer /// /// - /// An nditer for each item in axes, outermost first + /// An nditer for each item in axes, outermost first /// - public static tuple of nditer nested_iters(NDarray op, int[] axes = null) - => NumPy.Instance.nested_iters(op, axes); + public static tuple of nditer nested_iters(this NDarray op, int[] axes = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + op, + }); + var kwargs=new PyDict(); + if (axes!=null) kwargs["axes"]=ToPython(axes); + dynamic py = __self__.InvokeMethod("nested_iters", pyargs, kwargs); + return ToCsharp(py); + } */ /// - /// Flat iterator object to iterate over arrays. - /// - /// A flatiter iterator is returned by x.flat for any array x. - /// It allows iterating over the array as if it were a 1-D array, - /// either in a for-loop or by calling its next method. - /// - /// Iteration is done in row-major, C-style order (the last - /// index varying the fastest). The iterator can also be indexed using - /// basic slicing or advanced indexing. - /// - /// Notes - /// - /// A flatiter iterator can not be constructed directly from Python code - /// by calling the flatiter constructor. + /// Flat iterator object to iterate over arrays.

+ /// + /// A flatiter iterator is returned by x.flat for any array x.

+ /// + /// It allows iterating over the array as if it were a 1-D array, + /// either in a for-loop or by calling its next method.

+ /// + /// Iteration is done in row-major, C-style order (the last + /// index varying the fastest).

+ /// The iterator can also be indexed using + /// basic slicing or advanced indexing.

+ /// + /// Notes + /// + /// A flatiter iterator can not be constructed directly from Python code + /// by calling the flatiter constructor. ///
public static void flatiter() - => NumPy.Instance.flatiter(); + { + //auto-generated code, do not change + var __self__=self; + dynamic py = __self__.InvokeMethod("flatiter"); + } public static partial class lib { /// - /// Buffered iterator for big arrays. - /// - /// Arrayterator creates a buffered iterator for reading big arrays in small - /// contiguous blocks. The class is useful for objects stored in the - /// file system. It allows iteration over the object without reading - /// everything in memory; instead, small blocks are read and iterated over. - /// - /// Arrayterator can be used with any object that supports multidimensional - /// slices. This includes NumPy arrays, but also variables from - /// Scientific.IO.NetCDF or pynetcdf for example. - /// - /// Notes - /// - /// The algorithm works by first finding a “running dimension”, along which - /// the blocks will be extracted. Given an array of dimensions - /// (d1, d2, ..., dn), e.g. if buf_size is smaller than d1, the - /// first dimension will be used. If, on the other hand, - /// d1 < buf_size < d1*d2 the second dimension will be used, and so on. - /// Blocks are extracted along this dimension, and when the last block is - /// returned the process continues from the next dimension, until all - /// elements have been read. + /// Buffered iterator for big arrays.

+ /// + /// Arrayterator creates a buffered iterator for reading big arrays in small + /// contiguous blocks.

+ /// The class is useful for objects stored in the + /// file system.

+ /// It allows iteration over the object without reading + /// everything in memory; instead, small blocks are read and iterated over.

+ /// + /// Arrayterator can be used with any object that supports multidimensional + /// slices.

+ /// This includes NumPy arrays, but also variables from + /// Scientific.IO.NetCDF or pynetcdf for example.

+ /// + /// Notes + /// + /// The algorithm works by first finding a “running dimension”, along which + /// the blocks will be extracted.

+ /// Given an array of dimensions + /// (d1, d2, ..., dn), e.g.

+ /// if buf_size is smaller than d1, the + /// first dimension will be used.

+ /// If, on the other hand, + /// d1 < buf_size < d1*d2 the second dimension will be used, and so on.

+ /// + /// Blocks are extracted along this dimension, and when the last block is + /// returned the process continues from the next dimension, until all + /// elements have been read. ///
- /// - /// The object to iterate over. + /// + /// The object to iterate over. /// /// - /// The buffer size. If buf_size is supplied, the maximum amount of - /// data that will be read into memory is buf_size elements. - /// Default is None, which will read as many element as possible - /// into memory. + /// The buffer size.

+ /// If buf_size is supplied, the maximum amount of + /// data that will be read into memory is buf_size elements.

+ /// + /// Default is None, which will read as many element as possible + /// into memory. /// public static void Arrayterator(NDarray @var, int? buf_size = null) - => NumPy.Instance.lib_Arrayterator(@var, buf_size:buf_size); + { + //auto-generated code, do not change + var lib = self.GetAttr("lib"); + var __self__=lib; + var pyargs=ToTuple(new object[] + { + @var, + }); + var kwargs=new PyDict(); + if (buf_size!=null) kwargs["buf_size"]=ToPython(buf_size); + dynamic py = __self__.InvokeMethod("Arrayterator", pyargs, kwargs); + } } diff --git a/src/Numpy/np.io.gen.cs b/src/Numpy/np.io.gen.cs index 8107304..8e09d8f 100644 --- a/src/Numpy/np.io.gen.cs +++ b/src/Numpy/np.io.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,876 +20,1141 @@ public static partial class np { /// - /// Load arrays or pickled objects from .npy, .npz or pickled files. - /// - /// Notes + /// Load arrays or pickled objects from .npy, .npz or pickled files.

+ /// + /// Notes ///
/// - /// The file to read. File-like objects must support the - /// seek() and read() methods. Pickled files require that the - /// file-like object support the readline() method as well. + /// The file to read.

+ /// File-like objects must support the + /// seek() and read() methods.

+ /// Pickled files require that the + /// file-like object support the readline() method as well. /// /// - /// If not None, then memory-map the file, using the given mode (see - /// numpy.memmap for a detailed description of the modes). A - /// memory-mapped array is kept on disk. However, it can be accessed - /// and sliced like any ndarray. Memory mapping is especially useful - /// for accessing small fragments of large files without reading the - /// entire file into memory. + /// If not None, then memory-map the file, using the given mode (see + /// numpy.memmap for a detailed description of the modes).

+ /// A + /// memory-mapped array is kept on disk.

+ /// However, it can be accessed + /// and sliced like any ndarray.

+ /// Memory mapping is especially useful + /// for accessing small fragments of large files without reading the + /// entire file into memory. /// /// - /// Allow loading pickled object arrays stored in npy files. Reasons for - /// disallowing pickles include security, as loading pickled data can - /// execute arbitrary code. If pickles are disallowed, loading object - /// arrays will fail. - /// Default: True + /// Allow loading pickled object arrays stored in npy files.

+ /// Reasons for + /// disallowing pickles include security, as loading pickled data can + /// execute arbitrary code.

+ /// If pickles are disallowed, loading object + /// arrays will fail.

+ /// + /// Default: True /// /// - /// Only useful when loading Python 2 generated pickled files on Python 3, - /// which includes npy/npz files containing object arrays. If fix_imports - /// is True, pickle will try to map the old Python 2 names to the new names - /// used in Python 3. + /// Only useful when loading Python 2 generated pickled files on Python 3, + /// which includes npy/npz files containing object arrays.

+ /// If fix_imports + /// is True, pickle will try to map the old Python 2 names to the new names + /// used in Python 3. /// /// - /// What encoding to use when reading Python 2 strings. Only useful when - /// loading Python 2 generated pickled files in Python 3, which includes - /// npy/npz files containing object arrays. Values other than ‘latin1’, - /// ‘ASCII’, and ‘bytes’ are not allowed, as they can corrupt numerical - /// data. Default: ‘ASCII’ + /// What encoding to use when reading Python 2 strings.

+ /// Only useful when + /// loading Python 2 generated pickled files in Python 3, which includes + /// npy/npz files containing object arrays.

+ /// Values other than ‘latin1’, + /// ‘ASCII’, and ‘bytes’ are not allowed, as they can corrupt numerical + /// data.

+ /// Default: ‘ASCII’ /// /// - /// Data stored in the file. For .npz files, the returned instance - /// of NpzFile class must be closed to avoid leaking file descriptors. + /// Data stored in the file.

+ /// For .npz files, the returned instance + /// of NpzFile class must be closed to avoid leaking file descriptors. ///
- public static NDarray load(string file, MemMapMode mmap_mode = null, bool? allow_pickle = true, bool? fix_imports = true, string encoding = "ASCII") - => NumPy.Instance.load(file, mmap_mode:mmap_mode, allow_pickle:allow_pickle, fix_imports:fix_imports, encoding:encoding); - - /// - /// Save an array to a binary file in NumPy .npy format. - /// - /// Notes - /// - /// For a description of the .npy format, see numpy.lib.format. - /// - /// - /// File or filename to which the data is saved. If file is a file-object, - /// then the filename is unchanged. If file is a string or Path, a .npy - /// extension will be appended to the file name if it does not already - /// have one. - /// - /// - /// Array data to be saved. - /// - /// - /// Allow saving object arrays using Python pickles. Reasons for disallowing - /// pickles include security (loading pickled data can execute arbitrary - /// code) and portability (pickled objects may not be loadable on different - /// Python installations, for example if the stored objects require libraries - /// that are not available, and not all pickled data is compatible between - /// Python 2 and Python 3). - /// Default: True - /// - /// - /// Only useful in forcing objects in object arrays on Python 3 to be - /// pickled in a Python 2 compatible way. If fix_imports is True, pickle - /// will try to map the new Python 3 names to the old module names used in - /// Python 2, so that the pickle data stream is readable with Python 2. - /// - public static void save(string file, NDarray arr, bool? allow_pickle = true, bool? fix_imports = true) - => NumPy.Instance.save(file, arr, allow_pickle:allow_pickle, fix_imports:fix_imports); - - /// - /// Save several arrays into a single file in uncompressed .npz format. - /// - /// If arguments are passed in with no keywords, the corresponding variable - /// names, in the .npz file, are ‘arr_0’, ‘arr_1’, etc. If keyword - /// arguments are given, the corresponding variable names, in the .npz - /// file will match the keyword names. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is not compressed and each file - /// in the archive contains one variable in .npy format. For a - /// description of the .npy format, see numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public static void savez(string file, NDarray[] args = null, Dictionary kwds = null) - => NumPy.Instance.savez(file, args:args, kwds:kwds); + public static NDarray load(string file, MemMapMode mmap_mode = null, bool? allow_pickle = false, bool? fix_imports = true, string encoding = "ASCII") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + file, + }); + var kwargs=new PyDict(); + if (mmap_mode!=null) kwargs["mmap_mode"]=ToPython(mmap_mode); + if (allow_pickle!=false) kwargs["allow_pickle"]=ToPython(allow_pickle); + if (fix_imports!=true) kwargs["fix_imports"]=ToPython(fix_imports); + if (encoding!="ASCII") kwargs["encoding"]=ToPython(encoding); + dynamic py = __self__.InvokeMethod("load", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Save several arrays into a single file in compressed .npz format. - /// - /// If keyword arguments are given, then filenames are taken from the keywords. - /// If arguments are passed in with no keywords, then stored file names are - /// arr_0, arr_1, etc. - /// - /// Notes - /// - /// The .npz file format is a zipped archive of files named after the - /// variables they contain. The archive is compressed with - /// zipfile.ZIP_DEFLATED and each file in the archive contains one variable - /// in .npy format. For a description of the .npy format, see - /// numpy.lib.format. - /// - /// When opening the saved .npz file with load a NpzFile object is - /// returned. This is a dictionary-like object which can be queried for - /// its list of arrays (with the .files attribute), and for the arrays - /// themselves. - /// - /// - /// Either the file name (string) or an open file (file-like object) - /// where the data will be saved. If file is a string or a Path, the - /// .npz extension will be appended to the file name if it is not - /// already there. - /// - /// - /// Arrays to save to the file. Since it is not possible for Python to - /// know the names of the arrays outside savez, the arrays will be saved - /// with names “arr_0”, “arr_1”, and so on. These arguments can be any - /// expression. - /// - /// - /// Arrays to save to the file. Arrays will be saved in the file with the - /// keyword names. - /// - public static void savez_compressed(string file, NDarray[] args = null, Dictionary kwds = null) - => NumPy.Instance.savez_compressed(file, args:args, kwds:kwds); - - /// - /// Save an array to a text file. - /// - /// Notes - /// - /// Further explanation of the fmt parameter - /// (%[flag]width[.precision]specifier): - /// - /// This explanation of fmt is not complete, for an exhaustive - /// specification see [1]. - /// - /// References + /// Save an array to a text file.

+ /// + /// Notes + /// + /// Further explanation of the fmt parameter + /// (%[flag]width[.precision]specifier): + /// + /// This explanation of fmt is not complete, for an exhaustive + /// specification see [1].

+ /// + /// References ///
/// - /// If the filename ends in .gz, the file is automatically saved in - /// compressed gzip format. loadtxt understands gzipped files - /// transparently. + /// If the filename ends in .gz, the file is automatically saved in + /// compressed gzip format.

+ /// loadtxt understands gzipped files + /// transparently. /// /// - /// Data to be saved to a text file. + /// Data to be saved to a text file. /// /// - /// A single format (%10.5f), a sequence of formats, or a - /// multi-format string, e.g. ‘Iteration %d – %10.5f’, in which - /// case delimiter is ignored. For complex X, the legal options - /// for fmt are: + /// A single format (%10.5f), a sequence of formats, or a + /// multi-format string, e.g.

+ /// ‘Iteration %d – %10.5f’, in which + /// case delimiter is ignored.

+ /// For complex X, the legal options + /// for fmt are: /// /// - /// String or character separating columns. + /// String or character separating columns. /// /// - /// String or character separating lines. + /// String or character separating lines. /// /// - /// String that will be written at the beginning of the file. + /// String that will be written at the beginning of the file. /// /// - /// String that will be written at the end of the file. + /// String that will be written at the end of the file. /// /// - /// String that will be prepended to the header and footer strings, - /// to mark them as comments. Default: ‘# ‘, as expected by e.g. - /// numpy.loadtxt. + /// String that will be prepended to the header and footer strings, + /// to mark them as comments.

+ /// Default: ‘# ‘, as expected by e.g.

+ /// + /// numpy.loadtxt. /// /// - /// Encoding used to encode the outputfile. Does not apply to output - /// streams. If the encoding is something other than ‘bytes’ or ‘latin1’ - /// you will not be able to load the file in NumPy versions < 1.14. Default - /// is ‘latin1’. + /// Encoding used to encode the outputfile.

+ /// Does not apply to output + /// streams.

+ /// If the encoding is something other than ‘bytes’ or ‘latin1’ + /// you will not be able to load the file in NumPy versions < 1.14. Default + /// is ‘latin1’. /// public static void savetxt(string fname, NDarray X, string[] fmt = null, string delimiter = " ", string newline = "\n", string header = "", string footer = "", string comments = null, string encoding = null) - => NumPy.Instance.savetxt(fname, X, fmt:fmt, delimiter:delimiter, newline:newline, header:header, footer:footer, comments:comments, encoding:encoding); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + fname, + X, + }); + var kwargs=new PyDict(); + if (fmt!=null) kwargs["fmt"]=ToPython(fmt); + if (delimiter!=" ") kwargs["delimiter"]=ToPython(delimiter); + if (newline!="\n") kwargs["newline"]=ToPython(newline); + if (header!="") kwargs["header"]=ToPython(header); + if (footer!="") kwargs["footer"]=ToPython(footer); + if (comments!=null) kwargs["comments"]=ToPython(comments); + if (encoding!=null) kwargs["encoding"]=ToPython(encoding); + dynamic py = __self__.InvokeMethod("savetxt", pyargs, kwargs); + } /* /// - /// Load data from a text file, with missing values handled as specified. - /// - /// Each line past the first skip_header lines is split at the delimiter - /// character, and characters following the comments character are discarded. - /// - /// Notes - /// - /// References + /// Load data from a text file, with missing values handled as specified.

+ /// + /// Each line past the first skip_header lines is split at the delimiter + /// character, and characters following the comments character are discarded.

+ /// + /// Notes + /// + /// References ///
/// - /// File, filename, list, or generator to read. If the filename - /// extension is gz or bz2, the file is first decompressed. Note - /// that generators must return byte strings in Python 3k. The strings - /// in a list or produced by a generator are treated as lines. + /// File, filename, list, or generator to read.

+ /// If the filename + /// extension is gz or bz2, the file is first decompressed.

+ /// Note + /// that generators must return byte strings in Python 3k.

+ /// The strings + /// in a list or produced by a generator are treated as lines. /// /// - /// Data type of the resulting array. - /// If None, the dtypes will be determined by the contents of each - /// column, individually. + /// Data type of the resulting array.

+ /// + /// If None, the dtypes will be determined by the contents of each + /// column, individually. /// /// - /// The character used to indicate the start of a comment. - /// All the characters occurring on a line after a comment are discarded + /// The character used to indicate the start of a comment.

+ /// + /// All the characters occurring on a line after a comment are discarded /// /// - /// The string used to separate values. By default, any consecutive - /// whitespaces act as delimiter. An integer or sequence of integers - /// can also be provided as width(s) of each field. + /// The string used to separate values.

+ /// By default, any consecutive + /// whitespaces act as delimiter.

+ /// An integer or sequence of integers + /// can also be provided as width(s) of each field. /// /// - /// skiprows was removed in numpy 1.10. Please use skip_header instead. + /// skiprows was removed in numpy 1.10. Please use skip_header instead. /// /// - /// The number of lines to skip at the beginning of the file. + /// The number of lines to skip at the beginning of the file. /// /// - /// The number of lines to skip at the end of the file. + /// The number of lines to skip at the end of the file. /// /// - /// The set of functions that convert the data of a column to a value. - /// The converters can also be used to provide a default value - /// for missing data: converters = {3: lambda s: float(s or 0)}. + /// The set of functions that convert the data of a column to a value.

+ /// + /// The converters can also be used to provide a default value + /// for missing data: converters = {3: lambda s: float(s or 0)}. /// /// - /// missing was removed in numpy 1.10. Please use missing_values - /// instead. + /// missing was removed in numpy 1.10. Please use missing_values + /// instead. /// /// - /// The set of strings corresponding to missing data. + /// The set of strings corresponding to missing data. /// /// - /// The set of values to be used as default when the data are missing. + /// The set of values to be used as default when the data are missing. /// /// - /// Which columns to read, with 0 being the first. For example, - /// usecols = (1, 4, 5) will extract the 2nd, 5th and 6th columns. + /// Which columns to read, with 0 being the first.

+ /// For example, + /// usecols = (1, 4, 5) will extract the 2nd, 5th and 6th columns. /// /// - /// If names is True, the field names are read from the first line after - /// the first skip_header lines. This line can optionally be proceeded - /// by a comment delimiter. If names is a sequence or a single-string of - /// comma-separated names, the names will be used to define the field names - /// in a structured dtype. If names is None, the names of the dtype - /// fields will be used, if any. + /// If names is True, the field names are read from the first line after + /// the first skip_header lines.

+ /// This line can optionally be proceeded + /// by a comment delimiter.

+ /// If names is a sequence or a single-string of + /// comma-separated names, the names will be used to define the field names + /// in a structured dtype.

+ /// If names is None, the names of the dtype + /// fields will be used, if any. /// /// - /// A list of names to exclude. This list is appended to the default list - /// [‘return’,’file’,’print’]. Excluded names are appended an underscore: - /// for example, file would become file_. + /// A list of names to exclude.

+ /// This list is appended to the default list + /// [‘return’,’file’,’print’].

+ /// Excluded names are appended an underscore: + /// for example, file would become file_. /// /// - /// A string combining invalid characters that must be deleted from the - /// names. + /// A string combining invalid characters that must be deleted from the + /// names. /// /// - /// A format used to define default field names, such as “f%i” or “f_%02i”. + /// A format used to define default field names, such as “f%i” or “f_%02i”. /// /// - /// Whether to automatically strip white spaces from the variables. + /// Whether to automatically strip white spaces from the variables. /// /// - /// Character(s) used in replacement of white spaces in the variables - /// names. By default, use a ‘_’. + /// Character(s) used in replacement of white spaces in the variables + /// names.

+ /// By default, use a ‘_’. /// /// - /// If True, field names are case sensitive. - /// If False or ‘upper’, field names are converted to upper case. - /// If ‘lower’, field names are converted to lower case. + /// If True, field names are case sensitive.

+ /// + /// If False or ‘upper’, field names are converted to upper case.

+ /// + /// If ‘lower’, field names are converted to lower case. /// /// - /// If True, the returned array is transposed, so that arguments may be - /// unpacked using x, y, z = loadtxt(...) + /// If True, the returned array is transposed, so that arguments may be + /// unpacked using x, y, z = loadtxt(...) /// /// - /// If True, return a masked array. - /// If False, return a regular array. + /// If True, return a masked array.

+ /// + /// If False, return a regular array. /// /// - /// If True, do not raise errors for invalid values. + /// If True, do not raise errors for invalid values. /// /// - /// If True, an exception is raised if an inconsistency is detected in the - /// number of columns. - /// If False, a warning is emitted and the offending lines are skipped. + /// If True, an exception is raised if an inconsistency is detected in the + /// number of columns.

+ /// + /// If False, a warning is emitted and the offending lines are skipped. /// /// - /// The maximum number of rows to read. Must not be used with skip_footer - /// at the same time. If given, the value must be at least 1. Default is - /// to read the entire file. + /// The maximum number of rows to read.

+ /// Must not be used with skip_footer + /// at the same time.

+ /// If given, the value must be at least 1.

+ /// Default is + /// to read the entire file. /// /// - /// Encoding used to decode the inputfile. Does not apply when fname is - /// a file object. The special value ‘bytes’ enables backward compatibility - /// workarounds that ensure that you receive byte arrays when possible - /// and passes latin1 encoded strings to converters. Override this value to - /// receive unicode arrays and pass strings as input to converters. If set - /// to None the system default is used. The default value is ‘bytes’. + /// Encoding used to decode the inputfile.

+ /// Does not apply when fname is + /// a file object.

+ /// The special value ‘bytes’ enables backward compatibility + /// workarounds that ensure that you receive byte arrays when possible + /// and passes latin1 encoded strings to converters.

+ /// Override this value to + /// receive unicode arrays and pass strings as input to converters.

+ /// If set + /// to None the system default is used.

+ /// The default value is ‘bytes’. /// /// - /// Data read from the text file. If usemask is True, this is a - /// masked array. + /// Data read from the text file.

+ /// If usemask is True, this is a + /// masked array. ///
- public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, char replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes") - => NumPy.Instance.genfromtxt(fname, dtype:dtype, comments:comments, delimiter:delimiter, skiprows:skiprows, skip_header:skip_header, skip_footer:skip_footer, converters:converters, missing:missing, missing_values:missing_values, filling_values:filling_values, usecols:usecols, names:names, excludelist:excludelist, deletechars:deletechars, defaultfmt:defaultfmt, autostrip:autostrip, replace_space:replace_space, case_sensitive:case_sensitive, unpack:unpack, usemask:usemask, loose:loose, invalid_raise:invalid_raise, max_rows:max_rows, encoding:encoding); + public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, string replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + fname, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (comments!=null) kwargs["comments"]=ToPython(comments); + if (delimiter!=null) kwargs["delimiter"]=ToPython(delimiter); + if (skiprows!=null) kwargs["skiprows"]=ToPython(skiprows); + if (skip_header!=0) kwargs["skip_header"]=ToPython(skip_header); + if (skip_footer!=0) kwargs["skip_footer"]=ToPython(skip_footer); + if (converters!=null) kwargs["converters"]=ToPython(converters); + if (missing!=null) kwargs["missing"]=ToPython(missing); + if (missing_values!=null) kwargs["missing_values"]=ToPython(missing_values); + if (filling_values!=null) kwargs["filling_values"]=ToPython(filling_values); + if (usecols!=null) kwargs["usecols"]=ToPython(usecols); + if (names!=null) kwargs["names"]=ToPython(names); + if (excludelist!=null) kwargs["excludelist"]=ToPython(excludelist); + if (deletechars!=null) kwargs["deletechars"]=ToPython(deletechars); + if (defaultfmt!="f%i") kwargs["defaultfmt"]=ToPython(defaultfmt); + if (autostrip!=false) kwargs["autostrip"]=ToPython(autostrip); + if (replace_space!="_") kwargs["replace_space"]=ToPython(replace_space); + if (case_sensitive!=true) kwargs["case_sensitive"]=ToPython(case_sensitive); + if (unpack!=null) kwargs["unpack"]=ToPython(unpack); + if (usemask!=false) kwargs["usemask"]=ToPython(usemask); + if (loose!=true) kwargs["loose"]=ToPython(loose); + if (invalid_raise!=true) kwargs["invalid_raise"]=ToPython(invalid_raise); + if (max_rows!=null) kwargs["max_rows"]=ToPython(max_rows); + if (encoding!="bytes") kwargs["encoding"]=ToPython(encoding); + dynamic py = __self__.InvokeMethod("genfromtxt", pyargs, kwargs); + return ToCsharp(py); + } */ /// - /// Construct an array from a text file, using regular expression parsing. - /// - /// The returned array is always a structured array, and is constructed from - /// all matches of the regular expression in the file. Groups in the regular - /// expression are converted to fields of the structured array. - /// - /// Notes - /// - /// Dtypes for structured arrays can be specified in several forms, but all - /// forms specify at least the data type and field name. For details see - /// doc.structured_arrays. + /// Construct an array from a text file, using regular expression parsing.

+ /// + /// The returned array is always a structured array, and is constructed from + /// all matches of the regular expression in the file.

+ /// Groups in the regular + /// expression are converted to fields of the structured array.

+ /// + /// Notes + /// + /// Dtypes for structured arrays can be specified in several forms, but all + /// forms specify at least the data type and field name.

+ /// For details see + /// doc.structured_arrays. ///
/// - /// File name or file object to read. + /// File name or file object to read. /// /// - /// Regular expression used to parse the file. - /// Groups in the regular expression correspond to fields in the dtype. + /// Regular expression used to parse the file.

+ /// + /// Groups in the regular expression correspond to fields in the dtype. /// /// - /// Dtype for the structured array. + /// Dtype for the structured array. /// /// - /// Encoding used to decode the inputfile. Does not apply to input streams. + /// Encoding used to decode the inputfile.

+ /// Does not apply to input streams. /// /// - /// The output array, containing the part of the content of file that - /// was matched by regexp. output is always a structured array. + /// The output array, containing the part of the content of file that + /// was matched by regexp.

+ /// output is always a structured array. ///
public static NDarray fromregex(string file, string regexp, Dtype dtype, string encoding = null) - => NumPy.Instance.fromregex(file, regexp, dtype, encoding:encoding); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + file, + regexp, + dtype, + }); + var kwargs=new PyDict(); + if (encoding!=null) kwargs["encoding"]=ToPython(encoding); + dynamic py = __self__.InvokeMethod("fromregex", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Write array to a file as text or binary (default). - /// - /// Data is always written in ‘C’ order, independent of the order of a. - /// The data produced by this method can be recovered using the function - /// fromfile(). - /// - /// Notes - /// - /// This is a convenience function for quick storage of array data. - /// Information on endianness and precision is lost, so this method is not a - /// good choice for files intended to archive data or transport data between - /// machines with different endianness. Some of these problems can be overcome - /// by outputting the data as text files, at the expense of speed and file - /// size. - /// - /// When fid is a file object, array contents are directly written to the - /// file, bypassing the file object’s write method. As a result, tofile - /// cannot be used with files objects supporting compression (e.g., GzipFile) - /// or file-like objects that do not support fileno() (e.g., BytesIO). + /// Write array to a file as text or binary (default).

+ /// + /// Data is always written in ‘C’ order, independent of the order of a.

+ /// + /// The data produced by this method can be recovered using the function + /// fromfile().

+ /// + /// Notes + /// + /// This is a convenience function for quick storage of array data.

+ /// + /// Information on endianness and precision is lost, so this method is not a + /// good choice for files intended to archive data or transport data between + /// machines with different endianness.

+ /// Some of these problems can be overcome + /// by outputting the data as text files, at the expense of speed and file + /// size.

+ /// + /// When fid is a file object, array contents are directly written to the + /// file, bypassing the file object’s write method.

+ /// As a result, tofile + /// cannot be used with files objects supporting compression (e.g., GzipFile) + /// or file-like objects that do not support fileno() (e.g., BytesIO). ///
/// - /// An open file object, or a string containing a filename. + /// An open file object, or a string containing a filename. /// /// - /// Separator between array items for text output. - /// If “” (empty), a binary file is written, equivalent to - /// file.write(a.tobytes()). + /// Separator between array items for text output.

+ /// + /// If “” (empty), a binary file is written, equivalent to + /// file.write(a.tobytes()). /// /// - /// Format string for text file output. - /// Each entry in the array is formatted to text by first converting - /// it to the closest Python type, and then using “format” % item. + /// Format string for text file output.

+ /// + /// Each entry in the array is formatted to text by first converting + /// it to the closest Python type, and then using “format” % item. /// public static void tofile(string fid, string sep, string format) - => NumPy.Instance.tofile(fid, sep, format); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + fid, + sep, + format, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("tofile", pyargs, kwargs); + } /* /// - /// Return the array as a (possibly nested) list. - /// - /// Return a copy of the array data as a (nested) Python list. - /// Data items are converted to the nearest compatible Python type. - /// - /// Notes - /// - /// The array may be recreated, a = np.array(a.tolist()). + /// Return the array as a (possibly nested) list.

+ /// + /// Return a copy of the array data as a (nested) Python list.

+ /// + /// Data items are converted to the nearest compatible Python type.

+ /// + /// Notes + /// + /// The array may be recreated, a = np.array(a.tolist()). ///
/// - /// The possibly nested list of array elements. + /// The possibly nested list of array elements. /// public static List tolist() - => NumPy.Instance.tolist(); + { + //auto-generated code, do not change + var __self__=self; + dynamic py = __self__.InvokeMethod("tolist"); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// The maximum number of columns the string should span. Newline - /// characters splits the string appropriately after array elements. + /// 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. + /// 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. + /// Represent very small numbers as zero.

+ /// A number is “very small” if it + /// is smaller than the current printing precision. /// /// - /// Inserted between elements. + /// 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. + /// 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: + /// 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. + /// 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. + /// 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 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: + /// 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. + /// 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. + /// String representation of the array. /// - public static string array2string(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) - => NumPy.Instance.array2string(a, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small, separator:separator, prefix:prefix, suffix:suffix, formatter:formatter, threshold:threshold, edgeitems:edgeitems, sign:sign, floatmode:floatmode, legacy:legacy); + public static string array2string(this NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null, string separator = " ", string prefix = "", string suffix = "", dict of callables formatter = null, int? threshold = null, int? edgeitems = null, string sign = null, string floatmode = null, string or False legacy = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// Return the string representation of an array. /// /// - /// Input array. + /// Input array. /// /// - /// The maximum number of columns the string should span. Newline - /// characters split the string appropriately after array elements. + /// 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. + /// 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. + /// 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. + /// The string representation of an array. /// - public static string array_repr(NDarray arr, int? max_line_width = null, int? precision = null, bool? suppress_small = null) - => NumPy.Instance.array_repr(arr, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); + public static string array_repr(this NDarray arr, int? max_line_width = null, int? precision = null, bool? suppress_small = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + arr, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Inserts newlines if text is longer than max_line_width. The - /// default is, indirectly, 75. + /// 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. + /// 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 static void array_str(NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null) - => NumPy.Instance.array_str(a, max_line_width:max_line_width, precision:precision, suppress_small:suppress_small); + /// 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 static void array_str(this NDarray a, int? max_line_width = null, int? precision = null, bool? suppress_small = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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); + } /* /// - /// Format a floating-point scalar as a decimal string in positional notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. + /// Format a floating-point scalar as a decimal string in positional notation.

+ /// + /// Provides control over rounding, trimming and padding.

+ /// Uses and assumes + /// IEEE unbiased rounding.

+ /// Uses the “Dragon4” algorithm. ///
/// - /// Value to format. + /// Value to format. /// /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. + /// Maximum number of digits to print.

+ /// May be None if unique is + /// True, but must be an integer if unique is False. /// /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print out all necessary digits, otherwise digit generation - /// is cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. + /// If True, use a digit-generation strategy which gives the shortest + /// representation which uniquely identifies the floating-point number from + /// other values of the same type, by judicious rounding.

+ /// If precision + /// was omitted, print out all necessary digits, otherwise digit generation + /// is cut off after precision digits and the remaining value is rounded.

+ /// + /// If False, digits are generated as if printing an infinite-precision + /// value and stopping after precision digits, rounding the remaining + /// value. /// /// - /// If True, the cutoff of precision digits refers to the total number - /// of digits after the decimal point, including leading zeros. - /// If False, precision refers to the total number of significant - /// digits, before or after the decimal point, ignoring leading zeros. + /// If True, the cutoff of precision digits refers to the total number + /// of digits after the decimal point, including leading zeros.

+ /// + /// If False, precision refers to the total number of significant + /// digits, before or after the decimal point, ignoring leading zeros. /// /// - /// Controls post-processing trimming of trailing digits, as follows: + /// Controls post-processing trimming of trailing digits, as follows: /// /// - /// Whether to show the sign for positive values. + /// Whether to show the sign for positive values. /// /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. + /// Pad the left side of the string with whitespace until at least that + /// many characters are to the left of the decimal point. /// /// - /// Pad the right side of the string with whitespace until at least that - /// many characters are to the right of the decimal point. + /// Pad the right side of the string with whitespace until at least that + /// many characters are to the right of the decimal point. /// /// - /// The string representation of the floating point value + /// The string representation of the floating point value /// - public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null) - => NumPy.Instance.format_float_positional(x, precision:precision, unique:unique, fractional:fractional, trim:trim, sign:sign, pad_left:pad_left, pad_right:pad_right); + public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, string trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (precision!=null) kwargs["precision"]=ToPython(precision); + if (unique!=true) kwargs["unique"]=ToPython(unique); + if (fractional!=true) kwargs["fractional"]=ToPython(fractional); + if (trim!="k") kwargs["trim"]=ToPython(trim); + if (sign!=false) kwargs["sign"]=ToPython(sign); + if (pad_left!=null) kwargs["pad_left"]=ToPython(pad_left); + if (pad_right!=null) kwargs["pad_right"]=ToPython(pad_right); + dynamic py = __self__.InvokeMethod("format_float_positional", pyargs, kwargs); + return ToCsharp(py); + } */ /* /// - /// Format a floating-point scalar as a decimal string in scientific notation. - /// - /// Provides control over rounding, trimming and padding. Uses and assumes - /// IEEE unbiased rounding. Uses the “Dragon4” algorithm. + /// Format a floating-point scalar as a decimal string in scientific notation.

+ /// + /// Provides control over rounding, trimming and padding.

+ /// Uses and assumes + /// IEEE unbiased rounding.

+ /// Uses the “Dragon4” algorithm. ///
/// - /// Value to format. + /// Value to format. /// /// - /// Maximum number of digits to print. May be None if unique is - /// True, but must be an integer if unique is False. + /// Maximum number of digits to print.

+ /// May be None if unique is + /// True, but must be an integer if unique is False. /// /// - /// If True, use a digit-generation strategy which gives the shortest - /// representation which uniquely identifies the floating-point number from - /// other values of the same type, by judicious rounding. If precision - /// was omitted, print all necessary digits, otherwise digit generation is - /// cut off after precision digits and the remaining value is rounded. - /// If False, digits are generated as if printing an infinite-precision - /// value and stopping after precision digits, rounding the remaining - /// value. + /// If True, use a digit-generation strategy which gives the shortest + /// representation which uniquely identifies the floating-point number from + /// other values of the same type, by judicious rounding.

+ /// If precision + /// was omitted, print all necessary digits, otherwise digit generation is + /// cut off after precision digits and the remaining value is rounded.

+ /// + /// If False, digits are generated as if printing an infinite-precision + /// value and stopping after precision digits, rounding the remaining + /// value. /// /// - /// Controls post-processing trimming of trailing digits, as follows: + /// Controls post-processing trimming of trailing digits, as follows: /// /// - /// Whether to show the sign for positive values. + /// Whether to show the sign for positive values. /// /// - /// Pad the left side of the string with whitespace until at least that - /// many characters are to the left of the decimal point. + /// Pad the left side of the string with whitespace until at least that + /// many characters are to the left of the decimal point. /// /// - /// Pad the exponent with zeros until it contains at least this many digits. - /// If omitted, the exponent will be at least 2 digits. + /// Pad the exponent with zeros until it contains at least this many digits.

+ /// + /// If omitted, the exponent will be at least 2 digits. /// /// - /// The string representation of the floating point value + /// The string representation of the floating point value /// - public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null) - => NumPy.Instance.format_float_scientific(x, precision:precision, unique:unique, trim:trim, sign:sign, pad_left:pad_left, exp_digits:exp_digits); + public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, string trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (precision!=null) kwargs["precision"]=ToPython(precision); + if (unique!=true) kwargs["unique"]=ToPython(unique); + if (trim!="k") kwargs["trim"]=ToPython(trim); + if (sign!=false) kwargs["sign"]=ToPython(sign); + if (pad_left!=null) kwargs["pad_left"]=ToPython(pad_left); + if (exp_digits!=null) kwargs["exp_digits"]=ToPython(exp_digits); + dynamic py = __self__.InvokeMethod("format_float_scientific", pyargs, kwargs); + return ToCsharp(py); + } */ /// - /// Create a memory-map to an array stored in a binary file on disk. - /// - /// Memory-mapped files are used for accessing small segments of large files - /// on disk, without reading the entire file into memory. NumPy’s - /// memmap’s are array-like objects. This differs from Python’s mmap - /// module, which uses file-like objects. - /// - /// This subclass of ndarray has some unpleasant interactions with - /// some operations, because it doesn’t quite fit properly as a subclass. - /// An alternative to using this subclass is to create the mmap - /// object yourself, then create an ndarray with ndarray.__new__ directly, - /// passing the object created in its ‘buffer=’ parameter. - /// - /// This class may at some point be turned into a factory function - /// which returns a view into an mmap buffer. - /// - /// Delete the memmap instance to close the memmap file. - /// - /// Notes - /// - /// The memmap object can be used anywhere an ndarray is accepted. - /// Given a memmap fp, isinstance(fp, numpy.ndarray) returns - /// True. - /// - /// Memory-mapped files cannot be larger than 2GB on 32-bit systems. - /// - /// When a memmap causes a file to be created or extended beyond its - /// current size in the filesystem, the contents of the new part are - /// unspecified. On systems with POSIX filesystem semantics, the extended - /// part will be filled with zero bytes. + /// Create a memory-map to an array stored in a binary file on disk.

+ /// + /// Memory-mapped files are used for accessing small segments of large files + /// on disk, without reading the entire file into memory.

+ /// NumPy’s + /// memmap’s are array-like objects.

+ /// This differs from Python’s mmap + /// module, which uses file-like objects.

+ /// + /// This subclass of ndarray has some unpleasant interactions with + /// some operations, because it doesn’t quite fit properly as a subclass.

+ /// + /// An alternative to using this subclass is to create the mmap + /// object yourself, then create an ndarray with ndarray.__new__ directly, + /// passing the object created in its ‘buffer=’ parameter.

+ /// + /// This class may at some point be turned into a factory function + /// which returns a view into an mmap buffer.

+ /// + /// Delete the memmap instance to close the memmap file.

+ /// + /// Notes + /// + /// The memmap object can be used anywhere an ndarray is accepted.

+ /// + /// Given a memmap fp, isinstance(fp, numpy.ndarray) returns + /// True.

+ /// + /// Memory-mapped files cannot be larger than 2GB on 32-bit systems.

+ /// + /// When a memmap causes a file to be created or extended beyond its + /// current size in the filesystem, the contents of the new part are + /// unspecified.

+ /// On systems with POSIX filesystem semantics, the extended + /// part will be filled with zero bytes. ///
/// - /// The file name or file object to be used as the array data buffer. + /// The file name or file object to be used as the array data buffer. /// /// - /// The data-type used to interpret the file contents. - /// Default is uint8. + /// The data-type used to interpret the file contents.

+ /// + /// Default is uint8. /// /// - /// The file is opened in this mode: - /// - /// Default is ‘r+’. + /// The file is opened in this mode: + /// + /// Default is ‘r+’. /// /// - /// In the file, array data starts at this offset. Since offset is - /// measured in bytes, it should normally be a multiple of the byte-size - /// of dtype. When mode != 'r', even positive offsets beyond end of - /// file are valid; The file will be extended to accommodate the - /// additional data. By default, memmap will start at the beginning of - /// the file, even if filename is a file pointer fp and - /// fp.tell() != 0. + /// In the file, array data starts at this offset.

+ /// Since offset is + /// measured in bytes, it should normally be a multiple of the byte-size + /// of dtype.

+ /// When mode != 'r', even positive offsets beyond end of + /// file are valid; The file will be extended to accommodate the + /// additional data.

+ /// By default, memmap will start at the beginning of + /// the file, even if filename is a file pointer fp and + /// fp.tell() != 0. /// /// - /// The desired shape of the array. If mode == 'r' and the number - /// of remaining bytes after offset is not a multiple of the byte-size - /// of dtype, you must specify shape. By default, the returned array - /// will be 1-D with the number of elements determined by file size - /// and data-type. + /// The desired shape of the array.

+ /// If mode == 'r' and the number + /// of remaining bytes after offset is not a multiple of the byte-size + /// of dtype, you must specify shape.

+ /// By default, the returned array + /// will be 1-D with the number of elements determined by file size + /// and data-type. /// /// - /// Specify the order of the ndarray memory layout: - /// row-major, C-style or column-major, - /// Fortran-style. This only has an effect if the shape is - /// greater than 1-D. The default order is ‘C’. + /// Specify the order of the ndarray memory layout: + /// row-major, C-style or column-major, + /// Fortran-style.

+ /// This only has an effect if the shape is + /// greater than 1-D.

+ /// The default order is ‘C’. /// public static void memmap(string filename, Dtype dtype = null, string mode = null, int? offset = null, Shape shape = null, string order = null) - => NumPy.Instance.memmap(filename, dtype:dtype, mode:mode, offset:offset, shape:shape, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + filename, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (mode!=null) kwargs["mode"]=ToPython(mode); + if (offset!=null) kwargs["offset"]=ToPython(offset); + if (shape!=null) kwargs["shape"]=ToPython(shape); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("memmap", pyargs, kwargs); + } /* /// - /// Set printing options. - /// - /// These options determine the way floating point numbers, arrays and - /// other NumPy objects are displayed. - /// - /// Notes - /// - /// formatter is always reset with a call to set_printoptions. + /// Set printing options.

+ /// + /// These options determine the way floating point numbers, arrays and + /// other NumPy objects are displayed.

+ /// + /// Notes + /// + /// formatter is always reset with a call to set_printoptions. ///
/// - /// Number of digits of precision for floating point output (default 8). - /// May be None if floatmode is not fixed, to print as many digits as - /// necessary to uniquely specify the value. + /// Number of digits of precision for floating point output (default 8).

+ /// + /// May be None if floatmode is not fixed, to print as many digits as + /// necessary to uniquely specify the value. /// /// - /// Total number of array elements which trigger summarization - /// rather than full repr (default 1000). + /// Total number of array elements which trigger summarization + /// rather than full repr (default 1000). /// /// - /// Number of array items in summary at beginning and end of - /// each dimension (default 3). + /// Number of array items in summary at beginning and end of + /// each dimension (default 3). /// /// - /// The number of characters per line for the purpose of inserting - /// line breaks (default 75). + /// The number of characters per line for the purpose of inserting + /// line breaks (default 75). /// /// - /// If True, always print floating point numbers using fixed point - /// notation, in which case numbers equal to zero in the current precision - /// will print as zero. If False, then scientific notation is used when - /// absolute value of the smallest number is < 1e-4 or the ratio of the - /// maximum absolute value to the minimum is > 1e3. The default is False. + /// If True, always print floating point numbers using fixed point + /// notation, in which case numbers equal to zero in the current precision + /// will print as zero.

+ /// If False, then scientific notation is used when + /// absolute value of the smallest number is < 1e-4 or the ratio of the + /// maximum absolute value to the minimum is > 1e3. The default is False. /// /// - /// String representation of floating point not-a-number (default nan). + /// String representation of floating point not-a-number (default nan). /// /// - /// String representation of floating point infinity (default inf). + /// String representation of floating point infinity (default inf). /// /// - /// 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. (default ‘-‘) + /// 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.

+ /// (default ‘-‘) /// /// - /// 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: + /// 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: /// /// - /// Controls the interpretation of the precision option for - /// floating-point types. Can take the following 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. + /// 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. /// public static void set_printoptions(int? precision = null, int? threshold = null, int? edgeitems = null, int? linewidth = null, bool? suppress = null, string nanstr = null, string infstr = null, string sign = null, dict of callables formatter = null, string floatmode = null, string or False legacy = null) - => NumPy.Instance.set_printoptions(precision:precision, threshold:threshold, edgeitems:edgeitems, linewidth:linewidth, suppress:suppress, nanstr:nanstr, infstr:infstr, sign:sign, formatter:formatter, floatmode:floatmode, legacy:legacy); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (precision!=null) kwargs["precision"]=ToPython(precision); + if (threshold!=null) kwargs["threshold"]=ToPython(threshold); + if (edgeitems!=null) kwargs["edgeitems"]=ToPython(edgeitems); + if (linewidth!=null) kwargs["linewidth"]=ToPython(linewidth); + if (suppress!=null) kwargs["suppress"]=ToPython(suppress); + if (nanstr!=null) kwargs["nanstr"]=ToPython(nanstr); + if (infstr!=null) kwargs["infstr"]=ToPython(infstr); + if (sign!=null) kwargs["sign"]=ToPython(sign); + if (formatter!=null) kwargs["formatter"]=ToPython(formatter); + if (floatmode!=null) kwargs["floatmode"]=ToPython(floatmode); + if (legacy!=null) kwargs["legacy"]=ToPython(legacy); + dynamic py = __self__.InvokeMethod("set_printoptions", pyargs, kwargs); + } */ /// - /// Return the current print options. + /// Return the current print options. /// /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. + /// Dictionary of current print options with keys + /// + /// For a full description of these options, see set_printoptions. /// /// - /// Dictionary of current print options with keys - /// - /// For a full description of these options, see set_printoptions. + /// Dictionary of current print options with keys + /// + /// For a full description of these options, see set_printoptions. /// public static Hashtable get_printoptions(Hashtable print_opts) - => NumPy.Instance.get_printoptions(print_opts); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + print_opts, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("get_printoptions", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// Set a Python function to be used when pretty printing arrays. + /// Set a Python function to be used when pretty printing arrays. /// /// - /// Function to be used to pretty print arrays. The function should expect - /// a single array argument and return a string of the representation of - /// the array. If None, the function is reset to the default NumPy function - /// to print arrays. + /// Function to be used to pretty print arrays.

+ /// The function should expect + /// a single array argument and return a string of the representation of + /// the array.

+ /// If None, the function is reset to the default NumPy function + /// to print arrays. /// /// - /// If True (default), the function for pretty printing (__repr__) - /// is set, if False the function that returns the default string - /// representation (__str__) is set. + /// If True (default), the function for pretty printing (__repr__) + /// is set, if False the function that returns the default string + /// representation (__str__) is set. /// public static void set_string_function(function or None f, bool? repr = true) - => NumPy.Instance.set_string_function(f, repr:repr); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + f, + }); + var kwargs=new PyDict(); + if (repr!=true) kwargs["repr"]=ToPython(repr); + dynamic py = __self__.InvokeMethod("set_string_function", pyargs, kwargs); + } */ /// - /// Return a string representation of a number in the given base system. + /// Return a string representation of a number in the given base system. /// /// - /// The value to convert. Positive and negative values are handled. + /// The value to convert.

+ /// Positive and negative values are handled. /// - /// - /// Convert number to the base number system. The valid range is 2-36, - /// the default value is 2. + /// + /// Convert number to the base number system.

+ /// The valid range is 2-36, + /// the default value is 2. /// /// - /// Number of zeros padded on the left. Default is 0 (no padding). + /// Number of zeros padded on the left.

+ /// Default is 0 (no padding). /// /// - /// String representation of number in base system. + /// String representation of number in base system. /// public static string base_repr(int number, int? @base = 2, int? padding = 0) - => NumPy.Instance.base_repr(number, @base:@base, padding:padding); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + number, + }); + var kwargs=new PyDict(); + if (@base!=2) kwargs["base"]=ToPython(@base); + if (padding!=0) kwargs["padding"]=ToPython(padding); + dynamic py = __self__.InvokeMethod("base_repr", pyargs, kwargs); + return ToCsharp(py); + } /// - /// A generic data source file (file, http, ftp, …). - /// - /// DataSources can be local files or remote files/URLs. The files may - /// also be compressed or uncompressed. DataSource hides some of the - /// low-level details of downloading the file, allowing you to simply pass - /// in a valid file path (or URL) and obtain a file object. - /// - /// Notes - /// - /// URLs require a scheme string (http://) to be used, without it they - /// will fail: - /// - /// Temporary directories are deleted when the DataSource is deleted. + /// A generic data source file (file, http, ftp, …).

+ /// + /// DataSources can be local files or remote files/URLs.

+ /// The files may + /// also be compressed or uncompressed.

+ /// DataSource hides some of the + /// low-level details of downloading the file, allowing you to simply pass + /// in a valid file path (or URL) and obtain a file object.

+ /// + /// Notes + /// + /// URLs require a scheme string (http://) to be used, without it they + /// will fail: + /// + /// Temporary directories are deleted when the DataSource is deleted. ///
/// - /// Path to the directory where the source file gets downloaded to for - /// use. If destpath is None, a temporary directory will be created. - /// The default path is the current directory. + /// Path to the directory where the source file gets downloaded to for + /// use.

+ /// If destpath is None, a temporary directory will be created.

+ /// + /// The default path is the current directory. /// public static void DataSource(string destpath = null) - => NumPy.Instance.DataSource(destpath:destpath); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (destpath!=null) kwargs["destpath"]=ToPython(destpath); + dynamic py = __self__.InvokeMethod("DataSource", pyargs, kwargs); + } } diff --git a/src/Numpy/np.linalg.gen.cs b/src/Numpy/np.linalg.gen.cs index e37ae11..61256b6 100644 --- a/src/Numpy/np.linalg.gen.cs +++ b/src/Numpy/np.linalg.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,736 +20,794 @@ public static partial class np { /// - /// Dot product of two arrays. Specifically, + /// Dot product of two arrays.

+ /// Specifically, ///
/// - /// First argument. + /// First argument. /// /// - /// Second argument. + /// 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. + /// + /// 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. + /// 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 static NDarray dot(NDarray a, NDarray b, NDarray @out = null) - => NumPy.Instance.dot(a, b, @out:@out); + public static NDarray dot(this NDarray a, NDarray b, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + b, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("dot", pyargs, kwargs); + return ToCsharp(py); + } public static partial class linalg { /// - /// Compute the dot product of two or more arrays in a single function call, - /// while automatically selecting the fastest evaluation order. - /// - /// multi_dot chains numpy.dot and uses optimal parenthesization - /// of the matrices [1] [2]. Depending on the shapes of the matrices, - /// this can speed up the multiplication a lot. - /// - /// If the first argument is 1-D it is treated as a row vector. - /// If the last argument is 1-D it is treated as a column vector. - /// The other arguments must be 2-D. - /// - /// Think of multi_dot as: - /// - /// Notes - /// - /// The cost for a matrix multiplication can be calculated with the - /// following function: - /// - /// Let’s assume we have three matrices - /// . - /// - /// The costs for the two different parenthesizations are as follows: - /// - /// References + /// Compute the dot product of two or more arrays in a single function call, + /// while automatically selecting the fastest evaluation order.

+ /// + /// multi_dot chains numpy.dot and uses optimal parenthesization + /// of the matrices [1] [2].

+ /// Depending on the shapes of the matrices, + /// this can speed up the multiplication a lot.

+ /// + /// If the first argument is 1-D it is treated as a row vector.

+ /// + /// If the last argument is 1-D it is treated as a column vector.

+ /// + /// The other arguments must be 2-D.

+ /// + /// Think of multi_dot as: + /// + /// Notes + /// + /// The cost for a matrix multiplication can be calculated with the + /// following function: + /// + /// Let’s assume we have three matrices + /// . + /// + /// The costs for the two different parenthesizations are as follows: + /// + /// References ///
/// - /// If the first argument is 1-D it is treated as row vector. - /// If the last argument is 1-D it is treated as column vector. - /// The other arguments must be 2-D. + /// If the first argument is 1-D it is treated as row vector.

+ /// + /// If the last argument is 1-D it is treated as column vector.

+ /// + /// The other arguments must be 2-D. /// /// - /// Returns the dot product of the supplied arrays. + /// Returns the dot product of the supplied arrays. /// - public static NDarray multi_dot(NDarray[] arrays) - => NumPy.Instance.linalg_multi_dot(arrays); + public static NDarray multi_dot(params NDarray[] arrays) + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + arrays, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("multi_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. + /// 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. ///
/// - /// If a is complex the complex conjugate is taken before calculation - /// of the dot product. + /// If a is complex the complex conjugate is taken before calculation + /// of the dot product. /// /// - /// Second argument to the dot product. + /// 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. + /// Dot product of a and b.

+ /// Can be an int, float, or + /// complex depending on the types of a and b. ///
- public static NDarray vdot(NDarray a, NDarray b) - => NumPy.Instance.vdot(a, b); + public static NDarray vdot(this NDarray a, NDarray b) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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: + /// 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. + /// If a and b are nonscalar, their last dimensions must match. /// /// - /// If a and b are nonscalar, their last dimensions must match. + /// If a and b are nonscalar, their last dimensions must match. /// /// - /// out.shape = a.shape[:-1] + b.shape[:-1] + /// out.shape = a.shape[:-1] + b.shape[:-1] /// - public static NDarray inner(NDarray b, NDarray a) - => NumPy.Instance.inner(b, a); + public static NDarray inner(this NDarray b, NDarray a) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + b, + 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 + /// 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 ///
/// - /// First input vector. Input is flattened if - /// not already 1-dimensional. + /// First input vector.

+ /// Input is flattened if + /// not already 1-dimensional. /// /// - /// Second input vector. Input is flattened if - /// not already 1-dimensional. + /// Second input vector.

+ /// Input is flattened if + /// not already 1-dimensional. /// - /// - /// A location where the result is stored + /// + /// A location where the result is stored /// /// - /// out[i, j] = a[i] * b[j] + /// out[i, j] = a[i] * b[j] /// - public static NDarray outer(NDarray a, NDarray b, NDarray @out = null) - => NumPy.Instance.outer(a, b, @out:@out); + public static NDarray outer(this NDarray a, NDarray b, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. + /// Input arrays, scalars not allowed. /// /// - /// Input arrays, scalars not allowed. + /// 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. + /// + /// 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. + /// The matrix product of the inputs.

+ /// + /// This is a scalar only when both x1, x2 are 1-d vectors. ///
- public static NDarray matmul(NDarray x2, NDarray x1, NDarray @out = null) - => NumPy.Instance.matmul(x2, x1, @out:@out); + public static NDarray matmul(this NDarray x2, NDarray x1, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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”. + /// Tensors to “dot”. /// /// - /// Tensors to “dot”. - /// - public static NDarray tensordot(NDarray b, NDarray a, int[] axes = null) - => NumPy.Instance.tensordot(b, a, axes); - - /// - /// 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’. + /// Tensors to “dot”. /// - /// - /// 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) - => NumPy.Instance.einsum(subscripts, operands, @out:@out, dtype:dtype, order:order, casting:casting, optimize:optimize); + public static NDarray tensordot(this NDarray b, NDarray a, int[] axes = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + b, + a, + }); + var kwargs=new PyDict(); + if (axes!=null) kwargs["axes"]=ToPython(axes); + dynamic py = __self__.InvokeMethod("tensordot", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// Evaluates the lowest cost contraction order for an einsum expression by - /// considering the creation of intermediate arrays. - /// - /// Notes - /// - /// The resulting path indicates which terms of the input contraction should be - /// contracted first, the result of this contraction is then appended to the - /// end of the contraction list. This list can then be iterated over until all - /// intermediate contractions are complete. + /// Evaluates the lowest cost contraction order for an einsum expression by + /// considering the creation of intermediate arrays.

+ /// + /// Notes + /// + /// The resulting path indicates which terms of the input contraction should be + /// contracted first, the result of this contraction is then appended to the + /// end of the contraction list.

+ /// This list can then be iterated over until all + /// intermediate contractions are complete. ///
/// - /// Specifies the subscripts for summation. + /// Specifies the subscripts for summation. /// /// - /// These are the arrays for the operation. + /// These are the arrays for the operation. /// /// - /// Choose the type of path. If a tuple is provided, the second argument is - /// assumed to be the maximum intermediate size created. If only a single - /// argument is provided the largest input or output array size is used - /// as a maximum intermediate size. - /// - /// Default is ‘greedy’. + /// Choose the type of path.

+ /// If a tuple is provided, the second argument is + /// assumed to be the maximum intermediate size created.

+ /// If only a single + /// argument is provided the largest input or output array size is used + /// as a maximum intermediate size.

+ /// + /// Default is ‘greedy’. /// /// /// A tuple of: /// path - /// A list representation of the einsum path. + /// A list representation of the einsum path. /// string_repr - /// A printable representation of the einsum path. + /// A printable representation of the einsum path. /// - public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, {bool optimize = "greedy") - => NumPy.Instance.einsum_path(subscripts, operands, optimize); + public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, string optimize = "greedy") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + subscripts, + operands, + }); + var kwargs=new PyDict(); + if (optimize!="greedy") kwargs["optimize"]=ToPython(optimize); + dynamic py = __self__.InvokeMethod("einsum_path", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } */ public static partial class linalg { /// - /// Raise a square matrix to the (integer) power n. - /// - /// For positive integers n, the power is computed by repeated matrix - /// squarings and matrix multiplications. If n == 0, the identity matrix - /// of the same shape as M is returned. If n < 0, the inverse - /// is computed and then raised to the abs(n). + /// Raise a square matrix to the (integer) power n.

+ /// + /// For positive integers n, the power is computed by repeated matrix + /// squarings and matrix multiplications.

+ /// If n == 0, the identity matrix + /// of the same shape as M is returned.

+ /// If n < 0, the inverse + /// is computed and then raised to the abs(n). ///
/// - /// Matrix to be “powered.” + /// Matrix to be “powered.” /// /// - /// The exponent can be any integer or long integer, positive, - /// negative, or zero. + /// The exponent can be any integer or long integer, positive, + /// negative, or zero. /// /// - /// The return value is the same shape and type as M; - /// if the exponent is positive or zero then the type of the - /// elements is the same as those of M. If the exponent is - /// negative the elements are floating-point. + /// The return value is the same shape and type as M; + /// if the exponent is positive or zero then the type of the + /// elements is the same as those of M.

+ /// If the exponent is + /// negative the elements are floating-point. ///
public static NDarray matrix_power(NDarray a, int n) - => NumPy.Instance.linalg_matrix_power(a, n); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + n, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("matrix_power", 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: + /// 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 static NDarray kron(NDarray b, NDarray a) - => NumPy.Instance.kron(b, a); - - public static partial class linalg { - /// - /// 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") - => NumPy.Instance.linalg_qr(a, mode:mode); + public static NDarray kron(this NDarray b, NDarray a) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + b, + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("kron", pyargs, kwargs); + return ToCsharp(py); } /* public static partial class linalg { /// - /// Compute the condition number of a matrix. - /// - /// This function is capable of returning the condition number using - /// one of seven different norms, depending on the value of p (see - /// Parameters below). - /// - /// Notes - /// - /// The condition number of x is defined as the norm of x times the - /// norm of the inverse of x [1]; the norm can be the usual L2-norm - /// (root-of-sum-of-squares) or one of a number of other matrix norms. - /// - /// References + /// Compute the condition number of a matrix.

+ /// + /// This function is capable of returning the condition number using + /// one of seven different norms, depending on the value of p (see + /// Parameters below).

+ /// + /// Notes + /// + /// The condition number of x is defined as the norm of x times the + /// norm of the inverse of x [1]; the norm can be the usual L2-norm + /// (root-of-sum-of-squares) or one of a number of other matrix norms.

+ /// + /// References ///
/// - /// The matrix whose condition number is sought. + /// The matrix whose condition number is sought. /// /// - /// Order of the norm: - /// - /// inf means the numpy.inf object, and the Frobenius norm is - /// the root-of-sum-of-squares norm. + /// Order of the norm: + /// + /// inf means the numpy.inf object, and the Frobenius norm is + /// the root-of-sum-of-squares norm. /// /// - /// The condition number of the matrix. May be infinite. + /// The condition number of the matrix.

+ /// May be infinite. ///
public static {float cond(NDarray x, {None p = null) - => NumPy.Instance.linalg_cond(x, p:p); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (p!=null) kwargs["p"]=ToPython(p); + dynamic py = __self__.InvokeMethod("cond", pyargs, kwargs); + return ToCsharp<{float>(py); + } } */ public static partial class linalg { /// - /// Return matrix rank of array using SVD method - /// - /// Rank of the array is the number of singular values of the array that are - /// greater than tol. - /// - /// Notes - /// - /// The default threshold to detect rank deficiency is a test on the magnitude - /// of the singular values of M. By default, we identify singular values less - /// than S.max() * max(M.shape) * eps as indicating rank deficiency (with - /// the symbols defined above). This is the algorithm MATLAB uses [1]. It also - /// appears in Numerical recipes in the discussion of SVD solutions for linear - /// least squares [2]. - /// - /// This default threshold is designed to detect rank deficiency accounting for - /// the numerical errors of the SVD computation. Imagine that there is a column - /// in M that is an exact (in floating point) linear combination of other - /// columns in M. Computing the SVD on M will not produce a singular value - /// exactly equal to 0 in general: any difference of the smallest SVD value from - /// 0 will be caused by numerical imprecision in the calculation of the SVD. - /// Our threshold for small SVD values takes this numerical imprecision into - /// account, and the default threshold will detect such numerical rank - /// deficiency. The threshold may declare a matrix M rank deficient even if - /// the linear combination of some columns of M is not exactly equal to - /// another column of M but only numerically very close to another column of - /// M. - /// - /// We chose our default threshold because it is in wide use. Other thresholds - /// are possible. For example, elsewhere in the 2007 edition of Numerical - /// recipes there is an alternative threshold of S.max() * - /// np.finfo(M.dtype).eps / 2. * np.sqrt(m + n + 1.). The authors describe - /// this threshold as being based on “expected roundoff error” (p 71). - /// - /// The thresholds above deal with floating point roundoff error in the - /// calculation of the SVD. However, you may have more information about the - /// sources of error in M that would make you consider other tolerance values - /// to detect effective rank deficiency. The most useful measure of the - /// tolerance depends on the operations you intend to use on your matrix. For - /// example, if your data come from uncertain measurements with uncertainties - /// greater than floating point epsilon, choosing a tolerance near that - /// uncertainty may be preferable. The tolerance may be absolute if the - /// uncertainties are absolute rather than relative. - /// - /// References + /// Return matrix rank of array using SVD method + /// + /// Rank of the array is the number of singular values of the array that are + /// greater than tol.

+ /// + /// Notes + /// + /// The default threshold to detect rank deficiency is a test on the magnitude + /// of the singular values of M.

+ /// By default, we identify singular values less + /// than S.max() * max(M.shape) * eps as indicating rank deficiency (with + /// the symbols defined above).

+ /// This is the algorithm MATLAB uses [1].

+ /// It also + /// appears in Numerical recipes in the discussion of SVD solutions for linear + /// least squares [2].

+ /// + /// This default threshold is designed to detect rank deficiency accounting for + /// the numerical errors of the SVD computation.

+ /// Imagine that there is a column + /// in M that is an exact (in floating point) linear combination of other + /// columns in M.

+ /// Computing the SVD on M will not produce a singular value + /// exactly equal to 0 in general: any difference of the smallest SVD value from + /// 0 will be caused by numerical imprecision in the calculation of the SVD.

+ /// + /// Our threshold for small SVD values takes this numerical imprecision into + /// account, and the default threshold will detect such numerical rank + /// deficiency.

+ /// The threshold may declare a matrix M rank deficient even if + /// the linear combination of some columns of M is not exactly equal to + /// another column of M but only numerically very close to another column of + /// M.

+ /// + /// We chose our default threshold because it is in wide use.

+ /// Other thresholds + /// are possible.

+ /// For example, elsewhere in the 2007 edition of Numerical + /// recipes there is an alternative threshold of S.max() * + /// np.finfo(M.dtype).eps / 2.

+ /// * np.sqrt(m + n + 1.).

+ /// The authors describe + /// this threshold as being based on “expected roundoff error” (p 71).

+ /// + /// The thresholds above deal with floating point roundoff error in the + /// calculation of the SVD.

+ /// However, you may have more information about the + /// sources of error in M that would make you consider other tolerance values + /// to detect effective rank deficiency.

+ /// The most useful measure of the + /// tolerance depends on the operations you intend to use on your matrix.

+ /// For + /// example, if your data come from uncertain measurements with uncertainties + /// greater than floating point epsilon, choosing a tolerance near that + /// uncertainty may be preferable.

+ /// The tolerance may be absolute if the + /// uncertainties are absolute rather than relative.

+ /// + /// References ///
/// - /// input vector or stack of matrices + /// input vector or stack of matrices /// /// - /// threshold below which SVD values are considered zero. If tol is - /// None, and S is an array with singular values for M, and - /// eps is the epsilon value for datatype of S, then tol is - /// set to S.max() * max(M.shape) * eps. + /// threshold below which SVD values are considered zero.

+ /// If tol is + /// None, and S is an array with singular values for M, and + /// eps is the epsilon value for datatype of S, then tol is + /// set to S.max() * max(M.shape) * eps. /// /// - /// If True, M is assumed to be Hermitian (symmetric if real-valued), - /// enabling a more efficient method for finding singular values. - /// Defaults to False. + /// If True, M is assumed to be Hermitian (symmetric if real-valued), + /// enabling a more efficient method for finding singular values.

+ /// + /// Defaults to False. /// public static int matrix_rank(NDarray M, NDarray tol = null, bool? hermitian = false) - => NumPy.Instance.linalg_matrix_rank(M, tol:tol, hermitian:hermitian); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + M, + }); + var kwargs=new PyDict(); + if (tol!=null) kwargs["tol"]=ToPython(tol); + if (hermitian!=false) kwargs["hermitian"]=ToPython(hermitian); + dynamic py = __self__.InvokeMethod("matrix_rank", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Compute the sign and (natural) logarithm of the determinant of an array. - /// - /// If an array has a very small or very large determinant, then a call to - /// det may overflow or underflow. This routine is more robust against such - /// issues, because it computes the logarithm of the determinant rather than - /// the determinant itself. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. + /// Compute the sign and (natural) logarithm of the determinant of an array.

+ /// + /// If an array has a very small or very large determinant, then a call to + /// det may overflow or underflow.

+ /// This routine is more robust against such + /// issues, because it computes the logarithm of the determinant rather than + /// the determinant itself.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// The determinant is computed via LU factorization using the LAPACK + /// routine z/dgetrf. ///
/// - /// Input array, has to be a square 2-D array. + /// Input array, has to be a square 2-D array. /// /// /// A tuple of: /// sign - /// A number representing the sign of the determinant. For a real matrix, - /// this is 1, 0, or -1. For a complex matrix, this is a complex number - /// with absolute value 1 (i.e., it is on the unit circle), or else 0. + /// A number representing the sign of the determinant. For a real matrix, + /// this is 1, 0, or -1. For a complex matrix, this is a complex number + /// with absolute value 1 (i.e., it is on the unit circle), or else 0. /// logdet - /// The natural log of the absolute value of the determinant. + /// The natural log of the absolute value of the determinant. /// public static (NDarray, NDarray) slogdet(NDarray a) - => NumPy.Instance.linalg_slogdet(a); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("slogdet", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } } /// - /// 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. + /// 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. ///
/// - /// Input array, from which the diagonals are taken. + /// Input array, from which the diagonals are taken. /// /// - /// Offset of the diagonal from the main diagonal. Can be both positive - /// and negative. Defaults to 0. + /// 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. /// /// - /// 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. + /// 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. + /// + /// 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. + /// 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 static NDarray trace(NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.trace(a, offset:offset, axis2:axis2, axis1:axis1, dtype:dtype, @out:@out); + public static NDarray trace(this NDarray a, int? offset = 0, int? axis2 = null, int? axis1 = null, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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); + } public static partial class linalg { /// - /// Solve the tensor equation a x = b for x. - /// - /// It is assumed that all indices of x are summed over in the product, - /// together with the rightmost indices of a, as is done in, for example, - /// tensordot(a, x, axes=b.ndim). + /// Solve the tensor equation a x = b for x.

+ /// + /// It is assumed that all indices of x are summed over in the product, + /// together with the rightmost indices of a, as is done in, for example, + /// tensordot(a, x, axes=b.ndim). ///
/// - /// Coefficient tensor, of shape b.shape + Q. Q, a tuple, equals - /// the shape of that sub-tensor of a consisting of the appropriate - /// number of its rightmost indices, and must be such that - /// prod(Q) == prod(b.shape) (in which sense a is said to be - /// ‘square’). + /// Coefficient tensor, of shape b.shape + Q.

+ /// Q, a tuple, equals + /// the shape of that sub-tensor of a consisting of the appropriate + /// number of its rightmost indices, and must be such that + /// prod(Q) == prod(b.shape) (in which sense a is said to be + /// ‘square’). /// /// - /// Right-hand tensor, which can be of any shape. + /// Right-hand tensor, which can be of any shape. /// /// - /// Axes in a to reorder to the right, before inversion. - /// If None (default), no reordering is done. + /// Axes in a to reorder to the right, before inversion.

+ /// + /// If None (default), no reordering is done. /// public static NDarray tensorsolve(NDarray a, NDarray b, int[] axes = null) - => NumPy.Instance.linalg_tensorsolve(a, b, axes:axes); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + b, + }); + var kwargs=new PyDict(); + if (axes!=null) kwargs["axes"]=ToPython(axes); + dynamic py = __self__.InvokeMethod("tensorsolve", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Compute the ‘inverse’ of an N-dimensional array. - /// - /// The result is an inverse for a relative to the tensordot operation - /// tensordot(a, b, ind), i. e., up to floating-point accuracy, - /// tensordot(tensorinv(a), a, ind) is the “identity” tensor for the - /// tensordot operation. + /// Compute the ‘inverse’ of an N-dimensional array.

+ /// + /// The result is an inverse for a relative to the tensordot operation + /// tensordot(a, b, ind), i.

+ /// e., up to floating-point accuracy, + /// tensordot(tensorinv(a), a, ind) is the “identity” tensor for the + /// tensordot operation. ///
/// - /// Tensor to ‘invert’. Its shape must be ‘square’, i. e., - /// prod(a.shape[:ind]) == prod(a.shape[ind:]). + /// Tensor to ‘invert’. Its shape must be ‘square’, i.

+ /// e., + /// prod(a.shape[:ind]) == prod(a.shape[ind:]). /// /// - /// Number of first indices that are involved in the inverse sum. - /// Must be a positive integer, default is 2. + /// Number of first indices that are involved in the inverse sum.

+ /// + /// Must be a positive integer, default is 2. /// /// - /// a’s tensordot inverse, shape a.shape[ind:] + a.shape[:ind]. + /// a’s tensordot inverse, shape a.shape[ind:] + a.shape[:ind]. /// public static NDarray tensorinv(NDarray a, int? ind = 2) - => NumPy.Instance.linalg_tensorinv(a, ind:ind); + { + //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 (ind!=2) kwargs["ind"]=ToPython(ind); + dynamic py = __self__.InvokeMethod("tensorinv", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Generic Python-exception-derived object raised by linalg functions. - /// - /// General purpose exception class, derived from Python’s exception.Exception - /// class, programmatically raised in linalg functions when a Linear - /// Algebra-related condition would prevent further correct execution of the - /// function. + /// Generic Python-exception-derived object raised by linalg functions.

+ /// + /// General purpose exception class, derived from Python’s exception.Exception + /// class, programmatically raised in linalg functions when a Linear + /// Algebra-related condition would prevent further correct execution of the + /// function. ///
public static void LinAlgError() - => NumPy.Instance.linalg_LinAlgError(); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + dynamic py = __self__.InvokeMethod("LinAlgError"); + } } diff --git a/src/Numpy/np.linalg_fft.gen.cs b/src/Numpy/np.linalg_fft.gen.cs index 904b968..d4d0676 100644 --- a/src/Numpy/np.linalg_fft.gen.cs +++ b/src/Numpy/np.linalg_fft.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -19,778 +21,1092 @@ public static partial class np public static partial class linalg { /// - /// Cholesky decomposition. - /// - /// Return the Cholesky decomposition, L * L.H, of the square matrix a, - /// where L is lower-triangular and .H is the conjugate transpose operator - /// (which is the ordinary transpose if a is real-valued). a must be - /// Hermitian (symmetric if real-valued) and positive-definite. Only L is - /// actually returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The Cholesky decomposition is often used as a fast way of solving - /// - /// (when A is both Hermitian/symmetric and positive-definite). - /// - /// First, we solve for in - /// - /// and then for in + /// Cholesky decomposition.

+ /// + /// Return the Cholesky decomposition, L * L.H, of the square matrix a, + /// where L is lower-triangular and .H is the conjugate transpose operator + /// (which is the ordinary transpose if a is real-valued).

+ /// a must be + /// Hermitian (symmetric if real-valued) and positive-definite.

+ /// Only L is + /// actually returned.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// The Cholesky decomposition is often used as a fast way of solving + /// + /// (when A is both Hermitian/symmetric and positive-definite).

+ /// + /// First, we solve for in + /// + /// and then for in ///
/// - /// Hermitian (symmetric if all elements are real), positive-definite - /// input matrix. + /// Hermitian (symmetric if all elements are real), positive-definite + /// input matrix. /// /// - /// Upper or lower-triangular Cholesky factor of a. Returns a - /// matrix object if a is a matrix object. + /// Upper or lower-triangular Cholesky factor of a.

+ /// Returns a + /// matrix object if a is a matrix object. ///
public static NDarray cholesky(NDarray a) - => NumPy.Instance.linalg_cholesky(a); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("cholesky", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Compute the determinant of an array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The determinant is computed via LU factorization using the LAPACK - /// routine z/dgetrf. + /// Compute the determinant of an array.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// The determinant is computed via LU factorization using the LAPACK + /// routine z/dgetrf. ///
/// - /// Input array to compute determinants for. + /// Input array to compute determinants for. /// /// - /// Determinant of a. + /// Determinant of a. /// public static NDarray det(NDarray a) - => NumPy.Instance.linalg_det(a); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("det", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Compute the eigenvalues and right eigenvectors of a square array. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. - /// - /// The number w is an eigenvalue of a if there exists a vector - /// v such that dot(a,v) = w * v. Thus, the arrays a, w, and - /// v satisfy the equations dot(a[:,:], v[:,i]) = w[i] * v[:,i] - /// for . - /// - /// The array v of eigenvectors may not be of maximum rank, that is, some - /// of the columns may be linearly dependent, although round-off error may - /// obscure that fact. If the eigenvalues are all different, then theoretically - /// the eigenvectors are linearly independent. Likewise, the (complex-valued) - /// matrix of eigenvectors v is unitary if the matrix a is normal, i.e., - /// if dot(a, a.H) = dot(a.H, a), where a.H denotes the conjugate - /// transpose of a. - /// - /// Finally, it is emphasized that v consists of the right (as in - /// right-hand side) eigenvectors of a. A vector y satisfying - /// dot(y.T, a) = z * y.T for some number z is called a left - /// eigenvector of a, and, in general, the left and right eigenvectors - /// of a matrix are not necessarily the (perhaps conjugate) transposes - /// of each other. - /// - /// References - /// - /// G. Strang, Linear Algebra and Its Applications, 2nd Ed., Orlando, FL, - /// Academic Press, Inc., 1980, Various pp. + /// Compute the eigenvalues and right eigenvectors of a square array.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// This is implemented using the _geev LAPACK routines which compute + /// the eigenvalues and eigenvectors of general square arrays.

+ /// + /// The number w is an eigenvalue of a if there exists a vector + /// v such that dot(a,v) = w * v.

+ /// Thus, the arrays a, w, and + /// v satisfy the equations dot(a[:,:], v[:,i]) = w[i] * v[:,i] + /// for . + /// + /// The array v of eigenvectors may not be of maximum rank, that is, some + /// of the columns may be linearly dependent, although round-off error may + /// obscure that fact.

+ /// If the eigenvalues are all different, then theoretically + /// the eigenvectors are linearly independent.

+ /// Likewise, the (complex-valued) + /// matrix of eigenvectors v is unitary if the matrix a is normal, i.e., + /// if dot(a, a.H) = dot(a.H, a), where a.H denotes the conjugate + /// transpose of a.

+ /// + /// Finally, it is emphasized that v consists of the right (as in + /// right-hand side) eigenvectors of a.

+ /// A vector y satisfying + /// dot(y.T, a) = z * y.T for some number z is called a left + /// eigenvector of a, and, in general, the left and right eigenvectors + /// of a matrix are not necessarily the (perhaps conjugate) transposes + /// of each other.

+ /// + /// References + /// + /// G.

+ /// Strang, Linear Algebra and Its Applications, 2nd Ed., Orlando, FL, + /// Academic Press, Inc., 1980, Various pp. ///
/// - /// Matrices for which the eigenvalues and right eigenvectors will - /// be computed + /// Matrices for which the eigenvalues and right eigenvectors will + /// be computed /// /// /// A tuple of: /// w - /// The eigenvalues, each repeated according to its multiplicity. - /// The eigenvalues are not necessarily ordered. The resulting - /// array will be of complex type, unless the imaginary part is - /// zero in which case it will be cast to a real type. When a - /// is real the resulting eigenvalues will be real (0 imaginary - /// part) or occur in conjugate pairs + /// The eigenvalues, each repeated according to its multiplicity. + /// The eigenvalues are not necessarily ordered. The resulting + /// array will be of complex type, unless the imaginary part is + /// zero in which case it will be cast to a real type. When a + /// is real the resulting eigenvalues will be real (0 imaginary + /// part) or occur in conjugate pairs /// v - /// The normalized (unit “length”) eigenvectors, such that the - /// column v[:,i] is the eigenvector corresponding to the - /// eigenvalue w[i]. + /// The normalized (unit “length”) eigenvectors, such that the + /// column v[:,i] is the eigenvector corresponding to the + /// eigenvalue w[i]. /// public static (NDarray, NDarray) eig(NDarray a) - => NumPy.Instance.linalg_eig(a); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("eig", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } } public static partial class linalg { /// - /// Return the eigenvalues and eigenvectors of a complex Hermitian - /// (conjugate symmetric) or a real symmetric matrix. - /// - /// Returns two objects, a 1-D array containing the eigenvalues of a, and - /// a 2-D square array or matrix (depending on the input type) of the - /// corresponding eigenvectors (in columns). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues/eigenvectors are computed using LAPACK routines _syevd, - /// _heevd - /// - /// The eigenvalues of real symmetric or complex Hermitian matrices are - /// always real. [1] The array v of (column) eigenvectors is unitary - /// and a, w, and v satisfy the equations - /// dot(a, v[:, i]) = w[i] * v[:, i]. - /// - /// References + /// Return the eigenvalues and eigenvectors of a complex Hermitian + /// (conjugate symmetric) or a real symmetric matrix.

+ /// + /// Returns two objects, a 1-D array containing the eigenvalues of a, and + /// a 2-D square array or matrix (depending on the input type) of the + /// corresponding eigenvectors (in columns).

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// The eigenvalues/eigenvectors are computed using LAPACK routines _syevd, + /// _heevd + /// + /// The eigenvalues of real symmetric or complex Hermitian matrices are + /// always real.

+ /// [1] The array v of (column) eigenvectors is unitary + /// and a, w, and v satisfy the equations + /// dot(a, v[:, i]) = w[i] * v[:, i].

+ /// + /// References ///
/// - /// Hermitian or real symmetric matrices whose eigenvalues and - /// eigenvectors are to be computed. + /// Hermitian or real symmetric matrices whose eigenvalues and + /// eigenvectors are to be computed. /// /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. + /// Specifies whether the calculation is done with the lower triangular + /// part of a (‘L’, default) or the upper triangular part (‘U’).

+ /// + /// Irrespective of this value only the real parts of the diagonal will + /// be considered in the computation to preserve the notion of a Hermitian + /// matrix.

+ /// It therefore follows that the imaginary part of the diagonal + /// will always be treated as zero. /// /// /// A tuple of: /// w - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. + /// The eigenvalues in ascending order, each repeated according to + /// its multiplicity. /// v - /// The column v[:, i] is the normalized eigenvector corresponding - /// to the eigenvalue w[i]. Will return a matrix object if a is - /// a matrix object. + /// The column v[:, i] is the normalized eigenvector corresponding + /// to the eigenvalue w[i]. Will return a matrix object if a is + /// a matrix object. /// public static (NDarray, NDarray) eigh(NDarray a, string UPLO = "L") - => NumPy.Instance.linalg_eigh(a, UPLO:UPLO); + { + //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 (UPLO!="L") kwargs["UPLO"]=ToPython(UPLO); + dynamic py = __self__.InvokeMethod("eigh", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } } public static partial class linalg { /// - /// Compute the eigenvalues of a general matrix. - /// - /// Main difference between eigvals and eig: the eigenvectors aren’t - /// returned. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// This is implemented using the _geev LAPACK routines which compute - /// the eigenvalues and eigenvectors of general square arrays. + /// Compute the eigenvalues of a general matrix.

+ /// + /// Main difference between eigvals and eig: the eigenvectors aren’t + /// returned.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// This is implemented using the _geev LAPACK routines which compute + /// the eigenvalues and eigenvectors of general square arrays. ///
/// - /// A complex- or real-valued matrix whose eigenvalues will be computed. + /// A complex- or real-valued matrix whose eigenvalues will be computed. /// /// - /// The eigenvalues, each repeated according to its multiplicity. - /// They are not necessarily ordered, nor are they necessarily - /// real for real matrices. + /// The eigenvalues, each repeated according to its multiplicity.

+ /// + /// They are not necessarily ordered, nor are they necessarily + /// real for real matrices. ///
public static NDarray eigvals(NDarray a) - => NumPy.Instance.linalg_eigvals(a); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("eigvals", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Compute the eigenvalues of a complex Hermitian or real symmetric matrix. - /// - /// Main difference from eigh: the eigenvectors are not computed. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The eigenvalues are computed using LAPACK routines _syevd, _heevd + /// Compute the eigenvalues of a complex Hermitian or real symmetric matrix.

+ /// + /// Main difference from eigh: the eigenvectors are not computed.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// The eigenvalues are computed using LAPACK routines _syevd, _heevd ///
/// - /// A complex- or real-valued matrix whose eigenvalues are to be - /// computed. + /// A complex- or real-valued matrix whose eigenvalues are to be + /// computed. /// /// - /// Specifies whether the calculation is done with the lower triangular - /// part of a (‘L’, default) or the upper triangular part (‘U’). - /// Irrespective of this value only the real parts of the diagonal will - /// be considered in the computation to preserve the notion of a Hermitian - /// matrix. It therefore follows that the imaginary part of the diagonal - /// will always be treated as zero. + /// Specifies whether the calculation is done with the lower triangular + /// part of a (‘L’, default) or the upper triangular part (‘U’).

+ /// + /// Irrespective of this value only the real parts of the diagonal will + /// be considered in the computation to preserve the notion of a Hermitian + /// matrix.

+ /// It therefore follows that the imaginary part of the diagonal + /// will always be treated as zero. /// /// - /// The eigenvalues in ascending order, each repeated according to - /// its multiplicity. + /// The eigenvalues in ascending order, each repeated according to + /// its multiplicity. /// public static NDarray eigvalsh(NDarray a, string UPLO = "L") - => NumPy.Instance.linalg_eigvalsh(a, UPLO:UPLO); + { + //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 (UPLO!="L") kwargs["UPLO"]=ToPython(UPLO); + dynamic py = __self__.InvokeMethod("eigvalsh", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Compute the (multiplicative) inverse of a matrix. - /// - /// Given a square matrix a, return the matrix ainv satisfying - /// dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]). - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. + /// Compute the (multiplicative) inverse of a matrix.

+ /// + /// Given a square matrix a, return the matrix ainv satisfying + /// dot(a, ainv) = dot(ainv, a) = eye(a.shape[0]).

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details. ///
/// - /// Matrix to be inverted. + /// Matrix to be inverted. /// /// - /// (Multiplicative) inverse of the matrix a. + /// (Multiplicative) inverse of the matrix a. /// public static NDarray inv(NDarray a) - => NumPy.Instance.linalg_inv(a); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("inv", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Return the least-squares solution to a linear matrix equation. - /// - /// Solves the equation a x = b by computing a vector x that - /// minimizes the Euclidean 2-norm || b - a x ||^2. The equation may - /// be under-, well-, or over- determined (i.e., the number of - /// linearly independent rows of a can be less than, equal to, or - /// greater than its number of linearly independent columns). If a - /// is square and of full rank, then x (but for round-off error) is - /// the “exact” solution of the equation. - /// - /// Notes - /// - /// If b is a matrix, then all array results are returned as matrices. + /// Return the least-squares solution to a linear matrix equation.

+ /// + /// Solves the equation a x = b by computing a vector x that + /// minimizes the Euclidean 2-norm || b - a x ||^2. The equation may + /// be under-, well-, or over- determined (i.e., the number of + /// linearly independent rows of a can be less than, equal to, or + /// greater than its number of linearly independent columns).

+ /// If a + /// is square and of full rank, then x (but for round-off error) is + /// the “exact” solution of the equation.

+ /// + /// Notes + /// + /// If b is a matrix, then all array results are returned as matrices. ///
/// - /// “Coefficient” matrix. + /// “Coefficient” matrix. /// /// - /// Ordinate or “dependent variable” values. If b is two-dimensional, - /// the least-squares solution is calculated for each of the K columns - /// of b. + /// Ordinate or “dependent variable” values.

+ /// If b is two-dimensional, + /// the least-squares solution is calculated for each of the K columns + /// of b. /// /// - /// Cut-off ratio for small singular values of a. - /// For the purposes of rank determination, singular values are treated - /// as zero if they are smaller than rcond times the largest singular - /// value of a. + /// Cut-off ratio for small singular values of a.

+ /// + /// For the purposes of rank determination, singular values are treated + /// as zero if they are smaller than rcond times the largest singular + /// value of a. /// /// /// A tuple of: /// x - /// Least-squares solution. If b is two-dimensional, - /// the solutions are in the K columns of x. + /// Least-squares solution. If b is two-dimensional, + /// the solutions are in the K columns of x. /// residuals - /// Sums of residuals; squared Euclidean 2-norm for each column in - /// b - a*x. - /// If the rank of a is < N or M <= N, this is an empty array. - /// If b is 1-dimensional, this is a (1,) shape array. - /// Otherwise the shape is (K,). + /// Sums of residuals; squared Euclidean 2-norm for each column in + /// b - a*x. + /// If the rank of a is < N or M <= N, this is an empty array. + /// If b is 1-dimensional, this is a (1,) shape array. + /// Otherwise the shape is (K,). /// rank - /// Rank of matrix a. + /// Rank of matrix a. /// s - /// Singular values of a. + /// Singular values of a. /// public static (NDarray, NDarray, int, NDarray) lstsq(NDarray a, NDarray b, float? rcond = null) - => NumPy.Instance.linalg_lstsq(a, b, rcond:rcond); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + b, + }); + var kwargs=new PyDict(); + if (rcond!=null) kwargs["rcond"]=ToPython(rcond); + dynamic py = __self__.InvokeMethod("lstsq", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2]), ToCsharp(py[3])); + } } public static partial class linalg { /// - /// Compute the (Moore-Penrose) pseudo-inverse of a matrix. - /// - /// Calculate the generalized inverse of a matrix using its - /// singular-value decomposition (SVD) and including all - /// large singular values. - /// - /// Notes - /// - /// The pseudo-inverse of a matrix A, denoted , is - /// defined as: “the matrix that ‘solves’ [the least-squares problem] - /// ,” i.e., if is said solution, then - /// is that matrix such that . - /// - /// It can be shown that if is the singular - /// value decomposition of A, then - /// , where are - /// orthogonal matrices, is a diagonal matrix consisting - /// of A’s so-called singular values, (followed, typically, by - /// zeros), and then is simply the diagonal matrix - /// consisting of the reciprocals of A’s singular values - /// (again, followed by zeros). [1] - /// - /// References + /// Compute the (Moore-Penrose) pseudo-inverse of a matrix.

+ /// + /// Calculate the generalized inverse of a matrix using its + /// singular-value decomposition (SVD) and including all + /// large singular values.

+ /// + /// Notes + /// + /// The pseudo-inverse of a matrix A, denoted , is + /// defined as: “the matrix that ‘solves’ [the least-squares problem] + /// ,” i.e., if is said solution, then + /// is that matrix such that . + /// + /// It can be shown that if is the singular + /// value decomposition of A, then + /// , where are + /// orthogonal matrices, is a diagonal matrix consisting + /// of A’s so-called singular values, (followed, typically, by + /// zeros), and then is simply the diagonal matrix + /// consisting of the reciprocals of A’s singular values + /// (again, followed by zeros).

+ /// [1] + /// + /// References ///
/// - /// Matrix or stack of matrices to be pseudo-inverted. + /// Matrix or stack of matrices to be pseudo-inverted. /// /// - /// Cutoff for small singular values. - /// Singular values smaller (in modulus) than - /// rcond * largest_singular_value (again, in modulus) - /// are set to zero. Broadcasts against the stack of matrices + /// Cutoff for small singular values.

+ /// + /// Singular values smaller (in modulus) than + /// rcond * largest_singular_value (again, in modulus) + /// are set to zero.

+ /// Broadcasts against the stack of matrices /// /// - /// The pseudo-inverse of a. If a is a matrix instance, then so - /// is B. + /// The pseudo-inverse of a.

+ /// If a is a matrix instance, then so + /// is B. ///
public static NDarray pinv(NDarray a, float rcond = 1e-15f) - => NumPy.Instance.linalg_pinv(a, rcond); + { + //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 (rcond!=1e-15f) kwargs["rcond"]=ToPython(rcond); + dynamic py = __self__.InvokeMethod("pinv", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Solve a linear matrix equation, or system of linear scalar equations. - /// - /// Computes the “exact” solution, x, of the well-determined, i.e., full - /// rank, linear matrix equation ax = b. - /// - /// Notes - /// - /// Broadcasting rules apply, see the numpy.linalg documentation for - /// details. - /// - /// The solutions are computed using LAPACK routine _gesv - /// - /// a must be square and of full-rank, i.e., all rows (or, equivalently, - /// columns) must be linearly independent; if either is not true, use - /// lstsq for the least-squares best “solution” of the - /// system/equation. - /// - /// References + /// Solve a linear matrix equation, or system of linear scalar equations.

+ /// + /// Computes the “exact” solution, x, of the well-determined, i.e., full + /// rank, linear matrix equation ax = b.

+ /// + /// Notes + /// + /// Broadcasting rules apply, see the numpy.linalg documentation for + /// details.

+ /// + /// The solutions are computed using LAPACK routine _gesv + /// + /// a must be square and of full-rank, i.e., all rows (or, equivalently, + /// columns) must be linearly independent; if either is not true, use + /// lstsq for the least-squares best “solution” of the + /// system/equation.

+ /// + /// References ///
/// - /// Coefficient matrix. + /// Coefficient matrix. /// /// - /// Ordinate or “dependent variable” values. + /// Ordinate or “dependent variable” values. /// /// - /// Solution to the system a x = b. Returned shape is identical to b. + /// Solution to the system a x = b.

+ /// Returned shape is identical to b. ///
public static NDarray solve(NDarray a, NDarray b) - => NumPy.Instance.linalg_solve(a, b); + { + //auto-generated code, do not change + var linalg = self.GetAttr("linalg"); + var __self__=linalg; + var pyargs=ToTuple(new object[] + { + a, + b, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("solve", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class linalg { /// - /// Singular Value Decomposition. - /// - /// When a is a 2D array, it is factorized as u @ np.diag(s) @ vh - /// = (u * s) @ vh, where u and vh are 2D unitary arrays and s is a 1D - /// array of a’s singular values. When a is higher-dimensional, SVD is - /// applied in stacked mode as explained below. - /// - /// Notes - /// - /// The decomposition is performed using LAPACK routine _gesdd. - /// - /// SVD is usually described for the factorization of a 2D matrix . - /// The higher-dimensional case will be discussed below. In the 2D case, SVD is - /// written as , where , , - /// and . The 1D array s - /// contains the singular values of a and u and vh are unitary. The rows - /// of vh are the eigenvectors of and the columns of u are - /// the eigenvectors of . In both cases the corresponding - /// (possibly non-zero) eigenvalues are given by s**2. - /// - /// If a has more than two dimensions, then broadcasting rules apply, as - /// explained in Linear algebra on several matrices at once. This means that SVD is - /// working in “stacked” mode: it iterates over all indices of the first - /// a.ndim - 2 dimensions and for each combination SVD is applied to the - /// last two indices. The matrix a can be reconstructed from the - /// decomposition with either (u * s[..., None, :]) @ vh or - /// u @ (s[..., None] * vh). (The @ operator can be replaced by the - /// function np.matmul for python versions below 3.5.) - /// - /// If a is a matrix object (as opposed to an ndarray), then so are - /// all the return values. + /// Singular Value Decomposition.

+ /// + /// When a is a 2D array, it is factorized as u @ np.diag(s) @ vh + /// = (u * s) @ vh, where u and vh are 2D unitary arrays and s is a 1D + /// array of a’s singular values.

+ /// When a is higher-dimensional, SVD is + /// applied in stacked mode as explained below.

+ /// + /// Notes + /// + /// The decomposition is performed using LAPACK routine _gesdd.

+ /// + /// SVD is usually described for the factorization of a 2D matrix . + /// The higher-dimensional case will be discussed below.

+ /// In the 2D case, SVD is + /// written as , where , , + /// and . The 1D array s + /// contains the singular values of a and u and vh are unitary.

+ /// The rows + /// of vh are the eigenvectors of and the columns of u are + /// the eigenvectors of . In both cases the corresponding + /// (possibly non-zero) eigenvalues are given by s**2. + /// + /// If a has more than two dimensions, then broadcasting rules apply, as + /// explained in Linear algebra on several matrices at once.

+ /// This means that SVD is + /// working in “stacked” mode: it iterates over all indices of the first + /// a.ndim - 2 dimensions and for each combination SVD is applied to the + /// last two indices.

+ /// The matrix a can be reconstructed from the + /// decomposition with either (u * s[..., None, :]) @ vh or + /// u @ (s[..., None] * vh).

+ /// (The @ operator can be replaced by the + /// function np.matmul for python versions below 3.5.) + /// + /// If a is a matrix object (as opposed to an ndarray), then so are + /// all the return values. ///
/// - /// A real or complex array with a.ndim >= 2. + /// A real or complex array with a.ndim >= 2. /// /// - /// If True (default), u and vh have the shapes (..., M, M) and - /// (..., N, N), respectively. Otherwise, the shapes are - /// (..., M, K) and (..., K, N), respectively, where - /// K = min(M, N). + /// If True (default), u and vh have the shapes (..., M, M) and + /// (..., N, N), respectively.

+ /// Otherwise, the shapes are + /// (..., M, K) and (..., K, N), respectively, where + /// K = min(M, N). /// /// - /// Whether or not to compute u and vh in addition to s. True - /// by default. + /// Whether or not to compute u and vh in addition to s.

+ /// True + /// by default. /// /// /// A tuple of: /// u - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. + /// Unitary array(s). The first a.ndim - 2 dimensions have the same + /// size as those of the input a. The size of the last two dimensions + /// depends on the value of full_matrices. Only returned when + /// compute_uv is True. /// s - /// Vector(s) with the singular values, within each vector sorted in - /// descending order. The first a.ndim - 2 dimensions have the same - /// size as those of the input a. + /// Vector(s) with the singular values, within each vector sorted in + /// descending order. The first a.ndim - 2 dimensions have the same + /// size as those of the input a. /// vh - /// Unitary array(s). The first a.ndim - 2 dimensions have the same - /// size as those of the input a. The size of the last two dimensions - /// depends on the value of full_matrices. Only returned when - /// compute_uv is True. + /// Unitary array(s). The first a.ndim - 2 dimensions have the same + /// size as those of the input a. The size of the last two dimensions + /// depends on the value of full_matrices. Only returned when + /// compute_uv is True. /// public static (NDarray, NDarray, NDarray) svd(NDarray a, bool? full_matrices = true, bool? compute_uv = true) - => NumPy.Instance.linalg_svd(a, full_matrices:full_matrices, compute_uv:compute_uv); + { + //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 (full_matrices!=true) kwargs["full_matrices"]=ToPython(full_matrices); + if (compute_uv!=true) kwargs["compute_uv"]=ToPython(compute_uv); + dynamic py = __self__.InvokeMethod("svd", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); + } } public static partial class fft { /// - /// Compute the one-dimensional discrete Fourier Transform. - /// - /// This function computes the one-dimensional n-point discrete Fourier - /// Transform (DFT) with the efficient Fast Fourier Transform (FFT) - /// algorithm [CT]. - /// - /// Notes - /// - /// FFT (Fast Fourier Transform) refers to a way the discrete Fourier - /// Transform (DFT) can be calculated efficiently, by using symmetries in the - /// calculated terms. The symmetry is highest when n is a power of 2, and - /// the transform is therefore most efficient for these sizes. - /// - /// The DFT is defined, with the conventions used in this implementation, in - /// the documentation for the numpy.fft module. - /// - /// References + /// Compute the one-dimensional discrete Fourier Transform.

+ /// + /// This function computes the one-dimensional n-point discrete Fourier + /// Transform (DFT) with the efficient Fast Fourier Transform (FFT) + /// algorithm [CT].

+ /// + /// Notes + /// + /// FFT (Fast Fourier Transform) refers to a way the discrete Fourier + /// Transform (DFT) can be calculated efficiently, by using symmetries in the + /// calculated terms.

+ /// The symmetry is highest when n is a power of 2, and + /// the transform is therefore most efficient for these sizes.

+ /// + /// The DFT is defined, with the conventions used in this implementation, in + /// the documentation for the numpy.fft module.

+ /// + /// References ///
/// - /// Input array, can be complex. + /// Input array, can be complex. /// /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. + /// Length of the transformed axis of the output.

+ /// + /// If n is smaller than the length of the input, the input is cropped.

+ /// + /// If it is larger, the input is padded with zeros.

+ /// If n is not given, + /// the length of the input along the axis specified by axis is used. /// /// - /// Axis over which to compute the FFT. If not given, the last axis is - /// used. + /// Axis over which to compute the FFT.

+ /// If not given, the last axis is + /// used. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. + /// The truncated or zero-padded input, transformed along the axis + /// indicated by axis, or the last one if axis is not specified. /// public static NDarray fft_(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_fft(a, n:n, axis:axis, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (n!=null) kwargs["n"]=ToPython(n); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("fft", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the 2-dimensional discrete Fourier Transform - /// - /// This function computes the n-dimensional discrete Fourier Transform - /// over any axes in an M-dimensional array by means of the - /// Fast Fourier Transform (FFT). By default, the transform is computed over - /// the last two axes of the input array, i.e., a 2-dimensional FFT. - /// - /// Notes - /// - /// fft2 is just fftn with a different default for axes. - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of the transformed axes, the positive frequency terms - /// in the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// the axes, in order of decreasingly negative frequency. - /// - /// See fftn for details and a plotting example, and numpy.fft for - /// definitions and conventions used. + /// Compute the 2-dimensional discrete Fourier Transform + /// + /// This function computes the n-dimensional discrete Fourier Transform + /// over any axes in an M-dimensional array by means of the + /// Fast Fourier Transform (FFT).

+ /// By default, the transform is computed over + /// the last two axes of the input array, i.e., a 2-dimensional FFT.

+ /// + /// Notes + /// + /// fft2 is just fftn with a different default for axes.

+ /// + /// The output, analogously to fft, contains the term for zero frequency in + /// the low-order corner of the transformed axes, the positive frequency terms + /// in the first half of these axes, the term for the Nyquist frequency in the + /// middle of the axes and the negative frequency terms in the second half of + /// the axes, in order of decreasingly negative frequency.

+ /// + /// See fftn for details and a plotting example, and numpy.fft for + /// definitions and conventions used. ///
/// - /// Input array, can be complex + /// Input array, can be complex /// /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. + /// Shape (length of each transformed axis) of the output + /// (s[0] refers to axis 0, s[1] to axis 1, etc.).

+ /// + /// This corresponds to n for fft(x, n).

+ /// + /// Along each axis, if the given shape is smaller than that of the input, + /// the input is cropped.

+ /// If it is larger, the input is padded with zeros.

+ /// + /// if s is not given, the shape of the input along the axes specified + /// by axes is used. /// /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. + /// Axes over which to compute the FFT.

+ /// If not given, the last two + /// axes are used.

+ /// A repeated index in axes means the transform over + /// that axis is performed multiple times.

+ /// A one-element sequence means + /// that a one-dimensional FFT is performed. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. + /// The truncated or zero-padded input, transformed along the axes + /// indicated by axes, or the last two axes if axes is not given. /// public static NDarray fft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_fft2(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("fft2", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the N-dimensional discrete Fourier Transform. - /// - /// This function computes the N-dimensional discrete Fourier Transform over - /// any number of axes in an M-dimensional array by means of the Fast Fourier - /// Transform (FFT). - /// - /// Notes - /// - /// The output, analogously to fft, contains the term for zero frequency in - /// the low-order corner of all axes, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// See numpy.fft for details, definitions and conventions used. + /// Compute the N-dimensional discrete Fourier Transform.

+ /// + /// This function computes the N-dimensional discrete Fourier Transform over + /// any number of axes in an M-dimensional array by means of the Fast Fourier + /// Transform (FFT).

+ /// + /// Notes + /// + /// The output, analogously to fft, contains the term for zero frequency in + /// the low-order corner of all axes, the positive frequency terms in the + /// first half of all axes, the term for the Nyquist frequency in the middle + /// of all axes and the negative frequency terms in the second half of all + /// axes, in order of decreasingly negative frequency.

+ /// + /// See numpy.fft for details, definitions and conventions used. ///
/// - /// Input array, can be complex. + /// Input array, can be complex. /// /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for fft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. + /// Shape (length of each transformed axis) of the output + /// (s[0] refers to axis 0, s[1] to axis 1, etc.).

+ /// + /// This corresponds to n for fft(x, n).

+ /// + /// Along any axis, if the given shape is smaller than that of the input, + /// the input is cropped.

+ /// If it is larger, the input is padded with zeros.

+ /// + /// if s is not given, the shape of the input along the axes specified + /// by axes is used. /// /// - /// Axes over which to compute the FFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the transform over that axis is - /// performed multiple times. + /// Axes over which to compute the FFT.

+ /// If not given, the last len(s) + /// axes are used, or all axes if s is also not specified.

+ /// + /// Repeated indices in axes means that the transform over that axis is + /// performed multiple times. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s and a, - /// as explained in the parameters section above. + /// The truncated or zero-padded input, transformed along the axes + /// indicated by axes, or by a combination of s and a, + /// as explained in the parameters section above. /// public static NDarray fftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_fftn(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("fftn", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the one-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the one-dimensional n-point - /// discrete Fourier transform computed by fft. In other words, - /// ifft(fft(a)) == a to within numerical accuracy. - /// For a general description of the algorithm and definitions, - /// see numpy.fft. - /// - /// The input should be ordered in the same way as is returned by fft, - /// i.e., - /// - /// For an even number of input points, A[n//2] represents the sum of - /// the values at the positive and negative Nyquist frequencies, as the two - /// are aliased together. See numpy.fft for details. - /// - /// Notes - /// - /// If the input parameter n is larger than the size of the input, the input - /// is padded by appending zeros at the end. Even though this is the common - /// approach, it might lead to surprising results. If a different padding is - /// desired, it must be performed before calling ifft. + /// Compute the one-dimensional inverse discrete Fourier Transform.

+ /// + /// This function computes the inverse of the one-dimensional n-point + /// discrete Fourier transform computed by fft.

+ /// In other words, + /// ifft(fft(a)) == a to within numerical accuracy.

+ /// + /// For a general description of the algorithm and definitions, + /// see numpy.fft.

+ /// + /// The input should be ordered in the same way as is returned by fft, + /// i.e., + /// + /// For an even number of input points, A[n//2] represents the sum of + /// the values at the positive and negative Nyquist frequencies, as the two + /// are aliased together.

+ /// See numpy.fft for details.

+ /// + /// Notes + /// + /// If the input parameter n is larger than the size of the input, the input + /// is padded by appending zeros at the end.

+ /// Even though this is the common + /// approach, it might lead to surprising results.

+ /// If a different padding is + /// desired, it must be performed before calling ifft. ///
/// - /// Input array, can be complex. + /// Input array, can be complex. /// /// - /// Length of the transformed axis of the output. - /// If n is smaller than the length of the input, the input is cropped. - /// If it is larger, the input is padded with zeros. If n is not given, - /// the length of the input along the axis specified by axis is used. - /// See notes about padding issues. + /// Length of the transformed axis of the output.

+ /// + /// If n is smaller than the length of the input, the input is cropped.

+ /// + /// If it is larger, the input is padded with zeros.

+ /// If n is not given, + /// the length of the input along the axis specified by axis is used.

+ /// + /// See notes about padding issues. /// /// - /// Axis over which to compute the inverse DFT. If not given, the last - /// axis is used. + /// Axis over which to compute the inverse DFT.

+ /// If not given, the last + /// axis is used. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axis - /// indicated by axis, or the last one if axis is not specified. + /// The truncated or zero-padded input, transformed along the axis + /// indicated by axis, or the last one if axis is not specified. /// public static NDarray ifft(NDarray a, int? n = null, int? axis = -1, string norm = null) - => NumPy.Instance.fft_ifft(a, n:n, axis:axis, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (n!=null) kwargs["n"]=ToPython(n); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("ifft", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the 2-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the 2-dimensional discrete Fourier - /// Transform over any number of axes in an M-dimensional array by means of - /// the Fast Fourier Transform (FFT). In other words, ifft2(fft2(a)) == a - /// to within numerical accuracy. By default, the inverse transform is - /// computed over the last two axes of the input array. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fft2, i.e. it should have the term for zero frequency - /// in the low-order corner of the two axes, the positive frequency terms in - /// the first half of these axes, the term for the Nyquist frequency in the - /// middle of the axes and the negative frequency terms in the second half of - /// both axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// ifft2 is just ifftn with a different default for axes. - /// - /// See ifftn for details and a plotting example, and numpy.fft for - /// definition and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifft2 is called. + /// Compute the 2-dimensional inverse discrete Fourier Transform.

+ /// + /// This function computes the inverse of the 2-dimensional discrete Fourier + /// Transform over any number of axes in an M-dimensional array by means of + /// the Fast Fourier Transform (FFT).

+ /// In other words, ifft2(fft2(a)) == a + /// to within numerical accuracy.

+ /// By default, the inverse transform is + /// computed over the last two axes of the input array.

+ /// + /// The input, analogously to ifft, should be ordered in the same way as is + /// returned by fft2, i.e.

+ /// it should have the term for zero frequency + /// in the low-order corner of the two axes, the positive frequency terms in + /// the first half of these axes, the term for the Nyquist frequency in the + /// middle of the axes and the negative frequency terms in the second half of + /// both axes, in order of decreasingly negative frequency.

+ /// + /// Notes + /// + /// ifft2 is just ifftn with a different default for axes.

+ /// + /// See ifftn for details and a plotting example, and numpy.fft for + /// definition and conventions used.

+ /// + /// Zero-padding, analogously with ifft, is performed by appending zeros to + /// the input along the specified dimension.

+ /// Although this is the common + /// approach, it might lead to surprising results.

+ /// If another form of zero + /// padding is desired, it must be performed before ifft2 is called. ///
/// - /// Input array, can be complex. + /// Input array, can be complex. /// /// - /// Shape (length of each axis) of the output (s[0] refers to axis 0, - /// s[1] to axis 1, etc.). This corresponds to n for ifft(x, n). - /// Along each axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. + /// Shape (length of each axis) of the output (s[0] refers to axis 0, + /// s[1] to axis 1, etc.).

+ /// This corresponds to n for ifft(x, n).

+ /// + /// Along each axis, if the given shape is smaller than that of the input, + /// the input is cropped.

+ /// If it is larger, the input is padded with zeros.

+ /// + /// if s is not given, the shape of the input along the axes specified + /// by axes is used.

+ /// See notes for issue on ifft zero padding. /// /// - /// Axes over which to compute the FFT. If not given, the last two - /// axes are used. A repeated index in axes means the transform over - /// that axis is performed multiple times. A one-element sequence means - /// that a one-dimensional FFT is performed. + /// Axes over which to compute the FFT.

+ /// If not given, the last two + /// axes are used.

+ /// A repeated index in axes means the transform over + /// that axis is performed multiple times.

+ /// A one-element sequence means + /// that a one-dimensional FFT is performed. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or the last two axes if axes is not given. + /// The truncated or zero-padded input, transformed along the axes + /// indicated by axes, or the last two axes if axes is not given. /// public static NDarray ifft2(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_ifft2(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("ifft2", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class fft { /// - /// Compute the N-dimensional inverse discrete Fourier Transform. - /// - /// This function computes the inverse of the N-dimensional discrete - /// Fourier Transform over any number of axes in an M-dimensional array by - /// means of the Fast Fourier Transform (FFT). In other words, - /// ifftn(fftn(a)) == a to within numerical accuracy. - /// For a description of the definitions and conventions used, see numpy.fft. - /// - /// The input, analogously to ifft, should be ordered in the same way as is - /// returned by fftn, i.e. it should have the term for zero frequency - /// in all axes in the low-order corner, the positive frequency terms in the - /// first half of all axes, the term for the Nyquist frequency in the middle - /// of all axes and the negative frequency terms in the second half of all - /// axes, in order of decreasingly negative frequency. - /// - /// Notes - /// - /// See numpy.fft for definitions and conventions used. - /// - /// Zero-padding, analogously with ifft, is performed by appending zeros to - /// the input along the specified dimension. Although this is the common - /// approach, it might lead to surprising results. If another form of zero - /// padding is desired, it must be performed before ifftn is called. + /// Compute the N-dimensional inverse discrete Fourier Transform.

+ /// + /// This function computes the inverse of the N-dimensional discrete + /// Fourier Transform over any number of axes in an M-dimensional array by + /// means of the Fast Fourier Transform (FFT).

+ /// In other words, + /// ifftn(fftn(a)) == a to within numerical accuracy.

+ /// + /// For a description of the definitions and conventions used, see numpy.fft.

+ /// + /// The input, analogously to ifft, should be ordered in the same way as is + /// returned by fftn, i.e.

+ /// it should have the term for zero frequency + /// in all axes in the low-order corner, the positive frequency terms in the + /// first half of all axes, the term for the Nyquist frequency in the middle + /// of all axes and the negative frequency terms in the second half of all + /// axes, in order of decreasingly negative frequency.

+ /// + /// Notes + /// + /// See numpy.fft for definitions and conventions used.

+ /// + /// Zero-padding, analogously with ifft, is performed by appending zeros to + /// the input along the specified dimension.

+ /// Although this is the common + /// approach, it might lead to surprising results.

+ /// If another form of zero + /// padding is desired, it must be performed before ifftn is called. ///
/// - /// Input array, can be complex. + /// Input array, can be complex. /// /// - /// Shape (length of each transformed axis) of the output - /// (s[0] refers to axis 0, s[1] to axis 1, etc.). - /// This corresponds to n for ifft(x, n). - /// Along any axis, if the given shape is smaller than that of the input, - /// the input is cropped. If it is larger, the input is padded with zeros. - /// if s is not given, the shape of the input along the axes specified - /// by axes is used. See notes for issue on ifft zero padding. + /// Shape (length of each transformed axis) of the output + /// (s[0] refers to axis 0, s[1] to axis 1, etc.).

+ /// + /// This corresponds to n for ifft(x, n).

+ /// + /// Along any axis, if the given shape is smaller than that of the input, + /// the input is cropped.

+ /// If it is larger, the input is padded with zeros.

+ /// + /// if s is not given, the shape of the input along the axes specified + /// by axes is used.

+ /// See notes for issue on ifft zero padding. /// /// - /// Axes over which to compute the IFFT. If not given, the last len(s) - /// axes are used, or all axes if s is also not specified. - /// Repeated indices in axes means that the inverse transform over that - /// axis is performed multiple times. + /// Axes over which to compute the IFFT.

+ /// If not given, the last len(s) + /// axes are used, or all axes if s is also not specified.

+ /// + /// Repeated indices in axes means that the inverse transform over that + /// axis is performed multiple times. /// /// - /// Normalization mode (see numpy.fft). Default is None. + /// Normalization mode (see numpy.fft).

+ /// Default is None. /// /// - /// The truncated or zero-padded input, transformed along the axes - /// indicated by axes, or by a combination of s or a, - /// as explained in the parameters section above. + /// The truncated or zero-padded input, transformed along the axes + /// indicated by axes, or by a combination of s or a, + /// as explained in the parameters section above. /// public static NDarray ifftn(NDarray a, int[] s = null, int[] axes = null, string norm = null) - => NumPy.Instance.fft_ifftn(a, s:s, axes:axes, norm:norm); + { + //auto-generated code, do not change + var fft = self.GetAttr("fft"); + var __self__=fft; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (s!=null) kwargs["s"]=ToPython(s); + if (axes!=null) kwargs["axes"]=ToPython(axes); + if (norm!=null) kwargs["norm"]=ToPython(norm); + dynamic py = __self__.InvokeMethod("ifftn", 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 + /// 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 ///
/// - /// Argument of the Bessel function. + /// Argument of the Bessel function. /// /// - /// The modified Bessel function evaluated at each of the elements of x. + /// The modified Bessel function evaluated at each of the elements of x. /// - public static NDarray i0(NDarray x) - => NumPy.Instance.i0(x); + public static NDarray i0(this NDarray x) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("i0", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.logic.gen.cs b/src/Numpy/np.logic.gen.cs index 0107bb0..14e190f 100644 --- a/src/Numpy/np.logic.gen.cs +++ b/src/Numpy/np.logic.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,838 +20,1296 @@ public static partial class np { /// - /// 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. + /// 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. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// 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. + /// 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. + /// 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. + /// A new boolean or array is returned unless out is specified, + /// in which case a reference to out is returned. /// - public static NDarray all(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.all(a, axis:axis, @out:@out, keepdims:keepdims); + public static NDarray all(this NDarray a, Axis axis, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// A new boolean or array is returned unless out is specified, - /// in which case a reference to out is returned. + /// A new boolean or array is returned unless out is specified, + /// in which case a reference to out is returned. /// - public static bool all(NDarray a) - => NumPy.Instance.all(a); + public static bool all(this 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("all", 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. + /// 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. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// 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. + /// 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. + /// 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. + /// A new boolean or ndarray is returned unless out is specified, + /// in which case a reference to out is returned. /// - public static NDarray any(NDarray a, int[] axis, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.any(a, axis:axis, @out:@out, keepdims:keepdims); + public static NDarray any(this NDarray a, Axis axis, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// A new boolean or ndarray is returned unless out is specified, - /// in which case a reference to out is returned. + /// A new boolean or ndarray is returned unless out is specified, + /// in which case a reference to out is returned. /// - public static bool any(NDarray a) - => NumPy.Instance.any(a); + public static bool any(this 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("any", pyargs, kwargs); + 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. + /// 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. ///
/// - /// Input values. + /// 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. + /// + /// 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. + /// + /// 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. + /// True where x is not positive infinity, negative infinity, + /// or NaN; false otherwise.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray isfinite(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isfinite(x, @out:@out, @where:@where); + public static NDarray isfinite(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input values + /// 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. + /// + /// 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. + /// + /// 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. + /// True where x is positive or negative infinity, false otherwise.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray isinf(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isinf(x, @out:@out, @where:@where); + public static NDarray isinf(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// True where x is NaN, false otherwise.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray isnan(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isnan(x, @out:@out, @where:@where); + public static NDarray isnan(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Test element-wise for NaT (not a time) and return result as a boolean array. /// /// - /// Input array with datetime or timedelta data type. + /// Input array with datetime or timedelta data type. /// - /// - /// 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. + /// + /// 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. + /// + /// 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. + /// True where x is NaT, false otherwise.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray isnat(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.isnat(x, @out:@out, @where:@where); + public static NDarray isnat(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// The input array. + /// The input array. /// - /// - /// A boolean array with the same shape and type as x to store the - /// result. + /// + /// 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. + /// 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 static NDarray isneginf(NDarray x, NDarray @out = null) - => NumPy.Instance.isneginf(x, @out:@out); + public static NDarray isneginf(this NDarray x, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// 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 ///
/// - /// The input array. + /// The input array. /// /// - /// A boolean array with the same shape as x to store the result. + /// 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. + /// 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 static NDarray isposinf(NDarray x, NDarray y = null) - => NumPy.Instance.isposinf(x, y:y); + public static NDarray isposinf(this NDarray x, NDarray y = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Output array. + /// Output array. /// - public static NDarray iscomplex(NDarray x) - => NumPy.Instance.iscomplex(x); + public static NDarray iscomplex(this NDarray x) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("iscomplex", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Check for a complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. Even if the input - /// has an imaginary part equal to zero, iscomplexobj evaluates to True. + /// Check for a complex type or an array of complex numbers.

+ /// + /// The type of the input is checked, not the value.

+ /// Even if the input + /// has an imaginary part equal to zero, iscomplexobj evaluates to True. ///
/// - /// The input can be of any type and shape. + /// The input can be of any type and shape. /// /// - /// The return value, True if x is of a complex type or has at least - /// one complex element. + /// The return value, True if x is of a complex type or has at least + /// one complex element. /// public static bool iscomplexobj(object x) - => NumPy.Instance.iscomplexobj(x); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("iscomplexobj", pyargs, kwargs); + 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. + /// 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. ///
/// - /// Input array. - /// - public static bool isfortran(NDarray a) - => NumPy.Instance.isfortran(a); + /// Input array. + /// + public static bool isfortran(this 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("isfortran", pyargs, kwargs); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Boolean array of same shape as x. + /// Boolean array of same shape as x. /// - public static NDarray isreal(NDarray x) - => NumPy.Instance.isreal(x); + public static NDarray isreal(this NDarray x) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isreal", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return True if x is a not complex type or an array of complex numbers. - /// - /// The type of the input is checked, not the value. So even if the input - /// has an imaginary part equal to zero, isrealobj evaluates to False - /// if the data type is complex. + /// Return True if x is a not complex type or an array of complex numbers.

+ /// + /// The type of the input is checked, not the value.

+ /// So even if the input + /// has an imaginary part equal to zero, isrealobj evaluates to False + /// if the data type is complex. ///
/// - /// The input can be of any type and shape. + /// The input can be of any type and shape. /// /// - /// The return value, False if x is of a complex type. + /// The return value, False if x is of a complex type. /// public static bool isrealobj(object x) - => NumPy.Instance.isrealobj(x); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isrealobj", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns True if the type of num is a scalar type. - /// - /// Notes - /// - /// In almost all cases np.ndim(x) == 0 should be used instead of this - /// function, as that will also return true for 0d arrays. This is how - /// numpy overloads functions in the style of the dx arguments to gradient - /// and the bins argument to histogram. Some key differences: + /// Returns True if the type of num is a scalar type.

+ /// + /// Notes + /// + /// In almost all cases np.ndim(x) == 0 should be used instead of this + /// function, as that will also return true for 0d arrays.

+ /// This is how + /// numpy overloads functions in the style of the dx arguments to gradient + /// and the bins argument to histogram.

+ /// Some key differences: ///
/// - /// Input argument, can be of any type and shape. + /// Input argument, can be of any type and shape. /// /// - /// True if num is a scalar type, False if it is not. + /// True if num is a scalar type, False if it is not. /// public static bool isscalar(object num) - => NumPy.Instance.isscalar(num); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + num, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isscalar", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the truth value of x1 AND x2 element-wise. + /// Compute the truth value of x1 AND x2 element-wise. /// /// - /// Input arrays. x1 and x2 must be of the same shape. + /// Input arrays.

+ /// x1 and x2 must be of the same shape. /// /// - /// 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. + /// 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. + /// 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 static NDarray logical_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_and(x2, x1, @out:@out, @where:@where); + public static NDarray logical_and(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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. + /// Logical OR is applied to the elements of x1 and x2. + /// They have to be of the same shape. /// /// - /// 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. + /// 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. + /// 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 static NDarray logical_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_or(x2, x1, @out:@out, @where:@where); + public static NDarray logical_or(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// Compute the truth value of NOT x element-wise. /// /// - /// Logical NOT is applied to the elements of x. + /// Logical NOT is applied to the elements 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. + /// + /// 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. + /// + /// 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. + /// 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 static NDarray logical_not(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_not(x, @out:@out, @where:@where); + public static NDarray logical_not(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. + /// Logical XOR is applied to the elements of x1 and x2. They must + /// be broadcastable to the same shape. /// /// - /// 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. + /// 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. + /// 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 static NDarray logical_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logical_xor(x2, x1, @out:@out, @where:@where); + public static NDarray logical_xor(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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. + /// Input arrays to compare. /// /// - /// Input arrays to compare. + /// Input arrays to compare. /// /// - /// The relative tolerance parameter (see Notes). + /// The relative tolerance parameter (see Notes). /// /// - /// The absolute 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. + /// 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. + /// Returns True if the two arrays are equal within the given + /// tolerance; False otherwise. /// - public static bool allclose(NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) - => NumPy.Instance.allclose(b, a, rtol, atol, equal_nan); + public static bool allclose(this NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + b, + 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. + /// 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. + /// Input arrays to compare. /// /// - /// Input arrays to compare. + /// Input arrays to compare. /// /// - /// The relative tolerance parameter (see Notes). + /// The relative tolerance parameter (see Notes). /// /// - /// The absolute 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. + /// 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. + /// 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 static NDarray isclose(NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) - => NumPy.Instance.isclose(b, a, rtol, atol, equal_nan); + public static NDarray isclose(this NDarray b, NDarray a, float rtol = 1e-05f, float atol = 1e-08f, bool equal_nan = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + b, + 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. + /// True if two arrays have the same shape and elements, False otherwise. /// /// - /// Input arrays. + /// Input arrays. /// /// - /// Input arrays. + /// Input arrays. /// /// - /// Returns True if the arrays are equal. + /// Returns True if the arrays are equal. /// - public static bool array_equal(NDarray a2, NDarray a1) - => NumPy.Instance.array_equal(a2, a1); + public static bool array_equal(this NDarray a2, NDarray a1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a2, + 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. + /// 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. + /// Input arrays. /// /// - /// Input arrays. + /// Input arrays. /// /// - /// True if equivalent, False otherwise. + /// True if equivalent, False otherwise. /// - public static bool array_equiv(NDarray a2, NDarray a1) - => NumPy.Instance.array_equiv(a2, a1); + public static bool array_equiv(this NDarray a2, NDarray a1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a2, + 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. + /// 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). + /// 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). /// /// - /// 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. + /// 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. + /// 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 static NDarray greater(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.greater(x2, x1, @out:@out, @where:@where); + public static NDarray greater(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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). + /// 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). /// /// - /// 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. + /// 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. + /// 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 static NDarray greater_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.greater_equal(x2, x1, @out:@out, @where:@where); + public static NDarray greater_equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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). + /// 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). /// /// - /// 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. + /// 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. + /// 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 static NDarray less(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.less(x2, x1, @out:@out, @where:@where); + public static NDarray less(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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). + /// 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). /// /// - /// 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. + /// 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. + /// 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 static NDarray less_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.less_equal(x2, x1, @out:@out, @where:@where); + public static NDarray less_equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// Return (x1 == x2) element-wise. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// 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. + /// + /// 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. + /// + /// 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. + /// 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 static NDarray equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.equal(x2, x1, @out:@out, @where:@where); + public static NDarray equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// Return (x1 != x2) element-wise. /// /// - /// Input arrays. + /// Input arrays. /// /// - /// Input arrays. + /// 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. + /// + /// 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. + /// + /// 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. + /// 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 static NDarray not_equal(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.not_equal(x2, x1, @out:@out, @where:@where); + public static NDarray not_equal(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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); + } } diff --git a/src/Numpy/np.math.gen.cs b/src/Numpy/np.math.gen.cs index 40e7dc5..84dbded 100644 --- a/src/Numpy/np.math.gen.cs +++ b/src/Numpy/np.math.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,3112 +20,4678 @@ public static partial class np { /// - /// 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. + /// 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. ///
/// - /// Angle, in radians ( rad equals 360 degrees). + /// Angle, in radians ( rad equals 360 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. + /// + /// 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. + /// + /// 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. + /// The sine of each element of x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray sin(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sin(x, @out:@out, @where:@where); + public static NDarray sin(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input array in radians. + /// Input array in 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. + /// + /// 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. + /// + /// 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. + /// The corresponding cosine values.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray cos(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.cos(x, @out:@out, @where:@where); + public static NDarray cos(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input 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 corresponding tangent values. - /// This is a scalar if x is a scalar. - /// - public static NDarray tan(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.tan(x, @out:@out, @where:@where); - - /// - /// 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/ + /// Input 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 corresponding tangent values.

+ /// + /// This is a scalar if x is a scalar. + ///
+ public static NDarray tan(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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/ ///
/// - /// y-coordinate on the unit circle. - /// - /// - /// 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 static NDarray arcsin(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arcsin(x, @out:@out, @where:@where); - - /// - /// 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/ + /// y-coordinate on the unit circle. + /// + /// + /// 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 static NDarray arcsin(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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/ ///
/// - /// x-coordinate on the unit circle. - /// For real arguments, the domain is [-1, 1]. - /// - /// - /// 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 static NDarray arccos(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arccos(x, @out:@out, @where:@where); - - /// - /// 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 static NDarray arctan(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arctan(x, @out:@out, @where:@where); - - /// - /// 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) + /// x-coordinate on the unit circle.

+ /// + /// For real arguments, the domain is [-1, 1]. + /// + /// + /// 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 static NDarray arccos(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 static NDarray arctan(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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). + /// Leg of the triangle(s). /// /// - /// 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 static NDarray hypot(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.hypot(x2, x1, @out:@out, @where:@where); - - /// - /// 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 + /// 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 static NDarray hypot(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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 ///
/// - /// y-coordinates. + /// y-coordinates. /// /// - /// 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. + /// 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. + /// Array of angles in radians, in the range [-pi, pi].

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray arctan2(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arctan2(x1, x2, @out:@out, @where:@where); + public static NDarray arctan2(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// Convert angles from radians to degrees. /// /// - /// Input array in radians. + /// Input array in 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. + /// + /// 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. + /// + /// 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. + /// The corresponding degree values; if out was supplied this is a + /// reference to it.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray degrees(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.degrees(x, @out:@out, @where:@where); + public static NDarray degrees(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Convert angles from degrees to radians. /// /// - /// Input array in degrees. + /// Input array in 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. + /// + /// 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. + /// + /// 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. + /// The corresponding radian values.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray radians(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.radians(x, @out:@out, @where:@where); + public static NDarray radians(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Maximum discontinuity between values, default is pi. + /// Maximum discontinuity between values, default is pi. /// /// - /// Axis along which unwrap will operate, default is the last axis. + /// Axis along which unwrap will operate, default is the last axis. /// /// - /// Output array. + /// Output array. /// - public static NDarray unwrap(NDarray p, float? discont = 3.141592653589793f, int? axis = -1) - => NumPy.Instance.unwrap(p, discont:discont, axis:axis); + public static NDarray unwrap(this NDarray p, float? discont = 3.141592653589793f, int? axis = -1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + p, + }); + 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. + /// Convert angles from degrees to radians.

+ /// + /// Notes + /// + /// deg2rad(x) is x * pi / 180. ///
/// - /// Angles in degrees. + /// Angles in 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. + /// + /// 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. + /// + /// 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. + /// The corresponding angle in radians.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray deg2rad(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.deg2rad(x, @out:@out, @where:@where); + public static NDarray deg2rad(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Convert angles from radians to degrees.

+ /// + /// Notes + /// + /// rad2deg(x) is 180 * x / pi. ///
/// - /// Angle in radians. + /// Angle in 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. + /// + /// 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. + /// + /// 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. + /// The corresponding angle in degrees.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray rad2deg(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.rad2deg(x, @out:@out, @where:@where); + public static NDarray rad2deg(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// The corresponding hyperbolic sine values.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray sinh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sinh(x, @out:@out, @where:@where); + public static NDarray sinh(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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). + /// Hyperbolic cosine, element-wise.

+ /// + /// Equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j*x). ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// Output array of same shape as x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray cosh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.cosh(x, @out:@out, @where:@where); + public static NDarray cosh(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// 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 ///
/// - /// Input 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 corresponding hyperbolic tangent values. - /// This is a scalar if x is a scalar. - /// - public static NDarray tanh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.tanh(x, @out:@out, @where:@where); - - /// - /// 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 + /// Input 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 corresponding hyperbolic tangent values.

+ /// + /// This is a scalar if x is a scalar. + ///
+ public static NDarray tanh(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray arcsinh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arcsinh(x, @out:@out, @where:@where); - - /// - /// 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 + /// Input 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. + /// + /// + /// Array of the same shape as x.

+ /// + /// This is a scalar if x is a scalar. + ///
+ public static NDarray arcsinh(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// Input 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. - /// - /// - /// Array of the same shape as x. - /// This is a scalar if x is a scalar. - /// - public static NDarray arccosh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arccosh(x, @out:@out, @where:@where); - - /// - /// 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 + /// Input 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. + /// + /// + /// Array of the same shape as x.

+ /// + /// This is a scalar if x is a scalar. + ///
+ public static NDarray arccosh(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// Array of the same shape as x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray arctanh(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.arctanh(x, @out:@out, @where:@where); + public static NDarray arctanh(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// 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 ///
/// - /// Input data. + /// Input data. /// /// - /// 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. + /// 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. + /// 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 static NDarray around(NDarray a, int? decimals = 0, NDarray @out = null) - => NumPy.Instance.around(a, decimals:decimals, @out:@out); + public static NDarray around(this NDarray a, int? decimals = 0, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// Round elements of the array to the nearest integer. /// /// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// Output array is same shape and type as x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray rint(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.rint(x, @out:@out, @where:@where); + public static NDarray rint(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// An array of floats to be rounded + /// An array of floats to be rounded /// /// - /// Output array + /// Output array /// /// - /// The array of rounded numbers + /// The array of rounded numbers /// - public static NDarray fix(NDarray x, NDarray y = null) - => NumPy.Instance.fix(x, y:y); + public static NDarray fix(this NDarray x, NDarray y = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input data. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// The floor of each element in x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray floor(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.floor(x, @out:@out, @where:@where); + public static NDarray floor(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 . + /// 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 . ///
/// - /// Input data. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// The ceiling of each element in x, with float dtype.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray ceil(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.ceil(x, @out:@out, @where:@where); + public static NDarray ceil(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// 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 ///
/// - /// Input data. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// The truncated value of each element in x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray trunc(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.trunc(x, @out:@out, @where:@where); + public static NDarray trunc(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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: + /// 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: ///
/// - /// Input data. + /// Input data. /// /// - /// 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. + /// 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. + /// 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. + /// 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. + /// 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. + /// An array shaped as a but with the specified axis removed.

+ /// + /// Returns a reference to out if specified. ///
- public static NDarray prod(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.prod(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); + public static NDarray prod(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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: + /// 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: ///
/// - /// Elements to sum. + /// Elements to sum. /// /// - /// 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. + /// 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. + /// 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. + /// 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. + /// 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. + /// 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 static NDarray sum(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.sum(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims, initial:initial); + public static NDarray sum(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Array containing numbers whose product is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose product is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the product is computed. The default is to compute - /// the product of the flattened array. + /// 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. + /// 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. + /// 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. + /// A new array holding the result is returned unless out is + /// specified, in which case it is returned. /// - public static NDarray nanprod(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanprod(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); + public static NDarray nanprod(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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). + /// 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). ///
/// - /// Array containing numbers whose sum is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose sum is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the sum is computed. The default is to compute the - /// sum of the flattened array. + /// 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. + /// 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. + /// 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. + /// 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 static NDarray nansum(NDarray a, int[] axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nansum(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); + public static NDarray nansum(this NDarray a, Axis axis = null, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Axis along which the cumulative product is computed. By default - /// the input is flattened. + /// 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. + /// 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. + /// A new array holding the result is returned unless out is + /// specified, in which case a reference to out is returned. /// - public static NDarray cumprod(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.cumprod(a, axis:axis, dtype:dtype, @out:@out); + public static NDarray cumprod(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Axis along which the cumulative sum is computed. The default - /// (None) is to compute the cumsum over the flattened array. + /// 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. + /// 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. + /// 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 static NDarray cumsum(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.cumsum(a, axis:axis, dtype:dtype, @out:@out); + public static NDarray cumsum(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Axis along which the cumulative product is computed. By default - /// the input is flattened. + /// 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. + /// 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. + /// A new array holding the result is returned unless out is + /// specified, in which case it is returned. /// - public static NDarray nancumprod(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.nancumprod(a, axis:axis, dtype:dtype, @out:@out); + public static NDarray nancumprod(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Axis along which the cumulative sum is computed. The default - /// (None) is to compute the cumsum over the flattened array. + /// 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 static NDarray nancumsum(NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.nancumsum(a, axis:axis, dtype:dtype, @out:@out); - - /// - /// 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: + /// 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 static NDarray nancumsum(this NDarray a, int? axis = null, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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: ///
/// - /// Input array + /// Input array /// /// - /// The number of times values are differenced. If zero, the input - /// is returned as-is. + /// 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. + /// 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. /// /// - /// 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. + /// 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 static NDarray diff(NDarray a, int? n = 1, int? axis = -1, NDarray append = null, NDarray prepend = null) - => NumPy.Instance.diff(a, n:n, axis:axis, append:append, prepend:prepend); + public static NDarray diff(this NDarray a, int? n = 1, int? axis = -1, NDarray append = null, NDarray prepend = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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. + /// 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. ///
/// - /// If necessary, will be flattened before the differences are taken. + /// If necessary, will be flattened before the differences are taken. /// /// - /// Number(s) to append at the end of the returned differences. + /// 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 static NDarray ediff1d(NDarray ary, NDarray to_end = null, NDarray to_begin = null) - => NumPy.Instance.ediff1d(ary, to_end:to_end, to_begin:to_begin); - - /// - /// 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. + /// Number(s) to prepend at the beginning of the returned differences. /// - /// - /// 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, NDarray varargs = null, int? edge_order = null, int[] axis = null) - => NumPy.Instance.gradient(f, varargs:varargs, edge_order:edge_order, axis:axis); - - /// - /// 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. + /// + /// The differences.

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

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

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

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

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

+ /// + /// Notes + /// + /// Supports full broadcasting of the inputs. ///
/// - /// Components of the first vector(s). + /// Components of the first vector(s). /// /// - /// Components of the second vector(s). + /// Components of the second vector(s). /// /// - /// Axis of a that defines the vector(s). By default, the last axis. + /// 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 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. + /// 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. + /// 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). + /// Vector cross product(s). /// - public static NDarray cross(NDarray a, NDarray b, int? axisa = -1, int? axisb = -1, int? axisc = -1, int? axis = null) - => NumPy.Instance.cross(a, b, axisa:axisa, axisb:axisb, axisc:axisc, axis:axis); + public static NDarray cross(this NDarray a, NDarray b, int? axisa = -1, int? axisb = -1, int? axisc = -1, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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 + /// 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 ///
/// - /// Input array to integrate. + /// Input array to integrate. /// /// - /// 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 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 spacing between sample points when x is None.

+ /// The default is 1. /// /// - /// The axis along which to integrate. + /// The axis along which to integrate. /// /// - /// Definite integral as approximated by trapezoidal rule. + /// Definite integral as approximated by trapezoidal rule. /// - public static float trapz(NDarray y, NDarray x = null, float? dx = 1.0f, int? axis = -1) - => NumPy.Instance.trapz(y, x:x, dx:dx, axis:axis); + public static float trapz(this NDarray y, NDarray x = null, float? dx = 1.0f, int? axis = -1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + y, + }); + 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 + /// 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 ///
/// - /// Input values. + /// 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. + /// + /// 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. + /// + /// 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. + /// Output array, element-wise exponential of x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray exp(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.exp(x, @out:@out, @where:@where); + public static NDarray exp(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input values. + /// 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. + /// + /// 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. + /// + /// 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. + /// Element-wise exponential minus one: out = exp(x) - 1.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray expm1(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.expm1(x, @out:@out, @where:@where); + public static NDarray expm1(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// Calculate 2**p for all p in the input array.

+ /// + /// 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. - /// - /// - /// Element-wise 2 to the power x. - /// This is a scalar if x is a scalar. - /// - public static NDarray exp2(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.exp2(x, @out:@out, @where:@where); - - /// - /// 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 + /// 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. + /// + /// + /// Element-wise 2 to the power x.

+ /// + /// This is a scalar if x is a scalar. + ///
+ public static NDarray exp2(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// Input value. - /// - /// - /// 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 static NDarray log(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log(x, @out:@out, @where:@where); - - /// - /// 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 + /// Input value. + /// + /// + /// 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 static NDarray log(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// 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. - /// - /// - /// 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 static NDarray log10(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log10(x, @out:@out, @where:@where); - - /// - /// 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. + /// 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. + /// + /// + /// 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 static NDarray log10(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. ///
/// - /// 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 x. - /// This is a scalar if x is a scalar. - /// - public static NDarray log2(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log2(x, @out:@out, @where:@where); - - /// - /// 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 + /// 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 x.

+ /// + /// This is a scalar if x is a scalar. + ///
+ public static NDarray log2(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// Input values. + /// 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. + /// + /// 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. + /// + /// 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. + /// Natural logarithm of 1 + x, element-wise.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray log1p(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.log1p(x, @out:@out, @where:@where); + public static NDarray log1p(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// 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. + /// Input values. /// /// - /// Input values. + /// 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. + /// + /// 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. + /// + /// 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. + /// Logarithm of exp(x1) + exp(x2).

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray logaddexp(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logaddexp(x2, x1, @out:@out, @where:@where); + public static NDarray logaddexp(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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 + /// 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. + /// Input values. /// /// - /// 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 static NDarray logaddexp2(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.logaddexp2(x2, x1, @out:@out, @where:@where); - - /// - /// 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 + /// 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 static NDarray logaddexp2(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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 ///
/// - /// Array (possibly multi-dimensional) of values for which to to - /// calculate sinc(x). + /// Array (possibly multi-dimensional) of values for which to to + /// calculate sinc(x). /// /// - /// sinc(x), which has the same shape as the input. + /// sinc(x), which has the same shape as the input. /// - public static NDarray sinc(NDarray x) - => NumPy.Instance.sinc(x); + public static NDarray sinc(this NDarray x) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("sinc", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns element-wise True where signbit is set (less than zero). + /// Returns element-wise True where signbit is set (less than zero). /// /// - /// The input value(s). + /// The input value(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. + /// + /// 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. + /// + /// 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. + /// Output array, or reference to out if that was supplied.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray signbit(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.signbit(x, @out:@out, @where:@where); + public static NDarray signbit(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Values to change the sign of. + /// Values to change the sign of. /// /// - /// The sign of x2 is copied to 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. + /// + /// 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. + /// + /// 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. + /// The values of x1 with the sign of x2. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray copysign(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.copysign(x1, x2, @out:@out, @where:@where); + public static NDarray copysign(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Array of numbers to be decomposed. + /// Array of numbers to be decomposed. /// /// - /// Output array for the mantissa. Must have the same shape as x. + /// 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. + /// 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. + /// 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. + /// Integer exponents of 2. + /// This is a scalar if x is a scalar. /// - public static (NDarray, NDarray) frexp(NDarray x, NDarray out1 = null, NDarray out2 = null, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.frexp(x, out1:out1, out2:out2, @out:@out, @where:@where); + public static (NDarray, NDarray) frexp(this NDarray x, NDarray out1 = null, NDarray out2 = null, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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 multipliers. + /// Array of multipliers. /// /// - /// Array of twos exponents. + /// 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. + /// + /// 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. + /// + /// 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. + /// The result of x1 * 2**x2. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray ldexp(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.ldexp(x1, x2, @out:@out, @where:@where); + public static NDarray ldexp(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// Return the next floating-point value after x1 towards x2, element-wise. /// /// - /// Values to find the next representable value of. + /// Values to find the next representable value of. /// /// - /// The direction where to look for the next representable value of x1. + /// 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. + /// + /// 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. + /// + /// 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. + /// The next representable values of x1 in the direction of x2. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray nextafter(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.nextafter(x1, x2, @out:@out, @where:@where); + public static NDarray nextafter(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Values to find the spacing of. + /// Values to find the spacing of. /// - /// - /// 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. + /// + /// 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. + /// + /// 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. + /// The spacing of values of x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray spacing(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.spacing(x, @out:@out, @where:@where); + public static NDarray spacing(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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| + /// Returns the lowest common multiple of |x1| and |x2| /// /// - /// Arrays of values + /// Arrays of values /// /// - /// Arrays of values + /// 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. + /// The lowest common multiple of the absolute value of the inputs + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray lcm(NDarray x2, NDarray x1) - => NumPy.Instance.lcm(x2, x1); + public static NDarray lcm(this NDarray x2, NDarray x1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("lcm", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns the greatest common divisor of |x1| and |x2| + /// Returns the greatest common divisor of |x1| and |x2| /// /// - /// Arrays of values + /// Arrays of values /// /// - /// Arrays of values + /// 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. + /// The greatest common divisor of the absolute value of the inputs + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray gcd(NDarray x2, NDarray x1) - => NumPy.Instance.gcd(x2, x1); + public static NDarray gcd(this NDarray x2, NDarray x1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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). + /// 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). /// /// - /// 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 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. + /// The sum of x1 and x2, element-wise.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray @add(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.@add(x2, x1, @out:@out, @where:@where); + public static NDarray @add(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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. ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// Return array.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray reciprocal(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.reciprocal(x, @out:@out, @where:@where); + public static NDarray reciprocal(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Numerical positive, element-wise.

+ /// + /// Notes + /// + /// Equivalent to x.copy(), but only defined for types that support + /// arithmetic. ///
/// - /// Input array. + /// Input array. /// /// - /// Returned array or scalar: y = +x. - /// This is a scalar if x is a scalar. + /// Returned array or scalar: y = +x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray positive(NDarray x) - => NumPy.Instance.positive(x); + public static NDarray positive(this NDarray x) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("positive", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Numerical negative, element-wise. + /// Numerical negative, element-wise. /// /// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// Returned array or scalar: y = -x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray negative(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.negative(x, @out:@out, @where:@where); + public static NDarray negative(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Multiply arguments element-wise.

+ /// + /// Notes + /// + /// Equivalent to x1 * x2 in terms of array broadcasting. ///
/// - /// Input arrays to be multiplied. + /// Input arrays to be multiplied. /// /// - /// 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 static NDarray multiply(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.multiply(x2, x1, @out:@out, @where:@where); - - /// - /// 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. + /// 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 static NDarray multiply(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. ///
/// - /// Dividend array. + /// Dividend array. /// /// - /// Divisor array. + /// 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. + /// + /// 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. + /// + /// 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. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.divide(x1, x2, @out:@out, @where:@where); + public static NDarray divide(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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 bases. + /// The bases. /// /// - /// The exponents. + /// 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. + /// + /// 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. + /// + /// 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. + /// The bases in x1 raised to the exponents in x2. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray power(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.power(x1, x2, @out:@out, @where:@where); + public static NDarray power(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// Subtract arguments, element-wise.

+ /// + /// Notes + /// + /// Equivalent to x1 - x2 in terms of array broadcasting. ///
/// - /// The arrays to be subtracted from each other. + /// The arrays to be subtracted from each other. /// /// - /// 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 static NDarray subtract(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.subtract(x2, x1, @out:@out, @where:@where); - - /// - /// 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. + /// 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 static NDarray subtract(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. ///
/// - /// Dividend array. + /// Dividend array. /// /// - /// Divisor array. + /// 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. + /// + /// 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. + /// + /// 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. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray true_divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.true_divide(x1, x2, @out:@out, @where:@where); + public static NDarray true_divide(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Numerator. + /// Numerator. /// /// - /// Denominator. + /// 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. + /// + /// 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. + /// + /// 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. + /// y = floor(x1/x2) + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray floor_divide(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.floor_divide(x1, x2, @out:@out, @where:@where); + public static NDarray floor_divide(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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 bases. + /// The bases. /// /// - /// The exponents. + /// 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. + /// + /// 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. + /// + /// 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. + /// The bases in x1 raised to the exponents in x2. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray float_power(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.float_power(x1, x2, @out:@out, @where:@where); + public static NDarray float_power(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Dividend. + /// Dividend. /// /// - /// Divisor. + /// 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. + /// + /// 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. + /// + /// 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. + /// The remainder of the division of x1 by x2. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray fmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fmod(x1, x2, @out:@out, @where:@where); + public static NDarray fmod(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Dividend array. + /// Dividend array. /// /// - /// Divisor array. + /// 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. + /// + /// 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. + /// + /// 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. + /// The element-wise remainder of the quotient floor_divide(x1, x2).

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray mod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.mod(x1, x2, @out:@out, @where:@where); + public static NDarray mod(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// 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. + /// Integral part of x. + /// This is a scalar if x is a scalar. /// - public static (NDarray, NDarray) modf(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.modf(x, @out:@out, @where:@where); + public static (NDarray, NDarray) modf(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Dividend array. + /// Dividend array. /// /// - /// Divisor array. + /// 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. + /// + /// 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. + /// + /// 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. + /// The element-wise remainder of the quotient floor_divide(x1, x2).

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray remainder(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.remainder(x1, x2, @out:@out, @where:@where); + public static NDarray remainder(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. ///
/// - /// Dividend array. + /// Dividend array. /// /// - /// Divisor array. + /// 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. + /// + /// 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. + /// + /// 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. + /// 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. + /// Element-wise remainder from floor division. + /// This is a scalar if both x1 and x2 are scalars. /// - public static (NDarray, NDarray) divmod(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.divmod(x1, x2, @out:@out, @where:@where); + public static (NDarray, NDarray) divmod(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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 the angle of the complex argument. /// /// - /// A complex number or sequence of complex numbers. + /// A complex number or sequence of complex numbers. /// /// - /// Return angle in degrees if True, radians if False (default). + /// 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. + /// The counterclockwise angle from the positive real axis on + /// the complex plane, with dtype as numpy.float64. /// - public static NDarray angle(NDarray z, bool? deg = false) - => NumPy.Instance.angle(z, deg:deg); + public static NDarray angle(this NDarray z, bool? deg = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + z, + }); + var kwargs=new PyDict(); + if (deg!=false) kwargs["deg"]=ToPython(deg); + dynamic py = __self__.InvokeMethod("angle", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the real part of the complex argument. + /// Return the real part of the complex argument. /// /// - /// Input array. + /// Input array. /// /// - /// The real component of the complex argument. If val is real, the type - /// of val is used for the output. If val has complex elements, the - /// returned type is float. + /// The real component of the complex argument.

+ /// If val is real, the type + /// of val is used for the output.

+ /// If val has complex elements, the + /// returned type is float. ///
- public static NDarray real(NDarray val) - => NumPy.Instance.real(val); + public static NDarray real(this NDarray val) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + val, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("real", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the imaginary part of the complex argument. + /// Return the imaginary part of the complex argument. /// /// - /// Input array. + /// Input array. /// /// - /// The imaginary component of the complex argument. If val is real, - /// the type of val is used for the output. If val has complex - /// elements, the returned type is float. + /// The imaginary component of the complex argument.

+ /// If val is real, + /// the type of val is used for the output.

+ /// If val has complex + /// elements, the returned type is float. ///
- public static NDarray imag(NDarray val) - => NumPy.Instance.imag(val); + public static NDarray imag(this NDarray val) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + val, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("imag", 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. + /// Return the complex conjugate, element-wise.

+ /// + /// The complex conjugate of a complex number is obtained by changing the + /// sign of its imaginary part. ///
/// - /// Input value. - /// - /// - /// 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 static NDarray conj(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.conj(x, @out:@out, @where:@where); - - /// - /// 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 + /// Input value. + /// + /// + /// 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 static NDarray conj(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 ///
/// - /// First one-dimensional input array. + /// First one-dimensional input array. /// /// - /// Second one-dimensional input array. + /// Second one-dimensional input array. /// /// - /// Discrete, linear convolution of a and v. + /// Discrete, linear convolution of a and v. /// - public static NDarray convolve(NDarray a, NDarray v, string mode = "full") - => NumPy.Instance.convolve(a, v, mode:mode); + public static NDarray convolve(this NDarray a, NDarray v, string mode = "full") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. ///
/// - /// Array containing elements to clip. + /// Array containing elements to clip. /// /// - /// 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. + /// 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. + /// 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. + /// 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 static NDarray clip(NDarray a, NDarray a_min, NDarray a_max, NDarray @out = null) - => NumPy.Instance.clip(a, a_min, a_max, @out:@out); + public static NDarray clip(this NDarray a, NDarray a_min, NDarray a_max, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + 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. + /// 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. ///
/// - /// The values whose square-roots are required. + /// The values whose square-roots are required. /// - /// - /// 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. + /// + /// 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. + /// + /// 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. + /// 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 static NDarray sqrt(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sqrt(x, @out:@out, @where:@where); + public static NDarray sqrt(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Return the cube-root of an array, element-wise. /// /// - /// The values whose cube-roots are required. + /// The values whose cube-roots are required. /// - /// - /// 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. + /// + /// 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. + /// + /// 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. + /// 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 static NDarray cbrt(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.cbrt(x, @out:@out, @where:@where); + public static NDarray cbrt(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Return the element-wise square of the input. /// /// - /// Input data. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// Element-wise x*x, of the same shape and dtype as x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray square(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.square(x, @out:@out, @where:@where); + public static NDarray square(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// Calculate the absolute value element-wise.

+ /// + /// np.abs is a shorthand for this function. ///
/// - /// Input array. + /// Input 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. + /// + /// 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. + /// + /// 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. + /// 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 static NDarray absolute(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.absolute(x, @out:@out, @where:@where); + public static NDarray absolute(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// The array of numbers for which the absolute values are required. If - /// x is a scalar, the result y will also be a scalar. - /// - /// - /// 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 static NDarray fabs(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fabs(x, @out:@out, @where:@where); - - /// - /// 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, . + /// The array of numbers for which the absolute values are required.

+ /// If + /// x is a scalar, the result y will also be a scalar. + /// + /// + /// 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 static NDarray fabs(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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, . ///
/// - /// Input values. + /// 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. + /// + /// 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. + /// + /// 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. + /// The sign of x.

+ /// + /// This is a scalar if x is a scalar. ///
- public static NDarray sign(NDarray x, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.sign(x, @out:@out, @where:@where); + public static NDarray sign(this NDarray x, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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 + /// 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 ///
/// - /// Input values. + /// Input values. /// /// - /// The value of the function when x1 is 0. + /// 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. + /// + /// 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. + /// + /// 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. + /// The output array, element-wise Heaviside step function of x1. + /// This is a scalar if both x1 and x2 are scalars. /// - public static NDarray heaviside(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.heaviside(x1, x2, @out:@out, @where:@where); + public static NDarray heaviside(this NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x1, + 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. + /// 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. + /// The arrays holding the elements to be compared.

+ /// They must have + /// the same shape, or shapes that can be broadcast to a single shape. /// /// - /// 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 static NDarray maximum(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.maximum(x2, x1, @out:@out, @where:@where); - - /// - /// 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 maximum of x1 and x2, element-wise.

+ /// + /// This is a scalar if both x1 and x2 are scalars. + ///
+ public static NDarray maximum(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// The arrays holding the elements to be compared.

+ /// They must have + /// the same shape, or shapes that can be broadcast to a single shape. /// /// - /// 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 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. + /// The minimum of x1 and x2, element-wise.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray minimum(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.minimum(x2, x1, @out:@out, @where:@where); + public static NDarray minimum(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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. + /// The arrays holding the elements to be compared.

+ /// They must have + /// the same shape. /// /// - /// 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 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. + /// The maximum of x1 and x2, element-wise.

+ /// + /// This is a scalar if both x1 and x2 are scalars. ///
- public static NDarray fmax(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fmax(x2, x1, @out:@out, @where:@where); + public static NDarray fmax(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. + /// 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. + /// The arrays holding the elements to be compared.

+ /// They must have + /// the same shape. /// /// - /// 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 static NDarray fmin(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) - => NumPy.Instance.fmin(x2, x1, @out:@out, @where:@where); - - /// - /// 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. + /// 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 static NDarray fmin(this NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x2, + 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. ///
/// - /// Input data. + /// Input data. /// /// - /// 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. + /// 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. + /// x, with the non-finite values replaced.

+ /// If copy is False, this may + /// be x itself. ///
- public static NDarray nan_to_num(NDarray x, bool? copy = true) - => NumPy.Instance.nan_to_num(x, copy:copy); + public static NDarray nan_to_num(this NDarray x, bool? copy = true) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + 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. + /// 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. ///
/// - /// Input array. + /// Input array. /// /// - /// Tolerance in machine epsilons for the complex part of the elements - /// in the array. + /// 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. + /// If a is real, the type of a is used for the output.

+ /// If a + /// has complex elements, the returned type is float. ///
- public static NDarray real_if_close(NDarray a, float tol = 100) - => NumPy.Instance.real_if_close(a, tol); + public static NDarray real_if_close(this NDarray a, float tol = 100) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (tol!=100) kwargs["tol"]=ToPython(tol); + dynamic py = __self__.InvokeMethod("real_if_close", pyargs, kwargs); + return ToCsharp(py); + } /* /// - /// One-dimensional linear interpolation. - /// - /// Returns the one-dimensional piecewise linear interpolant to a function - /// with given discrete data points (xp, fp), evaluated at x. - /// - /// Notes - /// - /// Does not check that the x-coordinate sequence xp is increasing. - /// If xp is not increasing, the results are nonsense. - /// A simple check for increasing is: + /// 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 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 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. + /// 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[0], default is fp[0]. /// /// - /// Value to return for x > xp[-1], default is fp[-1]. + /// 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. + /// 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. + /// The interpolated values, same shape as x. /// - public static float or complex (corresponding to fp) or ndarray interp(NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) - => NumPy.Instance.interp(x, xp, fp, left:left, right:right, period:period); + public static float or complex (corresponding to fp) or ndarray interp(this NDarray x, 1-D sequence of floats xp, 1-D sequence of float or complex fp, optional float or complex corresponding to fp left = null, optional float or complex corresponding to fp right = null, None or float period = null) + { + //auto-generated code, do not change + var __self__=self; + 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); + } */ diff --git a/src/Numpy.Bare/NumPy.conv.gen.cs b/src/Numpy/np.module.gen.cs similarity index 57% rename from src/Numpy.Bare/NumPy.conv.gen.cs rename to src/Numpy/np.module.gen.cs index e8de74f..eaf6da8 100644 --- a/src/Numpy.Bare/NumPy.conv.gen.cs +++ b/src/Numpy/np.module.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -10,51 +10,62 @@ using System.Text; using Python.Runtime; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { - public partial class NumPy : IDisposable + public static partial class np { + static np() + { + ReInitializeLazySelf(); + } - private PyObject _pyobj = null; - public static NumPy Instance => _instance.Value; + public static PyObject self => _lazy_self.Value; - private static Lazy _instance = new Lazy(() => + private static Lazy _lazy_self = default; + private static void ReInitializeLazySelf() => _lazy_self = new Lazy(() => { - var instance=new NumPy(); try { - instance._pyobj = InstallAndImport(); + return InstallAndImport(); } catch (Exception) { - // retry to fix the installation by forcing a repair. - instance._pyobj = InstallAndImport(force: true); + // retry to fix the installation by forcing a repair, if Python.Included is used. + return InstallAndImport(force: true); } - return instance; } ); private static PyObject InstallAndImport(bool force = false) { + #if PYTHON_INCLUDED + Installer.SetupPython(force).Wait(); + #endif + #if PYTHON_INCLUDED + Installer.InstallWheel(typeof(np).Assembly, "numpy-1.23.5-cp311-cp311-win_amd64.whl", force).Wait(); + #endif + PythonEngine.AddShutdownHandler(() => ReInitializeLazySelf()); PythonEngine.Initialize(); var mod = Py.Import("numpy"); return mod; } - public dynamic self => _pyobj; - private bool IsInitialized => _pyobj != null; + public static dynamic dynamic_self => self; + private static bool IsInitialized => self != null; - private NumPy() { } - public void Dispose() + public static void Dispose() { self?.Dispose(); } //auto-generated - protected PyTuple ToTuple(Array input) + private static PyTuple ToTuple(Array input) { var array = new PyObject[input.Length]; for (int i = 0; i < input.Length; i++) @@ -65,29 +76,33 @@ protected PyTuple ToTuple(Array input) } //auto-generated - protected PyObject ToPython(object obj) + internal static PyObject ToPython(object obj) { - if (obj == null) return Runtime.GetPyNone(); + if (obj == null) return Runtime.None; switch (obj) { // basic types case int o: return new PyInt(o); + case long o: return new PyInt(o); case float o: return new PyFloat(o); case double o: return new PyFloat(o); case string o: return new PyString(o); + case bool o: return ConverterExtension.ToPython(o); case PyObject o: return o; // sequence types case Array o: return ToTuple(o); // special types from 'ToPythonConversions' + case Axis o: return o.Axes==null ? null : ToTuple(o.Axes); case Shape o: return ToTuple(o.Dimensions); case Slice o: return o.ToPython(); case PythonObject o: return o.PyObject; + case Dictionary o: return ToDict(o); default: throw new NotImplementedException($"Type is not yet supported: { obj.GetType().Name}. Add it to 'ToPythonConversions'"); } } //auto-generated - protected T ToCsharp(dynamic pyobj) + internal static T ToCsharp(dynamic pyobj) { switch (typeof(T).Name) { @@ -107,13 +122,38 @@ protected T ToCsharp(dynamic pyobj) default: throw new NotImplementedException($"Type NDarray<{typeof(T).GenericTypeArguments[0].Name}> missing. Add it to 'ToCsharpConversions'"); } break; + case "NDarray[]": + var po = pyobj as PyObject; + var len = po.Length(); + var rv = new NDarray[len]; + for (int i = 0; i < len; i++) + rv[i] = ToCsharp(po[i]); + return (T) (object) rv; case "Matrix": return (T)(object)new Matrix(pyobj); - default: return (T)pyobj; + default: + var pyClass = $"{pyobj.__class__}"; + if (pyClass == "") + { + return (T)(object)pyobj.ToString(); + } + if (pyClass.StartsWith("(); + } + try + { + return pyobj.As(); + } + catch (Exception e) + { + throw new NotImplementedException($"conversion from {pyobj.__class__} to {typeof(T).Name} not implemented", e); + return default(T); + } } } //auto-generated - protected T SharpToSharp(object obj) + internal static T SharpToSharp(object obj) { if (obj == null) return default(T); switch (obj) @@ -127,11 +167,14 @@ protected T SharpToSharp(object obj) } //auto-generated: SpecialConversions - protected NDarray ConvertArrayToNDarray(Array a) + private static NDarray ConvertArrayToNDarray(Array a) { switch(a) { case bool[] arr: return np.array(arr); + case int[] arr: return np.array(arr); + case float[] arr: return np.array(arr); + case double[] arr: return np.array(arr); case int[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); case float[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); case double[,] arr: return np.array(arr.Cast().ToArray()).reshape(arr.GetLength(0), arr.GetLength(1)); @@ -139,5 +182,14 @@ protected NDarray ConvertArrayToNDarray(Array a) default: throw new NotImplementedException($"Type {a.GetType()} not supported yet in ConvertArrayToNDarray."); } } + + //auto-generated: SpecialConversions + private static PyDict ToDict(Dictionary d) + { + var dict = new PyDict(); + foreach (var pair in d) + dict[new PyString(pair.Key)] = pair.Value.self; + return dict; + } } } diff --git a/src/Numpy/np.other.gen.cs b/src/Numpy/np.other.gen.cs new file mode 100644 index 0000000..3e4fbdf --- /dev/null +++ b/src/Numpy/np.other.gen.cs @@ -0,0 +1,57 @@ +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) +// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion + +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 + { + + /// + /// Return the roots of a polynomial with coefficients given in p.

+ /// + /// The values in the rank-1 array p are coefficients of a polynomial.

+ /// + /// If the length of p is n+1 then the polynomial is described by: + /// + /// Notes + /// + /// The algorithm relies on computing the eigenvalues of the + /// companion matrix [1].

+ /// + /// References + ///
+ /// + /// Rank-1 array of polynomial coefficients. + /// + /// + /// An array containing the roots of the polynomial. + /// + public static NDarray roots(this NDarray p) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + p, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("roots", pyargs, kwargs); + return ToCsharp(py); + } + + + } +} diff --git a/src/Numpy/np.padding.gen.cs b/src/Numpy/np.padding.gen.cs index 9f91dfa..dd5083b 100644 --- a/src/Numpy/np.padding.gen.cs +++ b/src/Numpy/np.padding.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,92 +20,114 @@ public static partial class np { /// - /// Pads an array. - /// - /// Notes - /// - /// For an array with rank greater than 1, some of the padding of later - /// axes is calculated from padding of previous axes. This is easiest to - /// think about with a rank 2 array where the corners of the padded array - /// are calculated by using padded values from the first axis. - /// - /// The padding function, if used, should return a rank 1 array equal in - /// length to the vector argument with padded values replaced. It has the - /// following signature: - /// - /// where + /// Pads an array.

+ /// + /// Notes + /// + /// For an array with rank greater than 1, some of the padding of later + /// axes is calculated from padding of previous axes.

+ /// This is easiest to + /// think about with a rank 2 array where the corners of the padded array + /// are calculated by using padded values from the first axis.

+ /// + /// The padding function, if used, should return a rank 1 array equal in + /// length to the vector argument with padded values replaced.

+ /// It has the + /// following signature: + /// + /// where ///
/// - /// Input array + /// Input array /// /// - /// Number of values padded to the edges of each axis. - /// ((before_1, after_1), … (before_N, after_N)) unique pad widths - /// for each axis. - /// ((before, after),) yields same before and after pad for each axis. - /// (pad,) or int is a shortcut for before = after = pad width for all - /// axes. + /// Number of values padded to the edges of each axis.

+ /// + /// ((before_1, after_1), … (before_N, after_N)) unique pad widths + /// for each axis.

+ /// + /// ((before, after),) yields same before and after pad for each axis.

+ /// + /// (pad,) or int is a shortcut for before = after = pad width for all + /// axes. /// /// - /// One of the following string values or a user supplied function. + /// One of the following string values or a user supplied function. /// /// - /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of - /// values at edge of each axis used to calculate the statistic value. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique statistic - /// lengths for each axis. - /// - /// ((before, after),) yields same before and after statistic lengths - /// for each axis. - /// - /// (stat_length,) or int is a shortcut for before = after = statistic - /// length for all axes. - /// - /// Default is None, to use the entire axis. + /// Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of + /// values at edge of each axis used to calculate the statistic value.

+ /// + /// ((before_1, after_1), … (before_N, after_N)) unique statistic + /// lengths for each axis.

+ /// + /// ((before, after),) yields same before and after statistic lengths + /// for each axis.

+ /// + /// (stat_length,) or int is a shortcut for before = after = statistic + /// length for all axes.

+ /// + /// Default is None, to use the entire axis. /// /// - /// Used in ‘constant’. The values to set the padded values for each - /// axis. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique pad constants - /// for each axis. - /// - /// ((before, after),) yields same before and after constants for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = constant for - /// all axes. - /// - /// Default is 0. + /// Used in ‘constant’. The values to set the padded values for each + /// axis.

+ /// + /// ((before_1, after_1), … (before_N, after_N)) unique pad constants + /// for each axis.

+ /// + /// ((before, after),) yields same before and after constants for each + /// axis.

+ /// + /// (constant,) or int is a shortcut for before = after = constant for + /// all axes.

+ /// + /// Default is 0. /// /// - /// Used in ‘linear_ramp’. The values used for the ending value of the - /// linear_ramp and that will form the edge of the padded array. - /// - /// ((before_1, after_1), … (before_N, after_N)) unique end values - /// for each axis. - /// - /// ((before, after),) yields same before and after end values for each - /// axis. - /// - /// (constant,) or int is a shortcut for before = after = end value for - /// all axes. - /// - /// Default is 0. + /// Used in ‘linear_ramp’. The values used for the ending value of the + /// linear_ramp and that will form the edge of the padded array.

+ /// + /// ((before_1, after_1), … (before_N, after_N)) unique end values + /// for each axis.

+ /// + /// ((before, after),) yields same before and after end values for each + /// axis.

+ /// + /// (constant,) or int is a shortcut for before = after = end value for + /// all axes.

+ /// + /// Default is 0. /// /// - /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the - /// default with an unaltered reflection around the edge value. For - /// the ‘odd’ style, the extended part of the array is created by - /// subtracting the reflected values from two times the edge value. + /// Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the + /// default with an unaltered reflection around the edge value.

+ /// For + /// the ‘odd’ style, the extended part of the array is created by + /// subtracting the reflected values from two times the edge value. /// /// - /// Padded array of rank equal to array with shape increased - /// according to pad_width. + /// Padded array of rank equal to array with shape increased + /// according to pad_width. /// - public static NDarray pad(NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) - => NumPy.Instance.pad(array, pad_width, mode, stat_length:stat_length, constant_values:constant_values, end_values:end_values, reflect_type:reflect_type); + public static NDarray pad(this NDarray array, NDarray pad_width, string mode, int[] stat_length = null, int[] constant_values = null, int[] end_values = null, string reflect_type = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + array, + pad_width, + mode, + }); + var kwargs=new PyDict(); + if (stat_length!=null) kwargs["stat_length"]=ToPython(stat_length); + if (constant_values!=null) kwargs["constant_values"]=ToPython(constant_values); + if (end_values!=null) kwargs["end_values"]=ToPython(end_values); + if (reflect_type!=null) kwargs["reflect_type"]=ToPython(reflect_type); + dynamic py = __self__.InvokeMethod("pad", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.random.gen.cs b/src/Numpy/np.random.gen.cs index 1fbb923..bcbc5b9 100644 --- a/src/Numpy/np.random.gen.cs +++ b/src/Numpy/np.random.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -19,2008 +21,2867 @@ public static partial class np public static partial class random { /// - /// Random values in a given shape. - /// - /// Create an array of the given shape and populate it with - /// random samples from a uniform distribution - /// over [0, 1). - /// - /// Notes - /// - /// This is a convenience function. If you want an interface that - /// takes a shape-tuple as the first argument, refer to - /// np.random.random_sample . + /// Random values in a given shape.

+ /// + /// Create an array of the given shape and populate it with + /// random samples from a uniform distribution + /// over [0, 1).

+ /// + /// Notes + /// + /// This is a convenience function.

+ /// If you want an interface that + /// takes a shape-tuple as the first argument, refer to + /// np.random.random_sample . ///
- /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should all be positive. - /// If no argument is given a single Python float is returned. - /// /// - /// Random values. + /// Random values. /// - public static NDarray rand(int? d1 = null, int? d0 = null) - => NumPy.Instance.random_rand(d1:d1, d0:d0); + public static float rand() + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + dynamic py = __self__.InvokeMethod("rand"); + return ToCsharp(py); + } } public static partial class random { /// - /// Return a sample (or samples) from the “standard normal” distribution. - /// - /// If positive, int_like or int-convertible arguments are provided, - /// randn generates an array of shape (d0, d1, ..., dn), filled - /// with random floats sampled from a univariate “normal” (Gaussian) - /// distribution of mean 0 and variance 1 (if any of the are - /// floats, they are first converted to integers by truncation). A single - /// float randomly sampled from the distribution is returned if no - /// argument is provided. - /// - /// This is a convenience function. If you want an interface that takes a - /// tuple as the first argument, use numpy.random.standard_normal instead. - /// - /// Notes - /// - /// For random samples from , use: - /// - /// sigma * np.random.randn(...) + mu + /// Return a sample (or samples) from the “standard normal” distribution.

+ /// + /// If positive, int_like or int-convertible arguments are provided, + /// randn generates an array of shape (d0, d1, ..., dn), filled + /// with random floats sampled from a univariate “normal” (Gaussian) + /// distribution of mean 0 and variance 1 (if any of the are + /// floats, they are first converted to integers by truncation).

+ /// A single + /// float randomly sampled from the distribution is returned if no + /// argument is provided.

+ /// + /// This is a convenience function.

+ /// If you want an interface that takes a + /// tuple as the first argument, use numpy.random.standard_normal instead.

+ /// + /// Notes + /// + /// For random samples from , use: + /// + /// sigma * np.random.randn(...) + mu ///
- /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// - /// - /// The dimensions of the returned array, should be all positive. - /// If no argument is given a single Python float is returned. - /// /// - /// A (d0, d1, ..., dn)-shaped array of floating-point samples from - /// the standard normal distribution, or a single such float if - /// no parameters were supplied. + /// A (d0, d1, ..., dn)-shaped array of floating-point samples from + /// the standard normal distribution, or a single such float if + /// no parameters were supplied. /// - public static NDarray randn(int? d1 = null, int? d0 = null) - => NumPy.Instance.random_randn(d1:d1, d0:d0); + public static float randn() + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + dynamic py = __self__.InvokeMethod("randn"); + return ToCsharp(py); + } } public static partial class random { /// - /// Return random integers from low (inclusive) to high (exclusive). - /// - /// Return random integers from the “discrete uniform” distribution of - /// the specified dtype in the “half-open” interval [low, high). If - /// high is None (the default), then results are from [0, low). + /// Return random integers from low (inclusive) to high (exclusive).

+ /// + /// Return random integers from the “discrete uniform” distribution of + /// the specified dtype in the “half-open” interval [low, high).

+ /// If + /// high is None (the default), then results are from [0, low). ///
/// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is one above the - /// highest such integer). + /// Lowest (signed) integer to be drawn from the distribution (unless + /// high=None, in which case this parameter is one above the + /// highest such integer). /// /// - /// If provided, one above the largest (signed) integer to be drawn - /// from the distribution (see above for behavior if high=None). + /// If provided, one above the largest (signed) integer to be drawn + /// from the distribution (see above for behavior if high=None). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Desired dtype of the result. All dtypes are determined by their - /// name, i.e., ‘int64’, ‘int’, etc, so byteorder is not available - /// and a specific precision may have different C types depending - /// on the platform. The default value is ‘np.int’. + /// Desired dtype of the result.

+ /// All dtypes are determined by their + /// name, i.e., ‘int64’, ‘int’, etc, so byteorder is not available + /// and a specific precision may have different C types depending + /// on the platform.

+ /// The default value is ‘np.int’. /// /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. + /// size-shaped array of random integers from the appropriate + /// distribution, or a single such random int if size not provided. /// public static NDarray randint(int low, int? high = null, int[] size = null, Dtype dtype = null) - => NumPy.Instance.random_randint(low, high:high, size:size, dtype:dtype); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + low, + }); + var kwargs=new PyDict(); + if (high!=null) kwargs["high"]=ToPython(high); + if (size!=null) kwargs["size"]=ToPython(size); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + dynamic py = __self__.InvokeMethod("randint", pyargs, kwargs); + return ToCsharp>(py); + } } public static partial class random { /// - /// Random integers of type np.int between low and high, inclusive. - /// - /// Return random integers of type np.int from the “discrete uniform” - /// distribution in the closed interval [low, high]. If high is - /// None (the default), then results are from [1, low]. The np.int - /// type translates to the C long type used by Python 2 for “short” - /// integers and its precision is platform dependent. - /// - /// This function has been deprecated. Use randint instead. - /// - /// Notes - /// - /// To sample from N evenly spaced floating-point numbers between a and b, - /// use: + /// Random integers of type np.int between low and high, inclusive.

+ /// + /// Return random integers of type np.int from the “discrete uniform” + /// distribution in the closed interval [low, high].

+ /// If high is + /// None (the default), then results are from [1, low].

+ /// The np.int + /// type translates to the C long type used by Python 2 for “short” + /// integers and its precision is platform dependent.

+ /// + /// This function has been deprecated.

+ /// Use randint instead.

+ /// + /// Notes + /// + /// To sample from N evenly spaced floating-point numbers between a and b, + /// use: ///
/// - /// Lowest (signed) integer to be drawn from the distribution (unless - /// high=None, in which case this parameter is the highest such - /// integer). + /// Lowest (signed) integer to be drawn from the distribution (unless + /// high=None, in which case this parameter is the highest such + /// integer). /// /// - /// If provided, the largest (signed) integer to be drawn from the - /// distribution (see above for behavior if high=None). + /// If provided, the largest (signed) integer to be drawn from the + /// distribution (see above for behavior if high=None). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// size-shaped array of random integers from the appropriate - /// distribution, or a single such random int if size not provided. + /// size-shaped array of random integers from the appropriate + /// distribution, or a single such random int if size not provided. /// public static NDarray random_integers(int low, int? high = null, int[] size = null) - => NumPy.Instance.random_random_integers(low, high:high, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + low, + }); + var kwargs=new PyDict(); + if (high!=null) kwargs["high"]=ToPython(high); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("random_integers", pyargs, kwargs); + return ToCsharp>(py); + } } public static partial class random { /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: + /// Return random floats in the half-open interval [0.0, 1.0).

+ /// + /// Results are from the “continuous uniform” distribution over the + /// stated interval.

+ /// To sample multiply + /// the output of random_sample by (b-a) and add a: ///
/// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). + /// Array of random floats of shape size (unless size=None, in which + /// case a single float is returned). /// - public static NDarray random_sample(int[] size = null) - => NumPy.Instance.random_random_sample(size:size); + public static NDarray random_sample(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("random_sample", pyargs, kwargs); + return ToCsharp>(py); + } } public static partial class random { /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: + /// Return random floats in the half-open interval [0.0, 1.0).

+ /// + /// Results are from the “continuous uniform” distribution over the + /// stated interval.

+ /// To sample multiply + /// the output of random_sample by (b-a) and add a: ///
/// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). + /// Array of random floats of shape size (unless size=None, in which + /// case a single float is returned). /// - public static NDarray random_(int[] size = null) - => NumPy.Instance.random_random(size:size); + public static NDarray random_(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("random", pyargs, kwargs); + return ToCsharp>(py); + } } public static partial class random { /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: + /// Return random floats in the half-open interval [0.0, 1.0).

+ /// + /// Results are from the “continuous uniform” distribution over the + /// stated interval.

+ /// To sample multiply + /// the output of random_sample by (b-a) and add a: ///
/// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). + /// Array of random floats of shape size (unless size=None, in which + /// case a single float is returned). /// - public static NDarray ranf(int[] size = null) - => NumPy.Instance.random_ranf(size:size); + public static NDarray ranf(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("ranf", pyargs, kwargs); + return ToCsharp>(py); + } } public static partial class random { /// - /// Return random floats in the half-open interval [0.0, 1.0). - /// - /// Results are from the “continuous uniform” distribution over the - /// stated interval. To sample multiply - /// the output of random_sample by (b-a) and add a: + /// Return random floats in the half-open interval [0.0, 1.0).

+ /// + /// Results are from the “continuous uniform” distribution over the + /// stated interval.

+ /// To sample multiply + /// the output of random_sample by (b-a) and add a: ///
/// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Array of random floats of shape size (unless size=None, in which - /// case a single float is returned). + /// Array of random floats of shape size (unless size=None, in which + /// case a single float is returned). /// - public static NDarray sample(int[] size = null) - => NumPy.Instance.random_sample(size:size); + public static NDarray sample(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("sample", pyargs, kwargs); + return ToCsharp>(py); + } } public static partial class random { /// - /// Generates a random sample from a given 1-D array + /// Generates a random sample from a given 1-D array /// /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) + /// If an ndarray, a random sample is generated from its elements.

+ /// + /// If an int, the random sample is generated as if a were np.arange(a) /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Whether the sample is with or without replacement + /// Whether the sample is with or without replacement /// /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. + /// The probabilities associated with each entry in a.

+ /// + /// If not given the sample assumes a uniform distribution over all + /// entries in a. /// /// - /// The generated random samples + /// The generated random samples /// public static NDarray choice(NDarray a, int[] size = null, bool? replace = true, NDarray p = null) - => NumPy.Instance.random_choice(a, size:size, replace:replace, p:p); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + if (replace!=true) kwargs["replace"]=ToPython(replace); + if (p!=null) kwargs["p"]=ToPython(p); + dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Generates a random sample from a given 1-D array + /// Generates a random sample from a given 1-D array /// /// - /// If an ndarray, a random sample is generated from its elements. - /// If an int, the random sample is generated as if a were np.arange(a) + /// If an ndarray, a random sample is generated from its elements.

+ /// + /// If an int, the random sample is generated as if a were np.arange(a) /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Whether the sample is with or without replacement + /// Whether the sample is with or without replacement /// /// - /// The probabilities associated with each entry in a. - /// If not given the sample assumes a uniform distribution over all - /// entries in a. + /// The probabilities associated with each entry in a.

+ /// + /// If not given the sample assumes a uniform distribution over all + /// entries in a. /// /// - /// The generated random samples + /// The generated random samples /// public static NDarray choice(int a, int[] size = null, bool? replace = true, NDarray p = null) - => NumPy.Instance.random_choice(a, size:size, replace:replace, p:p); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + if (replace!=true) kwargs["replace"]=ToPython(replace); + if (p!=null) kwargs["p"]=ToPython(p); + dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Return random bytes. + /// Return random bytes. /// /// - /// Number of random bytes. + /// Number of random bytes. /// /// - /// String of length length. + /// String of length length. /// public static string bytes(int length) - => NumPy.Instance.random_bytes(length); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + length, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("bytes", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Modify a sequence in-place by shuffling its contents. - /// - /// This function only shuffles the array along the first axis of a - /// multi-dimensional array. The order of sub-arrays is changed but - /// their contents remains the same. + /// Modify a sequence in-place by shuffling its contents.

+ /// + /// This function only shuffles the array along the first axis of a + /// multi-dimensional array.

+ /// The order of sub-arrays is changed but + /// their contents remains the same. ///
/// - /// The array or list to be shuffled. + /// The array or list to be shuffled. /// public static void shuffle(NDarray x) - => NumPy.Instance.random_shuffle(x); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("shuffle", pyargs, kwargs); + } } public static partial class random { /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. + /// Randomly permute a sequence, or return a permuted range.

+ /// + /// If x is a multi-dimensional array, it is only shuffled along its + /// first index. ///
/// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. + /// If x is an integer, randomly permute np.arange(x).

+ /// + /// If x is an array, make a copy and shuffle the elements + /// randomly. /// /// - /// Permuted sequence or array range. + /// Permuted sequence or array range. /// public static NDarray permutation(NDarray x) - => NumPy.Instance.random_permutation(x); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Randomly permute a sequence, or return a permuted range. - /// - /// If x is a multi-dimensional array, it is only shuffled along its - /// first index. + /// Randomly permute a sequence, or return a permuted range.

+ /// + /// If x is a multi-dimensional array, it is only shuffled along its + /// first index. ///
/// - /// If x is an integer, randomly permute np.arange(x). - /// If x is an array, make a copy and shuffle the elements - /// randomly. + /// If x is an integer, randomly permute np.arange(x).

+ /// + /// If x is an array, make a copy and shuffle the elements + /// randomly. /// /// - /// Permuted sequence or array range. + /// Permuted sequence or array range. /// public static NDarray permutation(int x) - => NumPy.Instance.random_permutation(x); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Beta distribution. - /// - /// The Beta distribution is a special case of the Dirichlet distribution, - /// and is related to the Gamma distribution. It has the probability - /// distribution function - /// - /// where the normalisation, B, is the beta function, - /// - /// It is often seen in Bayesian inference and order statistics. + /// Draw samples from a Beta distribution.

+ /// + /// The Beta distribution is a special case of the Dirichlet distribution, + /// and is related to the Gamma distribution.

+ /// It has the probability + /// distribution function + /// + /// where the normalisation, B, is the beta function, + /// + /// It is often seen in Bayesian inference and order statistics. ///
/// - /// Alpha, positive (>0). + /// Alpha, positive (>0). /// /// - /// Beta, positive (>0). + /// Beta, positive (>0). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a and b are both scalars. - /// Otherwise, np.broadcast(a, b).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if a and b are both scalars.

+ /// + /// Otherwise, np.broadcast(a, b).size samples are drawn. /// /// - /// Drawn samples from the parameterized beta distribution. + /// Drawn samples from the parameterized beta distribution. /// public static NDarray beta(NDarray a, NDarray b, int[] size = null) - => NumPy.Instance.random_beta(a, b, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + b, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("beta", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References + /// Draw samples from a binomial distribution.

+ /// + /// Samples are drawn from a binomial distribution with specified + /// parameters, n trials and p probability of success where + /// n an integer >= 0 and p is in the interval [0,1].

+ /// (n may be + /// input as a float, but it is truncated to an integer in use) + /// + /// Notes + /// + /// The probability density for the binomial distribution is + /// + /// where is the number of trials, is the probability + /// of success, and is the number of successes.

+ /// + /// When estimating the standard error of a proportion in a population by + /// using a random sample, the normal distribution works well unless the + /// product p*n <=5, where p = population proportion estimate, and n = + /// number of samples, in which case the binomial distribution is used + /// instead.

+ /// For example, a sample of 15 people shows 4 who are left + /// handed, and 11 who are right handed.

+ /// Then p = 4/15 = 27%. 0.27*15 = 4, + /// so the binomial distribution should be used in this case.

+ /// + /// References ///
/// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. + /// Parameter of the distribution, >= 0.

+ /// Floats are also accepted, + /// but they will be truncated to integers. /// /// - /// Parameter of the distribution, >= 0 and <=1. + /// Parameter of the distribution, >= 0 and <=1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if n and p are both scalars.

+ /// + /// Otherwise, np.broadcast(n, p).size samples are drawn. /// /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. + /// Drawn samples from the parameterized binomial distribution, where + /// each sample is equal to the number of successes over the n trials. /// public static NDarray binomial(NDarray n, NDarray p, int[] size = null) - => NumPy.Instance.random_binomial(n, p, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + n, + p, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a binomial distribution. - /// - /// Samples are drawn from a binomial distribution with specified - /// parameters, n trials and p probability of success where - /// n an integer >= 0 and p is in the interval [0,1]. (n may be - /// input as a float, but it is truncated to an integer in use) - /// - /// Notes - /// - /// The probability density for the binomial distribution is - /// - /// where is the number of trials, is the probability - /// of success, and is the number of successes. - /// - /// When estimating the standard error of a proportion in a population by - /// using a random sample, the normal distribution works well unless the - /// product p*n <=5, where p = population proportion estimate, and n = - /// number of samples, in which case the binomial distribution is used - /// instead. For example, a sample of 15 people shows 4 who are left - /// handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4, - /// so the binomial distribution should be used in this case. - /// - /// References + /// Draw samples from a binomial distribution.

+ /// + /// Samples are drawn from a binomial distribution with specified + /// parameters, n trials and p probability of success where + /// n an integer >= 0 and p is in the interval [0,1].

+ /// (n may be + /// input as a float, but it is truncated to an integer in use) + /// + /// Notes + /// + /// The probability density for the binomial distribution is + /// + /// where is the number of trials, is the probability + /// of success, and is the number of successes.

+ /// + /// When estimating the standard error of a proportion in a population by + /// using a random sample, the normal distribution works well unless the + /// product p*n <=5, where p = population proportion estimate, and n = + /// number of samples, in which case the binomial distribution is used + /// instead.

+ /// For example, a sample of 15 people shows 4 who are left + /// handed, and 11 who are right handed.

+ /// Then p = 4/15 = 27%. 0.27*15 = 4, + /// so the binomial distribution should be used in this case.

+ /// + /// References ///
/// - /// Parameter of the distribution, >= 0. Floats are also accepted, - /// but they will be truncated to integers. + /// Parameter of the distribution, >= 0.

+ /// Floats are also accepted, + /// but they will be truncated to integers. /// /// - /// Parameter of the distribution, >= 0 and <=1. + /// Parameter of the distribution, >= 0 and <=1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if n and p are both scalars.

+ /// + /// Otherwise, np.broadcast(n, p).size samples are drawn. /// /// - /// Drawn samples from the parameterized binomial distribution, where - /// each sample is equal to the number of successes over the n trials. + /// Drawn samples from the parameterized binomial distribution, where + /// each sample is equal to the number of successes over the n trials. /// public static NDarray binomial(int n, NDarray p, int[] size = null) - => NumPy.Instance.random_binomial(n, p, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + n, + p, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a chi-square distribution. - /// - /// When df independent random variables, each with standard normal - /// distributions (mean 0, variance 1), are squared and summed, the - /// resulting distribution is chi-square (see Notes). This distribution - /// is often used in hypothesis testing. - /// - /// Notes - /// - /// The variable obtained by summing the squares of df independent, - /// standard normally distributed random variables: - /// - /// is chi-square distributed, denoted - /// - /// The probability density function of the chi-squared distribution is - /// - /// where is the gamma function, - /// - /// References + /// Draw samples from a chi-square distribution.

+ /// + /// When df independent random variables, each with standard normal + /// distributions (mean 0, variance 1), are squared and summed, the + /// resulting distribution is chi-square (see Notes).

+ /// This distribution + /// is often used in hypothesis testing.

+ /// + /// Notes + /// + /// The variable obtained by summing the squares of df independent, + /// standard normally distributed random variables: + /// + /// is chi-square distributed, denoted + /// + /// The probability density function of the chi-squared distribution is + /// + /// where is the gamma function, + /// + /// References ///
/// - /// Number of degrees of freedom, should be > 0. + /// Number of degrees of freedom, should be > 0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if df is a scalar.

+ /// Otherwise, + /// np.array(df).size samples are drawn. /// /// - /// Drawn samples from the parameterized chi-square distribution. + /// Drawn samples from the parameterized chi-square distribution. /// public static NDarray chisquare(NDarray df, int[] size = null) - => NumPy.Instance.random_chisquare(df, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + df, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("chisquare", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from the Dirichlet distribution. - /// - /// Draw size samples of dimension k from a Dirichlet distribution. A - /// Dirichlet-distributed random variable can be seen as a multivariate - /// generalization of a Beta distribution. Dirichlet pdf is the conjugate - /// prior of a multinomial in Bayesian inference. - /// - /// Notes - /// - /// Uses the following property for computation: for each dimension, - /// draw a random sample y_i from a standard gamma generator of shape - /// alpha_i, then - /// is - /// Dirichlet distributed. - /// - /// References + /// Draw samples from the Dirichlet distribution.

+ /// + /// Draw size samples of dimension k from a Dirichlet distribution.

+ /// A + /// Dirichlet-distributed random variable can be seen as a multivariate + /// generalization of a Beta distribution.

+ /// Dirichlet pdf is the conjugate + /// prior of a multinomial in Bayesian inference.

+ /// + /// Notes + /// + /// Uses the following property for computation: for each dimension, + /// draw a random sample y_i from a standard gamma generator of shape + /// alpha_i, then + /// is + /// Dirichlet distributed.

+ /// + /// References ///
/// - /// Parameter of the distribution (k dimension for sample of - /// dimension k). + /// Parameter of the distribution (k dimension for sample of + /// dimension k). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// The drawn samples, of shape (size, alpha.ndim). + /// The drawn samples, of shape (size, alpha.ndim). /// public static NDarray dirichlet(NDarray alpha, int[] size = null) - => NumPy.Instance.random_dirichlet(alpha, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + alpha, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("dirichlet", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from an exponential distribution. - /// - /// Its probability density function is - /// - /// for x > 0 and 0 elsewhere. is the scale parameter, - /// which is the inverse of the rate parameter . - /// The rate parameter is an alternative, widely used parameterization - /// of the exponential distribution [3]. - /// - /// The exponential distribution is a continuous analogue of the - /// geometric distribution. It describes many common situations, such as - /// the size of raindrops measured over many rainstorms [1], or the time - /// between page requests to Wikipedia [2]. - /// - /// References + /// Draw samples from an exponential distribution.

+ /// + /// Its probability density function is + /// + /// for x > 0 and 0 elsewhere.

+ /// is the scale parameter, + /// which is the inverse of the rate parameter . + /// The rate parameter is an alternative, widely used parameterization + /// of the exponential distribution [3].

+ /// + /// The exponential distribution is a continuous analogue of the + /// geometric distribution.

+ /// It describes many common situations, such as + /// the size of raindrops measured over many rainstorms [1], or the time + /// between page requests to Wikipedia [2].

+ /// + /// References ///
/// - /// The scale parameter, . + /// The scale parameter, . /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if scale is a scalar.

+ /// Otherwise, + /// np.array(scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized exponential distribution. + /// Drawn samples from the parameterized exponential distribution. /// public static NDarray exponential(NDarray scale = null, int[] size = null) - => NumPy.Instance.random_exponential(scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (scale!=null) kwargs["scale"]=ToPython(scale); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("exponential", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from an F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters should be greater than - /// zero. - /// - /// The random variate of the F distribution (also known as the - /// Fisher distribution) is a continuous probability distribution - /// that arises in ANOVA tests, and is the ratio of two chi-square - /// variates. - /// - /// Notes - /// - /// The F statistic is used to compare in-group variances to between-group - /// variances. Calculating the distribution depends on the sampling, and - /// so it is a function of the respective degrees of freedom in the - /// problem. The variable dfnum is the number of samples minus one, the - /// between-groups degrees of freedom, while dfden is the within-groups - /// degrees of freedom, the sum of the number of samples in each group - /// minus the number of groups. - /// - /// References + /// Draw samples from an F distribution.

+ /// + /// Samples are drawn from an F distribution with specified parameters, + /// dfnum (degrees of freedom in numerator) and dfden (degrees of + /// freedom in denominator), where both parameters should be greater than + /// zero.

+ /// + /// The random variate of the F distribution (also known as the + /// Fisher distribution) is a continuous probability distribution + /// that arises in ANOVA tests, and is the ratio of two chi-square + /// variates.

+ /// + /// Notes + /// + /// The F statistic is used to compare in-group variances to between-group + /// variances.

+ /// Calculating the distribution depends on the sampling, and + /// so it is a function of the respective degrees of freedom in the + /// problem.

+ /// The variable dfnum is the number of samples minus one, the + /// between-groups degrees of freedom, while dfden is the within-groups + /// degrees of freedom, the sum of the number of samples in each group + /// minus the number of groups.

+ /// + /// References ///
/// - /// Degrees of freedom in numerator, should be > 0. + /// Degrees of freedom in numerator, should be > 0. /// /// - /// Degrees of freedom in denominator, should be > 0. + /// Degrees of freedom in denominator, should be > 0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum and dfden are both scalars. - /// Otherwise, np.broadcast(dfnum, dfden).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if dfnum and dfden are both scalars.

+ /// + /// Otherwise, np.broadcast(dfnum, dfden).size samples are drawn. /// /// - /// Drawn samples from the parameterized Fisher distribution. + /// Drawn samples from the parameterized Fisher distribution. /// public static NDarray f(NDarray dfnum, NDarray dfden, int[] size = null) - => NumPy.Instance.random_f(dfnum, dfden, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + dfnum, + dfden, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("f", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale (sometimes designated - /// “theta”), where both parameters are > 0. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References + /// Draw samples from a Gamma distribution.

+ /// + /// Samples are drawn from a Gamma distribution with specified parameters, + /// shape (sometimes designated “k”) and scale (sometimes designated + /// “theta”), where both parameters are > 0.

+ /// + /// Notes + /// + /// The probability density for the Gamma distribution is + /// + /// where is the shape and the scale, + /// and is the Gamma function.

+ /// + /// The Gamma distribution is often used to model the times to failure of + /// electronic components, and arises naturally in processes for which the + /// waiting times between Poisson distributed events are relevant.

+ /// + /// References ///
/// - /// The shape of the gamma distribution. Should be greater than zero. + /// The shape of the gamma distribution.

+ /// Should be greater than zero. /// /// - /// The scale of the gamma distribution. Should be greater than zero. - /// Default is equal to 1. + /// The scale of the gamma distribution.

+ /// Should be greater than zero.

+ /// + /// Default is equal to 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape and scale are both scalars. - /// Otherwise, np.broadcast(shape, scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if shape and scale are both scalars.

+ /// + /// Otherwise, np.broadcast(shape, scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized gamma distribution. + /// Drawn samples from the parameterized gamma distribution. /// public static NDarray gamma(Shape shape, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_gamma(shape, scale:scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (scale!=null) kwargs["scale"]=ToPython(scale); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("gamma", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from the geometric distribution. - /// - /// Bernoulli trials are experiments with one of two outcomes: - /// success or failure (an example of such an experiment is flipping - /// a coin). The geometric distribution models the number of trials - /// that must be run in order to achieve success. It is therefore - /// supported on the positive integers, k = 1, 2, .... - /// - /// The probability mass function of the geometric distribution is - /// - /// where p is the probability of success of an individual trial. + /// Draw samples from the geometric distribution.

+ /// + /// Bernoulli trials are experiments with one of two outcomes: + /// success or failure (an example of such an experiment is flipping + /// a coin).

+ /// The geometric distribution models the number of trials + /// that must be run in order to achieve success.

+ /// It is therefore + /// supported on the positive integers, k = 1, 2, .... + /// + /// The probability mass function of the geometric distribution is + /// + /// where p is the probability of success of an individual trial. ///
/// - /// The probability of success of an individual trial. + /// The probability of success of an individual trial. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if p is a scalar.

+ /// Otherwise, + /// np.array(p).size samples are drawn. /// /// - /// Drawn samples from the parameterized geometric distribution. + /// Drawn samples from the parameterized geometric distribution. /// public static NDarray geometric(NDarray p, int[] size = null) - => NumPy.Instance.random_geometric(p, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + p, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("geometric", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Gumbel distribution. - /// - /// Draw samples from a Gumbel distribution with specified location and - /// scale. For more information on the Gumbel distribution, see - /// Notes and References below. - /// - /// Notes - /// - /// The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme - /// Value Type I) distribution is one of a class of Generalized Extreme - /// Value (GEV) distributions used in modeling extreme value problems. - /// The Gumbel is a special case of the Extreme Value Type I distribution - /// for maximums from distributions with “exponential-like” tails. - /// - /// The probability density for the Gumbel distribution is - /// - /// where is the mode, a location parameter, and - /// is the scale parameter. - /// - /// The Gumbel (named for German mathematician Emil Julius Gumbel) was used - /// very early in the hydrology literature, for modeling the occurrence of - /// flood events. It is also used for modeling maximum wind speed and - /// rainfall rates. It is a “fat-tailed” distribution - the probability of - /// an event in the tail of the distribution is larger than if one used a - /// Gaussian, hence the surprisingly frequent occurrence of 100-year - /// floods. Floods were initially modeled as a Gaussian process, which - /// underestimated the frequency of extreme events. - /// - /// It is one of a class of extreme value distributions, the Generalized - /// Extreme Value (GEV) distributions, which also includes the Weibull and - /// Frechet. - /// - /// The function has a mean of and a variance - /// of . - /// - /// References + /// Draw samples from a Gumbel distribution.

+ /// + /// Draw samples from a Gumbel distribution with specified location and + /// scale.

+ /// For more information on the Gumbel distribution, see + /// Notes and References below.

+ /// + /// Notes + /// + /// The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme + /// Value Type I) distribution is one of a class of Generalized Extreme + /// Value (GEV) distributions used in modeling extreme value problems.

+ /// + /// The Gumbel is a special case of the Extreme Value Type I distribution + /// for maximums from distributions with “exponential-like” tails.

+ /// + /// The probability density for the Gumbel distribution is + /// + /// where is the mode, a location parameter, and + /// is the scale parameter.

+ /// + /// The Gumbel (named for German mathematician Emil Julius Gumbel) was used + /// very early in the hydrology literature, for modeling the occurrence of + /// flood events.

+ /// It is also used for modeling maximum wind speed and + /// rainfall rates.

+ /// It is a “fat-tailed” distribution - the probability of + /// an event in the tail of the distribution is larger than if one used a + /// Gaussian, hence the surprisingly frequent occurrence of 100-year + /// floods.

+ /// Floods were initially modeled as a Gaussian process, which + /// underestimated the frequency of extreme events.

+ /// + /// It is one of a class of extreme value distributions, the Generalized + /// Extreme Value (GEV) distributions, which also includes the Weibull and + /// Frechet.

+ /// + /// The function has a mean of and a variance + /// of . + /// + /// References ///
/// - /// The location of the mode of the distribution. Default is 0. + /// The location of the mode of the distribution.

+ /// Default is 0. /// /// - /// The scale parameter of the distribution. Default is 1. + /// The scale parameter of the distribution.

+ /// Default is 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if loc and scale are both scalars.

+ /// + /// Otherwise, np.broadcast(loc, scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized Gumbel distribution. + /// Drawn samples from the parameterized Gumbel distribution. /// public static NDarray gumbel(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_gumbel(loc:loc, scale:scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (loc!=null) kwargs["loc"]=ToPython(loc); + if (scale!=null) kwargs["scale"]=ToPython(scale); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("gumbel", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Hypergeometric distribution. - /// - /// Samples are drawn from a hypergeometric distribution with specified - /// parameters, ngood (ways to make a good selection), nbad (ways to make - /// a bad selection), and nsample = number of items sampled, which is less - /// than or equal to the sum ngood + nbad. - /// - /// Notes - /// - /// The probability density for the Hypergeometric distribution is - /// - /// where and - /// - /// for P(x) the probability of x successes, g = ngood, b = nbad, and - /// n = number of samples. - /// - /// Consider an urn with black and white marbles in it, ngood of them - /// black and nbad are white. If you draw nsample balls without - /// replacement, then the hypergeometric distribution describes the - /// distribution of black balls in the drawn sample. - /// - /// Note that this distribution is very similar to the binomial - /// distribution, except that in this case, samples are drawn without - /// replacement, whereas in the Binomial case samples are drawn with - /// replacement (or the sample space is infinite). As the sample space - /// becomes large, this distribution approaches the binomial. - /// - /// References + /// Draw samples from a Hypergeometric distribution.

+ /// + /// Samples are drawn from a hypergeometric distribution with specified + /// parameters, ngood (ways to make a good selection), nbad (ways to make + /// a bad selection), and nsample = number of items sampled, which is less + /// than or equal to the sum ngood + nbad.

+ /// + /// Notes + /// + /// The probability density for the Hypergeometric distribution is + /// + /// where and + /// + /// for P(x) the probability of x successes, g = ngood, b = nbad, and + /// n = number of samples.

+ /// + /// Consider an urn with black and white marbles in it, ngood of them + /// black and nbad are white.

+ /// If you draw nsample balls without + /// replacement, then the hypergeometric distribution describes the + /// distribution of black balls in the drawn sample.

+ /// + /// Note that this distribution is very similar to the binomial + /// distribution, except that in this case, samples are drawn without + /// replacement, whereas in the Binomial case samples are drawn with + /// replacement (or the sample space is infinite).

+ /// As the sample space + /// becomes large, this distribution approaches the binomial.

+ /// + /// References ///
/// - /// Number of ways to make a good selection. Must be nonnegative. + /// Number of ways to make a good selection.

+ /// Must be nonnegative. /// /// - /// Number of ways to make a bad selection. Must be nonnegative. + /// Number of ways to make a bad selection.

+ /// Must be nonnegative. /// /// - /// Number of items sampled. Must be at least 1 and at most - /// ngood + nbad. + /// Number of items sampled.

+ /// Must be at least 1 and at most + /// ngood + nbad. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if ngood, nbad, and nsample - /// are all scalars. Otherwise, np.broadcast(ngood, nbad, nsample).size - /// samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if ngood, nbad, and nsample + /// are all scalars.

+ /// Otherwise, np.broadcast(ngood, nbad, nsample).size + /// samples are drawn. /// /// - /// Drawn samples from the parameterized hypergeometric distribution. + /// Drawn samples from the parameterized hypergeometric distribution. /// public static NDarray hypergeometric(NDarray ngood, NDarray nbad, NDarray nsample, int[] size = null) - => NumPy.Instance.random_hypergeometric(ngood, nbad, nsample, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + ngood, + nbad, + nsample, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("hypergeometric", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from the Laplace or double exponential distribution with - /// specified location (or mean) and scale (decay). - /// - /// The Laplace distribution is similar to the Gaussian/normal distribution, - /// but is sharper at the peak and has fatter tails. It represents the - /// difference between two independent, identically distributed exponential - /// random variables. - /// - /// Notes - /// - /// It has the probability density function - /// - /// The first law of Laplace, from 1774, states that the frequency - /// of an error can be expressed as an exponential function of the - /// absolute magnitude of the error, which leads to the Laplace - /// distribution. For many problems in economics and health - /// sciences, this distribution seems to model the data better - /// than the standard Gaussian distribution. - /// - /// References + /// Draw samples from the Laplace or double exponential distribution with + /// specified location (or mean) and scale (decay).

+ /// + /// The Laplace distribution is similar to the Gaussian/normal distribution, + /// but is sharper at the peak and has fatter tails.

+ /// It represents the + /// difference between two independent, identically distributed exponential + /// random variables.

+ /// + /// Notes + /// + /// It has the probability density function + /// + /// The first law of Laplace, from 1774, states that the frequency + /// of an error can be expressed as an exponential function of the + /// absolute magnitude of the error, which leads to the Laplace + /// distribution.

+ /// For many problems in economics and health + /// sciences, this distribution seems to model the data better + /// than the standard Gaussian distribution.

+ /// + /// References ///
/// - /// The position, , of the distribution peak. Default is 0. + /// The position, , of the distribution peak.

+ /// Default is 0. /// /// - /// , the exponential decay. Default is 1. + /// , the exponential decay.

+ /// Default is 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if loc and scale are both scalars.

+ /// + /// Otherwise, np.broadcast(loc, scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized Laplace distribution. + /// Drawn samples from the parameterized Laplace distribution. /// public static NDarray laplace(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_laplace(loc:loc, scale:scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (loc!=null) kwargs["loc"]=ToPython(loc); + if (scale!=null) kwargs["scale"]=ToPython(scale); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("laplace", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a logistic distribution. - /// - /// Samples are drawn from a logistic distribution with specified - /// parameters, loc (location or mean, also median), and scale (>0). - /// - /// Notes - /// - /// The probability density for the Logistic distribution is - /// - /// where = location and = scale. - /// - /// The Logistic distribution is used in Extreme Value problems where it - /// can act as a mixture of Gumbel distributions, in Epidemiology, and by - /// the World Chess Federation (FIDE) where it is used in the Elo ranking - /// system, assuming the performance of each player is a logistically - /// distributed random variable. - /// - /// References + /// Draw samples from a logistic distribution.

+ /// + /// Samples are drawn from a logistic distribution with specified + /// parameters, loc (location or mean, also median), and scale (>0).

+ /// + /// Notes + /// + /// The probability density for the Logistic distribution is + /// + /// where = location and = scale.

+ /// + /// The Logistic distribution is used in Extreme Value problems where it + /// can act as a mixture of Gumbel distributions, in Epidemiology, and by + /// the World Chess Federation (FIDE) where it is used in the Elo ranking + /// system, assuming the performance of each player is a logistically + /// distributed random variable.

+ /// + /// References ///
/// - /// Parameter of the distribution. Default is 0. + /// Parameter of the distribution.

+ /// Default is 0. /// /// - /// Parameter of the distribution. Should be greater than zero. - /// Default is 1. + /// Parameter of the distribution.

+ /// Should be greater than zero.

+ /// + /// Default is 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if loc and scale are both scalars.

+ /// + /// Otherwise, np.broadcast(loc, scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized logistic distribution. + /// Drawn samples from the parameterized logistic distribution. /// public static NDarray logistic(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_logistic(loc:loc, scale:scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (loc!=null) kwargs["loc"]=ToPython(loc); + if (scale!=null) kwargs["scale"]=ToPython(scale); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("logistic", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a log-normal distribution. - /// - /// Draw samples from a log-normal distribution with specified mean, - /// standard deviation, and array shape. Note that the mean and standard - /// deviation are not the values for the distribution itself, but of the - /// underlying normal distribution it is derived from. - /// - /// Notes - /// - /// A variable x has a log-normal distribution if log(x) is normally - /// distributed. The probability density function for the log-normal - /// distribution is: - /// - /// where is the mean and is the standard - /// deviation of the normally distributed logarithm of the variable. - /// A log-normal distribution results if a random variable is the product - /// of a large number of independent, identically-distributed variables in - /// the same way that a normal distribution results if the variable is the - /// sum of a large number of independent, identically-distributed - /// variables. - /// - /// References + /// Draw samples from a log-normal distribution.

+ /// + /// Draw samples from a log-normal distribution with specified mean, + /// standard deviation, and array shape.

+ /// Note that the mean and standard + /// deviation are not the values for the distribution itself, but of the + /// underlying normal distribution it is derived from.

+ /// + /// Notes + /// + /// A variable x has a log-normal distribution if log(x) is normally + /// distributed.

+ /// The probability density function for the log-normal + /// distribution is: + /// + /// where is the mean and is the standard + /// deviation of the normally distributed logarithm of the variable.

+ /// + /// A log-normal distribution results if a random variable is the product + /// of a large number of independent, identically-distributed variables in + /// the same way that a normal distribution results if the variable is the + /// sum of a large number of independent, identically-distributed + /// variables.

+ /// + /// References ///
/// - /// Mean value of the underlying normal distribution. Default is 0. + /// Mean value of the underlying normal distribution.

+ /// Default is 0. /// /// - /// Standard deviation of the underlying normal distribution. Should - /// be greater than zero. Default is 1. + /// Standard deviation of the underlying normal distribution.

+ /// Should + /// be greater than zero.

+ /// Default is 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and sigma are both scalars. - /// Otherwise, np.broadcast(mean, sigma).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if mean and sigma are both scalars.

+ /// + /// Otherwise, np.broadcast(mean, sigma).size samples are drawn. /// /// - /// Drawn samples from the parameterized log-normal distribution. + /// Drawn samples from the parameterized log-normal distribution. /// public static NDarray lognormal(NDarray mean = null, NDarray sigma = null, int[] size = null) - => NumPy.Instance.random_lognormal(mean:mean, sigma:sigma, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (mean!=null) kwargs["mean"]=ToPython(mean); + if (sigma!=null) kwargs["sigma"]=ToPython(sigma); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("lognormal", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a logarithmic series distribution. - /// - /// Samples are drawn from a log series distribution with specified - /// shape parameter, 0 < p < 1. - /// - /// Notes - /// - /// The probability density for the Log Series distribution is - /// - /// where p = probability. - /// - /// The log series distribution is frequently used to represent species - /// richness and occurrence, first proposed by Fisher, Corbet, and - /// Williams in 1943 [2]. It may also be used to model the numbers of - /// occupants seen in cars [3]. - /// - /// References + /// Draw samples from a logarithmic series distribution.

+ /// + /// Samples are drawn from a log series distribution with specified + /// shape parameter, 0 < p < 1.

+ /// + /// Notes + /// + /// The probability density for the Log Series distribution is + /// + /// where p = probability.

+ /// + /// The log series distribution is frequently used to represent species + /// richness and occurrence, first proposed by Fisher, Corbet, and + /// Williams in 1943 [2].

+ /// It may also be used to model the numbers of + /// occupants seen in cars [3].

+ /// + /// References ///
/// - /// Shape parameter for the distribution. Must be in the range (0, 1). + /// Shape parameter for the distribution.

+ /// Must be in the range (0, 1). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if p is a scalar. Otherwise, - /// np.array(p).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if p is a scalar.

+ /// Otherwise, + /// np.array(p).size samples are drawn. /// /// - /// Drawn samples from the parameterized logarithmic series distribution. + /// Drawn samples from the parameterized logarithmic series distribution. /// public static NDarray logseries(NDarray p, int[] size = null) - => NumPy.Instance.random_logseries(p, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + p, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("logseries", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a multinomial distribution. - /// - /// The multinomial distribution is a multivariate generalisation of the - /// binomial distribution. Take an experiment with one of p - /// possible outcomes. An example of such an experiment is throwing a dice, - /// where the outcome can be 1 through 6. Each sample drawn from the - /// distribution represents n such experiments. Its values, - /// X_i = [X_0, X_1, ..., X_p], represent the number of times the - /// outcome was i. + /// Draw samples from a multinomial distribution.

+ /// + /// The multinomial distribution is a multivariate generalisation of the + /// binomial distribution.

+ /// Take an experiment with one of p + /// possible outcomes.

+ /// An example of such an experiment is throwing a dice, + /// where the outcome can be 1 through 6.

+ /// Each sample drawn from the + /// distribution represents n such experiments.

+ /// Its values, + /// X_i = [X_0, X_1, ..., X_p], represent the number of times the + /// outcome was i. ///
/// - /// Number of experiments. + /// Number of experiments. /// /// - /// Probabilities of each of the p different outcomes. These - /// should sum to 1 (however, the last element is always assumed to - /// account for the remaining probability, as long as - /// sum(pvals[:-1]) <= 1). + /// Probabilities of each of the p different outcomes.

+ /// These + /// should sum to 1 (however, the last element is always assumed to + /// account for the remaining probability, as long as + /// sum(pvals[:-1]) <= 1). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. + /// The drawn samples, of shape size, if that was provided.

+ /// If not, + /// the shape is (N,).

+ /// + /// In other words, each entry out[i,j,...,:] is an N-dimensional + /// value drawn from the distribution. ///
public static NDarray multinomial(int n, NDarray pvals, int[] size = null) - => NumPy.Instance.random_multinomial(n, pvals, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + n, + pvals, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("multinomial", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw random samples from a multivariate normal distribution. - /// - /// The multivariate normal, multinormal or Gaussian distribution is a - /// generalization of the one-dimensional normal distribution to higher - /// dimensions. Such a distribution is specified by its mean and - /// covariance matrix. These parameters are analogous to the mean - /// (average or “center”) and variance (standard deviation, or “width,” - /// squared) of the one-dimensional normal distribution. - /// - /// Notes - /// - /// The mean is a coordinate in N-dimensional space, which represents the - /// location where samples are most likely to be generated. This is - /// analogous to the peak of the bell curve for the one-dimensional or - /// univariate normal distribution. - /// - /// Covariance indicates the level to which two variables vary together. - /// From the multivariate normal distribution, we draw N-dimensional - /// samples, . The covariance matrix - /// element is the covariance of and . - /// The element is the variance of (i.e. its - /// “spread”). - /// - /// Instead of specifying the full covariance matrix, popular - /// approximations include: - /// - /// This geometrical property can be seen in two dimensions by plotting - /// generated data-points: - /// - /// Diagonal covariance means that points are oriented along x or y-axis: - /// - /// Note that the covariance matrix must be positive semidefinite (a.k.a. - /// nonnegative-definite). Otherwise, the behavior of this method is - /// undefined and backwards compatibility is not guaranteed. - /// - /// References + /// Draw random samples from a multivariate normal distribution.

+ /// + /// The multivariate normal, multinormal or Gaussian distribution is a + /// generalization of the one-dimensional normal distribution to higher + /// dimensions.

+ /// Such a distribution is specified by its mean and + /// covariance matrix.

+ /// These parameters are analogous to the mean + /// (average or “center”) and variance (standard deviation, or “width,” + /// squared) of the one-dimensional normal distribution.

+ /// + /// Notes + /// + /// The mean is a coordinate in N-dimensional space, which represents the + /// location where samples are most likely to be generated.

+ /// This is + /// analogous to the peak of the bell curve for the one-dimensional or + /// univariate normal distribution.

+ /// + /// Covariance indicates the level to which two variables vary together.

+ /// + /// From the multivariate normal distribution, we draw N-dimensional + /// samples, . The covariance matrix + /// element is the covariance of and . + /// The element is the variance of (i.e.

+ /// its + /// “spread”).

+ /// + /// Instead of specifying the full covariance matrix, popular + /// approximations include: + /// + /// This geometrical property can be seen in two dimensions by plotting + /// generated data-points: + /// + /// Diagonal covariance means that points are oriented along x or y-axis: + /// + /// Note that the covariance matrix must be positive semidefinite (a.k.a.

+ /// + /// nonnegative-definite).

+ /// Otherwise, the behavior of this method is + /// undefined and backwards compatibility is not guaranteed.

+ /// + /// References ///
/// - /// Mean of the N-dimensional distribution. + /// Mean of the N-dimensional distribution. /// /// - /// Covariance matrix of the distribution. It must be symmetric and - /// positive-semidefinite for proper sampling. + /// Covariance matrix of the distribution.

+ /// It must be symmetric and + /// positive-semidefinite for proper sampling. /// /// - /// Given a shape of, for example, (m,n,k), m*n*k samples are - /// generated, and packed in an m-by-n-by-k arrangement. Because - /// each sample is N-dimensional, the output shape is (m,n,k,N). - /// If no shape is specified, a single (N-D) sample is returned. + /// Given a shape of, for example, (m,n,k), m*n*k samples are + /// generated, and packed in an m-by-n-by-k arrangement.

+ /// Because + /// each sample is N-dimensional, the output shape is (m,n,k,N).

+ /// + /// If no shape is specified, a single (N-D) sample is returned. /// /// - /// Behavior when the covariance matrix is not positive semidefinite. + /// Behavior when the covariance matrix is not positive semidefinite. /// /// - /// Tolerance when checking the singular values in covariance matrix. + /// Tolerance when checking the singular values in covariance matrix. /// /// - /// The drawn samples, of shape size, if that was provided. If not, - /// the shape is (N,). - /// - /// In other words, each entry out[i,j,...,:] is an N-dimensional - /// value drawn from the distribution. + /// The drawn samples, of shape size, if that was provided.

+ /// If not, + /// the shape is (N,).

+ /// + /// In other words, each entry out[i,j,...,:] is an N-dimensional + /// value drawn from the distribution. ///
public static NDarray multivariate_normal(NDarray mean, NDarray cov, int[] size = null, string check_valid = null, float? tol = null) - => NumPy.Instance.random_multivariate_normal(mean, cov, size:size, check_valid:check_valid, tol:tol); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + mean, + cov, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + if (check_valid!=null) kwargs["check_valid"]=ToPython(check_valid); + if (tol!=null) kwargs["tol"]=ToPython(tol); + dynamic py = __self__.InvokeMethod("multivariate_normal", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a negative binomial distribution. - /// - /// Samples are drawn from a negative binomial distribution with specified - /// parameters, n successes and p probability of success where n is an - /// integer > 0 and p is in the interval [0, 1]. - /// - /// Notes - /// - /// The probability density for the negative binomial distribution is - /// - /// where is the number of successes, is the - /// probability of success, and is the number of trials. - /// The negative binomial distribution gives the probability of N - /// failures given n successes, with a success on the last trial. - /// - /// If one throws a die repeatedly until the third time a “1” appears, - /// then the probability distribution of the number of non-“1”s that - /// appear before the third “1” is a negative binomial distribution. - /// - /// References + /// Draw samples from a negative binomial distribution.

+ /// + /// Samples are drawn from a negative binomial distribution with specified + /// parameters, n successes and p probability of success where n is an + /// integer > 0 and p is in the interval [0, 1].

+ /// + /// Notes + /// + /// The probability density for the negative binomial distribution is + /// + /// where is the number of successes, is the + /// probability of success, and is the number of trials.

+ /// + /// The negative binomial distribution gives the probability of N + /// failures given n successes, with a success on the last trial.

+ /// + /// If one throws a die repeatedly until the third time a “1” appears, + /// then the probability distribution of the number of non-“1”s that + /// appear before the third “1” is a negative binomial distribution.

+ /// + /// References ///
/// - /// Parameter of the distribution, > 0. Floats are also accepted, - /// but they will be truncated to integers. + /// Parameter of the distribution, > 0.

+ /// Floats are also accepted, + /// but they will be truncated to integers. /// /// - /// Parameter of the distribution, >= 0 and <=1. + /// Parameter of the distribution, >= 0 and <=1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if n and p are both scalars. - /// Otherwise, np.broadcast(n, p).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if n and p are both scalars.

+ /// + /// Otherwise, np.broadcast(n, p).size samples are drawn. /// /// - /// Drawn samples from the parameterized negative binomial distribution, - /// where each sample is equal to N, the number of failures that - /// occurred before a total of n successes was reached. + /// Drawn samples from the parameterized negative binomial distribution, + /// where each sample is equal to N, the number of failures that + /// occurred before a total of n successes was reached. /// public static NDarray negative_binomial(NDarray n, NDarray p, int[] size = null) - => NumPy.Instance.random_negative_binomial(n, p, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + n, + p, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("negative_binomial", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a noncentral chi-square distribution. - /// - /// The noncentral distribution is a generalisation of - /// the distribution. - /// - /// Notes - /// - /// The probability density function for the noncentral Chi-square - /// distribution is - /// - /// where is the Chi-square with q degrees of freedom. - /// - /// In Delhi (2007), it is noted that the noncentral chi-square is - /// useful in bombing and coverage problems, the probability of - /// killing the point target given by the noncentral chi-squared - /// distribution. - /// - /// References + /// Draw samples from a noncentral chi-square distribution.

+ /// + /// The noncentral distribution is a generalisation of + /// the distribution.

+ /// + /// Notes + /// + /// The probability density function for the noncentral Chi-square + /// distribution is + /// + /// where is the Chi-square with q degrees of freedom.

+ /// + /// In Delhi (2007), it is noted that the noncentral chi-square is + /// useful in bombing and coverage problems, the probability of + /// killing the point target given by the noncentral chi-squared + /// distribution.

+ /// + /// References ///
/// - /// Degrees of freedom, should be > 0. + /// Degrees of freedom, should be > 0. /// /// - /// Non-centrality, should be non-negative. + /// Non-centrality, should be non-negative. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df and nonc are both scalars. - /// Otherwise, np.broadcast(df, nonc).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if df and nonc are both scalars.

+ /// + /// Otherwise, np.broadcast(df, nonc).size samples are drawn. /// /// - /// Drawn samples from the parameterized noncentral chi-square distribution. + /// Drawn samples from the parameterized noncentral chi-square distribution. /// public static NDarray noncentral_chisquare(NDarray df, NDarray nonc, int[] size = null) - => NumPy.Instance.random_noncentral_chisquare(df, nonc, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + df, + nonc, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("noncentral_chisquare", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from the noncentral F distribution. - /// - /// Samples are drawn from an F distribution with specified parameters, - /// dfnum (degrees of freedom in numerator) and dfden (degrees of - /// freedom in denominator), where both parameters > 1. - /// nonc is the non-centrality parameter. - /// - /// Notes - /// - /// When calculating the power of an experiment (power = probability of - /// rejecting the null hypothesis when a specific alternative is true) the - /// non-central F statistic becomes important. When the null hypothesis is - /// true, the F statistic follows a central F distribution. When the null - /// hypothesis is not true, then it follows a non-central F statistic. - /// - /// References + /// Draw samples from the noncentral F distribution.

+ /// + /// Samples are drawn from an F distribution with specified parameters, + /// dfnum (degrees of freedom in numerator) and dfden (degrees of + /// freedom in denominator), where both parameters > 1.

+ /// + /// nonc is the non-centrality parameter.

+ /// + /// Notes + /// + /// When calculating the power of an experiment (power = probability of + /// rejecting the null hypothesis when a specific alternative is true) the + /// non-central F statistic becomes important.

+ /// When the null hypothesis is + /// true, the F statistic follows a central F distribution.

+ /// When the null + /// hypothesis is not true, then it follows a non-central F statistic.

+ /// + /// References ///
/// - /// Numerator degrees of freedom, should be > 0. + /// Numerator degrees of freedom, should be > 0. /// /// - /// Denominator degrees of freedom, should be > 0. + /// Denominator degrees of freedom, should be > 0. /// /// - /// Non-centrality parameter, the sum of the squares of the numerator - /// means, should be >= 0. + /// Non-centrality parameter, the sum of the squares of the numerator + /// means, should be >= 0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if dfnum, dfden, and nonc - /// are all scalars. Otherwise, np.broadcast(dfnum, dfden, nonc).size - /// samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if dfnum, dfden, and nonc + /// are all scalars.

+ /// Otherwise, np.broadcast(dfnum, dfden, nonc).size + /// samples are drawn. /// /// - /// Drawn samples from the parameterized noncentral Fisher distribution. + /// Drawn samples from the parameterized noncentral Fisher distribution. /// public static NDarray noncentral_f(NDarray dfnum, NDarray dfden, NDarray nonc, int[] size = null) - => NumPy.Instance.random_noncentral_f(dfnum, dfden, nonc, size:size); - } - - public static partial class random { - /// - /// Draw random samples from a normal (Gaussian) distribution. - /// - /// The probability density function of the normal distribution, first - /// derived by De Moivre and 200 years later by both Gauss and Laplace - /// independently [2], is often called the bell curve because of - /// its characteristic shape (see the example below). - /// - /// The normal distributions occurs often in nature. For example, it - /// describes the commonly occurring distribution of samples influenced - /// by a large number of tiny, random disturbances, each with its own - /// unique distribution [2]. - /// - /// Notes - /// - /// The probability density for the Gaussian distribution is - /// - /// where is the mean and the standard - /// deviation. The square of the standard deviation, , - /// is called the variance. - /// - /// The function has its peak at the mean, and its “spread” increases with - /// the standard deviation (the function reaches 0.607 times its maximum at - /// and [2]). This implies that - /// numpy.random.normal is more likely to return samples lying close to - /// the mean, rather than those far away. - /// - /// References - /// - /// - /// Mean (“centre”) of the distribution. - /// - /// - /// Standard deviation (spread or “width”) of the distribution. - /// - /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if loc and scale are both scalars. - /// Otherwise, np.broadcast(loc, scale).size samples are drawn. - /// - /// - /// Drawn samples from the parameterized normal distribution. - /// - public static NDarray normal(NDarray loc = null, NDarray scale = null, int[] size = null) - => NumPy.Instance.random_normal(loc:loc, scale:scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + dfnum, + dfden, + nonc, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("noncentral_f", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Pareto II or Lomax distribution with - /// specified shape. - /// - /// The Lomax or Pareto II distribution is a shifted Pareto - /// distribution. The classical Pareto distribution can be - /// obtained from the Lomax distribution by adding 1 and - /// multiplying by the scale parameter m (see Notes). The - /// smallest value of the Lomax distribution is zero while for the - /// classical Pareto distribution it is mu, where the standard - /// Pareto distribution has location mu = 1. Lomax can also - /// be considered as a simplified version of the Generalized - /// Pareto distribution (available in SciPy), with the scale set - /// to one and the location set to zero. - /// - /// The Pareto distribution must be greater than zero, and is - /// unbounded above. It is also known as the “80-20 rule”. In - /// this distribution, 80 percent of the weights are in the lowest - /// 20 percent of the range, while the other 20 percent fill the - /// remaining 80 percent of the range. - /// - /// Notes - /// - /// The probability density for the Pareto distribution is - /// - /// where is the shape and the scale. - /// - /// The Pareto distribution, named after the Italian economist - /// Vilfredo Pareto, is a power law probability distribution - /// useful in many real world problems. Outside the field of - /// economics it is generally referred to as the Bradford - /// distribution. Pareto developed the distribution to describe - /// the distribution of wealth in an economy. It has also found - /// use in insurance, web page access statistics, oil field sizes, - /// and many other problems, including the download frequency for - /// projects in Sourceforge [1]. It is one of the so-called - /// “fat-tailed” distributions. - /// - /// References + /// Draw samples from a Pareto II or Lomax distribution with + /// specified shape.

+ /// + /// The Lomax or Pareto II distribution is a shifted Pareto + /// distribution.

+ /// The classical Pareto distribution can be + /// obtained from the Lomax distribution by adding 1 and + /// multiplying by the scale parameter m (see Notes).

+ /// The + /// smallest value of the Lomax distribution is zero while for the + /// classical Pareto distribution it is mu, where the standard + /// Pareto distribution has location mu = 1.

+ /// Lomax can also + /// be considered as a simplified version of the Generalized + /// Pareto distribution (available in SciPy), with the scale set + /// to one and the location set to zero.

+ /// + /// The Pareto distribution must be greater than zero, and is + /// unbounded above.

+ /// It is also known as the “80-20 rule”. In + /// this distribution, 80 percent of the weights are in the lowest + /// 20 percent of the range, while the other 20 percent fill the + /// remaining 80 percent of the range.

+ /// + /// Notes + /// + /// The probability density for the Pareto distribution is + /// + /// where is the shape and the scale.

+ /// + /// The Pareto distribution, named after the Italian economist + /// Vilfredo Pareto, is a power law probability distribution + /// useful in many real world problems.

+ /// Outside the field of + /// economics it is generally referred to as the Bradford + /// distribution.

+ /// Pareto developed the distribution to describe + /// the distribution of wealth in an economy.

+ /// It has also found + /// use in insurance, web page access statistics, oil field sizes, + /// and many other problems, including the download frequency for + /// projects in Sourceforge [1].

+ /// It is one of the so-called + /// “fat-tailed” distributions.

+ /// + /// References ///
/// - /// Shape of the distribution. Should be greater than zero. + /// Shape of the distribution.

+ /// Should be greater than zero. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if a is a scalar.

+ /// Otherwise, + /// np.array(a).size samples are drawn. /// /// - /// Drawn samples from the parameterized Pareto distribution. + /// Drawn samples from the parameterized Pareto distribution. /// public static NDarray pareto(NDarray a, int[] size = null) - => NumPy.Instance.random_pareto(a, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("pareto", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Poisson distribution. - /// - /// The Poisson distribution is the limit of the binomial distribution - /// for large N. - /// - /// Notes - /// - /// The Poisson distribution - /// - /// For events with an expected separation the Poisson - /// distribution describes the probability of - /// events occurring within the observed - /// interval . - /// - /// Because the output is limited to the range of the C long type, a - /// ValueError is raised when lam is within 10 sigma of the maximum - /// representable value. - /// - /// References + /// Draw samples from a Poisson distribution.

+ /// + /// The Poisson distribution is the limit of the binomial distribution + /// for large N.

+ /// + /// Notes + /// + /// The Poisson distribution + /// + /// For events with an expected separation the Poisson + /// distribution describes the probability of + /// events occurring within the observed + /// interval . + /// + /// Because the output is limited to the range of the C long type, a + /// ValueError is raised when lam is within 10 sigma of the maximum + /// representable value.

+ /// + /// References ///
/// - /// Expectation of interval, should be >= 0. A sequence of expectation - /// intervals must be broadcastable over the requested size. + /// Expectation of interval, should be >= 0.

+ /// A sequence of expectation + /// intervals must be broadcastable over the requested size. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if lam is a scalar. Otherwise, - /// np.array(lam).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if lam is a scalar.

+ /// Otherwise, + /// np.array(lam).size samples are drawn. /// /// - /// Drawn samples from the parameterized Poisson distribution. + /// Drawn samples from the parameterized Poisson distribution. /// public static NDarray poisson(NDarray lam = null, int[] size = null) - => NumPy.Instance.random_poisson(lam:lam, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (lam!=null) kwargs["lam"]=ToPython(lam); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("poisson", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draws samples in [0, 1] from a power distribution with positive - /// exponent a - 1. - /// - /// Also known as the power function distribution. - /// - /// Notes - /// - /// The probability density function is - /// - /// The power function distribution is just the inverse of the Pareto - /// distribution. It may also be seen as a special case of the Beta - /// distribution. - /// - /// It is used, for example, in modeling the over-reporting of insurance - /// claims. - /// - /// References + /// Draws samples in [0, 1] from a power distribution with positive + /// exponent a - 1.

+ /// + /// Also known as the power function distribution.

+ /// + /// Notes + /// + /// The probability density function is + /// + /// The power function distribution is just the inverse of the Pareto + /// distribution.

+ /// It may also be seen as a special case of the Beta + /// distribution.

+ /// + /// It is used, for example, in modeling the over-reporting of insurance + /// claims.

+ /// + /// References ///
/// - /// Parameter of the distribution. Should be greater than zero. + /// Parameter of the distribution.

+ /// Should be greater than zero. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if a is a scalar.

+ /// Otherwise, + /// np.array(a).size samples are drawn. /// /// - /// Drawn samples from the parameterized power distribution. + /// Drawn samples from the parameterized power distribution. /// public static NDarray power(NDarray a, int[] size = null) - => NumPy.Instance.random_power(a, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("power", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Rayleigh distribution. - /// - /// The and Weibull distributions are generalizations of the - /// Rayleigh. - /// - /// Notes - /// - /// The probability density function for the Rayleigh distribution is - /// - /// The Rayleigh distribution would arise, for example, if the East - /// and North components of the wind velocity had identical zero-mean - /// Gaussian distributions. Then the wind speed would have a Rayleigh - /// distribution. - /// - /// References + /// Draw samples from a Rayleigh distribution.

+ /// + /// The and Weibull distributions are generalizations of the + /// Rayleigh.

+ /// + /// Notes + /// + /// The probability density function for the Rayleigh distribution is + /// + /// The Rayleigh distribution would arise, for example, if the East + /// and North components of the wind velocity had identical zero-mean + /// Gaussian distributions.

+ /// Then the wind speed would have a Rayleigh + /// distribution.

+ /// + /// References ///
/// - /// Scale, also equals the mode. Should be >= 0. Default is 1. + /// Scale, also equals the mode.

+ /// Should be >= 0.

+ /// Default is 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if scale is a scalar. Otherwise, - /// np.array(scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if scale is a scalar.

+ /// Otherwise, + /// np.array(scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized Rayleigh distribution. + /// Drawn samples from the parameterized Rayleigh distribution. /// public static NDarray rayleigh(NDarray scale = null, int[] size = null) - => NumPy.Instance.random_rayleigh(scale:scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (scale!=null) kwargs["scale"]=ToPython(scale); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("rayleigh", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a standard Cauchy distribution with mode = 0. - /// - /// Also known as the Lorentz distribution. - /// - /// Notes - /// - /// The probability density function for the full Cauchy distribution is - /// - /// and the Standard Cauchy distribution just sets and - /// - /// - /// The Cauchy distribution arises in the solution to the driven harmonic - /// oscillator problem, and also describes spectral line broadening. It - /// also describes the distribution of values at which a line tilted at - /// a random angle will cut the x axis. - /// - /// When studying hypothesis tests that assume normality, seeing how the - /// tests perform on data from a Cauchy distribution is a good indicator of - /// their sensitivity to a heavy-tailed distribution, since the Cauchy looks - /// very much like a Gaussian distribution, but with heavier tails. - /// - /// References + /// Draw samples from a standard Cauchy distribution with mode = 0.

+ /// + /// Also known as the Lorentz distribution.

+ /// + /// Notes + /// + /// The probability density function for the full Cauchy distribution is + /// + /// and the Standard Cauchy distribution just sets and + /// + /// The Cauchy distribution arises in the solution to the driven harmonic + /// oscillator problem, and also describes spectral line broadening.

+ /// It + /// also describes the distribution of values at which a line tilted at + /// a random angle will cut the x axis.

+ /// + /// When studying hypothesis tests that assume normality, seeing how the + /// tests perform on data from a Cauchy distribution is a good indicator of + /// their sensitivity to a heavy-tailed distribution, since the Cauchy looks + /// very much like a Gaussian distribution, but with heavier tails.

+ /// + /// References ///
/// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// The drawn samples. + /// The drawn samples. /// - public static NDarray standard_cauchy(int[] size = null) - => NumPy.Instance.random_standard_cauchy(size:size); + public static NDarray standard_cauchy(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("standard_cauchy", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from the standard exponential distribution. - /// - /// standard_exponential is identical to the exponential distribution - /// with a scale parameter of 1. + /// Draw samples from the standard exponential distribution.

+ /// + /// standard_exponential is identical to the exponential distribution + /// with a scale parameter of 1. ///
/// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Drawn samples. + /// Drawn samples. /// - public static NDarray standard_exponential(int[] size = null) - => NumPy.Instance.random_standard_exponential(size:size); + public static NDarray standard_exponential(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("standard_exponential", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a standard Gamma distribution. - /// - /// Samples are drawn from a Gamma distribution with specified parameters, - /// shape (sometimes designated “k”) and scale=1. - /// - /// Notes - /// - /// The probability density for the Gamma distribution is - /// - /// where is the shape and the scale, - /// and is the Gamma function. - /// - /// The Gamma distribution is often used to model the times to failure of - /// electronic components, and arises naturally in processes for which the - /// waiting times between Poisson distributed events are relevant. - /// - /// References + /// Draw samples from a standard Gamma distribution.

+ /// + /// Samples are drawn from a Gamma distribution with specified parameters, + /// shape (sometimes designated “k”) and scale=1. + /// + /// Notes + /// + /// The probability density for the Gamma distribution is + /// + /// where is the shape and the scale, + /// and is the Gamma function.

+ /// + /// The Gamma distribution is often used to model the times to failure of + /// electronic components, and arises naturally in processes for which the + /// waiting times between Poisson distributed events are relevant.

+ /// + /// References ///
/// - /// Parameter, should be > 0. + /// Parameter, should be > 0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if shape is a scalar. Otherwise, - /// np.array(shape).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if shape is a scalar.

+ /// Otherwise, + /// np.array(shape).size samples are drawn. /// /// - /// Drawn samples from the parameterized standard gamma distribution. + /// Drawn samples from the parameterized standard gamma distribution. /// public static NDarray standard_gamma(Shape shape, int[] size = null) - => NumPy.Instance.random_standard_gamma(shape, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("standard_gamma", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a standard Normal distribution (mean=0, stdev=1). + /// Draw samples from a standard Normal distribution (mean=0, stdev=1). /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. Default is None, in which case a - /// single value is returned. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// Default is None, in which case a + /// single value is returned. /// /// - /// Drawn samples. + /// Drawn samples. /// - public static NDarray standard_normal(int[] size = null) - => NumPy.Instance.random_standard_normal(size:size); + public static NDarray standard_normal(params int[] size) + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("standard_normal", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a standard Student’s t distribution with df degrees - /// of freedom. - /// - /// A special case of the hyperbolic distribution. As df gets - /// large, the result resembles that of the standard normal - /// distribution (standard_normal). - /// - /// Notes - /// - /// The probability density function for the t distribution is - /// - /// The t test is based on an assumption that the data come from a - /// Normal distribution. The t test provides a way to test whether - /// the sample mean (that is the mean calculated from the data) is - /// a good estimate of the true mean. - /// - /// The derivation of the t-distribution was first published in - /// 1908 by William Gosset while working for the Guinness Brewery - /// in Dublin. Due to proprietary issues, he had to publish under - /// a pseudonym, and so he used the name Student. - /// - /// References + /// Draw samples from a standard Student’s t distribution with df degrees + /// of freedom.

+ /// + /// A special case of the hyperbolic distribution.

+ /// As df gets + /// large, the result resembles that of the standard normal + /// distribution (standard_normal).

+ /// + /// Notes + /// + /// The probability density function for the t distribution is + /// + /// The t test is based on an assumption that the data come from a + /// Normal distribution.

+ /// The t test provides a way to test whether + /// the sample mean (that is the mean calculated from the data) is + /// a good estimate of the true mean.

+ /// + /// The derivation of the t-distribution was first published in + /// 1908 by William Gosset while working for the Guinness Brewery + /// in Dublin.

+ /// Due to proprietary issues, he had to publish under + /// a pseudonym, and so he used the name Student.

+ /// + /// References ///
/// - /// Degrees of freedom, should be > 0. + /// Degrees of freedom, should be > 0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if df is a scalar. Otherwise, - /// np.array(df).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if df is a scalar.

+ /// Otherwise, + /// np.array(df).size samples are drawn. /// /// - /// Drawn samples from the parameterized standard Student’s t distribution. + /// Drawn samples from the parameterized standard Student’s t distribution. /// public static NDarray standard_t(NDarray df, int[] size = null) - => NumPy.Instance.random_standard_t(df, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + df, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("standard_t", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from the triangular distribution over the - /// interval [left, right]. - /// - /// The triangular distribution is a continuous probability - /// distribution with lower limit left, peak at mode, and upper - /// limit right. Unlike the other distributions, these parameters - /// directly define the shape of the pdf. - /// - /// Notes - /// - /// The probability density function for the triangular distribution is - /// - /// The triangular distribution is often used in ill-defined - /// problems where the underlying distribution is not known, but - /// some knowledge of the limits and mode exists. Often it is used - /// in simulations. - /// - /// References + /// Draw samples from the triangular distribution over the + /// interval [left, right].

+ /// + /// The triangular distribution is a continuous probability + /// distribution with lower limit left, peak at mode, and upper + /// limit right.

+ /// Unlike the other distributions, these parameters + /// directly define the shape of the pdf.

+ /// + /// Notes + /// + /// The probability density function for the triangular distribution is + /// + /// The triangular distribution is often used in ill-defined + /// problems where the underlying distribution is not known, but + /// some knowledge of the limits and mode exists.

+ /// Often it is used + /// in simulations.

+ /// + /// References ///
/// - /// Lower limit. + /// Lower limit. /// /// - /// The value where the peak of the distribution occurs. - /// The value should fulfill the condition left <= mode <= right. + /// The value where the peak of the distribution occurs.

+ /// + /// The value should fulfill the condition left <= mode <= right. /// /// - /// Upper limit, should be larger than left. + /// Upper limit, should be larger than left. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if left, mode, and right - /// are all scalars. Otherwise, np.broadcast(left, mode, right).size - /// samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if left, mode, and right + /// are all scalars.

+ /// Otherwise, np.broadcast(left, mode, right).size + /// samples are drawn. /// /// - /// Drawn samples from the parameterized triangular distribution. + /// Drawn samples from the parameterized triangular distribution. /// public static NDarray triangular(NDarray left, NDarray mode, NDarray right, int[] size = null) - => NumPy.Instance.random_triangular(left, mode, right, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + left, + mode, + right, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("triangular", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a uniform distribution. - /// - /// Samples are uniformly distributed over the half-open interval - /// [low, high) (includes low, but excludes high). In other words, - /// any value within the given interval is equally likely to be drawn - /// by uniform. - /// - /// Notes - /// - /// The probability density function of the uniform distribution is - /// - /// anywhere within the interval [a, b), and zero elsewhere. - /// - /// When high == low, values of low will be returned. - /// If high < low, the results are officially undefined - /// and may eventually raise an error, i.e. do not rely on this - /// function to behave when passed arguments satisfying that - /// inequality condition. + /// Draw samples from a uniform distribution.

+ /// + /// Samples are uniformly distributed over the half-open interval + /// [low, high) (includes low, but excludes high).

+ /// In other words, + /// any value within the given interval is equally likely to be drawn + /// by uniform.

+ /// + /// Notes + /// + /// The probability density function of the uniform distribution is + /// + /// anywhere within the interval [a, b), and zero elsewhere.

+ /// + /// When high == low, values of low will be returned.

+ /// + /// If high < low, the results are officially undefined + /// and may eventually raise an error, i.e.

+ /// do not rely on this + /// function to behave when passed arguments satisfying that + /// inequality condition. ///
/// - /// Lower boundary of the output interval. All values generated will be - /// greater than or equal to low. The default value is 0. + /// Lower boundary of the output interval.

+ /// All values generated will be + /// greater than or equal to low.

+ /// The default value is 0. /// /// - /// Upper boundary of the output interval. All values generated will be - /// less than high. The default value is 1.0. + /// Upper boundary of the output interval.

+ /// All values generated will be + /// less than high.

+ /// The default value is 1.0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if low and high are both scalars. - /// Otherwise, np.broadcast(low, high).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if low and high are both scalars.

+ /// + /// Otherwise, np.broadcast(low, high).size samples are drawn. /// /// - /// Drawn samples from the parameterized uniform distribution. + /// Drawn samples from the parameterized uniform distribution. /// public static NDarray uniform(NDarray low = null, NDarray high = null, int[] size = null) - => NumPy.Instance.random_uniform(low:low, high:high, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (low!=null) kwargs["low"]=ToPython(low); + if (high!=null) kwargs["high"]=ToPython(high); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("uniform", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a von Mises distribution. - /// - /// Samples are drawn from a von Mises distribution with specified mode - /// (mu) and dispersion (kappa), on the interval [-pi, pi]. - /// - /// The von Mises distribution (also known as the circular normal - /// distribution) is a continuous probability distribution on the unit - /// circle. It may be thought of as the circular analogue of the normal - /// distribution. - /// - /// Notes - /// - /// The probability density for the von Mises distribution is - /// - /// where is the mode and the dispersion, - /// and is the modified Bessel function of order 0. - /// - /// The von Mises is named for Richard Edler von Mises, who was born in - /// Austria-Hungary, in what is now the Ukraine. He fled to the United - /// States in 1939 and became a professor at Harvard. He worked in - /// probability theory, aerodynamics, fluid mechanics, and philosophy of - /// science. - /// - /// References + /// Draw samples from a von Mises distribution.

+ /// + /// Samples are drawn from a von Mises distribution with specified mode + /// (mu) and dispersion (kappa), on the interval [-pi, pi].

+ /// + /// The von Mises distribution (also known as the circular normal + /// distribution) is a continuous probability distribution on the unit + /// circle.

+ /// It may be thought of as the circular analogue of the normal + /// distribution.

+ /// + /// Notes + /// + /// The probability density for the von Mises distribution is + /// + /// where is the mode and the dispersion, + /// and is the modified Bessel function of order 0.

+ /// + /// The von Mises is named for Richard Edler von Mises, who was born in + /// Austria-Hungary, in what is now the Ukraine.

+ /// He fled to the United + /// States in 1939 and became a professor at Harvard.

+ /// He worked in + /// probability theory, aerodynamics, fluid mechanics, and philosophy of + /// science.

+ /// + /// References ///
/// - /// Mode (“center”) of the distribution. + /// Mode (“center”) of the distribution. /// /// - /// Dispersion of the distribution, has to be >=0. + /// Dispersion of the distribution, has to be >=0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mu and kappa are both scalars. - /// Otherwise, np.broadcast(mu, kappa).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if mu and kappa are both scalars.

+ /// + /// Otherwise, np.broadcast(mu, kappa).size samples are drawn. /// /// - /// Drawn samples from the parameterized von Mises distribution. + /// Drawn samples from the parameterized von Mises distribution. /// public static NDarray vonmises(NDarray mu, NDarray kappa, int[] size = null) - => NumPy.Instance.random_vonmises(mu, kappa, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + mu, + kappa, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("vonmises", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Wald, or inverse Gaussian, distribution. - /// - /// As the scale approaches infinity, the distribution becomes more like a - /// Gaussian. Some references claim that the Wald is an inverse Gaussian - /// with mean equal to 1, but this is by no means universal. - /// - /// The inverse Gaussian distribution was first studied in relationship to - /// Brownian motion. In 1956 M.C.K. Tweedie used the name inverse Gaussian - /// because there is an inverse relationship between the time to cover a - /// unit distance and distance covered in unit time. - /// - /// Notes - /// - /// The probability density function for the Wald distribution is - /// - /// As noted above the inverse Gaussian distribution first arise - /// from attempts to model Brownian motion. It is also a - /// competitor to the Weibull for use in reliability modeling and - /// modeling stock returns and interest rate processes. - /// - /// References + /// Draw samples from a Wald, or inverse Gaussian, distribution.

+ /// + /// As the scale approaches infinity, the distribution becomes more like a + /// Gaussian.

+ /// Some references claim that the Wald is an inverse Gaussian + /// with mean equal to 1, but this is by no means universal.

+ /// + /// The inverse Gaussian distribution was first studied in relationship to + /// Brownian motion.

+ /// In 1956 M.C.K.

+ /// Tweedie used the name inverse Gaussian + /// because there is an inverse relationship between the time to cover a + /// unit distance and distance covered in unit time.

+ /// + /// Notes + /// + /// The probability density function for the Wald distribution is + /// + /// As noted above the inverse Gaussian distribution first arise + /// from attempts to model Brownian motion.

+ /// It is also a + /// competitor to the Weibull for use in reliability modeling and + /// modeling stock returns and interest rate processes.

+ /// + /// References ///
/// - /// Distribution mean, should be > 0. + /// Distribution mean, should be > 0. /// /// - /// Scale parameter, should be >= 0. + /// Scale parameter, should be >= 0. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if mean and scale are both scalars. - /// Otherwise, np.broadcast(mean, scale).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if mean and scale are both scalars.

+ /// + /// Otherwise, np.broadcast(mean, scale).size samples are drawn. /// /// - /// Drawn samples from the parameterized Wald distribution. + /// Drawn samples from the parameterized Wald distribution. /// public static NDarray wald(NDarray mean, NDarray scale, int[] size = null) - => NumPy.Instance.random_wald(mean, scale, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + mean, + scale, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("wald", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Weibull distribution. - /// - /// Draw samples from a 1-parameter Weibull distribution with the given - /// shape parameter a. - /// - /// Here, U is drawn from the uniform distribution over (0,1]. - /// - /// The more common 2-parameter Weibull, including a scale parameter - /// is just . - /// - /// Notes - /// - /// The Weibull (or Type III asymptotic extreme value distribution - /// for smallest values, SEV Type III, or Rosin-Rammler - /// distribution) is one of a class of Generalized Extreme Value - /// (GEV) distributions used in modeling extreme value problems. - /// This class includes the Gumbel and Frechet distributions. - /// - /// The probability density for the Weibull distribution is - /// - /// where is the shape and the scale. - /// - /// The function has its peak (the mode) at - /// . - /// - /// When a = 1, the Weibull distribution reduces to the exponential - /// distribution. - /// - /// References + /// Draw samples from a Weibull distribution.

+ /// + /// Draw samples from a 1-parameter Weibull distribution with the given + /// shape parameter a.

+ /// + /// Here, U is drawn from the uniform distribution over (0,1].

+ /// + /// The more common 2-parameter Weibull, including a scale parameter + /// is just . + /// + /// Notes + /// + /// The Weibull (or Type III asymptotic extreme value distribution + /// for smallest values, SEV Type III, or Rosin-Rammler + /// distribution) is one of a class of Generalized Extreme Value + /// (GEV) distributions used in modeling extreme value problems.

+ /// + /// This class includes the Gumbel and Frechet distributions.

+ /// + /// The probability density for the Weibull distribution is + /// + /// where is the shape and the scale.

+ /// + /// The function has its peak (the mode) at + /// . + /// + /// When a = 1, the Weibull distribution reduces to the exponential + /// distribution.

+ /// + /// References ///
/// - /// Shape parameter of the distribution. Must be nonnegative. + /// Shape parameter of the distribution.

+ /// Must be nonnegative. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if a is a scalar.

+ /// Otherwise, + /// np.array(a).size samples are drawn. /// /// - /// Drawn samples from the parameterized Weibull distribution. + /// Drawn samples from the parameterized Weibull distribution. /// public static NDarray weibull(NDarray a, int[] size = null) - => NumPy.Instance.random_weibull(a, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("weibull", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Draw samples from a Zipf distribution. - /// - /// Samples are drawn from a Zipf distribution with specified parameter - /// a > 1. - /// - /// The Zipf distribution (also known as the zeta distribution) is a - /// continuous probability distribution that satisfies Zipf’s law: the - /// frequency of an item is inversely proportional to its rank in a - /// frequency table. - /// - /// Notes - /// - /// The probability density for the Zipf distribution is - /// - /// where is the Riemann Zeta function. - /// - /// It is named for the American linguist George Kingsley Zipf, who noted - /// that the frequency of any word in a sample of a language is inversely - /// proportional to its rank in the frequency table. - /// - /// References + /// Draw samples from a Zipf distribution.

+ /// + /// Samples are drawn from a Zipf distribution with specified parameter + /// a > 1.

+ /// + /// The Zipf distribution (also known as the zeta distribution) is a + /// continuous probability distribution that satisfies Zipf’s law: the + /// frequency of an item is inversely proportional to its rank in a + /// frequency table.

+ /// + /// Notes + /// + /// The probability density for the Zipf distribution is + /// + /// where is the Riemann Zeta function.

+ /// + /// It is named for the American linguist George Kingsley Zipf, who noted + /// that the frequency of any word in a sample of a language is inversely + /// proportional to its rank in the frequency table.

+ /// + /// References ///
/// - /// Distribution parameter. Should be greater than 1. + /// Distribution parameter.

+ /// Should be greater than 1. /// /// - /// Output shape. If the given shape is, e.g., (m, n, k), then - /// m * n * k samples are drawn. If size is None (default), - /// a single value is returned if a is a scalar. Otherwise, - /// np.array(a).size samples are drawn. + /// Output shape.

+ /// If the given shape is, e.g., (m, n, k), then + /// m * n * k samples are drawn.

+ /// If size is None (default), + /// a single value is returned if a is a scalar.

+ /// Otherwise, + /// np.array(a).size samples are drawn. /// /// - /// Drawn samples from the parameterized Zipf distribution. + /// Drawn samples from the parameterized Zipf distribution. /// public static NDarray zipf(NDarray a, int[] size = null) - => NumPy.Instance.random_zipf(a, size:size); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (size!=null) kwargs["size"]=ToPython(size); + dynamic py = __self__.InvokeMethod("zipf", pyargs, kwargs); + return ToCsharp(py); + } } public static partial class random { /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods + /// Container for the Mersenne Twister pseudo-random number generator.

+ /// + /// RandomState exposes a number of methods for generating random numbers + /// drawn from a variety of probability distributions.

+ /// In addition to the + /// distribution-specific arguments, each method takes a keyword argument + /// size that defaults to None.

+ /// If size is None, then a single + /// value is generated and returned.

+ /// If size is an integer, then a 1-D + /// array filled with generated values is returned.

+ /// If size is a tuple, + /// then an array with that shape is filled and returned.

+ /// + /// Compatibility Guarantee + /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using + /// the same parameters will always produce the same results up to roundoff + /// error except when the values were incorrect.

+ /// Incorrect values will be + /// fixed and the NumPy version in which the fix was made will be noted in + /// the relevant docstring.

+ /// Extension of existing parameter ranges and the + /// addition of new parameters is allowed as long the previous behavior + /// remains unchanged.

+ /// + /// Notes + /// + /// The Python stdlib module “random” also contains a Mersenne Twister + /// pseudo-random number generator with a number of methods that are similar + /// to the ones available in RandomState.

+ /// RandomState, besides being + /// NumPy-aware, has the advantage that it provides a much larger number + /// of probability distributions to choose from.

+ /// + /// Methods ///
/// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. + /// Random seed used to initialize the pseudo-random number generator.

+ /// Can + /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other + /// sequence) of such integers, or None (the default).

+ /// If seed is + /// None, then RandomState will try to read data from + /// /dev/urandom (or the Windows analogue) if available or seed from + /// the clock otherwise. /// public static void RandomState(int? seed = null) - => NumPy.Instance.random_RandomState(seed:seed); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (seed!=null) kwargs["seed"]=ToPython(seed); + dynamic py = __self__.InvokeMethod("RandomState", pyargs, kwargs); + } } public static partial class random { /// - /// Container for the Mersenne Twister pseudo-random number generator. - /// - /// RandomState exposes a number of methods for generating random numbers - /// drawn from a variety of probability distributions. In addition to the - /// distribution-specific arguments, each method takes a keyword argument - /// size that defaults to None. If size is None, then a single - /// value is generated and returned. If size is an integer, then a 1-D - /// array filled with generated values is returned. If size is a tuple, - /// then an array with that shape is filled and returned. - /// - /// Compatibility Guarantee - /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using - /// the same parameters will always produce the same results up to roundoff - /// error except when the values were incorrect. Incorrect values will be - /// fixed and the NumPy version in which the fix was made will be noted in - /// the relevant docstring. Extension of existing parameter ranges and the - /// addition of new parameters is allowed as long the previous behavior - /// remains unchanged. - /// - /// Notes - /// - /// The Python stdlib module “random” also contains a Mersenne Twister - /// pseudo-random number generator with a number of methods that are similar - /// to the ones available in RandomState. RandomState, besides being - /// NumPy-aware, has the advantage that it provides a much larger number - /// of probability distributions to choose from. - /// - /// Methods + /// Container for the Mersenne Twister pseudo-random number generator.

+ /// + /// RandomState exposes a number of methods for generating random numbers + /// drawn from a variety of probability distributions.

+ /// In addition to the + /// distribution-specific arguments, each method takes a keyword argument + /// size that defaults to None.

+ /// If size is None, then a single + /// value is generated and returned.

+ /// If size is an integer, then a 1-D + /// array filled with generated values is returned.

+ /// If size is a tuple, + /// then an array with that shape is filled and returned.

+ /// + /// Compatibility Guarantee + /// A fixed seed and a fixed series of calls to ‘RandomState’ methods using + /// the same parameters will always produce the same results up to roundoff + /// error except when the values were incorrect.

+ /// Incorrect values will be + /// fixed and the NumPy version in which the fix was made will be noted in + /// the relevant docstring.

+ /// Extension of existing parameter ranges and the + /// addition of new parameters is allowed as long the previous behavior + /// remains unchanged.

+ /// + /// Notes + /// + /// The Python stdlib module “random” also contains a Mersenne Twister + /// pseudo-random number generator with a number of methods that are similar + /// to the ones available in RandomState.

+ /// RandomState, besides being + /// NumPy-aware, has the advantage that it provides a much larger number + /// of probability distributions to choose from.

+ /// + /// Methods ///
/// - /// Random seed used to initialize the pseudo-random number generator. Can - /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other - /// sequence) of such integers, or None (the default). If seed is - /// None, then RandomState will try to read data from - /// /dev/urandom (or the Windows analogue) if available or seed from - /// the clock otherwise. + /// Random seed used to initialize the pseudo-random number generator.

+ /// Can + /// be any integer between 0 and 2**32 - 1 inclusive, an array (or other + /// sequence) of such integers, or None (the default).

+ /// If seed is + /// None, then RandomState will try to read data from + /// /dev/urandom (or the Windows analogue) if available or seed from + /// the clock otherwise. /// public static void RandomState(NDarray seed = null) - => NumPy.Instance.random_RandomState(seed:seed); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (seed!=null) kwargs["seed"]=ToPython(seed); + dynamic py = __self__.InvokeMethod("RandomState", pyargs, kwargs); + } } public static partial class random { /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. + /// Seed the generator.

+ /// + /// This method is called when RandomState is initialized.

+ /// It can be + /// called again to re-seed the generator.

+ /// For details, see RandomState. ///
/// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. + /// Seed for RandomState.

+ /// + /// Must be convertible to 32 bit unsigned integers. /// public static void seed(int? seed = null) - => NumPy.Instance.random_seed(seed:seed); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (seed!=null) kwargs["seed"]=ToPython(seed); + dynamic py = __self__.InvokeMethod("seed", pyargs, kwargs); + } } public static partial class random { /// - /// Seed the generator. - /// - /// This method is called when RandomState is initialized. It can be - /// called again to re-seed the generator. For details, see RandomState. + /// Seed the generator.

+ /// + /// This method is called when RandomState is initialized.

+ /// It can be + /// called again to re-seed the generator.

+ /// For details, see RandomState. ///
/// - /// Seed for RandomState. - /// Must be convertible to 32 bit unsigned integers. + /// Seed for RandomState.

+ /// + /// Must be convertible to 32 bit unsigned integers. /// public static void seed(NDarray seed = null) - => NumPy.Instance.random_seed(seed:seed); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (seed!=null) kwargs["seed"]=ToPython(seed); + dynamic py = __self__.InvokeMethod("seed", pyargs, kwargs); + } } /* public static partial class random { /// - /// Return a tuple representing the internal state of the generator. - /// - /// For more details, see set_state. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. + /// Return a tuple representing the internal state of the generator.

+ /// + /// For more details, see set_state.

+ /// + /// Notes + /// + /// set_state and get_state are not needed to work with any of the + /// random distributions in NumPy.

+ /// If the internal state is manually altered, + /// the user should know exactly what he/she is doing. ///
- /// - /// The returned tuple has the following items: + /// + /// The returned tuple has the following items: /// /// - /// The returned tuple has the following items: + /// The returned tuple has the following items: /// public static tuple(str get_state(tuple(str @out = null) - => NumPy.Instance.random_get_state(@out:@out); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("get_state", pyargs, kwargs); + return ToCsharp(py); + } } */ /* public static partial class random { /// - /// Set the internal state of the generator from a tuple. - /// - /// For use if one has reason to manually (re-)set the internal state of the - /// “Mersenne Twister”[1] pseudo-random number generating algorithm. - /// - /// Notes - /// - /// set_state and get_state are not needed to work with any of the - /// random distributions in NumPy. If the internal state is manually altered, - /// the user should know exactly what he/she is doing. - /// - /// For backwards compatibility, the form (str, array of 624 uints, int) is - /// also accepted although it is missing some information about the cached - /// Gaussian value: state = ('MT19937', keys, pos). - /// - /// References + /// Set the internal state of the generator from a tuple.

+ /// + /// For use if one has reason to manually (re-)set the internal state of the + /// “Mersenne Twister”[1] pseudo-random number generating algorithm.

+ /// + /// Notes + /// + /// set_state and get_state are not needed to work with any of the + /// random distributions in NumPy.

+ /// If the internal state is manually altered, + /// the user should know exactly what he/she is doing.

+ /// + /// For backwards compatibility, the form (str, array of 624 uints, int) is + /// also accepted although it is missing some information about the cached + /// Gaussian value: state = ('MT19937', keys, pos).

+ /// + /// References ///
/// - /// The state tuple has the following items: + /// The state tuple has the following items: /// /// - /// Returns ‘None’ on success. + /// Returns ‘None’ on success. /// public static None set_state(tuple(str state) - => NumPy.Instance.random_set_state(state); + { + //auto-generated code, do not change + var random = self.GetAttr("random"); + var __self__=random; + var pyargs=ToTuple(new object[] + { + state, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("set_state", pyargs, kwargs); + return ToCsharp(py); + } } */ diff --git a/src/Numpy/np.set.gen.cs b/src/Numpy/np.set.gen.cs index 4835fa7..4620157 100644 --- a/src/Numpy/np.set.gen.cs +++ b/src/Numpy/np.set.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,185 +20,284 @@ public static partial class np { /// - /// Test whether each element of a 1-D array is also present in a second array. - /// - /// Returns a boolean array the same length as ar1 that is True - /// where an element of ar1 is in ar2 and False otherwise. - /// - /// We recommend using isin instead of in1d for new code. - /// - /// Notes - /// - /// in1d can be considered as an element-wise function version of the - /// python keyword in, for 1-D sequences. in1d(a, b) is roughly - /// equivalent to np.array([item in b for item in a]). - /// However, this idea fails if ar2 is a set, or similar (non-sequence) - /// container: As ar2 is converted to an array, in those cases - /// asarray(ar2) is an object array rather than the expected array of - /// contained values. + /// Test whether each element of a 1-D array is also present in a second array.

+ /// + /// Returns a boolean array the same length as ar1 that is True + /// where an element of ar1 is in ar2 and False otherwise.

+ /// + /// We recommend using isin instead of in1d for new code.

+ /// + /// Notes + /// + /// in1d can be considered as an element-wise function version of the + /// python keyword in, for 1-D sequences.

+ /// in1d(a, b) is roughly + /// equivalent to np.array([item in b for item in a]).

+ /// + /// However, this idea fails if ar2 is a set, or similar (non-sequence) + /// container: As ar2 is converted to an array, in those cases + /// asarray(ar2) is an object array rather than the expected array of + /// contained values. ///
/// - /// Input array. + /// Input array. /// /// - /// The values against which to test each value of ar1. + /// The values against which to test each value of ar1. /// /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. + /// If True, the input arrays are both assumed to be unique, which + /// can speed up the calculation.

+ /// Default is False. /// /// - /// If True, the values in the returned array are inverted (that is, - /// False where an element of ar1 is in ar2 and True otherwise). - /// Default is False. np.in1d(a, b, invert=True) is equivalent - /// to (but is faster than) np.invert(in1d(a, b)). + /// If True, the values in the returned array are inverted (that is, + /// False where an element of ar1 is in ar2 and True otherwise).

+ /// + /// Default is False.

+ /// np.in1d(a, b, invert=True) is equivalent + /// to (but is faster than) np.invert(in1d(a, b)). /// /// - /// The values ar1[in1d] are in ar2. + /// The values ar1[in1d] are in ar2. /// - public static NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) - => NumPy.Instance.in1d(ar1, ar2, assume_unique:assume_unique, invert:invert); + public static NDarray in1d(this NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar1, + ar2, + }); + var kwargs=new PyDict(); + if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); + if (invert!=false) kwargs["invert"]=ToPython(invert); + dynamic py = __self__.InvokeMethod("in1d", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Find the intersection of two arrays. - /// - /// Return the sorted, unique values that are in both of the input arrays. + /// Find the intersection of two arrays.

+ /// + /// Return the sorted, unique values that are in both of the input arrays. ///
/// - /// Input arrays. Will be flattened if not already 1D. + /// Input arrays.

+ /// Will be flattened if not already 1D. /// /// - /// Input arrays. Will be flattened if not already 1D. + /// Input arrays.

+ /// Will be flattened if not already 1D. /// /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. + /// If True, the input arrays are both assumed to be unique, which + /// can speed up the calculation.

+ /// Default is False. /// /// - /// If True, the indices which correspond to the intersection of the two - /// arrays are returned. The first instance of a value is used if there are - /// multiple. Default is False. + /// If True, the indices which correspond to the intersection of the two + /// arrays are returned.

+ /// The first instance of a value is used if there are + /// multiple.

+ /// Default is False. /// /// /// A tuple of: /// intersect1d - /// Sorted 1D array of common and unique elements. + /// Sorted 1D array of common and unique elements. /// comm1 - /// The indices of the first occurrences of the common values in ar1. - /// Only provided if return_indices is True. + /// The indices of the first occurrences of the common values in ar1. + /// Only provided if return_indices is True. /// comm2 - /// The indices of the first occurrences of the common values in ar2. - /// Only provided if return_indices is True. + /// The indices of the first occurrences of the common values in ar2. + /// Only provided if return_indices is True. /// - public static (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) - => NumPy.Instance.intersect1d(ar2, ar1, assume_unique, return_indices); + public static (NDarray, NDarray, NDarray) intersect1d(this NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar2, + ar1, + }); + var kwargs=new PyDict(); + if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); + if (return_indices!=false) kwargs["return_indices"]=ToPython(return_indices); + dynamic py = __self__.InvokeMethod("intersect1d", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); + } /// - /// Calculates element in test_elements, broadcasting over element only. - /// Returns a boolean array of the same shape as element that is True - /// where an element of element is in test_elements and False otherwise. - /// - /// Notes - /// - /// isin is an element-wise function version of the python keyword in. - /// isin(a, b) is roughly equivalent to - /// np.array([item in b for item in a]) if a and b are 1-D sequences. - /// - /// element and test_elements are converted to arrays if they are not - /// already. If test_elements is a set (or other non-sequence collection) - /// it will be converted to an object array with one element, rather than an - /// array of the values contained in test_elements. This is a consequence - /// of the array constructor’s way of handling non-sequence collections. - /// Converting the set to a list usually gives the desired behavior. + /// Calculates element in test_elements, broadcasting over element only.

+ /// + /// Returns a boolean array of the same shape as element that is True + /// where an element of element is in test_elements and False otherwise.

+ /// + /// Notes + /// + /// isin is an element-wise function version of the python keyword in.

+ /// + /// isin(a, b) is roughly equivalent to + /// np.array([item in b for item in a]) if a and b are 1-D sequences.

+ /// + /// element and test_elements are converted to arrays if they are not + /// already.

+ /// If test_elements is a set (or other non-sequence collection) + /// it will be converted to an object array with one element, rather than an + /// array of the values contained in test_elements.

+ /// This is a consequence + /// of the array constructor’s way of handling non-sequence collections.

+ /// + /// Converting the set to a list usually gives the desired behavior. ///
/// - /// Input array. + /// Input array. /// /// - /// The values against which to test each value of element. - /// This argument is flattened if it is an array or array_like. - /// See notes for behavior with non-array-like parameters. + /// The values against which to test each value of element.

+ /// + /// This argument is flattened if it is an array or array_like.

+ /// + /// See notes for behavior with non-array-like parameters. /// /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. + /// If True, the input arrays are both assumed to be unique, which + /// can speed up the calculation.

+ /// Default is False. /// /// - /// If True, the values in the returned array are inverted, as if - /// calculating element not in test_elements. Default is False. - /// np.isin(a, b, invert=True) is equivalent to (but faster - /// than) np.invert(np.isin(a, b)). + /// If True, the values in the returned array are inverted, as if + /// calculating element not in test_elements.

+ /// Default is False.

+ /// + /// np.isin(a, b, invert=True) is equivalent to (but faster + /// than) np.invert(np.isin(a, b)). /// /// - /// Has the same shape as element. The values element[isin] - /// are in test_elements. + /// Has the same shape as element.

+ /// The values element[isin] + /// are in test_elements. ///
- public static NDarray isin(NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) - => NumPy.Instance.isin(element, test_elements, assume_unique:assume_unique, invert:invert); + public static NDarray isin(this NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + element, + test_elements, + }); + var kwargs=new PyDict(); + if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); + if (invert!=false) kwargs["invert"]=ToPython(invert); + dynamic py = __self__.InvokeMethod("isin", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Find the set difference of two arrays. - /// - /// Return the unique values in ar1 that are not in ar2. + /// Find the set difference of two arrays.

+ /// + /// Return the unique values in ar1 that are not in ar2. ///
/// - /// Input array. + /// Input array. /// /// - /// Input comparison array. + /// Input comparison array. /// /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. + /// If True, the input arrays are both assumed to be unique, which + /// can speed up the calculation.

+ /// Default is False. /// /// - /// 1D array of values in ar1 that are not in ar2. The result - /// is sorted when assume_unique=False, but otherwise only sorted - /// if the input is sorted. + /// 1D array of values in ar1 that are not in ar2. The result + /// is sorted when assume_unique=False, but otherwise only sorted + /// if the input is sorted. /// - public static NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = false) - => NumPy.Instance.setdiff1d(ar1, ar2, assume_unique); + public static NDarray setdiff1d(this NDarray ar1, NDarray ar2, bool assume_unique = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar1, + ar2, + }); + var kwargs=new PyDict(); + if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); + dynamic py = __self__.InvokeMethod("setdiff1d", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Find the set exclusive-or of two arrays. - /// - /// Return the sorted, unique values that are in only one (not both) of the - /// input arrays. + /// Find the set exclusive-or of two arrays.

+ /// + /// Return the sorted, unique values that are in only one (not both) of the + /// input arrays. ///
/// - /// Input arrays. + /// Input arrays. /// /// - /// Input arrays. + /// Input arrays. /// /// - /// If True, the input arrays are both assumed to be unique, which - /// can speed up the calculation. Default is False. + /// If True, the input arrays are both assumed to be unique, which + /// can speed up the calculation.

+ /// Default is False. /// /// - /// Sorted 1D array of unique values that are in only one of the input - /// arrays. + /// Sorted 1D array of unique values that are in only one of the input + /// arrays. /// - public static NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = false) - => NumPy.Instance.setxor1d(ar2, ar1, assume_unique); + public static NDarray setxor1d(this NDarray ar2, NDarray ar1, bool assume_unique = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar2, + ar1, + }); + var kwargs=new PyDict(); + if (assume_unique!=false) kwargs["assume_unique"]=ToPython(assume_unique); + dynamic py = __self__.InvokeMethod("setxor1d", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Find the union of two arrays. - /// - /// Return the unique, sorted array of values that are in either of the two - /// input arrays. + /// Find the union of two arrays.

+ /// + /// Return the unique, sorted array of values that are in either of the two + /// input arrays. ///
/// - /// Input arrays. They are flattened if they are not already 1D. + /// Input arrays.

+ /// They are flattened if they are not already 1D. /// /// - /// Input arrays. They are flattened if they are not already 1D. + /// Input arrays.

+ /// They are flattened if they are not already 1D. /// /// - /// Unique, sorted union of the input arrays. + /// Unique, sorted union of the input arrays. /// - public static NDarray union1d(NDarray ar2, NDarray ar1) - => NumPy.Instance.union1d(ar2, ar1); + public static NDarray union1d(this NDarray ar2, NDarray ar1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + ar2, + ar1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("union1d", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.sorting.gen.cs b/src/Numpy/np.sorting.gen.cs index 38d5841..1cc4cf2 100644 --- a/src/Numpy/np.sorting.gen.cs +++ b/src/Numpy/np.sorting.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,521 +20,804 @@ public static partial class np { /// - /// Return a sorted copy of an array. - /// - /// Notes - /// - /// The various sorting algorithms are characterized by their average speed, - /// worst case performance, work space size, and whether they are stable. A - /// stable sort keeps items with the same key in the same relative - /// order. The three available algorithms have the following - /// properties: - /// - /// All the sort algorithms make temporary copies of the data when - /// sorting along any but the last axis. Consequently, sorting along - /// the last axis is faster and uses less space than sorting along - /// any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the real - /// and imaginary parts are non-nan then the order is determined by the - /// real parts except when they are equal, in which case the order is - /// determined by the imaginary parts. - /// - /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan - /// values led to undefined behaviour. In numpy versions >= 1.4.0 nan - /// values are sorted to the end. The extended sort order is: - /// - /// where R is a non-nan real value. Complex values with the same nan - /// placements are sorted according to the non-nan part if it exists. - /// Non-nan values are sorted as before. - /// - /// quicksort has been changed to an introsort which will switch - /// heapsort when it does not make enough progress. This makes its - /// worst case O(n*log(n)). - /// - /// ‘stable’ automatically choses the best stable sorting algorithm - /// for the data type being sorted. It is currently mapped to - /// merge sort. + /// Return a sorted copy of an array.

+ /// + /// Notes + /// + /// The various sorting algorithms are characterized by their average speed, + /// worst case performance, work space size, and whether they are stable.

+ /// A + /// stable sort keeps items with the same key in the same relative + /// order.

+ /// The three available algorithms have the following + /// properties: + /// + /// All the sort algorithms make temporary copies of the data when + /// sorting along any but the last axis.

+ /// Consequently, sorting along + /// the last axis is faster and uses less space than sorting along + /// any other axis.

+ /// + /// The sort order for complex numbers is lexicographic.

+ /// If both the real + /// and imaginary parts are non-nan then the order is determined by the + /// real parts except when they are equal, in which case the order is + /// determined by the imaginary parts.

+ /// + /// Previous to numpy 1.4.0 sorting real and complex arrays containing nan + /// values led to undefined behaviour.

+ /// In numpy versions >= 1.4.0 nan + /// values are sorted to the end.

+ /// The extended sort order is: + /// + /// where R is a non-nan real value.

+ /// Complex values with the same nan + /// placements are sorted according to the non-nan part if it exists.

+ /// + /// Non-nan values are sorted as before.

+ /// + /// quicksort has been changed to an introsort which will switch + /// heapsort when it does not make enough progress.

+ /// This makes its + /// worst case O(n*log(n)).

+ /// + /// ‘stable’ automatically choses the best stable sorting algorithm + /// for the data type being sorted.

+ /// It is currently mapped to + /// merge sort. ///
/// - /// Array to be sorted. + /// Array to be sorted. /// /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. + /// Axis along which to sort.

+ /// If None, the array is flattened before + /// sorting.

+ /// The default is -1, which sorts along the last axis. /// /// - /// Sorting algorithm. Default is ‘quicksort’. + /// Sorting algorithm.

+ /// Default is ‘quicksort’. /// /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. + /// When a is an array with fields defined, this argument specifies + /// which fields to compare first, second, etc.

+ /// A single field can + /// be specified as a string, and not all fields need be specified, + /// but unspecified fields will still be used, in the order in which + /// they come up in the dtype, to break ties. /// /// - /// Array of the same type and shape as a. + /// Array of the same type and shape as a. /// - public static NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - => NumPy.Instance.sort(a, axis:axis, kind:kind, order:order); + public static NDarray sort(this NDarray a, int? axis = -1, string kind = "quicksort", string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (kind!="quicksort") kwargs["kind"]=ToPython(kind); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Perform an indirect stable sort using a sequence of keys. - /// - /// Given multiple sorting keys, which can be interpreted as columns in a - /// spreadsheet, lexsort returns an array of integer indices that describes - /// the sort order by multiple columns. The last key in the sequence is used - /// for the primary sort order, the second-to-last key for the secondary sort - /// order, and so on. The keys argument must be a sequence of objects that - /// can be converted to arrays of the same shape. If a 2D array is provided - /// for the keys argument, it’s rows are interpreted as the sorting keys and - /// sorting is according to the last row, second last row etc. + /// Perform an indirect stable sort using a sequence of keys.

+ /// + /// Given multiple sorting keys, which can be interpreted as columns in a + /// spreadsheet, lexsort returns an array of integer indices that describes + /// the sort order by multiple columns.

+ /// The last key in the sequence is used + /// for the primary sort order, the second-to-last key for the secondary sort + /// order, and so on.

+ /// The keys argument must be a sequence of objects that + /// can be converted to arrays of the same shape.

+ /// If a 2D array is provided + /// for the keys argument, it’s rows are interpreted as the sorting keys and + /// sorting is according to the last row, second last row etc. ///
/// - /// The k different “columns” to be sorted. The last column (or row if - /// keys is a 2D array) is the primary sort key. + /// The k different “columns” to be sorted.

+ /// The last column (or row if + /// keys is a 2D array) is the primary sort key. /// /// - /// Axis to be indirectly sorted. By default, sort over the last axis. + /// Axis to be indirectly sorted.

+ /// By default, sort over the last axis. /// /// - /// Array of indices that sort the keys along the specified axis. + /// Array of indices that sort the keys along the specified axis. /// - public static NDarray lexsort(NDarray keys, int? axis = -1) - => NumPy.Instance.lexsort(keys, axis:axis); + public static NDarray lexsort(this NDarray keys, int? axis = -1) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + keys, + }); + var kwargs=new PyDict(); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("lexsort", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns the indices that would sort an array. - /// - /// Perform an indirect sort along the given axis using the algorithm specified - /// by the kind keyword. It returns an array of indices of the same shape as - /// a that index data along the given axis in sorted order. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. - /// - /// As of NumPy 1.4.0 argsort works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. + /// Returns the indices that would sort an array.

+ /// + /// Perform an indirect sort along the given axis using the algorithm specified + /// by the kind keyword.

+ /// It returns an array of indices of the same shape as + /// a that index data along the given axis in sorted order.

+ /// + /// Notes + /// + /// See sort for notes on the different sorting algorithms.

+ /// + /// As of NumPy 1.4.0 argsort works with real/complex arrays containing + /// nan values.

+ /// The enhanced sort order is documented in sort. ///
/// - /// Array to sort. + /// Array to sort. /// /// - /// Axis along which to sort. The default is -1 (the last axis). If None, - /// the flattened array is used. + /// Axis along which to sort.

+ /// The default is -1 (the last axis).

+ /// If None, + /// the flattened array is used. /// /// - /// Sorting algorithm. + /// Sorting algorithm. /// /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. + /// When a is an array with fields defined, this argument specifies + /// which fields to compare first, second, etc.

+ /// A single field can + /// be specified as a string, and not all fields need be specified, + /// but unspecified fields will still be used, in the order in which + /// they come up in the dtype, to break ties. /// /// - /// Array of indices that sort a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a sorted a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the sorted a, irrespective of dimensionality. + /// Array of indices that sort a along the specified axis.

+ /// + /// If a is one-dimensional, a[index_array] yields a sorted a.

+ /// + /// More generally, np.take_along_axis(a, index_array, axis=a) always + /// yields the sorted a, irrespective of dimensionality. ///
- public static NDarray argsort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null) - => NumPy.Instance.argsort(a, axis:axis, kind:kind, order:order); + public static NDarray argsort(this NDarray a, int? axis = -1, string kind = "quicksort", string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (kind!="quicksort") kwargs["kind"]=ToPython(kind); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("argsort", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Sort an array, in-place. - /// - /// Notes - /// - /// See sort for notes on the different sorting algorithms. + /// Sort an array, in-place.

+ /// + /// Notes + /// + /// See sort for notes on the different sorting algorithms. ///
/// - /// Axis along which to sort. Default is -1, which means sort along the - /// last axis. + /// Axis along which to sort.

+ /// Default is -1, which means sort along the + /// last axis. /// /// - /// Sorting algorithm. Default is ‘quicksort’. + /// Sorting algorithm.

+ /// Default is ‘quicksort’. /// /// - /// When a is an array with fields defined, this argument specifies - /// which fields to compare first, second, etc. A single field can - /// be specified as a string, and not all fields need be specified, - /// but unspecified fields will still be used, in the order in which - /// they come up in the dtype, to break ties. + /// When a is an array with fields defined, this argument specifies + /// which fields to compare first, second, etc.

+ /// A single field can + /// be specified as a string, and not all fields need be specified, + /// but unspecified fields will still be used, in the order in which + /// they come up in the dtype, to break ties. /// public static void sort(int? axis = -1, string kind = null, string order = null) - => NumPy.Instance.sort(axis:axis, kind:kind, order:order); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + }); + var kwargs=new PyDict(); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (kind!=null) kwargs["kind"]=ToPython(kind); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs); + } /// - /// Return a copy of an array sorted along the first axis. - /// - /// Notes - /// - /// np.msort(a) is equivalent to np.sort(a, axis=0). + /// Return a copy of an array sorted along the first axis.

+ /// + /// Notes + /// + /// np.msort(a) is equivalent to np.sort(a, axis=0). ///
/// - /// Array to be sorted. + /// Array to be sorted. /// /// - /// Array of the same type and shape as a. + /// Array of the same type and shape as a. /// - public static NDarray msort(NDarray a) - => NumPy.Instance.msort(a); + public static NDarray msort(this 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("msort", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Sort a complex array using the real part first, then the imaginary part. + /// Sort a complex array using the real part first, then the imaginary part. /// /// - /// Input array + /// Input array /// /// - /// Always returns a sorted complex array. + /// Always returns a sorted complex array. /// - public static NDarray sort_complex(NDarray a) - => NumPy.Instance.sort_complex(a); + public static NDarray sort_complex(this 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("sort_complex", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return a partitioned copy of an array. - /// - /// Creates a copy of the array with its elements rearranged in such a - /// way that the value of the element in k-th position is in the - /// position it would be in a sorted array. All elements smaller than - /// the k-th element are moved before this element and all equal or - /// greater are moved behind it. The ordering of the elements in the two - /// partitions is undefined. - /// - /// Notes - /// - /// The various selection algorithms are characterized by their average - /// speed, worst case performance, work space size, and whether they are - /// stable. A stable sort keeps items with the same key in the same - /// relative order. The available algorithms have the following - /// properties: - /// - /// All the partition algorithms make temporary copies of the data when - /// partitioning along any but the last axis. Consequently, - /// partitioning along the last axis is faster and uses less space than - /// partitioning along any other axis. - /// - /// The sort order for complex numbers is lexicographic. If both the - /// real and imaginary parts are non-nan then the order is determined by - /// the real parts except when they are equal, in which case the order - /// is determined by the imaginary parts. + /// Return a partitioned copy of an array.

+ /// + /// Creates a copy of the array with its elements rearranged in such a + /// way that the value of the element in k-th position is in the + /// position it would be in a sorted array.

+ /// All elements smaller than + /// the k-th element are moved before this element and all equal or + /// greater are moved behind it.

+ /// The ordering of the elements in the two + /// partitions is undefined.

+ /// + /// Notes + /// + /// The various selection algorithms are characterized by their average + /// speed, worst case performance, work space size, and whether they are + /// stable.

+ /// A stable sort keeps items with the same key in the same + /// relative order.

+ /// The available algorithms have the following + /// properties: + /// + /// All the partition algorithms make temporary copies of the data when + /// partitioning along any but the last axis.

+ /// Consequently, + /// partitioning along the last axis is faster and uses less space than + /// partitioning along any other axis.

+ /// + /// The sort order for complex numbers is lexicographic.

+ /// If both the + /// real and imaginary parts are non-nan then the order is determined by + /// the real parts except when they are equal, in which case the order + /// is determined by the imaginary parts. ///
/// - /// Array to be sorted. + /// Array to be sorted. /// /// - /// Element index to partition by. The k-th value of the element - /// will be in its final sorted position and all smaller elements - /// will be moved before it and all equal or greater elements behind - /// it. The order of all elements in the partitions is undefined. If - /// provided with a sequence of k-th it will partition all elements - /// indexed by k-th of them into their sorted position at once. + /// Element index to partition by.

+ /// The k-th value of the element + /// will be in its final sorted position and all smaller elements + /// will be moved before it and all equal or greater elements behind + /// it.

+ /// The order of all elements in the partitions is undefined.

+ /// If + /// provided with a sequence of k-th it will partition all elements + /// indexed by k-th of them into their sorted position at once. /// /// - /// Axis along which to sort. If None, the array is flattened before - /// sorting. The default is -1, which sorts along the last axis. + /// Axis along which to sort.

+ /// If None, the array is flattened before + /// sorting.

+ /// The default is -1, which sorts along the last axis. /// /// - /// Selection algorithm. Default is ‘introselect’. + /// Selection algorithm.

+ /// Default is ‘introselect’. /// /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string. Not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. + /// When a is an array with fields defined, this argument + /// specifies which fields to compare first, second, etc.

+ /// A single + /// field can be specified as a string.

+ /// Not all fields need be + /// specified, but unspecified fields will still be used, in the + /// order in which they come up in the dtype, to break ties. /// /// - /// Array of the same type and shape as a. + /// Array of the same type and shape as a. /// - public static NDarray partition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - => NumPy.Instance.partition(a, kth, axis:axis, kind:kind, order:order); + public static NDarray partition(this NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + kth, + }); + var kwargs=new PyDict(); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (kind!="introselect") kwargs["kind"]=ToPython(kind); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Perform an indirect partition along the given axis using the - /// algorithm specified by the kind keyword. It returns an array of - /// indices of the same shape as a that index data along the given - /// axis in partitioned order. - /// - /// Notes - /// - /// See partition for notes on the different selection algorithms. + /// Perform an indirect partition along the given axis using the + /// algorithm specified by the kind keyword.

+ /// It returns an array of + /// indices of the same shape as a that index data along the given + /// axis in partitioned order.

+ /// + /// Notes + /// + /// See partition for notes on the different selection algorithms. ///
/// - /// Array to sort. + /// Array to sort. /// /// - /// Element index to partition by. The k-th element will be in its - /// final sorted position and all smaller elements will be moved - /// before it and all larger elements behind it. The order all - /// elements in the partitions is undefined. If provided with a - /// sequence of k-th it will partition all of them into their sorted - /// position at once. + /// Element index to partition by.

+ /// The k-th element will be in its + /// final sorted position and all smaller elements will be moved + /// before it and all larger elements behind it.

+ /// The order all + /// elements in the partitions is undefined.

+ /// If provided with a + /// sequence of k-th it will partition all of them into their sorted + /// position at once. /// /// - /// Axis along which to sort. The default is -1 (the last axis). If - /// None, the flattened array is used. + /// Axis along which to sort.

+ /// The default is -1 (the last axis).

+ /// If + /// None, the flattened array is used. /// /// - /// Selection algorithm. Default is ‘introselect’ + /// Selection algorithm.

+ /// Default is ‘introselect’ /// /// - /// When a is an array with fields defined, this argument - /// specifies which fields to compare first, second, etc. A single - /// field can be specified as a string, and not all fields need be - /// specified, but unspecified fields will still be used, in the - /// order in which they come up in the dtype, to break ties. + /// When a is an array with fields defined, this argument + /// specifies which fields to compare first, second, etc.

+ /// A single + /// field can be specified as a string, and not all fields need be + /// specified, but unspecified fields will still be used, in the + /// order in which they come up in the dtype, to break ties. /// /// - /// Array of indices that partition a along the specified axis. - /// If a is one-dimensional, a[index_array] yields a partitioned a. - /// More generally, np.take_along_axis(a, index_array, axis=a) always - /// yields the partitioned a, irrespective of dimensionality. + /// Array of indices that partition a along the specified axis.

+ /// + /// If a is one-dimensional, a[index_array] yields a partitioned a.

+ /// + /// More generally, np.take_along_axis(a, index_array, axis=a) always + /// yields the partitioned a, irrespective of dimensionality. ///
- public static NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) - => NumPy.Instance.argpartition(a, kth, axis:axis, kind:kind, order:order); + public static NDarray argpartition(this NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + kth, + }); + var kwargs=new PyDict(); + if (axis!=-1) kwargs["axis"]=ToPython(axis); + if (kind!="introselect") kwargs["kind"]=ToPython(kind); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("argpartition", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns the indices of the maximum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the maximum values, the indices - /// corresponding to the first occurrence are returned. + /// Returns the indices of the maximum values along an axis.

+ /// + /// Notes + /// + /// In case of multiple occurrences of the maximum values, the indices + /// corresponding to the first occurrence are returned. ///
/// - /// Input array. + /// Input array. /// /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. + /// By default, the index is into the flattened array, otherwise + /// along the specified axis. /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. + /// + /// If provided, the result will be inserted into this array.

+ /// It should + /// be of the appropriate shape and dtype. /// /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. + /// Array of indices into the array.

+ /// It has the same shape as a.shape + /// with the dimension along axis removed. ///
- public static NDarray argmax(NDarray a, int? axis = null, NDarray @out = null) - => NumPy.Instance.argmax(a, axis:axis, @out:@out); + public static NDarray argmax(this NDarray a, int? axis = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("argmax", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the indices of the maximum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the - /// results cannot be trusted if a slice contains only NaNs and -Infs. + /// Return the indices of the maximum values in the specified axis ignoring + /// NaNs.

+ /// For all-NaN slices ValueError is raised.

+ /// Warning: the + /// results cannot be trusted if a slice contains only NaNs and -Infs. ///
/// - /// Input data. + /// Input data. /// /// - /// Axis along which to operate. By default flattened input is used. + /// Axis along which to operate.

+ /// By default flattened input is used. /// /// - /// An array of indices or a single index value. + /// An array of indices or a single index value. /// - public static NDarray nanargmax(NDarray a, int? axis = null) - => NumPy.Instance.nanargmax(a, axis:axis); + public static NDarray nanargmax(this NDarray a, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("nanargmax", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Returns the indices of the minimum values along an axis. - /// - /// Notes - /// - /// In case of multiple occurrences of the minimum values, the indices - /// corresponding to the first occurrence are returned. + /// Returns the indices of the minimum values along an axis.

+ /// + /// Notes + /// + /// In case of multiple occurrences of the minimum values, the indices + /// corresponding to the first occurrence are returned. ///
/// - /// Input array. + /// Input array. /// /// - /// By default, the index is into the flattened array, otherwise - /// along the specified axis. + /// By default, the index is into the flattened array, otherwise + /// along the specified axis. /// - /// - /// If provided, the result will be inserted into this array. It should - /// be of the appropriate shape and dtype. + /// + /// If provided, the result will be inserted into this array.

+ /// It should + /// be of the appropriate shape and dtype. /// /// - /// Array of indices into the array. It has the same shape as a.shape - /// with the dimension along axis removed. + /// Array of indices into the array.

+ /// It has the same shape as a.shape + /// with the dimension along axis removed. ///
- public static NDarray argmin(NDarray a, int? axis = null, NDarray @out = null) - => NumPy.Instance.argmin(a, axis:axis, @out:@out); + public static NDarray argmin(this NDarray a, int? axis = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("argmin", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the indices of the minimum values in the specified axis ignoring - /// NaNs. For all-NaN slices ValueError is raised. Warning: the results - /// cannot be trusted if a slice contains only NaNs and Infs. + /// Return the indices of the minimum values in the specified axis ignoring + /// NaNs.

+ /// For all-NaN slices ValueError is raised.

+ /// Warning: the results + /// cannot be trusted if a slice contains only NaNs and Infs. ///
/// - /// Input data. + /// Input data. /// /// - /// Axis along which to operate. By default flattened input is used. + /// Axis along which to operate.

+ /// By default flattened input is used. /// /// - /// An array of indices or a single index value. + /// An array of indices or a single index value. /// - public static NDarray nanargmin(NDarray a, int? axis = null) - => NumPy.Instance.nanargmin(a, axis:axis); + public static NDarray nanargmin(this NDarray a, int? axis = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("nanargmin", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Find the indices of array elements that are non-zero, grouped by element. - /// - /// Notes - /// - /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)). - /// - /// The output of argwhere is not suitable for indexing arrays. - /// For this purpose use nonzero(a) instead. + /// Find the indices of array elements that are non-zero, grouped by element.

+ /// + /// Notes + /// + /// np.argwhere(a) is the same as np.transpose(np.nonzero(a)).

+ /// + /// The output of argwhere is not suitable for indexing arrays.

+ /// + /// For this purpose use nonzero(a) instead. ///
/// - /// Input data. + /// Input data. /// /// - /// Indices of elements that are non-zero. Indices are grouped by element. + /// Indices of elements that are non-zero.

+ /// Indices are grouped by element. ///
- public static NDarray argwhere(NDarray a) - => NumPy.Instance.argwhere(a); + public static NDarray argwhere(this 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("argwhere", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return indices that are non-zero in the flattened version of a. - /// - /// This is equivalent to np.nonzero(np.ravel(a))[0]. + /// Return indices that are non-zero in the flattened version of a.

+ /// + /// This is equivalent to np.nonzero(np.ravel(a))[0]. ///
/// - /// Input data. + /// Input data. /// /// - /// Output array, containing the indices of the elements of a.ravel() - /// that are non-zero. + /// Output array, containing the indices of the elements of a.ravel() + /// that are non-zero. /// - public static NDarray flatnonzero(NDarray a) - => NumPy.Instance.flatnonzero(a); + public static NDarray flatnonzero(this 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("flatnonzero", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Find indices where elements should be inserted to maintain order. - /// - /// Find the indices into a sorted array a such that, if the - /// corresponding elements in v were inserted before the indices, the - /// order of a would be preserved. - /// - /// Assuming that a is sorted: - /// - /// Notes - /// - /// Binary search is used to find the required insertion points. - /// - /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing - /// nan values. The enhanced sort order is documented in sort. - /// - /// This function is a faster version of the builtin python bisect.bisect_left - /// (side='left') and bisect.bisect_right (side='right') functions, - /// which is also vectorized in the v argument. + /// Find indices where elements should be inserted to maintain order.

+ /// + /// Find the indices into a sorted array a such that, if the + /// corresponding elements in v were inserted before the indices, the + /// order of a would be preserved.

+ /// + /// Assuming that a is sorted: + /// + /// Notes + /// + /// Binary search is used to find the required insertion points.

+ /// + /// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing + /// nan values.

+ /// The enhanced sort order is documented in sort.

+ /// + /// This function is a faster version of the builtin python bisect.bisect_left + /// (side='left') and bisect.bisect_right (side='right') functions, + /// which is also vectorized in the v argument. ///
/// - /// Input array. If sorter is None, then it must be sorted in - /// ascending order, otherwise sorter must be an array of indices - /// that sort it. + /// Input array.

+ /// If sorter is None, then it must be sorted in + /// ascending order, otherwise sorter must be an array of indices + /// that sort it. /// /// - /// Values to insert into a. + /// Values to insert into a. /// /// - /// If ‘left’, the index of the first suitable location found is given. - /// If ‘right’, return the last such index. If there is no suitable - /// index, return either 0 or N (where N is the length of a). + /// If ‘left’, the index of the first suitable location found is given.

+ /// + /// If ‘right’, return the last such index.

+ /// If there is no suitable + /// index, return either 0 or N (where N is the length of a). /// /// - /// Optional array of integer indices that sort array a into ascending - /// order. They are typically the result of argsort. + /// Optional array of integer indices that sort array a into ascending + /// order.

+ /// They are typically the result of argsort. /// /// - /// Array of insertion points with the same shape as v. + /// Array of insertion points with the same shape as v. /// - public static NDarray searchsorted(NDarray a, NDarray v, string side = "left", NDarray sorter = null) - => NumPy.Instance.searchsorted(a, v, side:side, sorter:sorter); + public static NDarray searchsorted(this NDarray a, NDarray v, string side = "left", NDarray sorter = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + v, + }); + var kwargs=new PyDict(); + if (side!="left") kwargs["side"]=ToPython(side); + if (sorter!=null) kwargs["sorter"]=ToPython(sorter); + dynamic py = __self__.InvokeMethod("searchsorted", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return the elements of an array that satisfy some condition. - /// - /// This is equivalent to np.compress(ravel(condition), ravel(arr)). If - /// condition is boolean np.extract is equivalent to arr[condition]. - /// - /// Note that place does the exact opposite of extract. + /// Return the elements of an array that satisfy some condition.

+ /// + /// This is equivalent to np.compress(ravel(condition), ravel(arr)).

+ /// If + /// condition is boolean np.extract is equivalent to arr[condition].

+ /// + /// Note that place does the exact opposite of extract. ///
/// - /// An array whose nonzero or True entries indicate the elements of arr - /// to extract. + /// An array whose nonzero or True entries indicate the elements of arr + /// to extract. /// /// - /// Input array of the same size as condition. + /// Input array of the same size as condition. /// /// - /// Rank 1 array of values from arr where condition is True. + /// Rank 1 array of values from arr where condition is True. /// - public static NDarray extract(NDarray condition, NDarray arr) - => NumPy.Instance.extract(condition, arr); + public static NDarray extract(this NDarray condition, NDarray arr) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + condition, + arr, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("extract", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. + /// Counts the number of non-zero values in the array a.

+ /// + /// The word “non-zero” is in reference to the Python 2.x + /// built-in method __nonzero__() (renamed __bool__() + /// in Python 3.x) of Python objects that tests an object’s + /// “truthfulness”. For example, any number is considered + /// truthful if it is nonzero, whereas any string is considered + /// truthful if it is not the empty string.

+ /// Thus, this function + /// (recursively) counts how many elements in a (and in + /// sub-arrays thereof) have their __nonzero__() or __bool__() + /// method evaluated to True. ///
/// - /// The array for which to count non-zeros. + /// The array for which to count non-zeros. /// /// - /// Axis or tuple of axes along which to count non-zeros. - /// Default is None, meaning that non-zeros will be counted - /// along a flattened version of a. + /// Axis or tuple of axes along which to count non-zeros.

+ /// + /// Default is None, meaning that non-zeros will be counted + /// along a flattened version of a. /// /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. + /// Number of non-zero values in the array along a given axis.

+ /// + /// Otherwise, the total number of non-zero values in the array + /// is returned. ///
- public static NDarray count_nonzero(NDarray a, int[] axis) - => NumPy.Instance.count_nonzero(a, axis:axis); + public static NDarray count_nonzero(this NDarray a, Axis axis) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + dynamic py = __self__.InvokeMethod("count_nonzero", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Counts the number of non-zero values in the array a. - /// - /// The word “non-zero” is in reference to the Python 2.x - /// built-in method __nonzero__() (renamed __bool__() - /// in Python 3.x) of Python objects that tests an object’s - /// “truthfulness”. For example, any number is considered - /// truthful if it is nonzero, whereas any string is considered - /// truthful if it is not the empty string. Thus, this function - /// (recursively) counts how many elements in a (and in - /// sub-arrays thereof) have their __nonzero__() or __bool__() - /// method evaluated to True. + /// Counts the number of non-zero values in the array a.

+ /// + /// The word “non-zero” is in reference to the Python 2.x + /// built-in method __nonzero__() (renamed __bool__() + /// in Python 3.x) of Python objects that tests an object’s + /// “truthfulness”. For example, any number is considered + /// truthful if it is nonzero, whereas any string is considered + /// truthful if it is not the empty string.

+ /// Thus, this function + /// (recursively) counts how many elements in a (and in + /// sub-arrays thereof) have their __nonzero__() or __bool__() + /// method evaluated to True. ///
/// - /// The array for which to count non-zeros. + /// The array for which to count non-zeros. /// /// - /// Number of non-zero values in the array along a given axis. - /// Otherwise, the total number of non-zero values in the array - /// is returned. + /// Number of non-zero values in the array along a given axis.

+ /// + /// Otherwise, the total number of non-zero values in the array + /// is returned. ///
- public static int count_nonzero(NDarray a) - => NumPy.Instance.count_nonzero(a); + public static int count_nonzero(this 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("count_nonzero", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.staticstics.gen.cs b/src/Numpy/np.staticstics.gen.cs index 4d0880a..eac91eb 100644 --- a/src/Numpy/np.staticstics.gen.cs +++ b/src/Numpy/np.staticstics.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,2581 +20,3744 @@ public static partial class np { /// - /// Return the minimum of an array or minimum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding min value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmin. - /// - /// Don’t use amin for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than - /// amin(a, axis=0). + /// Return the minimum of an array or minimum along an axis.

+ /// + /// Notes + /// + /// NaN values are propagated, that is if at least one item is NaN, the + /// corresponding min value will be NaN as well.

+ /// To ignore NaN values + /// (MATLAB behavior), please use nanmin.

+ /// + /// Don’t use amin for element-wise comparison of 2 arrays; when + /// a.shape[0] is 2, minimum(a[0], a[1]) is faster than + /// amin(a, axis=0). ///
/// - /// Input data. + /// Input data. /// /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the minimum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// See doc.ufuncs (Section “Output arguments”) for more details. + /// Axis or axes along which to operate.

+ /// By default, flattened input is + /// used.

+ /// + /// If this is a tuple of ints, the minimum is selected over multiple axes, + /// instead of a single axis or all the axes as before. + /// + /// + /// Alternative output array in which to place the result.

+ /// Must + /// be of the same shape and buffer length as the expected output.

+ /// + /// 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 amin method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. + /// If 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 amin 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 maximum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. + /// The maximum value of an output element.

+ /// Must be present to allow + /// computation on empty slice.

+ /// See reduce for details. /// /// - /// Minimum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. + /// Minimum of a.

+ /// If axis is None, the result is a scalar value.

+ /// + /// If axis is given, the result is an array of dimension + /// a.ndim - 1. ///
- public static NDarray amin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amin(a, axis:axis, @out:@out, keepdims:keepdims, initial:initial); + public static NDarray amin(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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); + if (initial!=null) kwargs["initial"]=ToPython(initial); + dynamic py = __self__.InvokeMethod("amin", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the maximum of an array or maximum along an axis. - /// - /// Notes - /// - /// NaN values are propagated, that is if at least one item is NaN, the - /// corresponding max value will be NaN as well. To ignore NaN values - /// (MATLAB behavior), please use nanmax. - /// - /// Don’t use amax for element-wise comparison of 2 arrays; when - /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than - /// amax(a, axis=0). + /// Return the maximum of an array or maximum along an axis.

+ /// + /// Notes + /// + /// NaN values are propagated, that is if at least one item is NaN, the + /// corresponding max value will be NaN as well.

+ /// To ignore NaN values + /// (MATLAB behavior), please use nanmax.

+ /// + /// Don’t use amax for element-wise comparison of 2 arrays; when + /// a.shape[0] is 2, maximum(a[0], a[1]) is faster than + /// amax(a, axis=0). ///
/// - /// Input data. + /// Input data. /// /// - /// Axis or axes along which to operate. By default, flattened input is - /// used. - /// - /// If this is a tuple of ints, the maximum is selected over multiple axes, - /// instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. Must - /// be of the same shape and buffer length as the expected output. - /// See doc.ufuncs (Section “Output arguments”) for more details. + /// Axis or axes along which to operate.

+ /// By default, flattened input is + /// used.

+ /// + /// If this is a tuple of ints, the maximum is selected over multiple axes, + /// instead of a single axis or all the axes as before. + /// + /// + /// Alternative output array in which to place the result.

+ /// Must + /// be of the same shape and buffer length as the expected output.

+ /// + /// 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 amax method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. + /// If 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 amax 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 minimum value of an output element. Must be present to allow - /// computation on empty slice. See reduce for details. + /// The minimum value of an output element.

+ /// Must be present to allow + /// computation on empty slice.

+ /// See reduce for details. /// /// - /// Maximum of a. If axis is None, the result is a scalar value. - /// If axis is given, the result is an array of dimension - /// a.ndim - 1. + /// Maximum of a.

+ /// If axis is None, the result is a scalar value.

+ /// + /// If axis is given, the result is an array of dimension + /// a.ndim - 1. ///
- public static NDarray amax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) - => NumPy.Instance.amax(a, axis:axis, @out:@out, keepdims:keepdims, initial:initial); + public static NDarray amax(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null, ValueType initial = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + 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); + if (initial!=null) kwargs["initial"]=ToPython(initial); + dynamic py = __self__.InvokeMethod("amax", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return minimum of an array or minimum along an axis, ignoring any NaNs. - /// When all-NaN slices are encountered a RuntimeWarning is raised and - /// Nan is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.min. + /// Return minimum of an array or minimum along an axis, ignoring any NaNs.

+ /// + /// When all-NaN slices are encountered a RuntimeWarning is raised and + /// Nan is returned for that slice.

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

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

+ /// + /// Positive infinity is treated as a very large number and negative + /// infinity is treated as a very small (i.e.

+ /// negative) number.

+ /// + /// If the input has a integer type the function is equivalent to np.min. ///
/// - /// Array containing numbers whose minimum is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose minimum is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the minimum is computed. The default is to compute - /// the minimum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. + /// Axis or axes along which the minimum is computed.

+ /// The default is to compute + /// the minimum of the flattened array. + /// + /// + /// Alternate output array in which to place the result.

+ /// The default + /// is None; if provided, it must have the same shape as the + /// expected output, but the type will be cast if necessary.

+ /// See + /// doc.ufuncs for details. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the min method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

+ /// + /// If the value is anything but the default, then + /// keepdims will be passed through to the min method + /// of sub-classes of ndarray.

+ /// If the sub-classes methods + /// does not implement keepdims any exceptions will be raised. /// /// - /// An array with the same shape as a, with the specified axis - /// removed. If a is a 0-d array, or if axis is None, an ndarray - /// scalar is returned. The same dtype as a is returned. + /// An array with the same shape as a, with the specified axis + /// removed.

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

+ /// The same dtype as a is returned. ///
- public static NDarray nanmin(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanmin(a, axis:axis, @out:@out, keepdims:keepdims); + public static NDarray nanmin(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanmin", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the maximum of an array or maximum along an axis, ignoring any - /// NaNs. When all-NaN slices are encountered a RuntimeWarning is - /// raised and NaN is returned for that slice. - /// - /// Notes - /// - /// NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - /// (IEEE 754). This means that Not a Number is not equivalent to infinity. - /// Positive infinity is treated as a very large number and negative - /// infinity is treated as a very small (i.e. negative) number. - /// - /// If the input has a integer type the function is equivalent to np.max. + /// Return the maximum of an array or maximum along an axis, ignoring any + /// NaNs.

+ /// When all-NaN slices are encountered a RuntimeWarning is + /// raised and NaN is returned for that slice.

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

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

+ /// + /// Positive infinity is treated as a very large number and negative + /// infinity is treated as a very small (i.e.

+ /// negative) number.

+ /// + /// If the input has a integer type the function is equivalent to np.max. ///
/// - /// Array containing numbers whose maximum is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose maximum is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the maximum is computed. The default is to compute - /// the maximum of the flattened array. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. + /// Axis or axes along which the maximum is computed.

+ /// The default is to compute + /// the maximum of the flattened array. + /// + /// + /// Alternate output array in which to place the result.

+ /// The default + /// is None; if provided, it must have the same shape as the + /// expected output, but the type will be cast if necessary.

+ /// See + /// doc.ufuncs for details. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the max method - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

+ /// + /// If the value is anything but the default, then + /// keepdims will be passed through to the max method + /// of sub-classes of ndarray.

+ /// If the sub-classes methods + /// does not implement keepdims any exceptions will be raised. /// /// - /// An array with the same shape as a, with the specified axis removed. - /// If a is a 0-d array, or if axis is None, an ndarray scalar is - /// returned. The same dtype as a is returned. + /// An array with the same shape as a, with the specified axis removed.

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

+ /// The same dtype as a is returned. ///
- public static NDarray nanmax(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanmax(a, axis:axis, @out:@out, keepdims:keepdims); + public static NDarray nanmax(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanmax", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Range of values (maximum - minimum) along an axis. - /// - /// The name of the function comes from the acronym for ‘peak to peak’. + /// Range of values (maximum - minimum) along an axis.

+ /// + /// The name of the function comes from the acronym for ‘peak to peak’. ///
/// - /// Input values. + /// Input values. /// /// - /// Axis along which to find the peaks. By default, flatten the - /// array. axis may be negative, in - /// which case it counts from the last to the first axis. - /// - /// If this is a tuple of ints, a reduction is performed on multiple - /// axes, instead of a single axis or all the axes as before. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type of the output values will be cast if necessary. + /// Axis along which to find the peaks.

+ /// By default, flatten the + /// array.

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

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

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type of the output values will be cast if necessary. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the ptp method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

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

+ /// If the + /// sub-class’ method does not implement keepdims any + /// exceptions will be raised. /// /// - /// A new array holding the result, unless out was - /// specified, in which case a reference to out is returned. + /// A new array holding the result, unless out was + /// specified, in which case a reference to out is returned. /// - public static NDarray ptp(NDarray a, int[] axis = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.ptp(a, axis:axis, @out:@out, keepdims:keepdims); + public static NDarray ptp(this NDarray a, Axis axis = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("ptp", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. + /// Compute the q-th percentile of the data along the specified axis.

+ /// + /// Returns the q-th percentile(s) of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the q-th percentile of + /// V is the value q/100 of the way from the minimum to the + /// maximum in a sorted copy of V.

+ /// The values and distances of + /// the two nearest neighbors as well as the interpolation parameter + /// will determine the percentile if the normalized ranking does not + /// match the location of q exactly.

+ /// This function is the same as + /// the median if q=50, the same as the minimum if q=0 and the + /// same as the maximum if q=100. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. + /// Percentile or sequence of percentiles to compute, which must be between + /// 0 and 100 inclusive. /// /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. + /// Axis or axes along which the percentiles are computed.

+ /// The + /// default is to compute the percentile(s) along a flattened + /// version of the array. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired percentile lies between two data points + /// i < j: /// /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. + /// If this is set to True, the axes which are reduced are left in + /// the result as dimensions with size one.

+ /// With this option, the + /// result will broadcast correctly against the original array a. /// /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single percentile and axis=None, then the result + /// is a scalar.

+ /// If multiple percentiles are given, first axis of + /// the result corresponds to the percentiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static NDarray percentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - => NumPy.Instance.percentile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); + public static NDarray percentile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the q-th percentile of the data along the specified axis. - /// - /// Returns the q-th percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. + /// Compute the q-th percentile of the data along the specified axis.

+ /// + /// Returns the q-th percentile(s) of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the q-th percentile of + /// V is the value q/100 of the way from the minimum to the + /// maximum in a sorted copy of V.

+ /// The values and distances of + /// the two nearest neighbors as well as the interpolation parameter + /// will determine the percentile if the normalized ranking does not + /// match the location of q exactly.

+ /// This function is the same as + /// the median if q=50, the same as the minimum if q=0 and the + /// same as the maximum if q=100. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. + /// Percentile or sequence of percentiles to compute, which must be between + /// 0 and 100 inclusive. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired percentile lies between two data points + /// i < j: /// /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single percentile and axis=None, then the result + /// is a scalar.

+ /// If multiple percentiles are given, first axis of + /// the result corresponds to the percentiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static double percentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.percentile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); + public static double percentile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + dynamic py = __self__.InvokeMethod("percentile", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. + /// Compute the qth percentile of the data along the specified axis, + /// while ignoring nan values.

+ /// + /// Returns the qth percentile(s) of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the q-th percentile of + /// V is the value q/100 of the way from the minimum to the + /// maximum in a sorted copy of V.

+ /// The values and distances of + /// the two nearest neighbors as well as the interpolation parameter + /// will determine the percentile if the normalized ranking does not + /// match the location of q exactly.

+ /// This function is the same as + /// the median if q=50, the same as the minimum if q=0 and the + /// same as the maximum if q=100. ///
/// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. + /// Input array or object that can be converted to an array, containing + /// nan values to be ignored. /// /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. + /// Percentile or sequence of percentiles to compute, which must be between + /// 0 and 100 inclusive. /// /// - /// Axis or axes along which the percentiles are computed. The - /// default is to compute the percentile(s) along a flattened - /// version of the array. + /// Axis or axes along which the percentiles are computed.

+ /// The + /// default is to compute the percentile(s) along a flattened + /// version of the array. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired percentile lies between two data points + /// i < j: /// /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. + /// If this is set to True, the axes which are reduced are left in + /// the result as dimensions with size one.

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

+ /// + /// If this is anything but the default value it will be passed + /// through (in the special case of an empty array) to the + /// mean function of the underlying array.

+ /// If the array is + /// a sub-class and mean does not have the kwarg keepdims this + /// will raise a RuntimeError. /// /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single percentile and axis=None, then the result + /// is a scalar.

+ /// If multiple percentiles are given, first axis of + /// the result corresponds to the percentiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static NDarray nanpercentile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - => NumPy.Instance.nanpercentile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); + public static NDarray nanpercentile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the qth percentile of the data along the specified axis, - /// while ignoring nan values. - /// - /// Returns the qth percentile(s) of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the q-th percentile of - /// V is the value q/100 of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the percentile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=50, the same as the minimum if q=0 and the - /// same as the maximum if q=100. + /// Compute the qth percentile of the data along the specified axis, + /// while ignoring nan values.

+ /// + /// Returns the qth percentile(s) of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the q-th percentile of + /// V is the value q/100 of the way from the minimum to the + /// maximum in a sorted copy of V.

+ /// The values and distances of + /// the two nearest neighbors as well as the interpolation parameter + /// will determine the percentile if the normalized ranking does not + /// match the location of q exactly.

+ /// This function is the same as + /// the median if q=50, the same as the minimum if q=0 and the + /// same as the maximum if q=100. ///
/// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored. + /// Input array or object that can be converted to an array, containing + /// nan values to be ignored. /// /// - /// Percentile or sequence of percentiles to compute, which must be between - /// 0 and 100 inclusive. + /// Percentile or sequence of percentiles to compute, which must be between + /// 0 and 100 inclusive. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired percentile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired percentile lies between two data points + /// i < j: /// /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple percentiles are given, first axis of - /// the result corresponds to the percentiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single percentile and axis=None, then the result + /// is a scalar.

+ /// If multiple percentiles are given, first axis of + /// the result corresponds to the percentiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static double nanpercentile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.nanpercentile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); + public static double nanpercentile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + dynamic py = __self__.InvokeMethod("nanpercentile", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. + /// Compute the q-th quantile of the data along the specified axis.

+ /// + /// ..versionadded:: 1.15.0 + /// + /// Notes + /// + /// Given a vector V of length N, the q-th quantile of + /// V is the value q of the way from the minimum to the + /// maximum in a sorted copy of V.

+ /// The values and distances of + /// the two nearest neighbors as well as the interpolation parameter + /// will determine the quantile if the normalized ranking does not + /// match the location of q exactly.

+ /// This function is the same as + /// the median if q=0.5, the same as the minimum if q=0.0 and the + /// same as the maximum if q=1.0. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. + /// Quantile or sequence of quantiles to compute, which must be between + /// 0 and 1 inclusive. /// /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. + /// Axis or axes along which the quantiles are computed.

+ /// The + /// default is to compute the quantile(s) along a flattened + /// version of the array. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired quantile lies between two data points + /// i < j: /// /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. + /// If this is set to True, the axes which are reduced are left in + /// the result as dimensions with size one.

+ /// With this option, the + /// result will broadcast correctly against the original array a. /// /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single quantile and axis=None, then the result + /// is a scalar.

+ /// If multiple quantiles are given, first axis of + /// the result corresponds to the quantiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static NDarray quantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) - => NumPy.Instance.quantile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); + public static NDarray quantile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the q-th quantile of the data along the specified axis. - /// ..versionadded:: 1.15.0 - /// - /// Notes - /// - /// Given a vector V of length N, the q-th quantile of - /// V is the value q of the way from the minimum to the - /// maximum in a sorted copy of V. The values and distances of - /// the two nearest neighbors as well as the interpolation parameter - /// will determine the quantile if the normalized ranking does not - /// match the location of q exactly. This function is the same as - /// the median if q=0.5, the same as the minimum if q=0.0 and the - /// same as the maximum if q=1.0. + /// Compute the q-th quantile of the data along the specified axis.

+ /// + /// ..versionadded:: 1.15.0 + /// + /// Notes + /// + /// Given a vector V of length N, the q-th quantile of + /// V is the value q of the way from the minimum to the + /// maximum in a sorted copy of V.

+ /// The values and distances of + /// the two nearest neighbors as well as the interpolation parameter + /// will determine the quantile if the normalized ranking does not + /// match the location of q exactly.

+ /// This function is the same as + /// the median if q=0.5, the same as the minimum if q=0.0 and the + /// same as the maximum if q=1.0. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. + /// Quantile or sequence of quantiles to compute, which must be between + /// 0 and 1 inclusive. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired quantile lies between two data points + /// i < j: /// /// - /// If q is a single quantile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single quantile and axis=None, then the result + /// is a scalar.

+ /// If multiple quantiles are given, first axis of + /// the result corresponds to the quantiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static double quantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.quantile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); + public static double quantile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + dynamic py = __self__.InvokeMethod("quantile", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 + /// Compute the qth quantile of the data along the specified axis, + /// while ignoring nan values.

+ /// + /// Returns the qth quantile(s) of the array elements.

+ /// + /// .. versionadded:: 1.15.0 ///
/// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored + /// Input array or object that can be converted to an array, containing + /// nan values to be ignored /// /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. + /// Quantile or sequence of quantiles to compute, which must be between + /// 0 and 1 inclusive. /// /// - /// Axis or axes along which the quantiles are computed. The - /// default is to compute the quantile(s) along a flattened - /// version of the array. + /// Axis or axes along which the quantiles are computed.

+ /// The + /// default is to compute the quantile(s) along a flattened + /// version of the array. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired quantile lies between two data points + /// i < j: /// /// - /// If this is set to True, the axes which are reduced are left in - /// the result as dimensions with size one. With this option, the - /// result will broadcast correctly against the original array a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. + /// If this is set to True, the axes which are reduced are left in + /// the result as dimensions with size one.

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

+ /// + /// If this is anything but the default value it will be passed + /// through (in the special case of an empty array) to the + /// mean function of the underlying array.

+ /// If the array is + /// a sub-class and mean does not have the kwarg keepdims this + /// will raise a RuntimeError. /// /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single percentile and axis=None, then the result + /// is a scalar.

+ /// If multiple quantiles are given, first axis of + /// the result corresponds to the quantiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static NDarray nanquantile(NDarray a, NDarray q, int[] axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) - => NumPy.Instance.nanquantile(a, q, axis:axis, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation, keepdims:keepdims); + public static NDarray nanquantile(this NDarray a, NDarray q, Axis axis, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear", bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the qth quantile of the data along the specified axis, - /// while ignoring nan values. - /// Returns the qth quantile(s) of the array elements. - /// .. versionadded:: 1.15.0 + /// Compute the qth quantile of the data along the specified axis, + /// while ignoring nan values.

+ /// + /// Returns the qth quantile(s) of the array elements.

+ /// + /// .. versionadded:: 1.15.0 ///
/// - /// Input array or object that can be converted to an array, containing - /// nan values to be ignored + /// Input array or object that can be converted to an array, containing + /// nan values to be ignored /// /// - /// Quantile or sequence of quantiles to compute, which must be between - /// 0 and 1 inclusive. + /// Quantile or sequence of quantiles to compute, which must be between + /// 0 and 1 inclusive. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow the input array a to be modified by intermediate - /// calculations, to save memory. In this case, the contents of the input - /// a after this function completes is undefined. + /// If True, then allow the input array a to be modified by intermediate + /// calculations, to save memory.

+ /// In this case, the contents of the input + /// a after this function completes is undefined. /// /// - /// This optional parameter specifies the interpolation method to - /// use when the desired quantile lies between two data points - /// i < j: + /// This optional parameter specifies the interpolation method to + /// use when the desired quantile lies between two data points + /// i < j: /// /// - /// If q is a single percentile and axis=None, then the result - /// is a scalar. If multiple quantiles are given, first axis of - /// the result corresponds to the quantiles. The other axes are - /// the axes that remain after the reduction of a. If the input - /// contains integers or floats smaller than float64, the output - /// data-type is float64. Otherwise, the output data-type is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// If q is a single percentile and axis=None, then the result + /// is a scalar.

+ /// If multiple quantiles are given, first axis of + /// the result corresponds to the quantiles.

+ /// The other axes are + /// the axes that remain after the reduction of a.

+ /// If the input + /// contains integers or floats smaller than float64, the output + /// data-type is float64. Otherwise, the output data-type is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static double nanquantile(NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") - => NumPy.Instance.nanquantile(a, q, @out:@out, overwrite_input:overwrite_input, interpolation:interpolation); + public static double nanquantile(this NDarray a, NDarray q, NDarray @out = null, bool? overwrite_input = false, string interpolation = "linear") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + q, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (interpolation!="linear") kwargs["interpolation"]=ToPython(interpolation); + dynamic py = __self__.InvokeMethod("nanquantile", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. + /// Compute the median along the specified axis.

+ /// + /// Returns the median of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the median of V is the + /// middle value of a sorted copy of V, V_sorted - i + /// e., V_sorted[(N-1)/2], when N is odd, and the average of the + /// two middle values of V_sorted when N is even. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// Axis or axes along which the medians are computed.

+ /// The default + /// is to compute the median along a flattened version of the array.

+ /// + /// A sequence of axes is supported since version 1.9.0. + /// + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. + /// If True, then allow use of memory of input array a for + /// calculations.

+ /// The input array will be modified by the call to + /// median.

+ /// This will save memory when you do not need to preserve + /// the contents of the input array.

+ /// Treat the input as undefined, + /// but it will probably be fully or partially sorted.

+ /// Default is + /// False.

+ /// If overwrite_input is True and a is not already an + /// ndarray, an error will be raised. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original arr. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

+ /// With this option, + /// the result will broadcast correctly against the original arr. /// /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// A new array holding the result.

+ /// If the input contains integers + /// or floats smaller than float64, then the output data-type is + /// np.float64. Otherwise, the data-type of the output is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static NDarray median(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) - => NumPy.Instance.median(a, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); + public static NDarray median(this NDarray a, Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (keepdims!=false) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the median along the specified axis. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i - /// e., V_sorted[(N-1)/2], when N is odd, and the average of the - /// two middle values of V_sorted when N is even. + /// Compute the median along the specified axis.

+ /// + /// Returns the median of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the median of V is the + /// middle value of a sorted copy of V, V_sorted - i + /// e., V_sorted[(N-1)/2], when N is odd, and the average of the + /// two middle values of V_sorted when N is even. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. + /// If True, then allow use of memory of input array a for + /// calculations.

+ /// The input array will be modified by the call to + /// median.

+ /// This will save memory when you do not need to preserve + /// the contents of the input array.

+ /// Treat the input as undefined, + /// but it will probably be fully or partially sorted.

+ /// Default is + /// False.

+ /// If overwrite_input is True and a is not already an + /// ndarray, an error will be raised. /// /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// A new array holding the result.

+ /// If the input contains integers + /// or floats smaller than float64, then the output data-type is + /// np.float64. Otherwise, the data-type of the output is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static double median(NDarray a, NDarray @out = null, bool? overwrite_input = false) - => NumPy.Instance.median(a, @out:@out, overwrite_input:overwrite_input); + public static double median(this NDarray a, NDarray @out = null, bool? overwrite_input = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + dynamic py = __self__.InvokeMethod("median", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the weighted average along the specified axis. + /// Compute the weighted average along the specified axis. /// /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. + /// Array containing data to be averaged.

+ /// If a is not an array, a + /// conversion is attempted. /// /// - /// Axis or axes along which to average a. The default, - /// axis=None, will average over all of the elements of the input array. - /// If axis is negative it counts from the last to the first axis. - /// - /// If axis is a tuple of ints, averaging is performed on all of the axes - /// specified in the tuple instead of a single axis or all the axes as - /// before. + /// Axis or axes along which to average a.

+ /// The default, + /// axis=None, will average over all of the elements of the input array.

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

+ /// + /// If axis is a tuple of ints, averaging is performed on all of the axes + /// specified in the tuple instead of a single axis or all the axes as + /// before. /// /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. + /// An array of weights associated with the values in a.

+ /// Each value in + /// a contributes to the average according to its associated weight.

+ /// + /// The weights array can either be 1-D (in which case its length must be + /// the size of a along the given axis) or of the same shape as a.

+ /// + /// If weights=None, then all data in a are assumed to have a + /// weight equal to one. /// /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. + /// Default is False.

+ /// If True, the tuple (average, sum_of_weights) + /// is returned, otherwise only the average is returned.

+ /// + /// If weights=None, sum_of_weights is equivalent to the number of + /// elements over which the average is taken. /// /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. + /// Return the average along the specified axis.

+ /// When returned is True, + /// return a tuple with the average as the first element and the sum + /// of the weights as the second element.

+ /// sum_of_weights is of the + /// same type as retval.

+ /// The result dtype follows a genereal pattern.

+ /// + /// If weights is None, the result dtype will be that of a , or float64 + /// if a is integral.

+ /// Otherwise, if weights is not None and a is non- + /// integral, the result type will be the type of lowest precision capable of + /// representing values of both a and weights.

+ /// If a happens to be + /// integral, the previous rules still applies but the result dtype will + /// at least be float64. ///
- public static NDarray average(NDarray a, int[] axis, NDarray weights = null, bool? returned = false) - => NumPy.Instance.average(a, axis:axis, weights:weights, returned:returned); + public static NDarray average(this NDarray a, Axis axis, NDarray weights = null, bool? returned = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (weights!=null) kwargs["weights"]=ToPython(weights); + if (returned!=false) kwargs["returned"]=ToPython(returned); + dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the weighted average along the specified axis. + /// Compute the weighted average along the specified axis. /// /// - /// Array containing data to be averaged. If a is not an array, a - /// conversion is attempted. + /// Array containing data to be averaged.

+ /// If a is not an array, a + /// conversion is attempted. /// /// - /// An array of weights associated with the values in a. Each value in - /// a contributes to the average according to its associated weight. - /// The weights array can either be 1-D (in which case its length must be - /// the size of a along the given axis) or of the same shape as a. - /// If weights=None, then all data in a are assumed to have a - /// weight equal to one. + /// An array of weights associated with the values in a.

+ /// Each value in + /// a contributes to the average according to its associated weight.

+ /// + /// The weights array can either be 1-D (in which case its length must be + /// the size of a along the given axis) or of the same shape as a.

+ /// + /// If weights=None, then all data in a are assumed to have a + /// weight equal to one. /// /// - /// Default is False. If True, the tuple (average, sum_of_weights) - /// is returned, otherwise only the average is returned. - /// If weights=None, sum_of_weights is equivalent to the number of - /// elements over which the average is taken. + /// Default is False.

+ /// If True, the tuple (average, sum_of_weights) + /// is returned, otherwise only the average is returned.

+ /// + /// If weights=None, sum_of_weights is equivalent to the number of + /// elements over which the average is taken. /// /// - /// Return the average along the specified axis. When returned is True, - /// return a tuple with the average as the first element and the sum - /// of the weights as the second element. sum_of_weights is of the - /// same type as retval. The result dtype follows a genereal pattern. - /// If weights is None, the result dtype will be that of a , or float64 - /// if a is integral. Otherwise, if weights is not None and a is non- - /// integral, the result type will be the type of lowest precision capable of - /// representing values of both a and weights. If a happens to be - /// integral, the previous rules still applies but the result dtype will - /// at least be float64. + /// Return the average along the specified axis.

+ /// When returned is True, + /// return a tuple with the average as the first element and the sum + /// of the weights as the second element.

+ /// sum_of_weights is of the + /// same type as retval.

+ /// The result dtype follows a genereal pattern.

+ /// + /// If weights is None, the result dtype will be that of a , or float64 + /// if a is integral.

+ /// Otherwise, if weights is not None and a is non- + /// integral, the result type will be the type of lowest precision capable of + /// representing values of both a and weights.

+ /// If a happens to be + /// integral, the previous rules still applies but the result dtype will + /// at least be float64. ///
- public static double average(NDarray a, NDarray weights = null, bool? returned = false) - => NumPy.Instance.average(a, weights:weights, returned:returned); + public static double average(this NDarray a, NDarray weights = null, bool? returned = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (weights!=null) kwargs["weights"]=ToPython(weights); + if (returned!=false) kwargs["returned"]=ToPython(returned); + dynamic py = __self__.InvokeMethod("average", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. + /// Compute the arithmetic mean along the specified axis.

+ /// + /// Returns the average of the array elements.

+ /// The average is taken over + /// the flattened array by default, otherwise over the specified axis.

+ /// + /// float64 intermediate and return values are used for integer inputs.

+ /// + /// Notes + /// + /// The arithmetic mean is the sum of the elements along the axis divided + /// by the number of elements.

+ /// + /// Note that for floating-point input, the mean is computed using the + /// same precision the input has.

+ /// Depending on the input data, this can + /// cause the results to be inaccurate, especially for float32 (see + /// example below).

+ /// Specifying a higher-precision accumulator using the + /// dtype keyword can alleviate this issue.

+ /// + /// By default, float16 results are computed using float32 intermediates + /// for extra precision. ///
/// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose mean is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the means are computed. The default is to - /// compute the mean of the flattened array. - /// - /// If this is a tuple of ints, a mean is performed over multiple axes, - /// instead of a single axis or all the axes as before. + /// Axis or axes along which the means are computed.

+ /// The default is to + /// compute the mean of the flattened array.

+ /// + /// If this is a tuple of ints, a mean is performed over multiple axes, + /// instead of a single axis or all the axes as before. /// /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. + /// Type to use in computing the mean.

+ /// For integer inputs, the default + /// is float64; for floating point inputs, it is the same as the + /// input dtype. + /// + /// + /// Alternate output array in which to place the result.

+ /// The default + /// is None; if provided, it must have the same shape as the + /// expected output, but the type will be cast if necessary.

+ /// + /// See doc.ufuncs for details. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the mean method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

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

+ /// If the + /// sub-class’ method does not implement keepdims any + /// exceptions will be raised. /// /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. + /// If out=None, returns a new array containing the mean values, + /// otherwise a reference to the output array is returned. /// - public static NDarray mean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.mean(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); + public static NDarray mean(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the arithmetic mean along the specified axis. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the elements along the axis divided - /// by the number of elements. - /// - /// Note that for floating-point input, the mean is computed using the - /// same precision the input has. Depending on the input data, this can - /// cause the results to be inaccurate, especially for float32 (see - /// example below). Specifying a higher-precision accumulator using the - /// dtype keyword can alleviate this issue. - /// - /// By default, float16 results are computed using float32 intermediates - /// for extra precision. + /// Compute the arithmetic mean along the specified axis.

+ /// + /// Returns the average of the array elements.

+ /// The average is taken over + /// the flattened array by default, otherwise over the specified axis.

+ /// + /// float64 intermediate and return values are used for integer inputs.

+ /// + /// Notes + /// + /// The arithmetic mean is the sum of the elements along the axis divided + /// by the number of elements.

+ /// + /// Note that for floating-point input, the mean is computed using the + /// same precision the input has.

+ /// Depending on the input data, this can + /// cause the results to be inaccurate, especially for float32 (see + /// example below).

+ /// Specifying a higher-precision accumulator using the + /// dtype keyword can alleviate this issue.

+ /// + /// By default, float16 results are computed using float32 intermediates + /// for extra precision. ///
/// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose mean is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for floating point inputs, it is the same as the - /// input dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. - /// See doc.ufuncs for details. + /// Type to use in computing the mean.

+ /// For integer inputs, the default + /// is float64; for floating point inputs, it is the same as the + /// input dtype. + /// + /// + /// Alternate output array in which to place the result.

+ /// The default + /// is None; if provided, it must have the same shape as the + /// expected output, but the type will be cast if necessary.

+ /// + /// See doc.ufuncs for details. /// /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. + /// If out=None, returns a new array containing the mean values, + /// otherwise a reference to the output array is returned. /// - public static double mean(NDarray a, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.mean(a, dtype:dtype, @out:@out); + public static double mean(this NDarray a, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("mean", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. + /// Compute the standard deviation along the specified axis.

+ /// + /// Returns the standard deviation, a measure of the spread of a distribution, + /// of the array elements.

+ /// The standard deviation is computed for the + /// flattened array by default, otherwise over the specified axis.

+ /// + /// Notes + /// + /// The standard deviation is the square root of the average of the squared + /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)).

+ /// + /// The average squared deviation is normally calculated as + /// x.sum() / N, where N = len(x).

+ /// If, however, ddof is specified, + /// the divisor N - ddof is used instead.

+ /// In standard statistical + /// practice, ddof=1 provides an unbiased estimator of the variance + /// of the infinite population.

+ /// ddof=0 provides a maximum likelihood + /// estimate of the variance for normally distributed variables.

+ /// The + /// standard deviation computed in this function is the square root of + /// the estimated variance, so even with ddof=1, it will not be an + /// unbiased estimate of the standard deviation per se.

+ /// + /// Note that, for complex numbers, std takes the absolute + /// value before squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the std is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example below).

+ /// + /// Specifying a higher-accuracy accumulator using the dtype keyword can + /// alleviate this issue. ///
/// - /// Calculate the standard deviation of these values. + /// Calculate the standard deviation of these values. /// /// - /// Axis or axes along which the standard deviation is computed. The - /// default is to compute the standard deviation of the flattened array. - /// - /// If this is a tuple of ints, a standard deviation is performed over - /// multiple axes, instead of a single axis or all the axes as before. + /// Axis or axes along which the standard deviation is computed.

+ /// The + /// default is to compute the standard deviation of the flattened array.

+ /// + /// If this is a tuple of ints, a standard deviation is performed over + /// multiple axes, instead of a single axis or all the axes as before. /// /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. + /// Type to use in computing the standard deviation.

+ /// For arrays of + /// integer type the default is float64, for arrays of float types it is + /// the same as the array type. /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must have + /// the same shape as the expected output but the type (of the calculated + /// values) will be cast if necessary. /// /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. + /// Means Delta Degrees of Freedom.

+ /// The divisor used in calculations + /// is N - ddof, where N represents the number of elements.

+ /// + /// By default ddof is zero. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the std method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

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

+ /// If the + /// sub-class’ method does not implement keepdims any + /// exceptions will be raised. /// /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. + /// If out is None, return a new array containing the standard deviation, + /// otherwise return a reference to the output array. /// - public static NDarray std(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.std(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); + public static NDarray std(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the standard deviation along the specified axis. - /// - /// Returns the standard deviation, a measure of the spread of a distribution, - /// of the array elements. The standard deviation is computed for the - /// flattened array by default, otherwise over the specified axis. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is specified, - /// the divisor N - ddof is used instead. In standard statistical - /// practice, ddof=1 provides an unbiased estimator of the variance - /// of the infinite population. ddof=0 provides a maximum likelihood - /// estimate of the variance for normally distributed variables. The - /// standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute - /// value before squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example below). - /// Specifying a higher-accuracy accumulator using the dtype keyword can - /// alleviate this issue. + /// Compute the standard deviation along the specified axis.

+ /// + /// Returns the standard deviation, a measure of the spread of a distribution, + /// of the array elements.

+ /// The standard deviation is computed for the + /// flattened array by default, otherwise over the specified axis.

+ /// + /// Notes + /// + /// The standard deviation is the square root of the average of the squared + /// deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)).

+ /// + /// The average squared deviation is normally calculated as + /// x.sum() / N, where N = len(x).

+ /// If, however, ddof is specified, + /// the divisor N - ddof is used instead.

+ /// In standard statistical + /// practice, ddof=1 provides an unbiased estimator of the variance + /// of the infinite population.

+ /// ddof=0 provides a maximum likelihood + /// estimate of the variance for normally distributed variables.

+ /// The + /// standard deviation computed in this function is the square root of + /// the estimated variance, so even with ddof=1, it will not be an + /// unbiased estimate of the standard deviation per se.

+ /// + /// Note that, for complex numbers, std takes the absolute + /// value before squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the std is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example below).

+ /// + /// Specifying a higher-accuracy accumulator using the dtype keyword can + /// alleviate this issue. ///
/// - /// Calculate the standard deviation of these values. + /// Calculate the standard deviation of these values. /// /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it is - /// the same as the array type. + /// Type to use in computing the standard deviation.

+ /// For arrays of + /// integer type the default is float64, for arrays of float types it is + /// the same as the array type. /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the calculated - /// values) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must have + /// the same shape as the expected output but the type (of the calculated + /// values) will be cast if necessary. /// /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of elements. - /// By default ddof is zero. + /// Means Delta Degrees of Freedom.

+ /// The divisor used in calculations + /// is N - ddof, where N represents the number of elements.

+ /// + /// By default ddof is zero. /// /// - /// If out is None, return a new array containing the standard deviation, - /// otherwise return a reference to the output array. + /// If out is None, return a new array containing the standard deviation, + /// otherwise return a reference to the output array. /// - public static double std(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.std(a, dtype:dtype, @out:@out, ddof:ddof); + public static double std(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + dynamic py = __self__.InvokeMethod("std", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. + /// Compute the variance along the specified axis.

+ /// + /// Returns the variance of the array elements, a measure of the spread of a + /// distribution.

+ /// The variance is computed for the flattened array by + /// default, otherwise over the specified axis.

+ /// + /// Notes + /// + /// The variance is the average of the squared deviations from the mean, + /// i.e., var = mean(abs(x - x.mean())**2).

+ /// + /// The mean is normally calculated as x.sum() / N, where N = len(x).

+ /// + /// If, however, ddof is specified, the divisor N - ddof is used + /// instead.

+ /// In standard statistical practice, ddof=1 provides an + /// unbiased estimator of the variance of a hypothetical infinite population.

+ /// + /// ddof=0 provides a maximum likelihood estimate of the variance for + /// normally distributed variables.

+ /// + /// Note that for complex numbers, the absolute value is taken before + /// squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the variance is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example + /// below).

+ /// Specifying a higher-accuracy accumulator using the dtype + /// keyword can alleviate this issue. ///
/// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose variance is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the variance is computed. The default is to - /// compute the variance of the flattened array. - /// - /// If this is a tuple of ints, a variance is performed over multiple axes, - /// instead of a single axis or all the axes as before. + /// Axis or axes along which the variance is computed.

+ /// The default is to + /// compute the variance of the flattened array.

+ /// + /// If this is a tuple of ints, a variance is performed over multiple axes, + /// instead of a single axis or all the axes as before. /// /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. + /// Type to use in computing the variance.

+ /// For arrays of integer type + /// the default is float32; for arrays of float types it is the same as + /// the array type. /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. + /// + /// Alternate output array in which to place the result.

+ /// It must have + /// the same shape as the expected output, but the type is cast if + /// necessary. /// /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. + /// “Delta Degrees of Freedom”: the divisor used in the calculation is + /// N - ddof, where N represents the number of elements.

+ /// By + /// default ddof is zero. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the input array. - /// - /// If the default value is passed, then keepdims will not be - /// passed through to the var method of sub-classes of - /// ndarray, however any non-default value will be. If the - /// sub-class’ method does not implement keepdims any - /// exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

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

+ /// If the + /// sub-class’ method does not implement keepdims any + /// exceptions will be raised. /// /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. + /// If out=None, returns a new array containing the variance; + /// otherwise, a reference to the output array is returned. /// - public static NDarray @var(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.@var(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); + public static NDarray @var(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the variance along the specified axis. - /// - /// Returns the variance of the array elements, a measure of the spread of a - /// distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite population. - /// ddof=0 provides a maximum likelihood estimate of the variance for - /// normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. + /// Compute the variance along the specified axis.

+ /// + /// Returns the variance of the array elements, a measure of the spread of a + /// distribution.

+ /// The variance is computed for the flattened array by + /// default, otherwise over the specified axis.

+ /// + /// Notes + /// + /// The variance is the average of the squared deviations from the mean, + /// i.e., var = mean(abs(x - x.mean())**2).

+ /// + /// The mean is normally calculated as x.sum() / N, where N = len(x).

+ /// + /// If, however, ddof is specified, the divisor N - ddof is used + /// instead.

+ /// In standard statistical practice, ddof=1 provides an + /// unbiased estimator of the variance of a hypothetical infinite population.

+ /// + /// ddof=0 provides a maximum likelihood estimate of the variance for + /// normally distributed variables.

+ /// + /// Note that for complex numbers, the absolute value is taken before + /// squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the variance is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example + /// below).

+ /// Specifying a higher-accuracy accumulator using the dtype + /// keyword can alleviate this issue. ///
/// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose variance is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. + /// Type to use in computing the variance.

+ /// For arrays of integer type + /// the default is float32; for arrays of float types it is the same as + /// the array type. /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. + /// + /// Alternate output array in which to place the result.

+ /// It must have + /// the same shape as the expected output, but the type is cast if + /// necessary. /// /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of elements. By - /// default ddof is zero. + /// “Delta Degrees of Freedom”: the divisor used in the calculation is + /// N - ddof, where N represents the number of elements.

+ /// By + /// default ddof is zero. /// /// - /// If out=None, returns a new array containing the variance; - /// otherwise, a reference to the output array is returned. + /// If out=None, returns a new array containing the variance; + /// otherwise, a reference to the output array is returned. /// - public static double @var(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.@var(a, dtype:dtype, @out:@out, ddof:ddof); + public static double @var(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + dynamic py = __self__.InvokeMethod("var", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. + /// Compute the median along the specified axis, while ignoring NaNs.

+ /// + /// Returns the median of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the median of V is the + /// middle value of a sorted copy of V, V_sorted - i.e., + /// V_sorted[(N-1)/2], when N is odd and the average of the two + /// middle values of V_sorted when N is even. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// /// - /// Axis or axes along which the medians are computed. The default - /// is to compute the median along a flattened version of the array. - /// A sequence of axes is supported since version 1.9.0. - /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// Axis or axes along which the medians are computed.

+ /// The default + /// is to compute the median along a flattened version of the array.

+ /// + /// A sequence of axes is supported since version 1.9.0. + /// + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. + /// If True, then allow use of memory of input array a for + /// calculations.

+ /// The input array will be modified by the call to + /// median.

+ /// This will save memory when you do not need to preserve + /// the contents of the input array.

+ /// Treat the input as undefined, + /// but it will probably be fully or partially sorted.

+ /// Default is + /// False.

+ /// If overwrite_input is True and a is not already an + /// ndarray, an error will be raised. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this is anything but the default value it will be passed - /// through (in the special case of an empty array) to the - /// mean function of the underlying array. If the array is - /// a sub-class and mean does not have the kwarg keepdims this - /// will raise a RuntimeError. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

+ /// + /// If this is anything but the default value it will be passed + /// through (in the special case of an empty array) to the + /// mean function of the underlying array.

+ /// If the array is + /// a sub-class and mean does not have the kwarg keepdims this + /// will raise a RuntimeError. /// /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// A new array holding the result.

+ /// If the input contains integers + /// or floats smaller than float64, then the output data-type is + /// np.float64. Otherwise, the data-type of the output is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static NDarray nanmedian(NDarray a, int[] axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) - => NumPy.Instance.nanmedian(a, axis:axis, @out:@out, overwrite_input:overwrite_input, keepdims:keepdims); + public static NDarray nanmedian(this NDarray a, Axis axis, NDarray @out = null, bool? overwrite_input = false, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the median along the specified axis, while ignoring NaNs. - /// - /// Returns the median of the array elements. - /// - /// Notes - /// - /// Given a vector V of length N, the median of V is the - /// middle value of a sorted copy of V, V_sorted - i.e., - /// V_sorted[(N-1)/2], when N is odd and the average of the two - /// middle values of V_sorted when N is even. + /// Compute the median along the specified axis, while ignoring NaNs.

+ /// + /// Returns the median of the array elements.

+ /// + /// Notes + /// + /// Given a vector V of length N, the median of V is the + /// middle value of a sorted copy of V, V_sorted - i.e., + /// V_sorted[(N-1)/2], when N is odd and the average of the two + /// middle values of V_sorted when N is even. ///
/// - /// Input array or object that can be converted to an array. + /// Input array or object that can be converted to an array. /// - /// - /// Alternative output array in which to place the result. It must - /// have the same shape and buffer length as the expected output, - /// but the type (of the output) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must + /// have the same shape and buffer length as the expected output, + /// but the type (of the output) will be cast if necessary. /// /// - /// If True, then allow use of memory of input array a for - /// calculations. The input array will be modified by the call to - /// median. This will save memory when you do not need to preserve - /// the contents of the input array. Treat the input as undefined, - /// but it will probably be fully or partially sorted. Default is - /// False. If overwrite_input is True and a is not already an - /// ndarray, an error will be raised. + /// If True, then allow use of memory of input array a for + /// calculations.

+ /// The input array will be modified by the call to + /// median.

+ /// This will save memory when you do not need to preserve + /// the contents of the input array.

+ /// Treat the input as undefined, + /// but it will probably be fully or partially sorted.

+ /// Default is + /// False.

+ /// If overwrite_input is True and a is not already an + /// ndarray, an error will be raised. /// /// - /// A new array holding the result. If the input contains integers - /// or floats smaller than float64, then the output data-type is - /// np.float64. Otherwise, the data-type of the output is the - /// same as that of the input. If out is specified, that array is - /// returned instead. + /// A new array holding the result.

+ /// If the input contains integers + /// or floats smaller than float64, then the output data-type is + /// np.float64. Otherwise, the data-type of the output is the + /// same as that of the input.

+ /// If out is specified, that array is + /// returned instead. ///
- public static double nanmedian(NDarray a, NDarray @out = null, bool? overwrite_input = false) - => NumPy.Instance.nanmedian(a, @out:@out, overwrite_input:overwrite_input); + public static double nanmedian(this NDarray a, NDarray @out = null, bool? overwrite_input = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (overwrite_input!=false) kwargs["overwrite_input"]=ToPython(overwrite_input); + dynamic py = __self__.InvokeMethod("nanmedian", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. + /// Compute the arithmetic mean along the specified axis, ignoring NaNs.

+ /// + /// Returns the average of the array elements.

+ /// The average is taken over + /// the flattened array by default, otherwise over the specified axis.

+ /// + /// float64 intermediate and return values are used for integer inputs.

+ /// + /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised.

+ /// + /// Notes + /// + /// The arithmetic mean is the sum of the non-NaN elements along the axis + /// divided by the number of non-NaN elements.

+ /// + /// Note that for floating-point input, the mean is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32. Specifying a + /// higher-precision accumulator using the dtype keyword can alleviate + /// this issue. ///
/// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose mean is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the means are computed. The default is to compute - /// the mean of the flattened array. + /// Axis or axes along which the means are computed.

+ /// The default is to compute + /// the mean of the flattened array. /// /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. + /// Type to use in computing the mean.

+ /// For integer inputs, the default + /// is float64; for inexact inputs, it is the same as the input + /// dtype. + /// + /// + /// Alternate output array in which to place the result.

+ /// The default + /// is None; if provided, it must have the same shape as the + /// expected output, but the type will be cast if necessary.

+ /// See + /// doc.ufuncs for details. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If the value is anything but the default, then - /// keepdims will be passed through to the mean or sum methods - /// of sub-classes of ndarray. If the sub-classes methods - /// does not implement keepdims any exceptions will be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

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

+ /// If the sub-classes methods + /// does not implement keepdims any exceptions will be raised. /// /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. + /// If out=None, returns a new array containing the mean values, + /// otherwise a reference to the output array is returned.

+ /// Nan is + /// returned for slices that contain only NaNs. ///
- public static NDarray nanmean(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) - => NumPy.Instance.nanmean(a, axis:axis, dtype:dtype, @out:@out, keepdims:keepdims); + public static NDarray nanmean(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the arithmetic mean along the specified axis, ignoring NaNs. - /// - /// Returns the average of the array elements. The average is taken over - /// the flattened array by default, otherwise over the specified axis. - /// float64 intermediate and return values are used for integer inputs. - /// - /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The arithmetic mean is the sum of the non-NaN elements along the axis - /// divided by the number of non-NaN elements. - /// - /// Note that for floating-point input, the mean is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32. Specifying a - /// higher-precision accumulator using the dtype keyword can alleviate - /// this issue. + /// Compute the arithmetic mean along the specified axis, ignoring NaNs.

+ /// + /// Returns the average of the array elements.

+ /// The average is taken over + /// the flattened array by default, otherwise over the specified axis.

+ /// + /// float64 intermediate and return values are used for integer inputs.

+ /// + /// For all-NaN slices, NaN is returned and a RuntimeWarning is raised.

+ /// + /// Notes + /// + /// The arithmetic mean is the sum of the non-NaN elements along the axis + /// divided by the number of non-NaN elements.

+ /// + /// Note that for floating-point input, the mean is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32. Specifying a + /// higher-precision accumulator using the dtype keyword can alleviate + /// this issue. ///
/// - /// Array containing numbers whose mean is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose mean is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Type to use in computing the mean. For integer inputs, the default - /// is float64; for inexact inputs, it is the same as the input - /// dtype. - /// - /// - /// Alternate output array in which to place the result. The default - /// is None; if provided, it must have the same shape as the - /// expected output, but the type will be cast if necessary. See - /// doc.ufuncs for details. + /// Type to use in computing the mean.

+ /// For integer inputs, the default + /// is float64; for inexact inputs, it is the same as the input + /// dtype. + /// + /// + /// Alternate output array in which to place the result.

+ /// The default + /// is None; if provided, it must have the same shape as the + /// expected output, but the type will be cast if necessary.

+ /// See + /// doc.ufuncs for details. /// /// - /// If out=None, returns a new array containing the mean values, - /// otherwise a reference to the output array is returned. Nan is - /// returned for slices that contain only NaNs. + /// If out=None, returns a new array containing the mean values, + /// otherwise a reference to the output array is returned.

+ /// Nan is + /// returned for slices that contain only NaNs. ///
- public static double nanmean(NDarray a, Dtype dtype = null, NDarray @out = null) - => NumPy.Instance.nanmean(a, dtype:dtype, @out:@out); + public static double nanmean(this NDarray a, Dtype dtype = null, NDarray @out = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + dynamic py = __self__.InvokeMethod("nanmean", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. + /// Compute the standard deviation along the specified axis, while + /// ignoring NaNs.

+ /// + /// Returns the standard deviation, a measure of the spread of a + /// distribution, of the non-NaN array elements.

+ /// The standard deviation is + /// computed for the flattened array by default, otherwise over the + /// specified axis.

+ /// + /// For all-NaN slices or slices with zero degrees of freedom, NaN is + /// returned and a RuntimeWarning is raised.

+ /// + /// Notes + /// + /// The standard deviation is the square root of the average of the squared + /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)).

+ /// + /// The average squared deviation is normally calculated as + /// x.sum() / N, where N = len(x).

+ /// If, however, ddof is + /// specified, the divisor N - ddof is used instead.

+ /// In standard + /// statistical practice, ddof=1 provides an unbiased estimator of the + /// variance of the infinite population.

+ /// ddof=0 provides a maximum + /// likelihood estimate of the variance for normally distributed variables.

+ /// + /// The standard deviation computed in this function is the square root of + /// the estimated variance, so even with ddof=1, it will not be an + /// unbiased estimate of the standard deviation per se.

+ /// + /// Note that, for complex numbers, std takes the absolute value before + /// squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the std is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example + /// below).

+ /// Specifying a higher-accuracy accumulator using the dtype + /// keyword can alleviate this issue. ///
/// - /// Calculate the standard deviation of the non-NaN values. + /// Calculate the standard deviation of the non-NaN values. /// /// - /// Axis or axes along which the standard deviation is computed. The default is - /// to compute the standard deviation of the flattened array. + /// Axis or axes along which the standard deviation is computed.

+ /// The default is + /// to compute the standard deviation of the flattened array. /// /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. + /// Type to use in computing the standard deviation.

+ /// For arrays of + /// integer type the default is float64, for arrays of float types it + /// is the same as the array type. /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must have + /// the same shape as the expected output but the type (of the + /// calculated values) will be cast if necessary. /// /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. + /// Means Delta Degrees of Freedom.

+ /// The divisor used in calculations + /// is N - ddof, where N represents the number of non-NaN + /// elements.

+ /// By default ddof is zero. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. - /// - /// If this value is anything but the default it is passed through - /// as-is to the relevant functions of the sub-classes. If these - /// functions do not have a keepdims kwarg, a RuntimeError will - /// be raised. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

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

+ /// + /// If this value is anything but the default it is passed through + /// as-is to the relevant functions of the sub-classes.

+ /// If these + /// functions do not have a keepdims kwarg, a RuntimeError will + /// be raised. /// /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. + /// If out is None, return a new array containing the standard + /// deviation, otherwise return a reference to the output array.

+ /// If + /// ddof is >= the number of non-NaN elements in a slice or the slice + /// contains only NaNs, then the result for that slice is NaN. ///
- public static NDarray nanstd(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.nanstd(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); + public static NDarray nanstd(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the standard deviation along the specified axis, while - /// ignoring NaNs. - /// - /// Returns the standard deviation, a measure of the spread of a - /// distribution, of the non-NaN array elements. The standard deviation is - /// computed for the flattened array by default, otherwise over the - /// specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The standard deviation is the square root of the average of the squared - /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)). - /// - /// The average squared deviation is normally calculated as - /// x.sum() / N, where N = len(x). If, however, ddof is - /// specified, the divisor N - ddof is used instead. In standard - /// statistical practice, ddof=1 provides an unbiased estimator of the - /// variance of the infinite population. ddof=0 provides a maximum - /// likelihood estimate of the variance for normally distributed variables. - /// The standard deviation computed in this function is the square root of - /// the estimated variance, so even with ddof=1, it will not be an - /// unbiased estimate of the standard deviation per se. - /// - /// Note that, for complex numbers, std takes the absolute value before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the std is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. + /// Compute the standard deviation along the specified axis, while + /// ignoring NaNs.

+ /// + /// Returns the standard deviation, a measure of the spread of a + /// distribution, of the non-NaN array elements.

+ /// The standard deviation is + /// computed for the flattened array by default, otherwise over the + /// specified axis.

+ /// + /// For all-NaN slices or slices with zero degrees of freedom, NaN is + /// returned and a RuntimeWarning is raised.

+ /// + /// Notes + /// + /// The standard deviation is the square root of the average of the squared + /// deviations from the mean: std = sqrt(mean(abs(x - x.mean())**2)).

+ /// + /// The average squared deviation is normally calculated as + /// x.sum() / N, where N = len(x).

+ /// If, however, ddof is + /// specified, the divisor N - ddof is used instead.

+ /// In standard + /// statistical practice, ddof=1 provides an unbiased estimator of the + /// variance of the infinite population.

+ /// ddof=0 provides a maximum + /// likelihood estimate of the variance for normally distributed variables.

+ /// + /// The standard deviation computed in this function is the square root of + /// the estimated variance, so even with ddof=1, it will not be an + /// unbiased estimate of the standard deviation per se.

+ /// + /// Note that, for complex numbers, std takes the absolute value before + /// squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the std is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example + /// below).

+ /// Specifying a higher-accuracy accumulator using the dtype + /// keyword can alleviate this issue. ///
/// - /// Calculate the standard deviation of the non-NaN values. + /// Calculate the standard deviation of the non-NaN values. /// /// - /// Type to use in computing the standard deviation. For arrays of - /// integer type the default is float64, for arrays of float types it - /// is the same as the array type. + /// Type to use in computing the standard deviation.

+ /// For arrays of + /// integer type the default is float64, for arrays of float types it + /// is the same as the array type. /// - /// - /// Alternative output array in which to place the result. It must have - /// the same shape as the expected output but the type (of the - /// calculated values) will be cast if necessary. + /// + /// Alternative output array in which to place the result.

+ /// It must have + /// the same shape as the expected output but the type (of the + /// calculated values) will be cast if necessary. /// /// - /// Means Delta Degrees of Freedom. The divisor used in calculations - /// is N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. + /// Means Delta Degrees of Freedom.

+ /// The divisor used in calculations + /// is N - ddof, where N represents the number of non-NaN + /// elements.

+ /// By default ddof is zero. /// /// - /// If out is None, return a new array containing the standard - /// deviation, otherwise return a reference to the output array. If - /// ddof is >= the number of non-NaN elements in a slice or the slice - /// contains only NaNs, then the result for that slice is NaN. + /// If out is None, return a new array containing the standard + /// deviation, otherwise return a reference to the output array.

+ /// If + /// ddof is >= the number of non-NaN elements in a slice or the slice + /// contains only NaNs, then the result for that slice is NaN. ///
- public static double nanstd(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.nanstd(a, dtype:dtype, @out:@out, ddof:ddof); + public static double nanstd(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + dynamic py = __self__.InvokeMethod("nanstd", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims + /// Compute the variance along the specified axis, while ignoring NaNs.

+ /// + /// Returns the variance of the array elements, a measure of the spread of + /// a distribution.

+ /// The variance is computed for the flattened array by + /// default, otherwise over the specified axis.

+ /// + /// For all-NaN slices or slices with zero degrees of freedom, NaN is + /// returned and a RuntimeWarning is raised.

+ /// + /// Notes + /// + /// The variance is the average of the squared deviations from the mean, + /// i.e., var = mean(abs(x - x.mean())**2).

+ /// + /// The mean is normally calculated as x.sum() / N, where N = len(x).

+ /// + /// If, however, ddof is specified, the divisor N - ddof is used + /// instead.

+ /// In standard statistical practice, ddof=1 provides an + /// unbiased estimator of the variance of a hypothetical infinite + /// population.

+ /// ddof=0 provides a maximum likelihood estimate of the + /// variance for normally distributed variables.

+ /// + /// Note that for complex numbers, the absolute value is taken before + /// squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the variance is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example + /// below).

+ /// Specifying a higher-accuracy accumulator using the dtype + /// keyword can alleviate this issue.

+ /// + /// For this function to work on sub-classes of ndarray, they must define + /// sum with the kwarg keepdims ///
/// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose variance is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Axis or axes along which the variance is computed. The default is to compute - /// the variance of the flattened array. + /// Axis or axes along which the variance is computed.

+ /// The default is to compute + /// the variance of the flattened array. /// /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. + /// Type to use in computing the variance.

+ /// For arrays of integer type + /// the default is float32; for arrays of float types it is the same as + /// the array type. /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. + /// + /// Alternate output array in which to place the result.

+ /// It must have + /// the same shape as the expected output, but the type is cast if + /// necessary. /// /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. + /// “Delta Degrees of Freedom”: the divisor used in the calculation is + /// N - ddof, where N represents the number of non-NaN + /// elements.

+ /// By default ddof is zero. /// /// - /// If this is set to True, the axes which are reduced are left - /// in the result as dimensions with size one. With this option, - /// the result will broadcast correctly against the original a. + /// If this is set to True, the axes which are reduced are left + /// in the result as dimensions with size one.

+ /// With this option, + /// the result will broadcast correctly against the original a. /// /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. + /// If out is None, return a new array containing the variance, + /// otherwise return a reference to the output array.

+ /// If ddof is >= the + /// number of non-NaN elements in a slice or the slice contains only + /// NaNs, then the result for that slice is NaN. ///
- public static NDarray nanvar(NDarray a, int[] axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) - => NumPy.Instance.nanvar(a, axis:axis, dtype:dtype, @out:@out, ddof:ddof, keepdims:keepdims); + public static NDarray nanvar(this NDarray a, Axis axis, Dtype dtype = null, NDarray @out = null, int? ddof = 0, bool? keepdims = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (axis!=null) kwargs["axis"]=ToPython(axis); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + if (keepdims!=null) kwargs["keepdims"]=ToPython(keepdims); + dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Compute the variance along the specified axis, while ignoring NaNs. - /// - /// Returns the variance of the array elements, a measure of the spread of - /// a distribution. The variance is computed for the flattened array by - /// default, otherwise over the specified axis. - /// - /// For all-NaN slices or slices with zero degrees of freedom, NaN is - /// returned and a RuntimeWarning is raised. - /// - /// Notes - /// - /// The variance is the average of the squared deviations from the mean, - /// i.e., var = mean(abs(x - x.mean())**2). - /// - /// The mean is normally calculated as x.sum() / N, where N = len(x). - /// If, however, ddof is specified, the divisor N - ddof is used - /// instead. In standard statistical practice, ddof=1 provides an - /// unbiased estimator of the variance of a hypothetical infinite - /// population. ddof=0 provides a maximum likelihood estimate of the - /// variance for normally distributed variables. - /// - /// Note that for complex numbers, the absolute value is taken before - /// squaring, so that the result is always real and nonnegative. - /// - /// For floating-point input, the variance is computed using the same - /// precision the input has. Depending on the input data, this can cause - /// the results to be inaccurate, especially for float32 (see example - /// below). Specifying a higher-accuracy accumulator using the dtype - /// keyword can alleviate this issue. - /// - /// For this function to work on sub-classes of ndarray, they must define - /// sum with the kwarg keepdims + /// Compute the variance along the specified axis, while ignoring NaNs.

+ /// + /// Returns the variance of the array elements, a measure of the spread of + /// a distribution.

+ /// The variance is computed for the flattened array by + /// default, otherwise over the specified axis.

+ /// + /// For all-NaN slices or slices with zero degrees of freedom, NaN is + /// returned and a RuntimeWarning is raised.

+ /// + /// Notes + /// + /// The variance is the average of the squared deviations from the mean, + /// i.e., var = mean(abs(x - x.mean())**2).

+ /// + /// The mean is normally calculated as x.sum() / N, where N = len(x).

+ /// + /// If, however, ddof is specified, the divisor N - ddof is used + /// instead.

+ /// In standard statistical practice, ddof=1 provides an + /// unbiased estimator of the variance of a hypothetical infinite + /// population.

+ /// ddof=0 provides a maximum likelihood estimate of the + /// variance for normally distributed variables.

+ /// + /// Note that for complex numbers, the absolute value is taken before + /// squaring, so that the result is always real and nonnegative.

+ /// + /// For floating-point input, the variance is computed using the same + /// precision the input has.

+ /// Depending on the input data, this can cause + /// the results to be inaccurate, especially for float32 (see example + /// below).

+ /// Specifying a higher-accuracy accumulator using the dtype + /// keyword can alleviate this issue.

+ /// + /// For this function to work on sub-classes of ndarray, they must define + /// sum with the kwarg keepdims ///
/// - /// Array containing numbers whose variance is desired. If a is not an - /// array, a conversion is attempted. + /// Array containing numbers whose variance is desired.

+ /// If a is not an + /// array, a conversion is attempted. /// /// - /// Type to use in computing the variance. For arrays of integer type - /// the default is float32; for arrays of float types it is the same as - /// the array type. + /// Type to use in computing the variance.

+ /// For arrays of integer type + /// the default is float32; for arrays of float types it is the same as + /// the array type. /// - /// - /// Alternate output array in which to place the result. It must have - /// the same shape as the expected output, but the type is cast if - /// necessary. + /// + /// Alternate output array in which to place the result.

+ /// It must have + /// the same shape as the expected output, but the type is cast if + /// necessary. /// /// - /// “Delta Degrees of Freedom”: the divisor used in the calculation is - /// N - ddof, where N represents the number of non-NaN - /// elements. By default ddof is zero. + /// “Delta Degrees of Freedom”: the divisor used in the calculation is + /// N - ddof, where N represents the number of non-NaN + /// elements.

+ /// By default ddof is zero. /// /// - /// If out is None, return a new array containing the variance, - /// otherwise return a reference to the output array. If ddof is >= the - /// number of non-NaN elements in a slice or the slice contains only - /// NaNs, then the result for that slice is NaN. + /// If out is None, return a new array containing the variance, + /// otherwise return a reference to the output array.

+ /// If ddof is >= the + /// number of non-NaN elements in a slice or the slice contains only + /// NaNs, then the result for that slice is NaN. ///
- public static double nanvar(NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) - => NumPy.Instance.nanvar(a, dtype:dtype, @out:@out, ddof:ddof); + public static double nanvar(this NDarray a, Dtype dtype = null, NDarray @out = null, int? ddof = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (dtype!=null) kwargs["dtype"]=ToPython(dtype); + if (@out!=null) kwargs["out"]=ToPython(@out); + if (ddof!=0) kwargs["ddof"]=ToPython(ddof); + dynamic py = __self__.InvokeMethod("nanvar", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return Pearson product-moment correlation coefficients. - /// - /// Please refer to the documentation for cov for more detail. The - /// relationship between the correlation coefficient matrix, R, and the - /// covariance matrix, C, is - /// - /// The values of R are between -1 and 1, inclusive. - /// - /// Notes - /// - /// Due to floating point rounding the resulting array may not be Hermitian, - /// the diagonal elements may not be 1, and the elements may not satisfy the - /// inequality abs(a) <= 1. The real and imaginary parts are clipped to the - /// interval [-1, 1] in an attempt to improve on that situation but is not - /// much help in the complex case. - /// - /// This function accepts but discards arguments bias and ddof. This is - /// for backwards compatibility with previous versions of this function. These - /// arguments had no effect on the return values of the function and can be - /// safely ignored in this and previous versions of numpy. + /// Return Pearson product-moment correlation coefficients.

+ /// + /// Please refer to the documentation for cov for more detail.

+ /// The + /// relationship between the correlation coefficient matrix, R, and the + /// covariance matrix, C, is + /// + /// The values of R are between -1 and 1, inclusive.

+ /// + /// Notes + /// + /// Due to floating point rounding the resulting array may not be Hermitian, + /// the diagonal elements may not be 1, and the elements may not satisfy the + /// inequality abs(a) <= 1.

+ /// The real and imaginary parts are clipped to the + /// interval [-1, 1] in an attempt to improve on that situation but is not + /// much help in the complex case.

+ /// + /// This function accepts but discards arguments bias and ddof.

+ /// This is + /// for backwards compatibility with previous versions of this function.

+ /// These + /// arguments had no effect on the return values of the function and can be + /// safely ignored in this and previous versions of numpy. ///
/// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of x represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. + /// A 1-D or 2-D array containing multiple variables and observations.

+ /// + /// Each row of x represents a variable, and each column a single + /// observation of all those variables.

+ /// Also see rowvar below. /// /// - /// An additional set of variables and observations. y has the same - /// shape as x. + /// An additional set of variables and observations.

+ /// y has the same + /// shape as x. /// /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. + /// If rowvar is True (default), then each row represents a + /// variable, with observations in the columns.

+ /// Otherwise, the relationship + /// is transposed: each column represents a variable, while the rows + /// contain observations. /// /// - /// The correlation coefficient matrix of the variables. + /// The correlation coefficient matrix of the variables. /// - public static NDarray corrcoef(NDarray x, NDarray y = null, bool? rowvar = true) - => NumPy.Instance.corrcoef(x, y:y, rowvar:rowvar); + public static NDarray corrcoef(this NDarray x, NDarray y = null, bool? rowvar = true) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (y!=null) kwargs["y"]=ToPython(y); + if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); + dynamic py = __self__.InvokeMethod("corrcoef", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Cross-correlation of two 1-dimensional sequences. - /// - /// This function computes the correlation as generally defined in signal - /// processing texts: - /// - /// with a and v sequences being zero-padded where necessary and conj being - /// the conjugate. - /// - /// Notes - /// - /// The definition of correlation above is not unique and sometimes correlation - /// may be defined differently. Another common definition is: - /// - /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. + /// Cross-correlation of two 1-dimensional sequences.

+ /// + /// This function computes the correlation as generally defined in signal + /// processing texts: + /// + /// with a and v sequences being zero-padded where necessary and conj being + /// the conjugate.

+ /// + /// Notes + /// + /// The definition of correlation above is not unique and sometimes correlation + /// may be defined differently.

+ /// Another common definition is: + /// + /// which is related to c_{av}[k] by c'_{av}[k] = c_{av}[-k]. ///
/// - /// Input sequences. + /// Input sequences. /// /// - /// Input sequences. + /// Input sequences. /// /// - /// Refer to the convolve docstring. Note that the default - /// is ‘valid’, unlike convolve, which uses ‘full’. + /// Refer to the convolve docstring.

+ /// Note that the default + /// is ‘valid’, unlike convolve, which uses ‘full’. /// /// - /// Discrete cross-correlation of a and v. + /// Discrete cross-correlation of a and v. /// - public static NDarray correlate(NDarray v, NDarray a, string mode = "valid") - => NumPy.Instance.correlate(v, a, mode:mode); + public static NDarray correlate(this NDarray v, NDarray a, string mode = "valid") + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + v, + a, + }); + var kwargs=new PyDict(); + if (mode!="valid") kwargs["mode"]=ToPython(mode); + dynamic py = __self__.InvokeMethod("correlate", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Estimate a covariance matrix, given data and weights. - /// - /// Covariance indicates the level to which two variables vary together. - /// If we examine N-dimensional samples, , - /// then the covariance matrix element is the covariance of - /// and . The element is the variance - /// of . - /// - /// See the notes for an outline of the algorithm. - /// - /// Notes - /// - /// Assume that the observations are in the columns of the observation - /// array m and let f = fweights and a = aweights for brevity. The - /// steps to compute the weighted covariance are as follows: - /// - /// Note that when a == 1, the normalization factor - /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) - /// as it should. + /// Estimate a covariance matrix, given data and weights.

+ /// + /// Covariance indicates the level to which two variables vary together.

+ /// + /// If we examine N-dimensional samples, , + /// then the covariance matrix element is the covariance of + /// and . The element is the variance + /// of . + /// + /// See the notes for an outline of the algorithm.

+ /// + /// Notes + /// + /// Assume that the observations are in the columns of the observation + /// array m and let f = fweights and a = aweights for brevity.

+ /// The + /// steps to compute the weighted covariance are as follows: + /// + /// Note that when a == 1, the normalization factor + /// v1 / (v1**2 - ddof * v2) goes over to 1 / (np.sum(f) - ddof) + /// as it should. ///
/// - /// A 1-D or 2-D array containing multiple variables and observations. - /// Each row of m represents a variable, and each column a single - /// observation of all those variables. Also see rowvar below. + /// A 1-D or 2-D array containing multiple variables and observations.

+ /// + /// Each row of m represents a variable, and each column a single + /// observation of all those variables.

+ /// Also see rowvar below. /// /// - /// An additional set of variables and observations. y has the same form - /// as that of m. + /// An additional set of variables and observations.

+ /// y has the same form + /// as that of m. /// /// - /// If rowvar is True (default), then each row represents a - /// variable, with observations in the columns. Otherwise, the relationship - /// is transposed: each column represents a variable, while the rows - /// contain observations. + /// If rowvar is True (default), then each row represents a + /// variable, with observations in the columns.

+ /// Otherwise, the relationship + /// is transposed: each column represents a variable, while the rows + /// contain observations. /// /// - /// Default normalization (False) is by (N - 1), where N is the - /// number of observations given (unbiased estimate). If bias is True, - /// then normalization is by N. These values can be overridden by using - /// the keyword ddof in numpy versions >= 1.5. + /// Default normalization (False) is by (N - 1), where N is the + /// number of observations given (unbiased estimate).

+ /// If bias is True, + /// then normalization is by N.

+ /// These values can be overridden by using + /// the keyword ddof in numpy versions >= 1.5. /// /// - /// If not None the default value implied by bias is overridden. - /// Note that ddof=1 will return the unbiased estimate, even if both - /// fweights and aweights are specified, and ddof=0 will return - /// the simple average. See the notes for the details. The default value - /// is None. + /// If not None the default value implied by bias is overridden.

+ /// + /// Note that ddof=1 will return the unbiased estimate, even if both + /// fweights and aweights are specified, and ddof=0 will return + /// the simple average.

+ /// See the notes for the details.

+ /// The default value + /// is None. /// /// - /// 1-D array of integer frequency weights; the number of times each - /// observation vector should be repeated. + /// 1-D array of integer frequency weights; the number of times each + /// observation vector should be repeated. /// /// - /// 1-D array of observation vector weights. These relative weights are - /// typically large for observations considered “important” and smaller for - /// observations considered less “important”. If ddof=0 the array of - /// weights can be used to assign probabilities to observation vectors. + /// 1-D array of observation vector weights.

+ /// These relative weights are + /// typically large for observations considered “important” and smaller for + /// observations considered less “important”. If ddof=0 the array of + /// weights can be used to assign probabilities to observation vectors. /// /// - /// The covariance matrix of the variables. + /// The covariance matrix of the variables. /// - public static NDarray cov(NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) - => NumPy.Instance.cov(m, y:y, rowvar:rowvar, bias:bias, ddof:ddof, fweights:fweights, aweights:aweights); + public static NDarray cov(this NDarray m, NDarray y = null, bool? rowvar = true, bool? bias = false, int? ddof = null, NDarray fweights = null, NDarray aweights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + m, + }); + var kwargs=new PyDict(); + if (y!=null) kwargs["y"]=ToPython(y); + if (rowvar!=true) kwargs["rowvar"]=ToPython(rowvar); + if (bias!=false) kwargs["bias"]=ToPython(bias); + if (ddof!=null) kwargs["ddof"]=ToPython(ddof); + if (fweights!=null) kwargs["fweights"]=ToPython(fweights); + if (aweights!=null) kwargs["aweights"]=ToPython(aweights); + dynamic py = __self__.InvokeMethod("cov", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. + /// Compute the histogram of a set of data.

+ /// + /// Notes + /// + /// All but the last (righthand-most) bin is half-open.

+ /// In other words, + /// if bins is: + /// + /// then the first bin is [1, 2) (including 1, but excluding 2) and + /// the second [2, 3).

+ /// The last bin, however, is [3, 4], which + /// includes 4. ///
/// - /// Input data. The histogram is computed over the flattened array. + /// Input data.

+ /// The histogram is computed over the flattened array. /// /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. + /// If bins is an int, it defines the number of equal-width + /// bins in the given range (10, by default).

+ /// If bins is a + /// sequence, it defines a monotonically increasing array of bin edges, + /// including the rightmost edge, allowing for non-uniform bin widths.

+ /// + /// If bins is a string, it defines the method used to calculate the + /// optimal bin width, as defined by histogram_bin_edges. /// /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. + /// The lower and upper range of the bins.

+ /// If not provided, range + /// is simply (a.min(), a.max()).

+ /// Values outside the range are + /// ignored.

+ /// The first element of the range must be less than or + /// equal to the second.

+ /// range affects the automatic bin + /// computation as well.

+ /// While bin width is computed to be optimal + /// based on the actual data within range, the bin count will fill + /// the entire range including portions containing no data. /// /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. + /// This is equivalent to the density argument, but produces incorrect + /// results for unequal bin widths.

+ /// It should not be used. /// /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. + /// An array of weights, of the same shape as a.

+ /// Each value in + /// a only contributes its associated weight towards the bin count + /// (instead of 1).

+ /// If density is True, the weights are + /// normalized, so that the integral of the density over the range + /// remains 1. /// /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. + /// If False, the result will contain the number of samples in + /// each bin.

+ /// If True, the result is the value of the + /// probability density function at the bin, normalized such that + /// the integral over the range is 1.

+ /// Note that the sum of the + /// histogram values will not be equal to 1 unless bins of unity + /// width are chosen; it is not a probability mass function.

+ /// + /// Overrides the normed keyword if given. /// /// /// A tuple of: /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. + /// The values of the histogram. See density and weights for a + /// description of the possible semantics. /// bin_edges - /// Return the bin edges (length(hist)+1). + /// Return the bin edges (length(hist)+1). /// - public static (NDarray, NDarray) histogram(NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - => NumPy.Instance.histogram(a, bins:bins, range:range, normed:normed, weights:weights, density:density); + public static (NDarray, NDarray) histogram(this NDarray a, int? bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + if (density!=null) kwargs["density"]=ToPython(density); + dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. + /// Compute the histogram of a set of data.

+ /// + /// Notes + /// + /// All but the last (righthand-most) bin is half-open.

+ /// In other words, + /// if bins is: + /// + /// then the first bin is [1, 2) (including 1, but excluding 2) and + /// the second [2, 3).

+ /// The last bin, however, is [3, 4], which + /// includes 4. ///
/// - /// Input data. The histogram is computed over the flattened array. + /// Input data.

+ /// The histogram is computed over the flattened array. /// /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. + /// If bins is an int, it defines the number of equal-width + /// bins in the given range (10, by default).

+ /// If bins is a + /// sequence, it defines a monotonically increasing array of bin edges, + /// including the rightmost edge, allowing for non-uniform bin widths.

+ /// + /// If bins is a string, it defines the method used to calculate the + /// optimal bin width, as defined by histogram_bin_edges. /// /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. + /// The lower and upper range of the bins.

+ /// If not provided, range + /// is simply (a.min(), a.max()).

+ /// Values outside the range are + /// ignored.

+ /// The first element of the range must be less than or + /// equal to the second.

+ /// range affects the automatic bin + /// computation as well.

+ /// While bin width is computed to be optimal + /// based on the actual data within range, the bin count will fill + /// the entire range including portions containing no data. /// /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. + /// This is equivalent to the density argument, but produces incorrect + /// results for unequal bin widths.

+ /// It should not be used. /// /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. + /// An array of weights, of the same shape as a.

+ /// Each value in + /// a only contributes its associated weight towards the bin count + /// (instead of 1).

+ /// If density is True, the weights are + /// normalized, so that the integral of the density over the range + /// remains 1. /// /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. + /// If False, the result will contain the number of samples in + /// each bin.

+ /// If True, the result is the value of the + /// probability density function at the bin, normalized such that + /// the integral over the range is 1.

+ /// Note that the sum of the + /// histogram values will not be equal to 1 unless bins of unity + /// width are chosen; it is not a probability mass function.

+ /// + /// Overrides the normed keyword if given. /// /// /// A tuple of: /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. + /// The values of the histogram. See density and weights for a + /// description of the possible semantics. /// bin_edges - /// Return the bin edges (length(hist)+1). + /// Return the bin edges (length(hist)+1). /// - public static (NDarray, NDarray) histogram(NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - => NumPy.Instance.histogram(a, bins:bins, range:range, normed:normed, weights:weights, density:density); + public static (NDarray, NDarray) histogram(this NDarray a, NDarray bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + if (density!=null) kwargs["density"]=ToPython(density); + dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Compute the histogram of a set of data. - /// - /// Notes - /// - /// All but the last (righthand-most) bin is half-open. In other words, - /// if bins is: - /// - /// then the first bin is [1, 2) (including 1, but excluding 2) and - /// the second [2, 3). The last bin, however, is [3, 4], which - /// includes 4. + /// Compute the histogram of a set of data.

+ /// + /// Notes + /// + /// All but the last (righthand-most) bin is half-open.

+ /// In other words, + /// if bins is: + /// + /// then the first bin is [1, 2) (including 1, but excluding 2) and + /// the second [2, 3).

+ /// The last bin, however, is [3, 4], which + /// includes 4. ///
/// - /// Input data. The histogram is computed over the flattened array. + /// Input data.

+ /// The histogram is computed over the flattened array. /// /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines a monotonically increasing array of bin edges, - /// including the rightmost edge, allowing for non-uniform bin widths. - /// - /// If bins is a string, it defines the method used to calculate the - /// optimal bin width, as defined by histogram_bin_edges. + /// If bins is an int, it defines the number of equal-width + /// bins in the given range (10, by default).

+ /// If bins is a + /// sequence, it defines a monotonically increasing array of bin edges, + /// including the rightmost edge, allowing for non-uniform bin widths.

+ /// + /// If bins is a string, it defines the method used to calculate the + /// optimal bin width, as defined by histogram_bin_edges. /// /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. + /// The lower and upper range of the bins.

+ /// If not provided, range + /// is simply (a.min(), a.max()).

+ /// Values outside the range are + /// ignored.

+ /// The first element of the range must be less than or + /// equal to the second.

+ /// range affects the automatic bin + /// computation as well.

+ /// While bin width is computed to be optimal + /// based on the actual data within range, the bin count will fill + /// the entire range including portions containing no data. /// /// - /// This is equivalent to the density argument, but produces incorrect - /// results for unequal bin widths. It should not be used. + /// This is equivalent to the density argument, but produces incorrect + /// results for unequal bin widths.

+ /// It should not be used. /// /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). If density is True, the weights are - /// normalized, so that the integral of the density over the range - /// remains 1. + /// An array of weights, of the same shape as a.

+ /// Each value in + /// a only contributes its associated weight towards the bin count + /// (instead of 1).

+ /// If density is True, the weights are + /// normalized, so that the integral of the density over the range + /// remains 1. /// /// - /// If False, the result will contain the number of samples in - /// each bin. If True, the result is the value of the - /// probability density function at the bin, normalized such that - /// the integral over the range is 1. Note that the sum of the - /// histogram values will not be equal to 1 unless bins of unity - /// width are chosen; it is not a probability mass function. - /// - /// Overrides the normed keyword if given. + /// If False, the result will contain the number of samples in + /// each bin.

+ /// If True, the result is the value of the + /// probability density function at the bin, normalized such that + /// the integral over the range is 1.

+ /// Note that the sum of the + /// histogram values will not be equal to 1 unless bins of unity + /// width are chosen; it is not a probability mass function.

+ /// + /// Overrides the normed keyword if given. /// /// /// A tuple of: /// hist - /// The values of the histogram. See density and weights for a - /// description of the possible semantics. + /// The values of the histogram. See density and weights for a + /// description of the possible semantics. /// bin_edges - /// Return the bin edges (length(hist)+1). + /// Return the bin edges (length(hist)+1). /// - public static (NDarray, NDarray) histogram(NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) - => NumPy.Instance.histogram(a, bins:bins, range:range, normed:normed, weights:weights, density:density); + public static (NDarray, NDarray) histogram(this NDarray a, List bins = null, (float, float)? range = null, bool? normed = null, NDarray weights = null, bool? density = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + if (density!=null) kwargs["density"]=ToPython(density); + dynamic py = __self__.InvokeMethod("histogram", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. + /// Compute the bi-dimensional histogram of two data samples.

+ /// + /// Notes + /// + /// When normed is True, then the returned histogram is the sample + /// density, defined such that the sum over bins of the product + /// bin_value * bin_area is 1.

+ /// + /// Please note that the histogram does not follow the Cartesian convention + /// where x values are on the abscissa and y values on the ordinate + /// axis.

+ /// Rather, x is histogrammed along the first dimension of the + /// array (vertical), and y along the second dimension of the array + /// (horizontal).

+ /// This ensures compatibility with histogramdd. ///
/// - /// An array containing the x coordinates of the points to be - /// histogrammed. + /// An array containing the x coordinates of the points to be + /// histogrammed. /// /// - /// An array containing the y coordinates of the points to be - /// histogrammed. + /// An array containing the y coordinates of the points to be + /// histogrammed. /// /// - /// The bin specification: + /// The bin specification: /// /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. + /// The leftmost and rightmost edges of the bins along each dimension + /// (if not specified explicitly in the bins parameters): + /// [[xmin, xmax], [ymin, ymax]].

+ /// All values outside of this range + /// will be considered outliers and not tallied in the histogram. /// /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. + /// If False, the default, returns the number of samples in each bin.

+ /// + /// If True, returns the probability density function at the bin, + /// bin_count / sample_count / bin_area. /// /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. + /// An alias for the density argument that behaves identically.

+ /// To avoid + /// confusion with the broken normed argument to histogram, density + /// should be preferred. /// /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. + /// An array of values w_i weighing each sample (x_i, y_i).

+ /// + /// Weights are normalized to 1 if normed is True.

+ /// If normed is + /// False, the values of the returned histogram are equal to the sum of + /// the weights belonging to the samples falling into each bin. /// /// /// A tuple of: /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. + /// The bi-dimensional histogram of samples x and y. Values in x + /// are histogrammed along the first dimension and values in y are + /// histogrammed along the second dimension. /// xedges - /// The bin edges along the first dimension. + /// The bin edges along the first dimension. /// yedges - /// The bin edges along the second dimension. + /// The bin edges along the second dimension. /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogram2d(x, y, bins:bins, range:range, density:density, normed:normed, weights:weights); + public static (NDarray, NDarray, NDarray) histogram2d(this NDarray x, NDarray y, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + y, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (density!=null) kwargs["density"]=ToPython(density); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); + } /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. + /// Compute the bi-dimensional histogram of two data samples.

+ /// + /// Notes + /// + /// When normed is True, then the returned histogram is the sample + /// density, defined such that the sum over bins of the product + /// bin_value * bin_area is 1.

+ /// + /// Please note that the histogram does not follow the Cartesian convention + /// where x values are on the abscissa and y values on the ordinate + /// axis.

+ /// Rather, x is histogrammed along the first dimension of the + /// array (vertical), and y along the second dimension of the array + /// (horizontal).

+ /// This ensures compatibility with histogramdd. ///
/// - /// An array containing the x coordinates of the points to be - /// histogrammed. + /// An array containing the x coordinates of the points to be + /// histogrammed. /// /// - /// An array containing the y coordinates of the points to be - /// histogrammed. + /// An array containing the y coordinates of the points to be + /// histogrammed. /// /// - /// The bin specification: + /// The bin specification: /// /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. + /// The leftmost and rightmost edges of the bins along each dimension + /// (if not specified explicitly in the bins parameters): + /// [[xmin, xmax], [ymin, ymax]].

+ /// All values outside of this range + /// will be considered outliers and not tallied in the histogram. /// /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. + /// If False, the default, returns the number of samples in each bin.

+ /// + /// If True, returns the probability density function at the bin, + /// bin_count / sample_count / bin_area. /// /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. + /// An alias for the density argument that behaves identically.

+ /// To avoid + /// confusion with the broken normed argument to histogram, density + /// should be preferred. /// /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. + /// An array of values w_i weighing each sample (x_i, y_i).

+ /// + /// Weights are normalized to 1 if normed is True.

+ /// If normed is + /// False, the values of the returned histogram are equal to the sum of + /// the weights belonging to the samples falling into each bin. /// /// /// A tuple of: /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. + /// The bi-dimensional histogram of samples x and y. Values in x + /// are histogrammed along the first dimension and values in y are + /// histogrammed along the second dimension. /// xedges - /// The bin edges along the first dimension. + /// The bin edges along the first dimension. /// yedges - /// The bin edges along the second dimension. + /// The bin edges along the second dimension. /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogram2d(x, y, bins:bins, range:range, density:density, normed:normed, weights:weights); + public static (NDarray, NDarray, NDarray) histogram2d(this NDarray x, NDarray y, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + y, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (density!=null) kwargs["density"]=ToPython(density); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); + } /// - /// Compute the bi-dimensional histogram of two data samples. - /// - /// Notes - /// - /// When normed is True, then the returned histogram is the sample - /// density, defined such that the sum over bins of the product - /// bin_value * bin_area is 1. - /// - /// Please note that the histogram does not follow the Cartesian convention - /// where x values are on the abscissa and y values on the ordinate - /// axis. Rather, x is histogrammed along the first dimension of the - /// array (vertical), and y along the second dimension of the array - /// (horizontal). This ensures compatibility with histogramdd. + /// Compute the bi-dimensional histogram of two data samples.

+ /// + /// Notes + /// + /// When normed is True, then the returned histogram is the sample + /// density, defined such that the sum over bins of the product + /// bin_value * bin_area is 1.

+ /// + /// Please note that the histogram does not follow the Cartesian convention + /// where x values are on the abscissa and y values on the ordinate + /// axis.

+ /// Rather, x is histogrammed along the first dimension of the + /// array (vertical), and y along the second dimension of the array + /// (horizontal).

+ /// This ensures compatibility with histogramdd. ///
/// - /// An array containing the x coordinates of the points to be - /// histogrammed. + /// An array containing the x coordinates of the points to be + /// histogrammed. /// /// - /// An array containing the y coordinates of the points to be - /// histogrammed. + /// An array containing the y coordinates of the points to be + /// histogrammed. /// /// - /// The bin specification: + /// The bin specification: /// /// - /// The leftmost and rightmost edges of the bins along each dimension - /// (if not specified explicitly in the bins parameters): - /// [[xmin, xmax], [ymin, ymax]]. All values outside of this range - /// will be considered outliers and not tallied in the histogram. + /// The leftmost and rightmost edges of the bins along each dimension + /// (if not specified explicitly in the bins parameters): + /// [[xmin, xmax], [ymin, ymax]].

+ /// All values outside of this range + /// will be considered outliers and not tallied in the histogram. /// /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_area. + /// If False, the default, returns the number of samples in each bin.

+ /// + /// If True, returns the probability density function at the bin, + /// bin_count / sample_count / bin_area. /// /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. + /// An alias for the density argument that behaves identically.

+ /// To avoid + /// confusion with the broken normed argument to histogram, density + /// should be preferred. /// /// - /// An array of values w_i weighing each sample (x_i, y_i). - /// Weights are normalized to 1 if normed is True. If normed is - /// False, the values of the returned histogram are equal to the sum of - /// the weights belonging to the samples falling into each bin. + /// An array of values w_i weighing each sample (x_i, y_i).

+ /// + /// Weights are normalized to 1 if normed is True.

+ /// If normed is + /// False, the values of the returned histogram are equal to the sum of + /// the weights belonging to the samples falling into each bin. /// /// /// A tuple of: /// H - /// The bi-dimensional histogram of samples x and y. Values in x - /// are histogrammed along the first dimension and values in y are - /// histogrammed along the second dimension. + /// The bi-dimensional histogram of samples x and y. Values in x + /// are histogrammed along the first dimension and values in y are + /// histogrammed along the second dimension. /// xedges - /// The bin edges along the first dimension. + /// The bin edges along the first dimension. /// yedges - /// The bin edges along the second dimension. + /// The bin edges along the second dimension. /// - public static (NDarray, NDarray, NDarray) histogram2d(NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogram2d(x, y, bins:bins, range:range, density:density, normed:normed, weights:weights); + public static (NDarray, NDarray, NDarray) histogram2d(this NDarray x, NDarray y, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + y, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (density!=null) kwargs["density"]=ToPython(density); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogram2d", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1]), ToCsharp(py[2])); + } /// - /// Compute the multidimensional histogram of some data. + /// Compute the multidimensional histogram of some data. /// /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. + /// The data to be histogrammed.

+ /// + /// Note the unusual interpretation of sample when an array_like: + /// + /// The first form should be preferred. /// /// - /// The bin specification: + /// The bin specification: /// /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. + /// A sequence of length D, each an optional (lower, upper) tuple giving + /// the outer bin edges to be used if the edges are not given explicitly in + /// bins.

+ /// + /// An entry of None in the sequence results in the minimum and maximum + /// values being used for the corresponding dimension.

+ /// + /// The default, None, is equivalent to passing a tuple of D None values. /// /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. + /// If False, the default, returns the number of samples in each bin.

+ /// + /// If True, returns the probability density function at the bin, + /// bin_count / sample_count / bin_volume. /// /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. + /// An alias for the density argument that behaves identically.

+ /// To avoid + /// confusion with the broken normed argument to histogram, density + /// should be preferred. /// /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. + /// An array of values w_i weighing each sample (x_i, y_i, z_i, …).

+ /// + /// Weights are normalized to 1 if normed is True.

+ /// If normed is False, + /// the values of the returned histogram are equal to the sum of the + /// weights belonging to the samples falling into each bin. /// /// /// A tuple of: /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. + /// The multidimensional histogram of sample x. See normed and weights + /// for the different possible semantics. /// edges - /// A list of D arrays describing the bin edges for each dimension. + /// A list of D arrays describing the bin edges for each dimension. /// - public static (NDarray, NDarray) histogramdd(NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogramdd(sample, bins:bins, range:range, density:density, normed:normed, weights:weights); + public static (NDarray, NDarray) histogramdd(this NDarray sample, int? bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + sample, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (density!=null) kwargs["density"]=ToPython(density); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Compute the multidimensional histogram of some data. + /// Compute the multidimensional histogram of some data. /// /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. + /// The data to be histogrammed.

+ /// + /// Note the unusual interpretation of sample when an array_like: + /// + /// The first form should be preferred. /// /// - /// The bin specification: + /// The bin specification: /// /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. + /// A sequence of length D, each an optional (lower, upper) tuple giving + /// the outer bin edges to be used if the edges are not given explicitly in + /// bins.

+ /// + /// An entry of None in the sequence results in the minimum and maximum + /// values being used for the corresponding dimension.

+ /// + /// The default, None, is equivalent to passing a tuple of D None values. /// /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. + /// If False, the default, returns the number of samples in each bin.

+ /// + /// If True, returns the probability density function at the bin, + /// bin_count / sample_count / bin_volume. /// /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. + /// An alias for the density argument that behaves identically.

+ /// To avoid + /// confusion with the broken normed argument to histogram, density + /// should be preferred. /// /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. + /// An array of values w_i weighing each sample (x_i, y_i, z_i, …).

+ /// + /// Weights are normalized to 1 if normed is True.

+ /// If normed is False, + /// the values of the returned histogram are equal to the sum of the + /// weights belonging to the samples falling into each bin. /// /// /// A tuple of: /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. + /// The multidimensional histogram of sample x. See normed and weights + /// for the different possible semantics. /// edges - /// A list of D arrays describing the bin edges for each dimension. + /// A list of D arrays describing the bin edges for each dimension. /// - public static (NDarray, NDarray) histogramdd(NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogramdd(sample, bins:bins, range:range, density:density, normed:normed, weights:weights); + public static (NDarray, NDarray) histogramdd(this NDarray sample, NDarray bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + sample, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (density!=null) kwargs["density"]=ToPython(density); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Compute the multidimensional histogram of some data. + /// Compute the multidimensional histogram of some data. /// /// - /// The data to be histogrammed. - /// - /// Note the unusual interpretation of sample when an array_like: - /// - /// The first form should be preferred. + /// The data to be histogrammed.

+ /// + /// Note the unusual interpretation of sample when an array_like: + /// + /// The first form should be preferred. /// /// - /// The bin specification: + /// The bin specification: /// /// - /// A sequence of length D, each an optional (lower, upper) tuple giving - /// the outer bin edges to be used if the edges are not given explicitly in - /// bins. - /// An entry of None in the sequence results in the minimum and maximum - /// values being used for the corresponding dimension. - /// The default, None, is equivalent to passing a tuple of D None values. + /// A sequence of length D, each an optional (lower, upper) tuple giving + /// the outer bin edges to be used if the edges are not given explicitly in + /// bins.

+ /// + /// An entry of None in the sequence results in the minimum and maximum + /// values being used for the corresponding dimension.

+ /// + /// The default, None, is equivalent to passing a tuple of D None values. /// /// - /// If False, the default, returns the number of samples in each bin. - /// If True, returns the probability density function at the bin, - /// bin_count / sample_count / bin_volume. + /// If False, the default, returns the number of samples in each bin.

+ /// + /// If True, returns the probability density function at the bin, + /// bin_count / sample_count / bin_volume. /// /// - /// An alias for the density argument that behaves identically. To avoid - /// confusion with the broken normed argument to histogram, density - /// should be preferred. + /// An alias for the density argument that behaves identically.

+ /// To avoid + /// confusion with the broken normed argument to histogram, density + /// should be preferred. /// /// - /// An array of values w_i weighing each sample (x_i, y_i, z_i, …). - /// Weights are normalized to 1 if normed is True. If normed is False, - /// the values of the returned histogram are equal to the sum of the - /// weights belonging to the samples falling into each bin. + /// An array of values w_i weighing each sample (x_i, y_i, z_i, …).

+ /// + /// Weights are normalized to 1 if normed is True.

+ /// If normed is False, + /// the values of the returned histogram are equal to the sum of the + /// weights belonging to the samples falling into each bin. /// /// /// A tuple of: /// H - /// The multidimensional histogram of sample x. See normed and weights - /// for the different possible semantics. + /// The multidimensional histogram of sample x. See normed and weights + /// for the different possible semantics. /// edges - /// A list of D arrays describing the bin edges for each dimension. + /// A list of D arrays describing the bin edges for each dimension. /// - public static (NDarray, NDarray) histogramdd(NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) - => NumPy.Instance.histogramdd(sample, bins:bins, range:range, density:density, normed:normed, weights:weights); + public static (NDarray, NDarray) histogramdd(this NDarray sample, List bins = null, (float, float)? range = null, bool? density = null, bool? normed = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + sample, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (density!=null) kwargs["density"]=ToPython(density); + if (normed!=null) kwargs["normed"]=ToPython(normed); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogramdd", pyargs, kwargs); + return (ToCsharp(py[0]), ToCsharp(py[1])); + } /// - /// Count number of occurrences of each value in array of non-negative ints. - /// - /// The number of bins (of size 1) is one larger than the largest value in - /// x. If minlength is specified, there will be at least this number - /// of bins in the output array (though it will be longer if necessary, - /// depending on the contents of x). - /// Each bin gives the number of occurrences of its index value in x. - /// If weights is specified the input array is weighted by it, i.e. if a - /// value n is found at position i, out[n] += weight[i] instead - /// of out[n] += 1. + /// Count number of occurrences of each value in array of non-negative ints.

+ /// + /// The number of bins (of size 1) is one larger than the largest value in + /// x.

+ /// If minlength is specified, there will be at least this number + /// of bins in the output array (though it will be longer if necessary, + /// depending on the contents of x).

+ /// + /// Each bin gives the number of occurrences of its index value in x.

+ /// + /// If weights is specified the input array is weighted by it, i.e.

+ /// if a + /// value n is found at position i, out[n] += weight[i] instead + /// of out[n] += 1. ///
/// - /// Input array. + /// Input array. /// /// - /// Weights, array of the same shape as x. + /// Weights, array of the same shape as x. /// /// - /// A minimum number of bins for the output array. + /// A minimum number of bins for the output array. /// /// - /// The result of binning the input array. - /// The length of out is equal to np.amax(x)+1. + /// The result of binning the input array.

+ /// + /// The length of out is equal to np.amax(x)+1. ///
- public static NDarray bincount(NDarray x, NDarray weights = null, int? minlength = 0) - => NumPy.Instance.bincount(x, weights:weights, minlength:minlength); + public static NDarray bincount(this NDarray x, NDarray weights = null, int? minlength = 0) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + }); + var kwargs=new PyDict(); + if (weights!=null) kwargs["weights"]=ToPython(weights); + if (minlength!=0) kwargs["minlength"]=ToPython(minlength); + dynamic py = __self__.InvokeMethod("bincount", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). + /// Function to calculate only the edges of the bins used by the histogram function.

+ /// + /// Notes + /// + /// The methods to estimate the optimal number of bins are well founded + /// in literature, and are inspired by the choices R provides for + /// histogram visualisation.

+ /// Note that having the number of bins + /// proportional to is asymptotically optimal, which is + /// why it appears in most estimators.

+ /// These are simply plug-in methods + /// that give good starting points for number of bins.

+ /// In the equations + /// below, is the binwidth and is the number of + /// bins.

+ /// All estimators that compute bin counts are recast to bin width + /// using the ptp of the data.

+ /// The final bin count is obtained from + /// np.round(np.ceil(range / h)). ///
/// - /// Input data. The histogram is computed over the flattened array. + /// Input data.

+ /// The histogram is computed over the flattened array. /// /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. + /// If bins is an int, it defines the number of equal-width + /// bins in the given range (10, by default).

+ /// If bins is a + /// sequence, it defines the bin edges, including the rightmost + /// edge, allowing for non-uniform bin widths.

+ /// + /// If bins is a string from the list below, histogram_bin_edges will use + /// the method chosen to calculate the optimal bin width and + /// consequently the number of bins (see Notes for more detail on + /// the estimators) from the data that falls within the requested + /// range.

+ /// While the bin width will be optimal for the actual data + /// in the range, the number of bins will be computed to fill the + /// entire range, including the empty portions.

+ /// For visualisation, + /// using the ‘auto’ option is suggested.

+ /// Weighted data is not + /// supported for automated bin size selection. /// /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. + /// The lower and upper range of the bins.

+ /// If not provided, range + /// is simply (a.min(), a.max()).

+ /// Values outside the range are + /// ignored.

+ /// The first element of the range must be less than or + /// equal to the second.

+ /// range affects the automatic bin + /// computation as well.

+ /// While bin width is computed to be optimal + /// based on the actual data within range, the bin count will fill + /// the entire range including portions containing no data. /// /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. + /// An array of weights, of the same shape as a.

+ /// Each value in + /// a only contributes its associated weight towards the bin count + /// (instead of 1).

+ /// This is currently not used by any of the bin estimators, + /// but may be in the future. /// /// - /// The edges to pass into histogram + /// The edges to pass into histogram /// - public static NDarray histogram_bin_edges(NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) - => NumPy.Instance.histogram_bin_edges(a, bins:bins, range:range, weights:weights); + public static NDarray histogram_bin_edges(this NDarray a, int? bins = null, (float, float)? range = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). + /// Function to calculate only the edges of the bins used by the histogram function.

+ /// + /// Notes + /// + /// The methods to estimate the optimal number of bins are well founded + /// in literature, and are inspired by the choices R provides for + /// histogram visualisation.

+ /// Note that having the number of bins + /// proportional to is asymptotically optimal, which is + /// why it appears in most estimators.

+ /// These are simply plug-in methods + /// that give good starting points for number of bins.

+ /// In the equations + /// below, is the binwidth and is the number of + /// bins.

+ /// All estimators that compute bin counts are recast to bin width + /// using the ptp of the data.

+ /// The final bin count is obtained from + /// np.round(np.ceil(range / h)). ///
/// - /// Input data. The histogram is computed over the flattened array. + /// Input data.

+ /// The histogram is computed over the flattened array. /// /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. + /// If bins is an int, it defines the number of equal-width + /// bins in the given range (10, by default).

+ /// If bins is a + /// sequence, it defines the bin edges, including the rightmost + /// edge, allowing for non-uniform bin widths.

+ /// + /// If bins is a string from the list below, histogram_bin_edges will use + /// the method chosen to calculate the optimal bin width and + /// consequently the number of bins (see Notes for more detail on + /// the estimators) from the data that falls within the requested + /// range.

+ /// While the bin width will be optimal for the actual data + /// in the range, the number of bins will be computed to fill the + /// entire range, including the empty portions.

+ /// For visualisation, + /// using the ‘auto’ option is suggested.

+ /// Weighted data is not + /// supported for automated bin size selection. /// /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. + /// The lower and upper range of the bins.

+ /// If not provided, range + /// is simply (a.min(), a.max()).

+ /// Values outside the range are + /// ignored.

+ /// The first element of the range must be less than or + /// equal to the second.

+ /// range affects the automatic bin + /// computation as well.

+ /// While bin width is computed to be optimal + /// based on the actual data within range, the bin count will fill + /// the entire range including portions containing no data. /// /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. + /// An array of weights, of the same shape as a.

+ /// Each value in + /// a only contributes its associated weight towards the bin count + /// (instead of 1).

+ /// This is currently not used by any of the bin estimators, + /// but may be in the future. /// /// - /// The edges to pass into histogram + /// The edges to pass into histogram /// - public static NDarray histogram_bin_edges(NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) - => NumPy.Instance.histogram_bin_edges(a, bins:bins, range:range, weights:weights); + public static NDarray histogram_bin_edges(this NDarray a, NDarray bins = null, (float, float)? range = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Function to calculate only the edges of the bins used by the histogram function. - /// - /// Notes - /// - /// The methods to estimate the optimal number of bins are well founded - /// in literature, and are inspired by the choices R provides for - /// histogram visualisation. Note that having the number of bins - /// proportional to is asymptotically optimal, which is - /// why it appears in most estimators. These are simply plug-in methods - /// that give good starting points for number of bins. In the equations - /// below, is the binwidth and is the number of - /// bins. All estimators that compute bin counts are recast to bin width - /// using the ptp of the data. The final bin count is obtained from - /// np.round(np.ceil(range / h)). + /// Function to calculate only the edges of the bins used by the histogram function.

+ /// + /// Notes + /// + /// The methods to estimate the optimal number of bins are well founded + /// in literature, and are inspired by the choices R provides for + /// histogram visualisation.

+ /// Note that having the number of bins + /// proportional to is asymptotically optimal, which is + /// why it appears in most estimators.

+ /// These are simply plug-in methods + /// that give good starting points for number of bins.

+ /// In the equations + /// below, is the binwidth and is the number of + /// bins.

+ /// All estimators that compute bin counts are recast to bin width + /// using the ptp of the data.

+ /// The final bin count is obtained from + /// np.round(np.ceil(range / h)). ///
/// - /// Input data. The histogram is computed over the flattened array. + /// Input data.

+ /// The histogram is computed over the flattened array. /// /// - /// If bins is an int, it defines the number of equal-width - /// bins in the given range (10, by default). If bins is a - /// sequence, it defines the bin edges, including the rightmost - /// edge, allowing for non-uniform bin widths. - /// - /// If bins is a string from the list below, histogram_bin_edges will use - /// the method chosen to calculate the optimal bin width and - /// consequently the number of bins (see Notes for more detail on - /// the estimators) from the data that falls within the requested - /// range. While the bin width will be optimal for the actual data - /// in the range, the number of bins will be computed to fill the - /// entire range, including the empty portions. For visualisation, - /// using the ‘auto’ option is suggested. Weighted data is not - /// supported for automated bin size selection. + /// If bins is an int, it defines the number of equal-width + /// bins in the given range (10, by default).

+ /// If bins is a + /// sequence, it defines the bin edges, including the rightmost + /// edge, allowing for non-uniform bin widths.

+ /// + /// If bins is a string from the list below, histogram_bin_edges will use + /// the method chosen to calculate the optimal bin width and + /// consequently the number of bins (see Notes for more detail on + /// the estimators) from the data that falls within the requested + /// range.

+ /// While the bin width will be optimal for the actual data + /// in the range, the number of bins will be computed to fill the + /// entire range, including the empty portions.

+ /// For visualisation, + /// using the ‘auto’ option is suggested.

+ /// Weighted data is not + /// supported for automated bin size selection. /// /// - /// The lower and upper range of the bins. If not provided, range - /// is simply (a.min(), a.max()). Values outside the range are - /// ignored. The first element of the range must be less than or - /// equal to the second. range affects the automatic bin - /// computation as well. While bin width is computed to be optimal - /// based on the actual data within range, the bin count will fill - /// the entire range including portions containing no data. + /// The lower and upper range of the bins.

+ /// If not provided, range + /// is simply (a.min(), a.max()).

+ /// Values outside the range are + /// ignored.

+ /// The first element of the range must be less than or + /// equal to the second.

+ /// range affects the automatic bin + /// computation as well.

+ /// While bin width is computed to be optimal + /// based on the actual data within range, the bin count will fill + /// the entire range including portions containing no data. /// /// - /// An array of weights, of the same shape as a. Each value in - /// a only contributes its associated weight towards the bin count - /// (instead of 1). This is currently not used by any of the bin estimators, - /// but may be in the future. + /// An array of weights, of the same shape as a.

+ /// Each value in + /// a only contributes its associated weight towards the bin count + /// (instead of 1).

+ /// This is currently not used by any of the bin estimators, + /// but may be in the future. /// /// - /// The edges to pass into histogram + /// The edges to pass into histogram /// - public static NDarray histogram_bin_edges(NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) - => NumPy.Instance.histogram_bin_edges(a, bins:bins, range:range, weights:weights); + public static NDarray histogram_bin_edges(this NDarray a, List bins = null, (float, float)? range = null, NDarray weights = null) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (bins!=null) kwargs["bins"]=ToPython(bins); + if (range!=null) kwargs["range"]=ToPython(range); + if (weights!=null) kwargs["weights"]=ToPython(weights); + dynamic py = __self__.InvokeMethod("histogram_bin_edges", pyargs, kwargs); + return ToCsharp>(py); + } /// - /// Return the indices of the bins to which each value in input array belongs. - /// - /// If values in x are beyond the bounds of bins, 0 or len(bins) is - /// returned as appropriate. - /// - /// Notes - /// - /// If values in x are such that they fall outside the bin range, - /// attempting to index bins with the indices that digitize returns - /// will result in an IndexError. - /// - /// np.digitize is implemented in terms of np.searchsorted. This means - /// that a binary search is used to bin the values, which scales much better - /// for larger number of bins than the previous linear search. It also removes - /// the requirement for the input array to be 1-dimensional. - /// - /// For monotonically _increasing_ bins, the following are equivalent: - /// - /// Note that as the order of the arguments are reversed, the side must be too. - /// The searchsorted call is marginally faster, as it does not do any - /// monotonicity checks. Perhaps more importantly, it supports all dtypes. + /// Return the indices of the bins to which each value in input array belongs.

+ /// + /// If values in x are beyond the bounds of bins, 0 or len(bins) is + /// returned as appropriate.

+ /// + /// Notes + /// + /// If values in x are such that they fall outside the bin range, + /// attempting to index bins with the indices that digitize returns + /// will result in an IndexError.

+ /// + /// np.digitize is implemented in terms of np.searchsorted.

+ /// This means + /// that a binary search is used to bin the values, which scales much better + /// for larger number of bins than the previous linear search.

+ /// It also removes + /// the requirement for the input array to be 1-dimensional.

+ /// + /// For monotonically _increasing_ bins, the following are equivalent: + /// + /// Note that as the order of the arguments are reversed, the side must be too.

+ /// + /// The searchsorted call is marginally faster, as it does not do any + /// monotonicity checks.

+ /// Perhaps more importantly, it supports all dtypes. ///
/// - /// Input array to be binned. Prior to NumPy 1.10.0, this array had to - /// be 1-dimensional, but can now have any shape. + /// Input array to be binned.

+ /// Prior to NumPy 1.10.0, this array had to + /// be 1-dimensional, but can now have any shape. /// /// - /// Array of bins. It has to be 1-dimensional and monotonic. + /// Array of bins.

+ /// It has to be 1-dimensional and monotonic. /// /// - /// Indicating whether the intervals include the right or the left bin - /// edge. Default behavior is (right==False) indicating that the interval - /// does not include the right edge. The left bin end is open in this - /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for - /// monotonically increasing bins. + /// Indicating whether the intervals include the right or the left bin + /// edge.

+ /// Default behavior is (right==False) indicating that the interval + /// does not include the right edge.

+ /// The left bin end is open in this + /// case, i.e., bins[i-1] <= x < bins[i] is the default behavior for + /// monotonically increasing bins. /// /// - /// Output array of indices, of same shape as x. + /// Output array of indices, of same shape as x. /// - public static NDarray digitize(NDarray x, NDarray bins, bool? right = false) - => NumPy.Instance.digitize(x, bins, right:right); + public static NDarray digitize(this NDarray x, NDarray bins, bool? right = false) + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + x, + bins, + }); + var kwargs=new PyDict(); + if (right!=false) kwargs["right"]=ToPython(right); + dynamic py = __self__.InvokeMethod("digitize", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/Numpy/np.string.gen.cs b/src/Numpy/np.string.gen.cs index 204b9dc..78e53d2 100644 --- a/src/Numpy/np.string.gen.cs +++ b/src/Numpy/np.string.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -20,1033 +22,1712 @@ public static partial class np public static partial class core { public static partial class defchararray { /// - /// Return element-wise string concatenation for two arrays of str or unicode. - /// - /// Arrays x1 and x2 must have the same shape. + /// Return element-wise string concatenation for two arrays of str or unicode.

+ /// + /// Arrays x1 and x2 must have the same shape. ///
/// - /// Input array. + /// Input array. /// /// - /// Input array. + /// Input array. /// /// - /// Output array of string_ or unicode_, depending on input types - /// of the same shape as x1 and x2. + /// Output array of string_ or unicode_, depending on input types + /// of the same shape as x1 and x2. /// public static NDarray @add(string[] x1, string[] x2) - => NumPy.Instance.core_defchararray_add(x1, x2); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x1, + x2, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("add", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (a * i), that is string multiple concatenation, - /// element-wise. - /// - /// Values in i of less than 0 are treated as 0 (which yields an - /// empty string). + /// Return (a * i), that is string multiple concatenation, + /// element-wise.

+ /// + /// Values in i of less than 0 are treated as 0 (which yields an + /// empty string). ///
/// - /// Output array of str or unicode, depending on input types + /// Output array of str or unicode, depending on input types /// public static NDarray multiply(string[] a, int[] i) - => NumPy.Instance.core_defchararray_multiply(a, i); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + i, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("multiply", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (a % i), that is pre-Python 2.6 string formatting - /// (iterpolation), element-wise for a pair of array_likes of str - /// or unicode. + /// Return (a % i), that is pre-Python 2.6 string formatting + /// (iterpolation), element-wise for a pair of array_likes of str + /// or unicode. /// /// - /// These values will be element-wise interpolated into the string. + /// These values will be element-wise interpolated into the string. /// /// - /// Output array of str or unicode, depending on input types + /// Output array of str or unicode, depending on input types /// public static NDarray mod(string[] a, NDarray values) - => NumPy.Instance.core_defchararray_mod(a, values); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + values, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("mod", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return a copy of a with only the first character of each element - /// capitalized. - /// - /// Calls str.capitalize element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Return a copy of a with only the first character of each element + /// capitalized.

+ /// + /// Calls str.capitalize element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Input array of strings to capitalize. + /// Input array of strings to capitalize. /// /// - /// Output array of str or unicode, depending on input - /// types + /// Output array of str or unicode, depending on input + /// types /// - public static NDarray capitalize(string[] a) - => NumPy.Instance.core_defchararray_capitalize(a); + public static NDarray capitalize(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("capitalize", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return a copy of a with its elements centered in a string of - /// length width. - /// - /// Calls str.center element-wise. + /// Return a copy of a with its elements centered in a string of + /// length width.

+ /// + /// Calls str.center element-wise. ///
/// - /// The length of the resulting strings + /// The length of the resulting strings /// /// - /// The padding character to use (default is space). + /// The padding character to use (default is space). /// /// - /// Output array of str or unicode, depending on input - /// types + /// Output array of str or unicode, depending on input + /// types /// public static NDarray center(string[] a, int width, string fillchar = " ") - => NumPy.Instance.core_defchararray_center(a, width, fillchar:fillchar); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + width, + }); + var kwargs=new PyDict(); + if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); + dynamic py = __self__.InvokeMethod("center", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Calls str.decode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the - /// codecs module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. + /// Calls str.decode element-wise.

+ /// + /// The set of available codecs comes from the Python standard library, + /// and may be extended at runtime.

+ /// For more information, see the + /// codecs module.

+ /// + /// Notes + /// + /// The type of the result will depend on the encoding specified. ///
/// - /// The name of an encoding + /// The name of an encoding /// /// - /// Specifies how to handle encoding errors + /// Specifies how to handle encoding errors /// public static NDarray decode(string[] a, string encoding = null, string errors = null) - => NumPy.Instance.core_defchararray_decode(a, encoding:encoding, errors:errors); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (encoding!=null) kwargs["encoding"]=ToPython(encoding); + if (errors!=null) kwargs["errors"]=ToPython(errors); + dynamic py = __self__.InvokeMethod("decode", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Calls str.encode element-wise. - /// - /// The set of available codecs comes from the Python standard library, - /// and may be extended at runtime. For more information, see the codecs - /// module. - /// - /// Notes - /// - /// The type of the result will depend on the encoding specified. + /// Calls str.encode element-wise.

+ /// + /// The set of available codecs comes from the Python standard library, + /// and may be extended at runtime.

+ /// For more information, see the codecs + /// module.

+ /// + /// Notes + /// + /// The type of the result will depend on the encoding specified. ///
/// - /// The name of an encoding + /// The name of an encoding /// /// - /// Specifies how to handle encoding errors + /// Specifies how to handle encoding errors /// public static NDarray encode(string[] a, string encoding = null, string errors = null) - => NumPy.Instance.core_defchararray_encode(a, encoding:encoding, errors:errors); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (encoding!=null) kwargs["encoding"]=ToPython(encoding); + if (errors!=null) kwargs["errors"]=ToPython(errors); + dynamic py = __self__.InvokeMethod("encode", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return a string which is the concatenation of the strings in the - /// sequence seq. - /// - /// Calls str.join element-wise. + /// Return a string which is the concatenation of the strings in the + /// sequence seq.

+ /// + /// Calls str.join element-wise. ///
/// - /// Output array of str or unicode, depending on input types + /// Output array of str or unicode, depending on input types /// public static NDarray @join(string[] sep, string[] seq) - => NumPy.Instance.core_defchararray_join(sep, seq); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + sep, + seq, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("join", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return an array with the elements of a left-justified in a - /// string of length width. - /// - /// Calls str.ljust element-wise. + /// Return an array with the elements of a left-justified in a + /// string of length width.

+ /// + /// Calls str.ljust element-wise. ///
/// - /// The length of the resulting strings + /// The length of the resulting strings /// /// - /// The character to use for padding + /// The character to use for padding /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray ljust(string[] a, int width, string fillchar = " ") - => NumPy.Instance.core_defchararray_ljust(a, width, fillchar:fillchar); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + width, + }); + var kwargs=new PyDict(); + if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); + dynamic py = __self__.InvokeMethod("ljust", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return an array with the elements converted to lowercase. - /// - /// Call str.lower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Return an array with the elements converted to lowercase.

+ /// + /// Call str.lower element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Input array. + /// Input array. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray lower(NDarray a) - => NumPy.Instance.core_defchararray_lower(a); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("lower", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a copy with the leading characters - /// removed. - /// - /// Calls str.lstrip element-wise. + /// For each element in a, return a copy with the leading characters + /// removed.

+ /// + /// Calls str.lstrip element-wise. ///
/// - /// Input array. + /// Input array. /// /// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix; rather, all combinations of its values are - /// stripped. + /// The chars argument is a string specifying the set of + /// characters to be removed.

+ /// If omitted or None, the chars + /// argument defaults to removing whitespace.

+ /// The chars argument + /// is not a prefix; rather, all combinations of its values are + /// stripped. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray lstrip(NDarray a, string chars = null) - => NumPy.Instance.core_defchararray_lstrip(a, chars:chars); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (chars!=null) kwargs["chars"]=ToPython(chars); + dynamic py = __self__.InvokeMethod("lstrip", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Partition each element in a around sep. - /// - /// Calls str.partition element-wise. - /// - /// For each element in a, split the element as the first - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. + /// Partition each element in a around sep.

+ /// + /// Calls str.partition element-wise.

+ /// + /// For each element in a, split the element as the first + /// occurrence of sep, and return 3 strings containing the part + /// before the separator, the separator itself, and the part after + /// the separator.

+ /// If the separator is not found, return 3 strings + /// containing the string itself, followed by two empty strings. ///
/// - /// Input array + /// Input array /// /// - /// Separator to split each string element in a. + /// Separator to split each string element in a. /// /// - /// Output array of str or unicode, depending on input type. - /// The output array will have an extra dimension with 3 - /// elements per input element. + /// Output array of str or unicode, depending on input type.

+ /// + /// The output array will have an extra dimension with 3 + /// elements per input element. ///
public static NDarray partition(NDarray a, string sep) - => NumPy.Instance.core_defchararray_partition(a, sep); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sep, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a copy of the string with all - /// occurrences of substring old replaced by new. - /// - /// Calls str.replace element-wise. + /// For each element in a, return a copy of the string with all + /// occurrences of substring old replaced by new.

+ /// + /// Calls str.replace element-wise. ///
/// - /// If the optional argument count is given, only the first - /// count occurrences are replaced. + /// If the optional argument count is given, only the first + /// count occurrences are replaced. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray replace(string[] a, string @new, string old, int? count = null) - => NumPy.Instance.core_defchararray_replace(a, @new, old, count:count); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + @new, + old, + }); + var kwargs=new PyDict(); + if (count!=null) kwargs["count"]=ToPython(count); + dynamic py = __self__.InvokeMethod("replace", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return an array with the elements of a right-justified in a - /// string of length width. - /// - /// Calls str.rjust element-wise. + /// Return an array with the elements of a right-justified in a + /// string of length width.

+ /// + /// Calls str.rjust element-wise. ///
/// - /// The length of the resulting strings + /// The length of the resulting strings /// /// - /// The character to use for padding + /// The character to use for padding /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray rjust(string[] a, int width, string fillchar = " ") - => NumPy.Instance.core_defchararray_rjust(a, width, fillchar:fillchar); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + width, + }); + var kwargs=new PyDict(); + if (fillchar!=" ") kwargs["fillchar"]=ToPython(fillchar); + dynamic py = __self__.InvokeMethod("rjust", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Partition (split) each element around the right-most separator. - /// - /// Calls str.rpartition element-wise. - /// - /// For each element in a, split the element as the last - /// occurrence of sep, and return 3 strings containing the part - /// before the separator, the separator itself, and the part after - /// the separator. If the separator is not found, return 3 strings - /// containing the string itself, followed by two empty strings. + /// Partition (split) each element around the right-most separator.

+ /// + /// Calls str.rpartition element-wise.

+ /// + /// For each element in a, split the element as the last + /// occurrence of sep, and return 3 strings containing the part + /// before the separator, the separator itself, and the part after + /// the separator.

+ /// If the separator is not found, return 3 strings + /// containing the string itself, followed by two empty strings. ///
/// - /// Input array + /// Input array /// /// - /// Right-most separator to split each element in array. + /// Right-most separator to split each element in array. /// /// - /// Output array of string or unicode, depending on input - /// type. The output array will have an extra dimension with - /// 3 elements per input element. + /// Output array of string or unicode, depending on input + /// type.

+ /// The output array will have an extra dimension with + /// 3 elements per input element. ///
public static NDarray rpartition(string[] a, string sep) - => NumPy.Instance.core_defchararray_rpartition(a, sep); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sep, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("rpartition", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.rsplit element-wise. - /// - /// Except for splitting from the right, rsplit - /// behaves like split. + /// For each element in a, return a list of the words in the + /// string, using sep as the delimiter string.

+ /// + /// Calls str.rsplit element-wise.

+ /// + /// Except for splitting from the right, rsplit + /// behaves like split. ///
/// - /// If sep is not specified or None, any whitespace string - /// is a separator. + /// If sep is not specified or None, any whitespace string + /// is a separator. /// /// - /// If maxsplit is given, at most maxsplit splits are done, - /// the rightmost ones. + /// If maxsplit is given, at most maxsplit splits are done, + /// the rightmost ones. /// /// - /// Array of list objects + /// Array of list objects /// public static NDarray rsplit(string[] a, string sep = null, int? maxsplit = null) - => NumPy.Instance.core_defchararray_rsplit(a, sep:sep, maxsplit:maxsplit); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (sep!=null) kwargs["sep"]=ToPython(sep); + if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); + dynamic py = __self__.InvokeMethod("rsplit", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a copy with the trailing - /// characters removed. - /// - /// Calls str.rstrip element-wise. + /// For each element in a, return a copy with the trailing + /// characters removed.

+ /// + /// Calls str.rstrip element-wise. ///
/// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a suffix; rather, all combinations of its values are - /// stripped. + /// The chars argument is a string specifying the set of + /// characters to be removed.

+ /// If omitted or None, the chars + /// argument defaults to removing whitespace.

+ /// The chars argument + /// is not a suffix; rather, all combinations of its values are + /// stripped. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray rstrip(string[] a, string chars = null) - => NumPy.Instance.core_defchararray_rstrip(a, chars:chars); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (chars!=null) kwargs["chars"]=ToPython(chars); + dynamic py = __self__.InvokeMethod("rstrip", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a list of the words in the - /// string, using sep as the delimiter string. - /// - /// Calls str.split element-wise. + /// For each element in a, return a list of the words in the + /// string, using sep as the delimiter string.

+ /// + /// Calls str.split element-wise. ///
/// - /// If sep is not specified or None, any whitespace string is a - /// separator. + /// If sep is not specified or None, any whitespace string is a + /// separator. /// /// - /// If maxsplit is given, at most maxsplit splits are done. + /// If maxsplit is given, at most maxsplit splits are done. /// /// - /// Array of list objects + /// Array of list objects /// public static NDarray split(string[] a, string sep = null, int? maxsplit = null) - => NumPy.Instance.core_defchararray_split(a, sep:sep, maxsplit:maxsplit); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (sep!=null) kwargs["sep"]=ToPython(sep); + if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } + } + } + + public static partial class core { + public static partial class defchararray { + /// + /// For each element in a, return a list of the words in the + /// string, using sep as the delimiter string.

+ /// + /// Calls str.split element-wise. + ///
+ /// + /// If sep is not specified or None, any whitespace string is a + /// separator. + /// + /// + /// If maxsplit is given, at most maxsplit splits are done. + /// + /// + /// Array of list objects + /// + public static NDarray split(string[] a, int? sep = null, int? maxsplit = null) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (sep!=null) kwargs["sep"]=ToPython(sep); + if (maxsplit!=null) kwargs["maxsplit"]=ToPython(maxsplit); + dynamic py = __self__.InvokeMethod("split", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a list of the lines in the - /// element, breaking at line boundaries. - /// - /// Calls str.splitlines element-wise. + /// For each element in a, return a list of the lines in the + /// element, breaking at line boundaries.

+ /// + /// Calls str.splitlines element-wise. ///
/// - /// Line breaks are not included in the resulting list unless - /// keepends is given and true. + /// Line breaks are not included in the resulting list unless + /// keepends is given and true. /// /// - /// Array of list objects + /// Array of list objects /// public static NDarray splitlines(string[] a, bool? keepends = null) - => NumPy.Instance.core_defchararray_splitlines(a, keepends:keepends); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (keepends!=null) kwargs["keepends"]=ToPython(keepends); + dynamic py = __self__.InvokeMethod("splitlines", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a copy with the leading and - /// trailing characters removed. - /// - /// Calls str.strip element-wise. + /// For each element in a, return a copy with the leading and + /// trailing characters removed.

+ /// + /// Calls str.strip element-wise. ///
/// - /// The chars argument is a string specifying the set of - /// characters to be removed. If omitted or None, the chars - /// argument defaults to removing whitespace. The chars argument - /// is not a prefix or suffix; rather, all combinations of its - /// values are stripped. + /// The chars argument is a string specifying the set of + /// characters to be removed.

+ /// If omitted or None, the chars + /// argument defaults to removing whitespace.

+ /// The chars argument + /// is not a prefix or suffix; rather, all combinations of its + /// values are stripped. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray strip(string[] a, string chars = null) - => NumPy.Instance.core_defchararray_strip(a, chars:chars); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + if (chars!=null) kwargs["chars"]=ToPython(chars); + dynamic py = __self__.InvokeMethod("strip", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return element-wise a copy of the string with - /// uppercase characters converted to lowercase and vice versa. - /// - /// Calls str.swapcase element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Return element-wise a copy of the string with + /// uppercase characters converted to lowercase and vice versa.

+ /// + /// Calls str.swapcase element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Input array. + /// Input array. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray swapcase(NDarray a) - => NumPy.Instance.core_defchararray_swapcase(a); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("swapcase", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return element-wise title cased version of string or unicode. - /// - /// Title case words start with uppercase characters, all remaining cased - /// characters are lowercase. - /// - /// Calls str.title element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Return element-wise title cased version of string or unicode.

+ /// + /// Title case words start with uppercase characters, all remaining cased + /// characters are lowercase.

+ /// + /// Calls str.title element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Input array. + /// Input array. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray title(NDarray a) - => NumPy.Instance.core_defchararray_title(a); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("title", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return a copy of the string where all - /// characters occurring in the optional argument deletechars are - /// removed, and the remaining characters have been mapped through the - /// given translation table. - /// - /// Calls str.translate element-wise. + /// For each element in a, return a copy of the string where all + /// characters occurring in the optional argument deletechars are + /// removed, and the remaining characters have been mapped through the + /// given translation table.

+ /// + /// Calls str.translate element-wise. ///
/// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray translate(string[] a, string table, string deletechars) - => NumPy.Instance.core_defchararray_translate(a, table, deletechars); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + table, + deletechars, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("translate", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return an array with the elements converted to uppercase. - /// - /// Calls str.upper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Return an array with the elements converted to uppercase.

+ /// + /// Calls str.upper element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Input array. + /// Input array. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray upper(NDarray a) - => NumPy.Instance.core_defchararray_upper(a); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("upper", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return the numeric string left-filled with zeros - /// - /// Calls str.zfill element-wise. + /// Return the numeric string left-filled with zeros + /// + /// Calls str.zfill element-wise. /// /// - /// Input array. + /// Input array. /// /// - /// Width of string to left-fill elements in a. + /// Width of string to left-fill elements in a. /// /// - /// Output array of str or unicode, depending on input type + /// Output array of str or unicode, depending on input type /// public static NDarray zfill(NDarray a, int width) - => NumPy.Instance.core_defchararray_zfill(a, width); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + width, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("zfill", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (x1 == x2) element-wise. - /// - /// Unlike numpy.equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. + /// Return (x1 == x2) element-wise.

+ /// + /// Unlike numpy.equal, this comparison is performed by first + /// stripping whitespace characters from the end of the string.

+ /// This + /// behavior is provided for backward-compatibility with numarray. ///
/// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. + /// Output array of bools, or a single bool if x1 and x2 are scalars. /// public static NDarray equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_equal(x2, x1); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("equal", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (x1 != x2) element-wise. - /// - /// Unlike numpy.not_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. + /// Return (x1 != x2) element-wise.

+ /// + /// Unlike numpy.not_equal, this comparison is performed by first + /// stripping whitespace characters from the end of the string.

+ /// This + /// behavior is provided for backward-compatibility with numarray. ///
/// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. + /// Output array of bools, or a single bool if x1 and x2 are scalars. /// public static NDarray not_equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_not_equal(x2, x1); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("not_equal", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (x1 >= x2) element-wise. - /// - /// Unlike numpy.greater_equal, this comparison is performed by - /// first stripping whitespace characters from the end of the string. - /// This behavior is provided for backward-compatibility with - /// numarray. + /// Return (x1 >= x2) element-wise.

+ /// + /// Unlike numpy.greater_equal, this comparison is performed by + /// first stripping whitespace characters from the end of the string.

+ /// + /// This behavior is provided for backward-compatibility with + /// numarray. ///
/// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. + /// Output array of bools, or a single bool if x1 and x2 are scalars. /// public static NDarray greater_equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_greater_equal(x2, x1); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("greater_equal", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (x1 <= x2) element-wise. - /// - /// Unlike numpy.less_equal, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. + /// Return (x1 <= x2) element-wise.

+ /// + /// Unlike numpy.less_equal, this comparison is performed by first + /// stripping whitespace characters from the end of the string.

+ /// This + /// behavior is provided for backward-compatibility with numarray. ///
/// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. + /// Output array of bools, or a single bool if x1 and x2 are scalars. /// public static NDarray less_equal(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_less_equal(x2, x1); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("less_equal", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (x1 > x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. + /// Return (x1 > x2) element-wise.

+ /// + /// Unlike numpy.greater, this comparison is performed by first + /// stripping whitespace characters from the end of the string.

+ /// This + /// behavior is provided for backward-compatibility with numarray. ///
/// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. + /// Output array of bools, or a single bool if x1 and x2 are scalars. /// public static NDarray greater(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_greater(x2, x1); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("greater", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Return (x1 < x2) element-wise. - /// - /// Unlike numpy.greater, this comparison is performed by first - /// stripping whitespace characters from the end of the string. This - /// behavior is provided for backward-compatibility with numarray. + /// Return (x1 < x2) element-wise.

+ /// + /// Unlike numpy.greater, this comparison is performed by first + /// stripping whitespace characters from the end of the string.

+ /// This + /// behavior is provided for backward-compatibility with numarray. ///
/// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Input arrays of the same shape. + /// Input arrays of the same shape. /// /// - /// Output array of bools, or a single bool if x1 and x2 are scalars. + /// Output array of bools, or a single bool if x1 and x2 are scalars. /// public static NDarray less(string[] x2, string[] x1) - => NumPy.Instance.core_defchararray_less(x2, x1); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + x2, + x1, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("less", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns an array with the number of non-overlapping occurrences of - /// substring sub in the range [start, end]. - /// - /// Calls str.count element-wise. + /// Returns an array with the number of non-overlapping occurrences of + /// substring sub in the range [start, end].

+ /// + /// Calls str.count element-wise. ///
/// - /// The substring to search for. + /// The substring to search for. /// /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. + /// Optional arguments start and end are interpreted as slice + /// notation to specify the range in which to count. /// /// - /// Optional arguments start and end are interpreted as slice - /// notation to specify the range in which to count. + /// Optional arguments start and end are interpreted as slice + /// notation to specify the range in which to count. /// /// - /// Output array of ints. + /// Output array of ints. /// public static NDarray count(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_count(a, sub, end:end, start:start); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sub, + }); + var kwargs=new PyDict(); + if (end!=null) kwargs["end"]=ToPython(end); + if (start!=null) kwargs["start"]=ToPython(start); + dynamic py = __self__.InvokeMethod("count", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element, return the lowest index in the string where - /// substring sub is found. - /// - /// Calls str.find element-wise. - /// - /// For each element, return the lowest index in the string where - /// substring sub is found, such that sub is contained in the - /// range [start, end]. + /// For each element, return the lowest index in the string where + /// substring sub is found.

+ /// + /// Calls str.find element-wise.

+ /// + /// For each element, return the lowest index in the string where + /// substring sub is found, such that sub is contained in the + /// range [start, end]. ///
/// - /// Optional arguments start and end are interpreted as in - /// slice notation. + /// Optional arguments start and end are interpreted as in + /// slice notation. /// /// - /// Optional arguments start and end are interpreted as in - /// slice notation. + /// Optional arguments start and end are interpreted as in + /// slice notation. /// /// - /// Output array of ints. Returns -1 if sub is not found. + /// Output array of ints.

+ /// Returns -1 if sub is not found. ///
public static NDarray find(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_find(a, sub, end:end, start:start); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sub, + }); + var kwargs=new PyDict(); + if (end!=null) kwargs["end"]=ToPython(end); + if (start!=null) kwargs["start"]=ToPython(start); + dynamic py = __self__.InvokeMethod("find", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Like find, but raises ValueError when the substring is not found. - /// - /// Calls str.index element-wise. + /// Like find, but raises ValueError when the substring is not found.

+ /// + /// Calls str.index element-wise. ///
/// - /// Output array of ints. Returns -1 if sub is not found. + /// Output array of ints.

+ /// Returns -1 if sub is not found. ///
public static NDarray index(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_index(a, sub, end:end, start:start); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sub, + }); + var kwargs=new PyDict(); + if (end!=null) kwargs["end"]=ToPython(end); + if (start!=null) kwargs["start"]=ToPython(start); + dynamic py = __self__.InvokeMethod("index", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns true for each element if all characters in the string are - /// alphabetic and there is at least one character, false otherwise. - /// - /// Calls str.isalpha element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Returns true for each element if all characters in the string are + /// alphabetic and there is at least one character, false otherwise.

+ /// + /// Calls str.isalpha element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Output array of bools + /// Output array of bools /// - public static NDarray isalpha(string[] a) - => NumPy.Instance.core_defchararray_isalpha(a); + public static NDarray isalpha(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isalpha", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element, return True if there are only decimal - /// characters in the element. - /// - /// Calls unicode.isdecimal element-wise. - /// - /// Decimal characters include digit characters, and all characters - /// that that can be used to form decimal-radix numbers, - /// e.g. U+0660, ARABIC-INDIC DIGIT ZERO. + /// For each element, return True if there are only decimal + /// characters in the element.

+ /// + /// Calls unicode.isdecimal element-wise.

+ /// + /// Decimal characters include digit characters, and all characters + /// that that can be used to form decimal-radix numbers, + /// e.g.

+ /// U+0660, ARABIC-INDIC DIGIT ZERO. ///
/// - /// Input array. + /// Input array. /// /// - /// Array of booleans identical in shape to a. + /// Array of booleans identical in shape to a. /// public static NDarray isdecimal(NDarray a) - => NumPy.Instance.core_defchararray_isdecimal(a); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isdecimal", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns true for each element if all characters in the string are - /// digits and there is at least one character, false otherwise. - /// - /// Calls str.isdigit element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Returns true for each element if all characters in the string are + /// digits and there is at least one character, false otherwise.

+ /// + /// Calls str.isdigit element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Output array of bools + /// Output array of bools /// - public static NDarray isdigit(string[] a) - => NumPy.Instance.core_defchararray_isdigit(a); + public static NDarray isdigit(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isdigit", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns true for each element if all cased characters in the - /// string are lowercase and there is at least one cased character, - /// false otherwise. - /// - /// Calls str.islower element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Returns true for each element if all cased characters in the + /// string are lowercase and there is at least one cased character, + /// false otherwise.

+ /// + /// Calls str.islower element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Output array of bools + /// Output array of bools /// - public static NDarray islower(string[] a) - => NumPy.Instance.core_defchararray_islower(a); + public static NDarray islower(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("islower", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element, return True if there are only numeric - /// characters in the element. - /// - /// Calls unicode.isnumeric element-wise. - /// - /// Numeric characters include digit characters, and all characters - /// that have the Unicode numeric value property, e.g. U+2155, - /// VULGAR FRACTION ONE FIFTH. + /// For each element, return True if there are only numeric + /// characters in the element.

+ /// + /// Calls unicode.isnumeric element-wise.

+ /// + /// Numeric characters include digit characters, and all characters + /// that have the Unicode numeric value property, e.g.

+ /// U+2155, + /// VULGAR FRACTION ONE FIFTH. ///
/// - /// Input array. + /// Input array. /// /// - /// Array of booleans of same shape as a. + /// Array of booleans of same shape as a. /// public static NDarray isnumeric(NDarray a) - => NumPy.Instance.core_defchararray_isnumeric(a); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isnumeric", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns true for each element if there are only whitespace - /// characters in the string and there is at least one character, - /// false otherwise. - /// - /// Calls str.isspace element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Returns true for each element if there are only whitespace + /// characters in the string and there is at least one character, + /// false otherwise.

+ /// + /// Calls str.isspace element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Output array of bools + /// Output array of bools /// - public static NDarray isspace(string[] a) - => NumPy.Instance.core_defchararray_isspace(a); + public static NDarray isspace(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isspace", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns true for each element if the element is a titlecased - /// string and there is at least one character, false otherwise. - /// - /// Call str.istitle element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Returns true for each element if the element is a titlecased + /// string and there is at least one character, false otherwise.

+ /// + /// Call str.istitle element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Output array of bools + /// Output array of bools /// - public static NDarray istitle(string[] a) - => NumPy.Instance.core_defchararray_istitle(a); + public static NDarray istitle(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("istitle", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns true for each element if all cased characters in the - /// string are uppercase and there is at least one character, false - /// otherwise. - /// - /// Call str.isupper element-wise. - /// - /// For 8-bit strings, this method is locale-dependent. + /// Returns true for each element if all cased characters in the + /// string are uppercase and there is at least one character, false + /// otherwise.

+ /// + /// Call str.isupper element-wise.

+ /// + /// For 8-bit strings, this method is locale-dependent. ///
/// - /// Output array of bools + /// Output array of bools /// - public static NDarray isupper(string[] a) - => NumPy.Instance.core_defchararray_isupper(a); + public static NDarray isupper(params string[] a) + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("isupper", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// For each element in a, return the highest index in the string - /// where substring sub is found, such that sub is contained - /// within [start, end]. - /// - /// Calls str.rfind element-wise. + /// For each element in a, return the highest index in the string + /// where substring sub is found, such that sub is contained + /// within [start, end].

+ /// + /// Calls str.rfind element-wise. ///
/// - /// Optional arguments start and end are interpreted as in - /// slice notation. + /// Optional arguments start and end are interpreted as in + /// slice notation. /// /// - /// Optional arguments start and end are interpreted as in - /// slice notation. + /// Optional arguments start and end are interpreted as in + /// slice notation. /// /// - /// Output array of ints. Return -1 on failure. + /// Output array of ints.

+ /// Return -1 on failure. ///
public static NDarray rfind(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_rfind(a, sub, end:end, start:start); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sub, + }); + var kwargs=new PyDict(); + if (end!=null) kwargs["end"]=ToPython(end); + if (start!=null) kwargs["start"]=ToPython(start); + dynamic py = __self__.InvokeMethod("rfind", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Like rfind, but raises ValueError when the substring sub is - /// not found. - /// - /// Calls str.rindex element-wise. + /// Like rfind, but raises ValueError when the substring sub is + /// not found.

+ /// + /// Calls str.rindex element-wise. ///
/// - /// Output array of ints. + /// Output array of ints. /// public static NDarray rindex(string[] a, string sub, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_rindex(a, sub, end:end, start:start); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + sub, + }); + var kwargs=new PyDict(); + if (end!=null) kwargs["end"]=ToPython(end); + if (start!=null) kwargs["start"]=ToPython(start); + dynamic py = __self__.InvokeMethod("rindex", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Returns a boolean array which is True where the string element - /// in a starts with prefix, otherwise False. - /// - /// Calls str.startswith element-wise. + /// Returns a boolean array which is True where the string element + /// in a starts with prefix, otherwise False.

+ /// + /// Calls str.startswith element-wise. ///
/// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. + /// With optional start, test beginning at that position.

+ /// With + /// optional end, stop comparing at that position. /// /// - /// With optional start, test beginning at that position. With - /// optional end, stop comparing at that position. + /// With optional start, test beginning at that position.

+ /// With + /// optional end, stop comparing at that position. /// /// - /// Array of booleans + /// Array of booleans /// public static NDarray startswith(string[] a, string prefix, int? end = null, int? start = null) - => NumPy.Instance.core_defchararray_startswith(a, prefix, end:end, start:start); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + a, + prefix, + }); + var kwargs=new PyDict(); + if (end!=null) kwargs["end"]=ToPython(end); + if (start!=null) kwargs["start"]=ToPython(start); + dynamic py = __self__.InvokeMethod("startswith", pyargs, kwargs); + return ToCsharp(py); + } } } public static partial class core { public static partial class defchararray { /// - /// Provides a convenient view on arrays of string and unicode values. - /// - /// Versus a regular NumPy array of type str or unicode, this - /// class adds the following functionality: - /// - /// chararrays should be created using numpy.char.array or - /// numpy.char.asarray, rather than this constructor directly. - /// - /// This constructor creates the array, using buffer (with offset - /// and strides) if it is not None. If buffer is None, then - /// constructs a new array with strides in “C order”, unless both - /// len(shape) >= 2 and order='Fortran', in which case strides - /// is in “Fortran order”. + /// Provides a convenient view on arrays of string and unicode values.

+ /// + /// Versus a regular NumPy array of type str or unicode, this + /// class adds the following functionality: + /// + /// chararrays should be created using numpy.char.array or + /// numpy.char.asarray, rather than this constructor directly.

+ /// + /// This constructor creates the array, using buffer (with offset + /// and strides) if it is not None.

+ /// If buffer is None, then + /// constructs a new array with strides in “C order”, unless both + /// len(shape) >= 2 and order='Fortran', in which case strides + /// is in “Fortran order”. ///
/// - /// Shape of the array. + /// Shape of the array. /// /// - /// Length of each array element, in number of characters. Default is 1. + /// Length of each array element, in number of characters.

+ /// Default is 1. /// /// - /// Are the array elements of type unicode (True) or string (False). - /// Default is False. + /// Are the array elements of type unicode (True) or string (False).

+ /// + /// Default is False. /// /// - /// Memory address of the start of the array data. Default is None, - /// in which case a new array is created. + /// Memory address of the start of the array data.

+ /// Default is None, + /// in which case a new array is created. /// /// - /// Fixed stride displacement from the beginning of an axis? - /// Default is 0. Needs to be >=0. + /// Fixed stride displacement from the beginning of an axis? + /// Default is 0.

+ /// Needs to be >=0. /// /// - /// Strides for the array (see ndarray.strides for full description). - /// Default is None. + /// Strides for the array (see ndarray.strides for full description).

+ /// + /// Default is None. /// /// - /// The order in which the array data is stored in memory: ‘C’ -> - /// “row major” order (the default), ‘F’ -> “column major” - /// (Fortran) order. + /// The order in which the array data is stored in memory: ‘C’ -> + /// “row major” order (the default), ‘F’ -> “column major” + /// (Fortran) order. /// public static void chararray(Shape shape, int? itemsize = null, bool? unicode = null, int? buffer = null, int? offset = null, int[] strides = null, string order = null) - => NumPy.Instance.core_defchararray_chararray(shape, itemsize:itemsize, unicode:unicode, buffer:buffer, offset:offset, strides:strides, order:order); + { + //auto-generated code, do not change + var core = self.GetAttr("core"); + var defchararray = core.GetAttr("defchararray"); + var __self__=defchararray; + var pyargs=ToTuple(new object[] + { + shape, + }); + var kwargs=new PyDict(); + if (itemsize!=null) kwargs["itemsize"]=ToPython(itemsize); + if (unicode!=null) kwargs["unicode"]=ToPython(unicode); + if (buffer!=null) kwargs["buffer"]=ToPython(buffer); + if (offset!=null) kwargs["offset"]=ToPython(offset); + if (strides!=null) kwargs["strides"]=ToPython(strides); + if (order!=null) kwargs["order"]=ToPython(order); + dynamic py = __self__.InvokeMethod("chararray", pyargs, kwargs); + } } } diff --git a/src/Numpy/np.window.gen.cs b/src/Numpy/np.window.gen.cs index 06b2309..886be73 100644 --- a/src/Numpy/np.window.gen.cs +++ b/src/Numpy/np.window.gen.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2019 by the SciSharp Team +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) // Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion using System; @@ -9,8 +9,10 @@ using System.Runtime.InteropServices; using System.Text; using Python.Runtime; -using Python.Included; using Numpy.Models; +#if PYTHON_INCLUDED +using Python.Included; +#endif namespace Numpy { @@ -18,192 +20,280 @@ public static partial class np { /// - /// Return the Bartlett window. - /// - /// The Bartlett window is very similar to a triangular window, except - /// that the end points are at zero. It is often used in signal - /// processing for tapering a signal, without generating too much - /// ripple in the frequency domain. - /// - /// Notes - /// - /// The Bartlett window is defined as - /// - /// Most references to the Bartlett window come from the signal - /// processing literature, where it is used as one of many windowing - /// functions for smoothing values. Note that convolution with this - /// window produces linear interpolation. It is also known as an - /// apodization (which means”removing the foot”, i.e. smoothing - /// discontinuities at the beginning and end of the sampled signal) or - /// tapering function. The fourier transform of the Bartlett is the product - /// of two sinc functions. - /// Note the excellent discussion in Kanasewich. - /// - /// References + /// Return the Bartlett window.

+ /// + /// The Bartlett window is very similar to a triangular window, except + /// that the end points are at zero.

+ /// It is often used in signal + /// processing for tapering a signal, without generating too much + /// ripple in the frequency domain.

+ /// + /// Notes + /// + /// The Bartlett window is defined as + /// + /// Most references to the Bartlett window come from the signal + /// processing literature, where it is used as one of many windowing + /// functions for smoothing values.

+ /// Note that convolution with this + /// window produces linear interpolation.

+ /// It is also known as an + /// apodization (which means”removing the foot”, i.e.

+ /// smoothing + /// discontinuities at the beginning and end of the sampled signal) or + /// tapering function.

+ /// The fourier transform of the Bartlett is the product + /// of two sinc functions.

+ /// + /// Note the excellent discussion in Kanasewich.

+ /// + /// References ///
/// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. + /// Number of points in the output window.

+ /// If zero or less, an + /// empty array is returned. /// /// - /// The triangular window, with the maximum value normalized to one - /// (the value one appears only if the number of samples is odd), with - /// the first and last samples equal to zero. + /// The triangular window, with the maximum value normalized to one + /// (the value one appears only if the number of samples is odd), with + /// the first and last samples equal to zero. /// public static NDarray bartlett(int M) - => NumPy.Instance.bartlett(M); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + M, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("bartlett", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the Blackman window. - /// - /// The Blackman window is a taper formed by using the first three - /// terms of a summation of cosines. It was designed to have close to the - /// minimal leakage possible. It is close to optimal, only slightly worse - /// than a Kaiser window. - /// - /// Notes - /// - /// The Blackman window is defined as - /// - /// Most references to the Blackman window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. It is known as a - /// “near optimal” tapering function, almost as good (by some measures) - /// as the kaiser window. - /// - /// References - /// - /// Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, - /// Dover Publications, New York. - /// - /// Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. - /// Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. + /// Return the Blackman window.

+ /// + /// The Blackman window is a taper formed by using the first three + /// terms of a summation of cosines.

+ /// It was designed to have close to the + /// minimal leakage possible.

+ /// It is close to optimal, only slightly worse + /// than a Kaiser window.

+ /// + /// Notes + /// + /// The Blackman window is defined as + /// + /// Most references to the Blackman window come from the signal processing + /// literature, where it is used as one of many windowing functions for + /// smoothing values.

+ /// It is also known as an apodization (which means + /// “removing the foot”, i.e.

+ /// smoothing discontinuities at the beginning + /// and end of the sampled signal) or tapering function.

+ /// It is known as a + /// “near optimal” tapering function, almost as good (by some measures) + /// as the kaiser window.

+ /// + /// References + /// + /// Blackman, R.B.

+ /// and Tukey, J.W., (1958) The measurement of power spectra, + /// Dover Publications, New York.

+ /// + /// Oppenheim, A.V., and R.W.

+ /// Schafer.

+ /// Discrete-Time Signal Processing.

+ /// + /// Upper Saddle River, NJ: Prentice-Hall, 1999, pp.

+ /// 468-471. ///
/// - /// Number of points in the output window. If zero or less, an empty - /// array is returned. + /// Number of points in the output window.

+ /// If zero or less, an empty + /// array is returned. /// /// - /// The window, with the maximum value normalized to one (the value one - /// appears only if the number of samples is odd). + /// The window, with the maximum value normalized to one (the value one + /// appears only if the number of samples is odd). /// public static NDarray blackman(int M) - => NumPy.Instance.blackman(M); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + M, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("blackman", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the Hamming window. - /// - /// The Hamming window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hamming window is defined as - /// - /// The Hamming was named for R. W. Hamming, an associate of J. W. Tukey - /// and is described in Blackman and Tukey. It was recommended for - /// smoothing the truncated autocovariance function in the time domain. - /// Most references to the Hamming window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References + /// Return the Hamming window.

+ /// + /// The Hamming window is a taper formed by using a weighted cosine.

+ /// + /// Notes + /// + /// The Hamming window is defined as + /// + /// The Hamming was named for R.

+ /// W.

+ /// Hamming, an associate of J.

+ /// W.

+ /// Tukey + /// and is described in Blackman and Tukey.

+ /// It was recommended for + /// smoothing the truncated autocovariance function in the time domain.

+ /// + /// Most references to the Hamming window come from the signal processing + /// literature, where it is used as one of many windowing functions for + /// smoothing values.

+ /// It is also known as an apodization (which means + /// “removing the foot”, i.e.

+ /// smoothing discontinuities at the beginning + /// and end of the sampled signal) or tapering function.

+ /// + /// References ///
/// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. + /// Number of points in the output window.

+ /// If zero or less, an + /// empty array is returned. /// /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). + /// The window, with the maximum value normalized to one (the value + /// one appears only if the number of samples is odd). /// public static NDarray hamming(int M) - => NumPy.Instance.hamming(M); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + M, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("hamming", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the Hanning window. - /// - /// The Hanning window is a taper formed by using a weighted cosine. - /// - /// Notes - /// - /// The Hanning window is defined as - /// - /// The Hanning was named for Julius von Hann, an Austrian meteorologist. - /// It is also known as the Cosine Bell. Some authors prefer that it be - /// called a Hann window, to help avoid confusion with the very similar - /// Hamming window. - /// - /// Most references to the Hanning window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References + /// Return the Hanning window.

+ /// + /// The Hanning window is a taper formed by using a weighted cosine.

+ /// + /// Notes + /// + /// The Hanning window is defined as + /// + /// The Hanning was named for Julius von Hann, an Austrian meteorologist.

+ /// + /// It is also known as the Cosine Bell.

+ /// Some authors prefer that it be + /// called a Hann window, to help avoid confusion with the very similar + /// Hamming window.

+ /// + /// Most references to the Hanning window come from the signal processing + /// literature, where it is used as one of many windowing functions for + /// smoothing values.

+ /// It is also known as an apodization (which means + /// “removing the foot”, i.e.

+ /// smoothing discontinuities at the beginning + /// and end of the sampled signal) or tapering function.

+ /// + /// References ///
/// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. + /// Number of points in the output window.

+ /// If zero or less, an + /// empty array is returned. /// /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if M is odd). + /// The window, with the maximum value normalized to one (the value + /// one appears only if M is odd). /// public static NDarray hanning(int M) - => NumPy.Instance.hanning(M); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + M, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("hanning", pyargs, kwargs); + return ToCsharp(py); + } /// - /// Return the Kaiser window. - /// - /// The Kaiser window is a taper formed by using a Bessel function. - /// - /// Notes - /// - /// The Kaiser window is defined as - /// - /// with - /// - /// where is the modified zeroth-order Bessel function. - /// - /// The Kaiser was named for Jim Kaiser, who discovered a simple - /// approximation to the DPSS window based on Bessel functions. The Kaiser - /// window is a very good approximation to the Digital Prolate Spheroidal - /// Sequence, or Slepian window, which is the transform which maximizes the - /// energy in the main lobe of the window relative to total energy. - /// - /// The Kaiser can approximate many other windows by varying the beta - /// parameter. - /// - /// A beta value of 14 is probably a good starting point. Note that as beta - /// gets large, the window narrows, and so the number of samples needs to be - /// large enough to sample the increasingly narrow spike, otherwise NaNs will - /// get returned. - /// - /// Most references to the Kaiser window come from the signal processing - /// literature, where it is used as one of many windowing functions for - /// smoothing values. It is also known as an apodization (which means - /// “removing the foot”, i.e. smoothing discontinuities at the beginning - /// and end of the sampled signal) or tapering function. - /// - /// References + /// Return the Kaiser window.

+ /// + /// The Kaiser window is a taper formed by using a Bessel function.

+ /// + /// Notes + /// + /// The Kaiser window is defined as + /// + /// with + /// + /// where is the modified zeroth-order Bessel function.

+ /// + /// The Kaiser was named for Jim Kaiser, who discovered a simple + /// approximation to the DPSS window based on Bessel functions.

+ /// The Kaiser + /// window is a very good approximation to the Digital Prolate Spheroidal + /// Sequence, or Slepian window, which is the transform which maximizes the + /// energy in the main lobe of the window relative to total energy.

+ /// + /// The Kaiser can approximate many other windows by varying the beta + /// parameter.

+ /// + /// A beta value of 14 is probably a good starting point.

+ /// Note that as beta + /// gets large, the window narrows, and so the number of samples needs to be + /// large enough to sample the increasingly narrow spike, otherwise NaNs will + /// get returned.

+ /// + /// Most references to the Kaiser window come from the signal processing + /// literature, where it is used as one of many windowing functions for + /// smoothing values.

+ /// It is also known as an apodization (which means + /// “removing the foot”, i.e.

+ /// smoothing discontinuities at the beginning + /// and end of the sampled signal) or tapering function.

+ /// + /// References ///
/// - /// Number of points in the output window. If zero or less, an - /// empty array is returned. + /// Number of points in the output window.

+ /// If zero or less, an + /// empty array is returned. /// /// - /// Shape parameter for window. + /// Shape parameter for window. /// /// - /// The window, with the maximum value normalized to one (the value - /// one appears only if the number of samples is odd). + /// The window, with the maximum value normalized to one (the value + /// one appears only if the number of samples is odd). /// public static NDarray kaiser(int M, float beta) - => NumPy.Instance.kaiser(M, beta); + { + //auto-generated code, do not change + var __self__=self; + var pyargs=ToTuple(new object[] + { + M, + beta, + }); + var kwargs=new PyDict(); + dynamic py = __self__.InvokeMethod("kaiser", pyargs, kwargs); + return ToCsharp(py); + } } diff --git a/src/ReleaseBot/App.config b/src/ReleaseBot/App.config new file mode 100644 index 0000000..4543795 --- /dev/null +++ b/src/ReleaseBot/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/ReleaseBot/Program.cs b/src/ReleaseBot/Program.cs new file mode 100644 index 0000000..69a61f8 --- /dev/null +++ b/src/ReleaseBot/Program.cs @@ -0,0 +1,252 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Xml; +using HtmlAgilityPack; + +namespace ReleaseBot +{ + class Program + { + private const string V = "1.35"; // <--- numpy.net version! + private const string PythonNetVersion = "3.0.1"; + private const string PythonVersion = "3.11"; // relevant only for Numpy with included binaries + private const string NumpyVersion = "1.23.5"; + + private const string ProjectPath = "../../../Numpy"; + private const string ProjectName = "Numpy.csproj"; + + private const string ProjectPath2 = "../../../Numpy.Bare"; + private const string ProjectName2 = "Numpy.Bare.csproj"; + + private const string Description = "C# bindings for NumPy on {0} - a fundamental library for scientific computing, machine learning and AI. Does require Python {1} with NumPy {2} installed!"; + private const string Tags = "Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, BLAS, Vector, Matrix, Python"; + + static void Main(string[] args) + { + // ==> Numpy + ProcessNumpy(); + + // ==> Numpy Bare + // TODO: release numpy bare for the new Pythonnet 3.0.0 + //// first delete old packages as to not upload them again + //foreach (var nuget in Directory.GetFiles(Path.Combine(ProjectPath2, "bin", "Release"), "*.nupkg")) + //{ + // File.Delete(nuget); + //} + + //var specs = new ReleaseSpec[] + //{ + // // linux + // new ReleaseSpec() { CPythonVersion = "2.7", Platform="Linux", }, + // new ReleaseSpec() { CPythonVersion = "3.5", Platform="Linux", }, + // new ReleaseSpec() { CPythonVersion = "3.6", Platform="Linux", }, + // new ReleaseSpec() { CPythonVersion = "3.8", Platform="Linux", }, + // new ReleaseSpec() { CPythonVersion = "3.7", Platform="Linux", }, + // // mac + // new ReleaseSpec() { CPythonVersion = "2.7", Platform="OSX", }, + // new ReleaseSpec() { CPythonVersion = "3.5", Platform="OSX", }, + // new ReleaseSpec() { CPythonVersion = "3.6", Platform="OSX", }, + // new ReleaseSpec() { CPythonVersion = "3.8", Platform="OSX", }, + // new ReleaseSpec() { CPythonVersion = "3.7", Platform="OSX", }, + // // win + // new ReleaseSpec() { CPythonVersion = "2.7", Platform="Win64", }, + // new ReleaseSpec() { CPythonVersion = "3.5", Platform="Win64", }, + // new ReleaseSpec() { CPythonVersion = "3.6", Platform="Win64", }, + // new ReleaseSpec() { CPythonVersion = "3.8", Platform="Win64", }, + // new ReleaseSpec() { CPythonVersion = "3.7", Platform="Win64", }, + //}; + //foreach (var spec in specs) + //{ + // spec.Version = $"{spec.CPythonVersion}.{V}"; + // spec.PythonNetVersion = $"{PythonNetVersion}"; + // spec.NumpyVersion = NumpyVersion; + // spec.Description = string.Format(Description, spec.Platform, spec.CPythonVersion, spec.NumpyVersion); + // spec.PackageTags = Tags; + // spec.RelativeProjectPath = ProjectPath2; + // spec.ProjectName = ProjectName2; + // var py = spec.CPythonVersion.Replace(".", ""); + // switch (spec.Platform) + // { + // case "Linux": + // spec.PackageId = "Numpy.Bare.Mono"; + // spec.PythonNet = $"pythonnet_netstandard_py{py}_linux"; + // break; + // case "OSX": + // spec.PackageId = "Numpy.Bare.OSX"; + // spec.PythonNet = $"pythonnet_netstandard_py{py}_osx"; + // break; + // case "Win64": + // spec.PackageId = "Numpy.Bare"; + // spec.PythonNet = $"pythonnet_netstandard_py{py}_win"; + // break; + // } + // spec.Process(); + //} + + var key = File.ReadAllText("../../nuget.key").Trim(); + foreach (var nuget in Directory.GetFiles(Path.Combine(ProjectPath2, "bin", "Release"), "*.nupkg")) + { + Console.WriteLine("Push " + nuget); + var arg = $"push -Source https://api.nuget.org/v3/index.json -ApiKey {key} {nuget}"; + var p = new Process() { StartInfo = new ProcessStartInfo("nuget.exe", arg) { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false } }; + p.OutputDataReceived += (x, data) => Console.WriteLine(data.Data); + p.ErrorDataReceived += (x, data) => Console.WriteLine("Error: " + data.Data); + p.Start(); + p.WaitForExit(); + Console.WriteLine("... pushed"); + } + Thread.Sleep(3000); + } + + private static void ProcessNumpy() + { + // first delete old packages as to not upload them again + foreach (var nuget in Directory.GetFiles(Path.Combine(ProjectPath, "bin", "Release"), "*.nupkg")) + { + File.Delete(nuget); + } + + var spec = new ReleaseSpec() + { + Version = $"{PythonVersion}.{V}", + ProjectName = ProjectName, + RelativeProjectPath = ProjectPath, + PackageId = "Numpy", + Description = @"C# bindings for NumPy - a fundamental library for scientific computing, machine learning and AI. Does not require a local Python installation!", + PackageTags = "Data science, Machine Learning, ML, AI, Scientific Computing, NumPy, Linear Algebra, FFT, SVD, Matrix, Python", + UsePythonIncluded = true, + }; + spec.Process(); + // nuget + var key = File.ReadAllText("../../nuget.key").Trim(); + foreach (var nuget in Directory.GetFiles(Path.Combine(ProjectPath, "bin", "Release"), "*.nupkg")) + { + Console.WriteLine("Push " + nuget); + var arg = $"push -Source https://api.nuget.org/v3/index.json -ApiKey {key} {nuget}"; + var p = new Process() { StartInfo = new ProcessStartInfo("nuget.exe", arg) { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false } }; + p.OutputDataReceived += (x, data) => Console.WriteLine(data.Data); + p.ErrorDataReceived += (x, data) => Console.WriteLine("Error: " + data.Data); + p.Start(); + p.WaitForExit(); + Console.WriteLine("... pushed"); + } + } + } + + public class ReleaseSpec + { + /// + /// The assembly / nuget package version + /// + public string Version; + + public string CPythonVersion; + public string Platform; + + /// + /// Project description + /// + public string Description; + + /// + /// Project description + /// + public string PackageTags; + + /// + /// Nuget package id + /// + public string PackageId; + + /// + /// PythonNet package name + /// + public string PythonNet; + + /// + /// PythonNet Version + /// + public string PythonNetVersion; + + /// + /// Name of the csproj file + /// + public string ProjectName; + + /// + /// Path to the csproj file, relative to the execution directory of ReleaseBot + /// + public string RelativeProjectPath; + + public string FullProjectPath => Path.Combine(RelativeProjectPath, ProjectName); + + /// + /// Uses Python.Included + /// + public bool UsePythonIncluded { get; set; } + + // Numpy Version + public string NumpyVersion { get; set; } + + public void Process() + { + if (!File.Exists(FullProjectPath)) + throw new InvalidOperationException("Project not found at: " + FullProjectPath); + // modify csproj + var doc = new HtmlDocument() { OptionOutputOriginalCase = true, OptionWriteEmptyNodes = true }; + doc.Load(FullProjectPath); + var group0 = doc.DocumentNode.Descendants("propertygroup").FirstOrDefault(); + SetInnerText(group0.Element("version"), Version); + Console.WriteLine("Version: " + group0.Element("version").InnerText); + SetInnerText(group0.Element("description"), Description); + Console.WriteLine("Description: " + group0.Element("description").InnerText); + if (!UsePythonIncluded) + { + SetInnerText(group0.Element("packageid"), PackageId); + var group1 = doc.DocumentNode.Descendants("itemgroup").FirstOrDefault(g => g.Element("packagereference") != null); + var reference = group1.Descendants("packagereference").ToArray()[1]; + reference.Attributes["Include"].Value = PythonNet; + reference.Attributes["Version"].Value = PythonNetVersion; + } + doc.Save(FullProjectPath); + // now build in release mode + RestoreNugetDependencies(); + Build(); + } + + private void RestoreNugetDependencies() + { + Console.WriteLine("Fetch Nugets " + Description); + var p = new Process() + { + StartInfo = new ProcessStartInfo("dotnet", "restore") + { WorkingDirectory = Path.GetFullPath(RelativeProjectPath) } + }; + p.Start(); + p.WaitForExit(); + } + + private void Build() + { + Console.WriteLine("Build " + Description); + var p = new Process() + { + StartInfo = new ProcessStartInfo("dotnet", "build -c Release") + { WorkingDirectory = Path.GetFullPath(RelativeProjectPath) } + }; + p.Start(); + p.WaitForExit(); + } + + private void SetInnerText(HtmlNode node, string text) + { + node.ReplaceChild(HtmlTextNode.CreateNode(text), node.FirstChild); + } + } +} diff --git a/src/ReleaseBot/Properties/AssemblyInfo.cs b/src/ReleaseBot/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5a4d99f --- /dev/null +++ b/src/ReleaseBot/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ReleaseBot")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ReleaseBot")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2baea60c-88a2-45dc-8044-2c9571e1b8cf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/ReleaseBot/ReleaseBot.csproj b/src/ReleaseBot/ReleaseBot.csproj new file mode 100644 index 0000000..2b74974 --- /dev/null +++ b/src/ReleaseBot/ReleaseBot.csproj @@ -0,0 +1,72 @@ + + + + + Debug + AnyCPU + {2BAEA60C-88A2-45DC-8044-2C9571E1B8CF} + Exe + ReleaseBot + ReleaseBot + v4.6.1 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\HtmlAgilityPack.1.11.8\lib\Net45\HtmlAgilityPack.dll + + + + + + + ..\packages\System.Runtime.Serialization.Primitives.4.1.1\lib\net46\System.Runtime.Serialization.Primitives.dll + + + ..\packages\System.Threading.Thread.4.0.0\lib\net46\System.Threading.Thread.dll + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + \ No newline at end of file diff --git a/src/ReleaseBot/nuget.exe b/src/ReleaseBot/nuget.exe new file mode 100644 index 0000000..d56c578 Binary files /dev/null and b/src/ReleaseBot/nuget.exe differ diff --git a/src/ReleaseBot/packages.config b/src/ReleaseBot/packages.config new file mode 100644 index 0000000..06d9aab --- /dev/null +++ b/src/ReleaseBot/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/Numpy.UnitTest/NumPy_array_creation.tests.cs b/test/Numpy.UnitTest/NumPy_array_creation.tests.cs index c54ada2..c4d81a1 100644 --- a/test/Numpy.UnitTest/NumPy_array_creation.tests.cs +++ b/test/Numpy.UnitTest/NumPy_array_creation.tests.cs @@ -11,6 +11,7 @@ using Numpy.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Python.Runtime; using Assert = NUnit.Framework.Assert; namespace Numpy.UnitTest @@ -231,8 +232,8 @@ public void zerosTest() Assert.AreEqual(expected, given.repr); #endif } - - + + [TestMethod] public void zeros_likeTest() { @@ -245,8 +246,8 @@ public void zeros_likeTest() // array([[0, 0, 0], // [0, 0, 0]]) // - - #if TODO + +#if TODO var given= x = np.arange(6); given= x = x.reshape((2, 3)); given= x; @@ -259,15 +260,15 @@ public void zeros_likeTest() "array([[0, 0, 0],\n" + " [0, 0, 0]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> y = np.arange(3, dtype=float) // >>> y // array([ 0., 1., 2.]) // >>> np.zeros_like(y) // array([ 0., 0., 0.]) // - - #if TODO + +#if TODO given= y = np.arange(3, dtype=float); given= y; expected= @@ -277,10 +278,10 @@ public void zeros_likeTest() expected= "array([ 0., 0., 0.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fullTest() { @@ -291,8 +292,8 @@ public void fullTest() // array([[10, 10], // [10, 10]]) // - - #if TODO + +#if TODO var given= np.full((2, 2), np.inf); var expected= "array([[ inf, inf],\n" + @@ -303,10 +304,10 @@ public void fullTest() "array([[10, 10],\n" + " [10, 10]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void full_likeTest() { @@ -320,8 +321,8 @@ public void full_likeTest() // >>> np.full_like(x, np.nan, dtype=np.double) // array([ nan, nan, nan, nan, nan, nan]) // - - #if TODO + +#if TODO var given= x = np.arange(6, dtype=int); given= np.full_like(x, 1); var expected= @@ -339,169 +340,235 @@ public void full_likeTest() expected= "array([ nan, nan, nan, nan, nan, nan])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> y = np.arange(6, dtype=np.double) // >>> np.full_like(y, 0.1) // array([ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) // - - #if TODO + +#if TODO given= y = np.arange(6, dtype=np.double); given= np.full_like(y, 0.1); expected= "array([ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] + public void arrayLeakTest() + { + var arr = new double[10_000_000]; + using (var process = System.Diagnostics.Process.GetCurrentProcess()) + { + long memStart; + long getMemAfterGc() + { + GC.Collect(2, GCCollectionMode.Forced, true, true); + process.Refresh(); + return process.PrivateMemorySize64; + } + long getOutstandingMem() => getMemAfterGc() - memStart; + + var ones = np.ones(10_000_000); // python runtime warmup + ones.Dispose(); + + memStart = getMemAfterGc(); + + ones = np.ones(10_000_000); + Assert.IsTrue(getOutstandingMem() > 70_000_000); + ones.Dispose(); + Assert.IsTrue(getOutstandingMem() < 1_000_000); + + var array = np.array(arr); + Assert.IsTrue(getOutstandingMem() > 70_000_000); + array.Dispose(); + Assert.IsTrue(getOutstandingMem() < 1_000_000); + + array = np.array(arr, np.float32); + Assert.IsTrue(getOutstandingMem() > 30_000_000); + array.Dispose(); + Assert.IsTrue(getOutstandingMem() < 1_000_000); + } + } + [TestMethod] public void arrayTest() { // >>> np.array([1, 2, 3]) // array([1, 2, 3]) // - - #if TODO - var given= np.array({1, 2, 3}); - var expected= + + NDarray given = np.array(new int[] { 1, 2, 3 }); + var expected = "array([1, 2, 3])"; Assert.AreEqual(expected, given.repr); - #endif + // Upcasting: - + // >>> np.array([1, 2, 3.0]) // array([ 1., 2., 3.]) // - - #if TODO - given= np.array({1, 2, 3.0}); - expected= - "array([ 1., 2., 3.])"; + + + given = np.array(new double[] { 1, 2, 3.0 }); + expected = + "array([1., 2., 3.])"; Assert.AreEqual(expected, given.repr); - #endif // More than one dimension: - + // >>> np.array([[1, 2], [3, 4]]) // array([[1, 2], // [3, 4]]) // - - #if TODO - given= np.array({{1, 2}, {3, 4}}); - expected= - "array([[1, 2],\n" + - " [3, 4]])"; + + given = np.array(new int[,] { { 1, 2 }, { 3, 4 } }); + expected = + "array([[1, 2],\n" + + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif + // Minimum dimensions 2: - // >>> np.array([1, 2, 3], ndmin=2) // array([[1, 2, 3]]) // - - #if TODO - given= np.array({1, 2, 3}, ndmin=2); - expected= - "array([[1, 2, 3]])"; + + + given = np.array(new int[] { 1, 2, 3 }, ndmin: 2); + expected = + "array([[1, 2, 3]])"; Assert.AreEqual(expected, given.repr); - #endif + // Type provided: - + // >>> np.array([1, 2, 3], dtype=complex) // array([ 1.+0.j, 2.+0.j, 3.+0.j]) // - - #if TODO - given= np.array({1, 2, 3}, dtype=complex); - expected= - "array([ 1.+0.j, 2.+0.j, 3.+0.j])"; + + given = np.array(new int[] { 1, 2, 3 }, dtype: np.complex_); + expected = + "array([1.+0.j, 2.+0.j, 3.+0.j])"; Assert.AreEqual(expected, given.repr); - #endif + // Data-type consisting of more than one element: - + // >>> x = np.array([(1,2),(3,4)],dtype=[('a','>> x['a'] // array([1, 3]) // - - #if TODO + +#if TODO given= x = np.array({(1,2),(3,4)},dtype={('a','>> np.array(np.mat('1 2; 3 4')) // array([[1, 2], // [3, 4]]) // - - #if TODO + +#if TODO given= np.array(np.mat('1 2; 3 4')); expected= "array([[1, 2],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.array(np.mat('1 2; 3 4'), subok=True) // matrix([[1, 2], // [3, 4]]) // - - #if TODO + +#if TODO given= np.array(np.mat('1 2; 3 4'), subok=True); expected= "matrix([[1, 2],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] + public void array1Test() + { + //>>> a=[] + //>>> a.append(np.arange(5)) + //>>> a.append(np.arange(5)) + //>>> a.append(np.arange(5)) + //>>> a.append(np.arange(5)) + //>>> a + // [array([0, 1, 2, 3, 4]), array([0, 1, 2, 3, 4]), array([0, 1, 2, 3, 4]), array([0, 1, 2, 3, 4])] + //>>> b=np.array(a) + //>>> b + //array([[0, 1, 2, 3, 4], + //[0, 1, 2, 3, 4]]) + //>>> + var a = new List(); + a.Add(np.arange(5)); + a.Add(np.arange(5)); + var b = np.array(a); + Assert.AreEqual("array([[0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4]])", b.repr); + } + + [TestMethod] + public void array2Test() + { + //>>> a=np.array([1, 2, 3]) + //>>> b=np.array([a, a, a]) + //>>> b + //array([[1, 2, 3], + // [1, 2, 3], + // [1, 2, 3]]) + var a = np.array(new[] { 1, 2, 3 }); + var b = np.array(new[] { a, a, a }); + Assert.AreEqual("array([[1, 2, 3],\n [1, 2, 3],\n [1, 2, 3]])", b.repr); + } + [TestMethod] public void asarrayTest() { // Convert a list into an array: - + // >>> a = [1, 2] // >>> np.asarray(a) // array([1, 2]) // - - #if TODO + +#if TODO var given= a = [1, 2]; given= np.asarray(a); var expected= "array([1, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Existing arrays are not copied: - + // >>> a = np.array([1, 2]) // >>> np.asarray(a) is a // True // - - #if TODO + +#if TODO given= a = np.array({1, 2}); given= np.asarray(a) is a; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // If dtype is set, array is copied only if dtype does not match: - + // >>> a = np.array([1, 2], dtype=np.float32) // >>> np.asarray(a, dtype=np.float32) is a // True // >>> np.asarray(a, dtype=np.float64) is a // False // - - #if TODO + +#if TODO given= a = np.array({1, 2}, dtype=np.float32); given= np.asarray(a, dtype=np.float32) is a; expected= @@ -511,9 +578,9 @@ public void asarrayTest() expected= "False"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Contrary to asanyarray, ndarray subclasses are not passed through: - + // >>> issubclass(np.recarray, np.ndarray) // True // >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) @@ -522,8 +589,8 @@ public void asarrayTest() // >>> np.asanyarray(a) is a // True // - - #if TODO + +#if TODO given= issubclass(np.recarray, np.ndarray); expected= "True"; @@ -537,44 +604,44 @@ public void asarrayTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void asanyarrayTest() { // Convert a list into an array: - + // >>> a = [1, 2] // >>> np.asanyarray(a) // array([1, 2]) // - - #if TODO + +#if TODO var given= a = [1, 2]; given= np.asanyarray(a); var expected= "array([1, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Instances of ndarray subclasses are passed through as-is: - + // >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) // >>> np.asanyarray(a) is a // True // - - #if TODO + +#if TODO given= a = np.array({(1.0, 2), (3.0, 4)}, dtype='f4,i4').view(np.recarray); given= np.asanyarray(a) is a; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ascontiguousarrayTest() { @@ -585,8 +652,8 @@ public void ascontiguousarrayTest() // >>> x.flags['C_CONTIGUOUS'] // True // - - #if TODO + +#if TODO var given= x = np.arange(6).reshape(2,3); given= np.ascontiguousarray(x, dtype=np.float32); var expected= @@ -597,87 +664,85 @@ public void ascontiguousarrayTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note: This function returns an array with at least one-dimension (1-d) // so it will not preserve 0-d arrays. - + } - - + + [TestMethod] public void asmatrixTest() { // >>> x = np.array([[1, 2], [3, 4]]) // - - #if TODO + +#if TODO var given= x = np.array({{1, 2}, {3, 4}}); - #endif +#endif // >>> m = np.asmatrix(x) // - - #if TODO + +#if TODO given= m = np.asmatrix(x); - #endif +#endif // >>> x[0,0] = 5 // - - #if TODO + +#if TODO given= x[0,0] = 5; - #endif +#endif // >>> m // matrix([[5, 2], // [3, 4]]) // - - #if TODO + +#if TODO given= m; var expected= "matrix([[5, 2],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void copyTest() { // Create an array x, with a reference y and a copy z: - - // >>> x = np.array([1, 2, 3]) - // >>> y = x - // >>> z = np.copy(x) - // - - #if TODO - var given= x = np.array({1, 2, 3}); - given= y = x; - given= z = np.copy(x); - #endif + + var x = np.array(new[] { 1, 2, 3 }); + var y = x; + var z = np.copy(x); + // Note that, when we modify x, y changes, but not z: - - // >>> x[0] = 10 - // >>> x[0] == y[0] - // True - // >>> x[0] == z[0] - // False - // - - #if TODO - given= x[0] = 10; - given= x[0] == y[0]; - var expected= - "True"; - Assert.AreEqual(expected, given.repr); - given= x[0] == z[0]; - expected= - "False"; - Assert.AreEqual(expected, given.repr); - #endif + + x[0] = (NDarray)10; + + Assert.AreEqual(x[0], y[0]); + Assert.AreNotEqual(x[0], z[0]); } - - + + + [TestMethod] + public void copyTest1() + { + // Create an array x, with a reference y and a copy z: + + var x = np.array(new[] { 1, 2, 3 }); + var y = x; + var z = x.copy(); + + // Note that, when we modify x, y changes, but not z: + + x[0] = (NDarray)10; + + Assert.AreEqual(x[0], y[0]); + Assert.AreNotEqual(x[0], z[0]); + } + + [TestMethod] public void frombufferTest() { @@ -686,22 +751,22 @@ public void frombufferTest() // array(['w', 'o', 'r', 'l', 'd'], // dtype='|S1') // - - #if TODO + +#if TODO var given= s = 'hello world'; given= np.frombuffer(s, dtype='S1', count=5, offset=6); var expected= "array(['w', 'o', 'r', 'l', 'd'],\n" + " dtype='|S1')"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.frombuffer(b'\x01\x02', dtype=np.uint8) // array([1, 2], dtype=uint8) // >>> np.frombuffer(b'\x01\x02\x03\x04\x05', dtype=np.uint8, count=3) // array([1, 2, 3], dtype=uint8) // - - #if TODO + +#if TODO given= np.frombuffer(b'\x01\x02', dtype=np.uint8); expected= "array([1, 2], dtype=uint8)"; @@ -710,15 +775,15 @@ public void frombufferTest() expected= "array([1, 2, 3], dtype=uint8)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fromfileTest() { // Construct an ndarray: - + // >>> dt = np.dtype([('time', [('min', int), ('sec', int)]), // ... ('temp', float)]) // >>> x = np.zeros((1,), dtype=dt) @@ -727,8 +792,8 @@ public void fromfileTest() // array([((10, 0), 98.25)], // dtype=[('time', [('min', '>> import os // >>> fname = os.tmpnam() // >>> x.tofile(fname) // - - #if TODO + +#if TODO given= import os; given= fname = os.tmpnam(); given= x.tofile(fname); - #endif +#endif // Read the raw data from disk: - + // >>> np.fromfile(fname, dtype=dt) // array([((10, 0), 98.25)], // dtype=[('time', [('min', '>> np.save(fname, x) // >>> np.load(fname + '.npy') // array([((10, 0), 98.25)], // dtype=[('time', [('min', '>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) // array([[0, 1, 2], // [1, 2, 3], // [2, 3, 4]]) // - - #if TODO + +#if TODO given= np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int); expected= "array([[0, 1, 2],\n" + " [1, 2, 3],\n" + " [2, 3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fromiterTest() { @@ -827,17 +892,17 @@ public void fromiterTest() // >>> np.fromiter(iterable, float) // array([ 0., 1., 4., 9., 16.]) // - - #if TODO + +#if TODO var given= iterable = (x*x for x in range(5)); given= np.fromiter(iterable, float); var expected= "array([ 0., 1., 4., 9., 16.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fromstringTest() { @@ -846,8 +911,8 @@ public void fromstringTest() // >>> np.fromstring('1, 2', dtype=int, sep=',') // array([1, 2]) // - - #if TODO + +#if TODO var given= np.fromstring('1 2', dtype=int, sep=' '); var expected= "array([1, 2])"; @@ -856,10 +921,10 @@ public void fromstringTest() expected= "array([1, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void loadtxtTest() { @@ -869,24 +934,48 @@ public void loadtxtTest() // array([[ 0., 1.], // [ 2., 3.]]) // - - #if TODO - var given= from io import StringIO # StringIO behaves like a file object; - given= c = StringIO(u"0 1\n2 3"); - given= np.loadtxt(c); - var expected= - "array([[ 0., 1.],\n" + - " [ 2., 3.]])"; + + string tempFile = Path.GetTempFileName(); + File.WriteAllText(tempFile, "0 1\n2 3"); + var given = np.loadtxt(tempFile); + var expected = + "array([[0., 1.],\n" + + " [2., 3.]])"; Assert.AreEqual(expected, given.repr); - #endif + + + // >>> c = StringIO(u"1,0,2\n3,0,4") + // >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) + // >>> x + // array([ 1., 3.]) + // >>> y + // array([ 2., 4.]) + // + + File.WriteAllText(tempFile, "1,0,2\n3,0,4"); + var a = np.loadtxt(tempFile, delimiter: ",", usecols: new[] { 0, 2 }, unpack: true); + given = a[0]; + expected = + "array([1., 3.])"; + Assert.AreEqual(expected, given.repr); + given = a[1]; + expected = + "array([2., 4.])"; + Assert.AreEqual(expected, given.repr); + } + + + [TestMethod] + public void loadtxt_custom_dtype() + { // >>> d = StringIO(u"M 21 72\nF 35 58") // >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), // ... 'formats': ('S1', 'i4', 'f4')}) // array([('M', 21, 72.0), ('F', 35, 58.0)], // dtype=[('gender', '|S1'), ('age', '>> c = StringIO(u"1,0,2\n3,0,4") - // >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) - // >>> x - // array([ 1., 3.]) - // >>> y - // array([ 2., 4.]) - // - - #if TODO - given= c = StringIO(u"1,0,2\n3,0,4"); - given= x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True); - given= x; - expected= - "array([ 1., 3.])"; - Assert.AreEqual(expected, given.repr); - given= y; - expected= - "array([ 2., 4.])"; - Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + [TestMethod] public void chararrayTest() { @@ -929,8 +997,8 @@ public void chararrayTest() // ['a', 'a', 'a']], // dtype='|S1') // - - #if TODO + +#if TODO var given= charar = np.chararray((3, 3)); given= charar[:] = 'a'; given= charar; @@ -940,7 +1008,7 @@ public void chararrayTest() " ['a', 'a', 'a']],\n" + " dtype='|S1')"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> charar = np.chararray(charar.shape, itemsize=5) // >>> charar[:] = 'abc' // >>> charar @@ -949,8 +1017,8 @@ public void chararrayTest() // ['abc', 'abc', 'abc']], // dtype='|S5') // - - #if TODO + +#if TODO given= charar = np.chararray(charar.shape, itemsize=5); given= charar[:] = 'abc'; given= charar; @@ -960,12 +1028,12 @@ public void chararrayTest() " ['abc', 'abc', 'abc']],\n" + " dtype='|S5')"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Methods - + } - - + + [TestMethod] public void arangeTest() { @@ -978,8 +1046,8 @@ public void arangeTest() // >>> np.arange(3,7,2) // array([3, 5]) // - - #if TODO + +#if TODO var given= np.arange(3); var expected= "array([0, 1, 2])"; @@ -996,10 +1064,10 @@ public void arangeTest() expected= "array([3, 5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void linspaceTest() { @@ -1010,60 +1078,23 @@ public void linspaceTest() // >>> np.linspace(2.0, 3.0, num=5, retstep=True) // (array([ 2. , 2.25, 2.5 , 2.75, 3. ]), 0.25) // - - #if TODO - var given= np.linspace(2.0, 3.0, num=5); - var expected= - "array([ 2. , 2.25, 2.5 , 2.75, 3. ])"; - Assert.AreEqual(expected, given.repr); - given= np.linspace(2.0, 3.0, num=5, endpoint=False); - expected= - "array([ 2. , 2.2, 2.4, 2.6, 2.8])"; - Assert.AreEqual(expected, given.repr); - given= np.linspace(2.0, 3.0, num=5, retstep=True); - expected= - "(array([ 2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)"; - Assert.AreEqual(expected, given.repr); - #endif - // Graphical illustration: - - // >>> import matplotlib.pyplot as plt - // >>> N = 8 - // >>> y = np.zeros(N) - // >>> x1 = np.linspace(0, 10, N, endpoint=True) - // >>> x2 = np.linspace(0, 10, N, endpoint=False) - // >>> plt.plot(x1, y, 'o') - // [] - // >>> plt.plot(x2, y + 0.5, 'o') - // [] - // >>> plt.ylim([-0.5, 1]) - // (-0.5, 1) - // >>> plt.show() - // - - #if TODO - given= import matplotlib.pyplot as plt; - given= N = 8; - given= y = np.zeros(N); - given= x1 = np.linspace(0, 10, N, endpoint=True); - given= x2 = np.linspace(0, 10, N, endpoint=False); - given= plt.plot(x1, y, 'o'); - expected= - "[]"; + + var given = np.linspace(2.0, 3.0, num: 5); + var expected = + "array([2. , 2.25, 2.5 , 2.75, 3. ])"; Assert.AreEqual(expected, given.repr); - given= plt.plot(x2, y + 0.5, 'o'); - expected= - "[]"; + given = np.linspace(2.0, 3.0, num: 5, endpoint: false); + expected = + "array([2. , 2.2, 2.4, 2.6, 2.8])"; Assert.AreEqual(expected, given.repr); - given= plt.ylim([-0.5, 1]); - expected= - "(-0.5, 1)"; + given = np.linspace(2, 3, out var step, num: 5, endpoint: true); + expected = + "array([2. , 2.25, 2.5 , 2.75, 3. ])"; Assert.AreEqual(expected, given.repr); - given= plt.show(); - #endif + Assert.AreEqual(step, 0.25); } - - + + [TestMethod] public void logspaceTest() { @@ -1074,8 +1105,8 @@ public void logspaceTest() // >>> np.logspace(2.0, 3.0, num=4, base=2.0) // array([ 4. , 5.0396842 , 6.34960421, 8. ]) // - - #if TODO + +#if TODO var given= np.logspace(2.0, 3.0, num=4); var expected= "array([ 100. , 215.443469 , 464.15888336, 1000. ])"; @@ -1088,9 +1119,9 @@ public void logspaceTest() expected= "array([ 4. , 5.0396842 , 6.34960421, 8. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Graphical illustration: - + // >>> import matplotlib.pyplot as plt // >>> N = 10 // >>> x1 = np.logspace(0.1, 1, N, endpoint=True) @@ -1104,8 +1135,8 @@ public void logspaceTest() // (-0.5, 1) // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= N = 10; given= x1 = np.logspace(0.1, 1, N, endpoint=True); @@ -1124,10 +1155,10 @@ public void logspaceTest() "(-0.5, 1)"; Assert.AreEqual(expected, given.repr); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void geomspaceTest() { @@ -1140,8 +1171,8 @@ public void geomspaceTest() // >>> np.geomspace(1, 256, num=9) // array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.]) // - - #if TODO + +#if TODO var given= np.geomspace(1, 1000, num=4); var expected= "array([ 1., 10., 100., 1000.])"; @@ -1158,16 +1189,16 @@ public void geomspaceTest() expected= "array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note that the above may not produce exact integers: - + // >>> np.geomspace(1, 256, num=9, dtype=int) // array([ 1, 2, 4, 7, 16, 32, 63, 127, 256]) // >>> np.around(np.geomspace(1, 256, num=9)).astype(int) // array([ 1, 2, 4, 8, 16, 32, 64, 128, 256]) // - - #if TODO + +#if TODO given= np.geomspace(1, 256, num=9, dtype=int); expected= "array([ 1, 2, 4, 7, 16, 32, 63, 127, 256])"; @@ -1176,9 +1207,9 @@ public void geomspaceTest() expected= "array([ 1, 2, 4, 8, 16, 32, 64, 128, 256])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Negative, decreasing, and complex inputs are allowed: - + // >>> np.geomspace(1000, 1, num=4) // array([ 1000., 100., 10., 1.]) // >>> np.geomspace(-1000, -1, num=4) @@ -1190,8 +1221,8 @@ public void geomspaceTest() // 0.00000000+1.j , 0.70710678+0.70710678j, // 1.00000000+0.j ]) // - - #if TODO + +#if TODO given= np.geomspace(1000, 1, num=4); expected= "array([ 1000., 100., 10., 1.])"; @@ -1210,9 +1241,9 @@ public void geomspaceTest() " 0.00000000+1.j , 0.70710678+0.70710678j,\n" + " 1.00000000+0.j ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Graphical illustration of endpoint parameter: - + // >>> import matplotlib.pyplot as plt // >>> N = 10 // >>> y = np.zeros(N) @@ -1222,8 +1253,8 @@ public void geomspaceTest() // >>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= N = 10; given= y = np.zeros(N); @@ -1232,10 +1263,10 @@ public void geomspaceTest() given= plt.axis([0.5, 2000, 0, 3]); given= plt.grid(True, color='0.7', linestyle='-', which='both', axis='both'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void meshgridTest() { @@ -1256,56 +1287,33 @@ public void meshgridTest() // array([[ 0.], // [ 1.]]) // - - #if TODO - var given= nx, ny = (3, 2); - given= x = np.linspace(0, 1, nx); - given= y = np.linspace(0, 1, ny); - given= xv, yv = np.meshgrid(x, y); - given= xv; - var expected= - "array([[ 0. , 0.5, 1. ],\n" + - " [ 0. , 0.5, 1. ]])"; + var (nx, ny) = (3, 2); + var x = np.linspace(0, 1, nx); + var y = np.linspace(0, 1, ny); + var xv_yv = np.meshgrid(x, y); + var given = xv_yv[0]; + var expected = + "array([[0. , 0.5, 1. ],\n" + + " [0. , 0.5, 1. ]])"; Assert.AreEqual(expected, given.repr); - given= yv; - expected= - "array([[ 0., 0., 0.],\n" + - " [ 1., 1., 1.]])"; + given = xv_yv[1]; + expected = + "array([[0., 0., 0.],\n" + + " [1., 1., 1.]])"; Assert.AreEqual(expected, given.repr); - given= xv, yv = np.meshgrid(x, y, sparse=True) # make sparse output arrays; - given= xv; - expected= - "array([[ 0. , 0.5, 1. ]])"; + xv_yv = np.meshgrid(new[] { x, y }, sparse: true); // make sparse output arrays; + given = xv_yv[0]; + expected = + "array([[0. , 0.5, 1. ]])"; Assert.AreEqual(expected, given.repr); - given= yv; - expected= - "array([[ 0.],\n" + - " [ 1.]])"; + given = xv_yv[1]; + expected = + "array([[0.],\n" + + " [1.]])"; Assert.AreEqual(expected, given.repr); - #endif - // meshgrid is very useful to evaluate functions on a grid. - - // >>> import matplotlib.pyplot as plt - // >>> x = np.arange(-5, 5, 0.1) - // >>> y = np.arange(-5, 5, 0.1) - // >>> xx, yy = np.meshgrid(x, y, sparse=True) - // >>> z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2) - // >>> h = plt.contourf(x,y,z) - // >>> plt.show() - // - - #if TODO - given= import matplotlib.pyplot as plt; - given= x = np.arange(-5, 5, 0.1); - given= y = np.arange(-5, 5, 0.1); - given= xx, yy = np.meshgrid(x, y, sparse=True); - given= z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2); - given= h = plt.contourf(x,y,z); - given= plt.show(); - #endif } - - + + [TestMethod] public void mgridTest() { @@ -1323,9 +1331,9 @@ public void mgridTest() // >>> np.mgrid[-1:1:5j] // array([-1. , -0.5, 0. , 0.5, 1. ]) // - - #if TODO - var given= np.mgrid{0:5,0:5}; + +#if TODO + var given= np.mgrid["0:5,0:5"]; var expected= "array([[[0, 0, 0, 0, 0],\n" + " [1, 1, 1, 1, 1],\n" + @@ -1342,10 +1350,10 @@ public void mgridTest() expected= "array([-1. , -0.5, 0. , 0.5, 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ogridTest() { @@ -1359,8 +1367,8 @@ public void ogridTest() // [3], // [4]]), array([[0, 1, 2, 3, 4]])] // - - #if TODO + +#if TODO var given= from numpy import ogrid; given= ogrid[-1:1:5j]; var expected= @@ -1374,10 +1382,10 @@ public void ogridTest() " [3],\n" + " [4]]), array([[0, 1, 2, 3, 4]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void diagTest() { @@ -1387,8 +1395,8 @@ public void diagTest() // [3, 4, 5], // [6, 7, 8]]) // - - #if TODO + +#if TODO var given= x = np.arange(9).reshape((3,3)); given= x; var expected= @@ -1396,7 +1404,7 @@ public void diagTest() " [3, 4, 5],\n" + " [6, 7, 8]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.diag(x) // array([0, 4, 8]) // >>> np.diag(x, k=1) @@ -1404,8 +1412,8 @@ public void diagTest() // >>> np.diag(x, k=-1) // array([3, 7]) // - - #if TODO + +#if TODO given= np.diag(x); expected= "array([0, 4, 8])"; @@ -1418,24 +1426,24 @@ public void diagTest() expected= "array([3, 7])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.diag(np.diag(x)) // array([[0, 0, 0], // [0, 4, 0], // [0, 0, 8]]) // - - #if TODO + +#if TODO given= np.diag(np.diag(x)); expected= "array([[0, 0, 0],\n" + " [0, 4, 0],\n" + " [0, 0, 8]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void diagflatTest() { @@ -1445,8 +1453,8 @@ public void diagflatTest() // [0, 0, 3, 0], // [0, 0, 0, 4]]) // - - #if TODO + +#if TODO var given= np.diagflat({{1,2}, {3,4}}); var expected= "array([[1, 0, 0, 0],\n" + @@ -1454,24 +1462,24 @@ public void diagflatTest() " [0, 0, 3, 0],\n" + " [0, 0, 0, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.diagflat([1,2], 1) // array([[0, 1, 0], // [0, 0, 2], // [0, 0, 0]]) // - - #if TODO + +#if TODO given= np.diagflat({1,2}, 1); expected= "array([[0, 1, 0],\n" + " [0, 0, 2],\n" + " [0, 0, 0]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void triTest() { @@ -1480,32 +1488,32 @@ public void triTest() // [1, 1, 1, 1, 0], // [1, 1, 1, 1, 1]]) // - - #if TODO + +#if TODO var given= np.tri(3, 5, 2, dtype=int); var expected= "array([[1, 1, 1, 0, 0],\n" + " [1, 1, 1, 1, 0],\n" + " [1, 1, 1, 1, 1]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tri(3, 5, -1) // array([[ 0., 0., 0., 0., 0.], // [ 1., 0., 0., 0., 0.], // [ 1., 1., 0., 0., 0.]]) // - - #if TODO + +#if TODO given= np.tri(3, 5, -1); expected= "array([[ 0., 0., 0., 0., 0.],\n" + " [ 1., 0., 0., 0., 0.],\n" + " [ 1., 1., 0., 0., 0.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void trilTest() { @@ -1515,8 +1523,8 @@ public void trilTest() // [ 7, 8, 0], // [10, 11, 12]]) // - - #if TODO + +#if TODO var given= np.tril({{1,2,3},{4,5,6},{7,8,9},{10,11,12}}, -1); var expected= "array([[ 0, 0, 0],\n" + @@ -1524,10 +1532,10 @@ public void trilTest() " [ 7, 8, 0],\n" + " [10, 11, 12]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void vanderTest() { @@ -1539,8 +1547,8 @@ public void vanderTest() // [ 9, 3, 1], // [25, 5, 1]]) // - - #if TODO + +#if TODO var given= x = np.array({1, 2, 3, 5}); given= N = 3; given= np.vander(x, N); @@ -1550,15 +1558,15 @@ public void vanderTest() " [ 9, 3, 1],\n" + " [25, 5, 1]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.column_stack([x**(N-1-i) for i in range(N)]) // array([[ 1, 1, 1], // [ 4, 2, 1], // [ 9, 3, 1], // [25, 5, 1]]) // - - #if TODO + +#if TODO given= np.column_stack({x**(N-1-i) for i in range(N)}); expected= "array([[ 1, 1, 1],\n" + @@ -1566,7 +1574,7 @@ public void vanderTest() " [ 9, 3, 1],\n" + " [25, 5, 1]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.array([1, 2, 3, 5]) // >>> np.vander(x) // array([[ 1, 1, 1, 1], @@ -1579,8 +1587,8 @@ public void vanderTest() // [ 1, 3, 9, 27], // [ 1, 5, 25, 125]]) // - - #if TODO + +#if TODO given= x = np.array({1, 2, 3, 5}); given= np.vander(x); expected= @@ -1596,17 +1604,17 @@ public void vanderTest() " [ 1, 3, 9, 27],\n" + " [ 1, 5, 25, 125]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The determinant of a square Vandermonde matrix is the product // of the differences between the values of the input vector: - + // >>> np.linalg.det(np.vander(x)) // 48.000000000000043 // >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) // 48 // - - #if TODO + +#if TODO given= np.linalg.det(np.vander(x)); expected= "48.000000000000043"; @@ -1615,46 +1623,46 @@ public void vanderTest() expected= "48"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void matTest() { // >>> x = np.array([[1, 2], [3, 4]]) // - - #if TODO + +#if TODO var given= x = np.array({{1, 2}, {3, 4}}); - #endif +#endif // >>> m = np.asmatrix(x) // - - #if TODO + +#if TODO given= m = np.asmatrix(x); - #endif +#endif // >>> x[0,0] = 5 // - - #if TODO + +#if TODO given= x[0,0] = 5; - #endif +#endif // >>> m // matrix([[5, 2], // [3, 4]]) // - - #if TODO + +#if TODO given= m; var expected= "matrix([[5, 2],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void bmatTest() { @@ -1663,15 +1671,15 @@ public void bmatTest() // >>> C = np.mat('3 4; 5 6') // >>> D = np.mat('7 8; 9 0') // - - #if TODO + +#if TODO var given= A = np.mat('1 1; 1 1'); given= B = np.mat('2 2; 2 2'); given= C = np.mat('3 4; 5 6'); given= D = np.mat('7 8; 9 0'); - #endif +#endif // All the following expressions construct the same block matrix: - + // >>> np.bmat([[A, B], [C, D]]) // matrix([[1, 1, 2, 2], // [1, 1, 2, 2], @@ -1688,8 +1696,8 @@ public void bmatTest() // [3, 4, 7, 8], // [5, 6, 9, 0]]) // - - #if TODO + +#if TODO given= np.bmat({{A, B}, {C, D}}); var expected= "matrix([[1, 1, 2, 2],\n" + @@ -1711,8 +1719,8 @@ public void bmatTest() " [3, 4, 7, 8],\n" + " [5, 6, 9, 0]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - + } } diff --git a/test/Numpy.UnitTest/NumPy_array_manipulation.tests.cs b/test/Numpy.UnitTest/NumPy_array_manipulation.tests.cs index b7cf121..4f144c2 100644 --- a/test/Numpy.UnitTest/NumPy_array_manipulation.tests.cs +++ b/test/Numpy.UnitTest/NumPy_array_manipulation.tests.cs @@ -18,7 +18,7 @@ namespace Numpy.UnitTest [TestClass] public class NumPy_array_manipulationTest : BaseTestCase { - + [TestMethod] public void reshapeTest() { @@ -29,14 +29,14 @@ public void reshapeTest() // array([1, 4, 2, 5, 3, 6]) // - var a = np.array(new [,]{{1,2,3}, {4,5,6}}); - var given= np.reshape(a, 6); - var expected= + var a = np.array(new[,] { { 1, 2, 3 }, { 4, 5, 6 } }); + var given = np.reshape(a, 6); + var expected = "array([1, 2, 3, 4, 5, 6])"; Assert.AreEqual(expected, given.repr); - given= np.reshape(a, new Shape(6), order:"F"); - expected= - "array([1, 4, 2, 5, 3, 6])"; + given = np.reshape(a, new Shape(6), order: "F"); + expected = + "array([1, 4, 2, 5, 3, 6])"; Assert.AreEqual(expected, given.repr); // >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 // array([[1, 2], @@ -45,60 +45,60 @@ public void reshapeTest() // given = np.reshape(a, 3, -1); // the unspecified value is inferred to be 2; - expected= - "array([[1, 2],\n" + - " [3, 4],\n" + - " [5, 6]])"; + expected = + "array([[1, 2],\n" + + " [3, 4],\n" + + " [5, 6]])"; Assert.AreEqual(expected, given.repr); } - - + + [TestMethod] public void ravelTest() { // It is equivalent to reshape(-1, order=order). - + // >>> x = np.array([[1, 2, 3], [4, 5, 6]]) // >>> print(np.ravel(x)) // [1 2 3 4 5 6] // - - #if TODO + +#if TODO var given= x = np.array({{1, 2, 3}, {4, 5, 6}}); given= print(np.ravel(x)); var expected= "[1 2 3 4 5 6]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> print(x.reshape(-1)) // [1 2 3 4 5 6] // - - #if TODO + +#if TODO given= print(x.reshape(-1)); expected= "[1 2 3 4 5 6]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> print(np.ravel(x, order='F')) // [1 4 2 5 3 6] // - - #if TODO + +#if TODO given= print(np.ravel(x, order='F')); expected= "[1 4 2 5 3 6]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // When order is ‘A’, it will preserve the array’s ‘C’ or ‘F’ ordering: - + // >>> print(np.ravel(x.T)) // [1 4 2 5 3 6] // >>> print(np.ravel(x.T, order='A')) // [1 2 3 4 5 6] // - - #if TODO + +#if TODO given= print(np.ravel(x.T)); expected= "[1 4 2 5 3 6]"; @@ -107,10 +107,10 @@ public void ravelTest() expected= "[1 2 3 4 5 6]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // When order is ‘K’, it will preserve orderings that are neither ‘C’ // nor ‘F’, but won’t reverse axes: - + // >>> a = np.arange(3)[::-1]; a // array([2, 1, 0]) // >>> a.ravel(order='C') @@ -118,8 +118,8 @@ public void ravelTest() // >>> a.ravel(order='K') // array([2, 1, 0]) // - - #if TODO + +#if TODO given= a = np.arange(3){::-1}; a; expected= "array([2, 1, 0])"; @@ -132,7 +132,7 @@ public void ravelTest() expected= "array([2, 1, 0])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a // array([[[ 0, 2, 4], // [ 1, 3, 5]], @@ -143,8 +143,8 @@ public void ravelTest() // >>> a.ravel(order='K') // array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) // - - #if TODO + +#if TODO given= a = np.arange(12).reshape(2,3,2).swapaxes(1,2); a; expected= "array([[[ 0, 2, 4],\n" + @@ -160,10 +160,10 @@ public void ravelTest() expected= "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void flattenTest() { @@ -173,8 +173,8 @@ public void flattenTest() // >>> a.flatten('F') // array([1, 3, 2, 4]) // - - #if TODO + +#if TODO var given= a = np.array({{1,2}, {3,4}}); given= a.flatten(); var expected= @@ -184,10 +184,10 @@ public void flattenTest() expected= "array([1, 3, 2, 4])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void moveaxisTest() { @@ -197,8 +197,8 @@ public void moveaxisTest() // >>> np.moveaxis(x, -1, 0).shape // (5, 3, 4) // - - #if TODO + +#if TODO var given= x = np.zeros((3, 4, 5)); given= np.moveaxis(x, 0, -1).shape; var expected= @@ -208,9 +208,9 @@ public void moveaxisTest() expected= "(5, 3, 4)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // These all achieve the same result: - + // >>> np.transpose(x).shape // (5, 4, 3) // >>> np.swapaxes(x, 0, -1).shape @@ -220,8 +220,8 @@ public void moveaxisTest() // >>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape // (5, 4, 3) // - - #if TODO + +#if TODO given= np.transpose(x).shape; expected= "(5, 4, 3)"; @@ -238,10 +238,10 @@ public void moveaxisTest() expected= "(5, 4, 3)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rollaxisTest() { @@ -253,8 +253,8 @@ public void rollaxisTest() // >>> np.rollaxis(a, 1, 4).shape // (3, 5, 6, 4) // - - #if TODO + +#if TODO var given= a = np.ones((3,4,5,6)); given= np.rollaxis(a, 3, 1).shape; var expected= @@ -268,10 +268,10 @@ public void rollaxisTest() expected= "(3, 5, 6, 4)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void swapaxesTest() { @@ -281,8 +281,8 @@ public void swapaxesTest() // [2], // [3]]) // - - #if TODO + +#if TODO var given= x = np.array({{1,2,3}}); given= np.swapaxes(x,0,1); var expected= @@ -290,7 +290,7 @@ public void swapaxesTest() " [2],\n" + " [3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.array([[[0,1],[2,3]],[[4,5],[6,7]]]) // >>> x // array([[[0, 1], @@ -298,8 +298,8 @@ public void swapaxesTest() // [[4, 5], // [6, 7]]]) // - - #if TODO + +#if TODO given= x = np.array({{{0,1},{2,3}},{{4,5},{6,7}}}); given= x; expected= @@ -308,15 +308,15 @@ public void swapaxesTest() " [[4, 5],\n" + " [6, 7]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.swapaxes(x,0,2) // array([[[0, 4], // [2, 6]], // [[1, 5], // [3, 7]]]) // - - #if TODO + +#if TODO given= np.swapaxes(x,0,2); expected= "array([[[0, 4],\n" + @@ -324,10 +324,10 @@ public void swapaxesTest() " [[1, 5],\n" + " [3, 7]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void transposeTest() { @@ -336,55 +336,55 @@ public void transposeTest() // array([[0, 1], // [2, 3]]) // - - #if TODO + +#if TODO var given= x = np.arange(4).reshape((2,2)); given= x; var expected= "array([[0, 1],\n" + " [2, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.transpose(x) // array([[0, 2], // [1, 3]]) // - - #if TODO + +#if TODO given= np.transpose(x); expected= "array([[0, 2],\n" + " [1, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.ones((1, 2, 3)) // >>> np.transpose(x, (1, 0, 2)).shape // (2, 1, 3) // - - #if TODO + +#if TODO given= x = np.ones((1, 2, 3)); given= np.transpose(x, (1, 0, 2)).shape; expected= "(2, 1, 3)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void atleast_1dTest() { // >>> np.atleast_1d(1.0) // array([ 1.]) // - - #if TODO + +#if TODO var given= np.atleast_1d(1.0); var expected= "array([ 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(9.0).reshape(3,3) // >>> np.atleast_1d(x) // array([[ 0., 1., 2.], @@ -393,8 +393,8 @@ public void atleast_1dTest() // >>> np.atleast_1d(x) is x // True // - - #if TODO + +#if TODO given= x = np.arange(9.0).reshape(3,3); given= np.atleast_1d(x); expected= @@ -406,41 +406,41 @@ public void atleast_1dTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.atleast_1d(1, [3, 4]) // [array([1]), array([3, 4])] // - - #if TODO + +#if TODO given= np.atleast_1d(1, {3, 4}); expected= "[array([1]), array([3, 4])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void atleast_2dTest() { // >>> np.atleast_2d(3.0) // array([[ 3.]]) // - - #if TODO + +#if TODO var given= np.atleast_2d(3.0); var expected= "array([[ 3.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(3.0) // >>> np.atleast_2d(x) // array([[ 0., 1., 2.]]) // >>> np.atleast_2d(x).base is x // True // - - #if TODO + +#if TODO given= x = np.arange(3.0); given= np.atleast_2d(x); expected= @@ -450,53 +450,53 @@ public void atleast_2dTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.atleast_2d(1, [1, 2], [[1, 2]]) // [array([[1]]), array([[1, 2]]), array([[1, 2]])] // - - #if TODO + +#if TODO given= np.atleast_2d(1, {1, 2}, {{1, 2}}); expected= "[array([[1]]), array([[1, 2]]), array([[1, 2]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void atleast_3dTest() { // >>> np.atleast_3d(3.0) // array([[[ 3.]]]) // - - #if TODO + +#if TODO var given= np.atleast_3d(3.0); var expected= "array([[[ 3.]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(3.0) // >>> np.atleast_3d(x).shape // (1, 3, 1) // - - #if TODO + +#if TODO given= x = np.arange(3.0); given= np.atleast_3d(x).shape; expected= "(1, 3, 1)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(12.0).reshape(4,3) // >>> np.atleast_3d(x).shape // (4, 3, 1) // >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself // True // - - #if TODO + +#if TODO given= x = np.arange(12.0).reshape(4,3); given= np.atleast_3d(x).shape; expected= @@ -506,7 +506,7 @@ public void atleast_3dTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): // ... print(arr, arr.shape) // ... @@ -516,8 +516,8 @@ public void atleast_3dTest() // [2]]] (1, 2, 1) // [[[1 2]]] (1, 1, 2) // - - #if TODO + +#if TODO given= for arr in np.atleast_3d({1, 2}, {{1, 2}}, {{{1, 2}}}):; expected= "... print(arr, arr.shape)\n" + @@ -528,25 +528,25 @@ public void atleast_3dTest() " [2]]] (1, 2, 1)\n" + "[[[1 2]]] (1, 1, 2)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void broadcastTest() { // Manually adding two vectors, using broadcasting: - + // >>> x = np.array([[1], [2], [3]]) // >>> y = np.array([4, 5, 6]) // >>> b = np.broadcast(x, y) // - - #if TODO + +#if TODO var given= x = np.array({{1}, {2}, {3}}); given= y = np.array({4, 5, 6}); given= b = np.broadcast(x, y); - #endif +#endif // >>> out = np.empty(b.shape) // >>> out.flat = [u+v for (u,v) in b] // >>> out @@ -554,8 +554,8 @@ public void broadcastTest() // [ 6., 7., 8.], // [ 7., 8., 9.]]) // - - #if TODO + +#if TODO given= out = np.empty(b.shape); given= out.flat = [u+v for (u,v) in b]; given= out; @@ -564,31 +564,31 @@ public void broadcastTest() " [ 6., 7., 8.],\n" + " [ 7., 8., 9.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Compare against built-in broadcasting: - + // >>> x + y // array([[5, 6, 7], // [6, 7, 8], // [7, 8, 9]]) // - - #if TODO + +#if TODO given= x + y; expected= "array([[5, 6, 7],\n" + " [6, 7, 8],\n" + " [7, 8, 9]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.array([1, 2, 3]) // >>> y = np.array([[4], [5], [6]]) // >>> b = np.broadcast(x, y) // >>> b.nd // 2 // - - #if TODO + +#if TODO given= x = np.array({1, 2, 3}); given= y = np.array({{4}, {5}, {6}}); given= b = np.broadcast(x, y); @@ -596,12 +596,12 @@ public void broadcastTest() expected= "2"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Methods - + } - - + + [TestMethod] public void broadcast_toTest() { @@ -611,8 +611,8 @@ public void broadcast_toTest() // [1, 2, 3], // [1, 2, 3]]) // - - #if TODO + +#if TODO var given= x = np.array({1, 2, 3}); given= np.broadcast_to(x, (3, 3)); var expected= @@ -620,10 +620,10 @@ public void broadcast_toTest() " [1, 2, 3],\n" + " [1, 2, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void broadcast_arraysTest() { @@ -634,8 +634,8 @@ public void broadcast_arraysTest() // [1, 2, 3]]), array([[4, 4, 4], // [5, 5, 5]])] // - - #if TODO + +#if TODO var given= x = np.array({{1,2,3}}); given= y = np.array({{4},{5}}); given= np.broadcast_arrays(x, y); @@ -644,27 +644,27 @@ public void broadcast_arraysTest() " [1, 2, 3]]), array([[4, 4, 4],\n" + " [5, 5, 5]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Here is a useful idiom for getting contiguous copies instead of // non-contiguous views. - + // >>> [np.array(a) for a in np.broadcast_arrays(x, y)] // [array([[1, 2, 3], // [1, 2, 3]]), array([[4, 4, 4], // [5, 5, 5]])] // - - #if TODO + +#if TODO given= {np.array(a) for a in np.broadcast_arrays(x, y)}; expected= "[array([[1, 2, 3],\n" + " [1, 2, 3]]), array([[4, 4, 4],\n" + " [5, 5, 5]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void expand_dimsTest() { @@ -672,24 +672,24 @@ public void expand_dimsTest() // >>> x.shape // (2,) // - - #if TODO + +#if TODO var given= x = np.array({1,2}); given= x.shape; var expected= "(2,)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The following is equivalent to x[np.newaxis,:] or x[np.newaxis]: - + // >>> y = np.expand_dims(x, axis=0) // >>> y // array([[1, 2]]) // >>> y.shape // (1, 2) // - - #if TODO + +#if TODO given= y = np.expand_dims(x, axis=0); given= y; expected= @@ -699,7 +699,7 @@ public void expand_dimsTest() expected= "(1, 2)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> y = np.expand_dims(x, axis=1) # Equivalent to x[:,np.newaxis] // >>> y // array([[1], @@ -707,8 +707,8 @@ public void expand_dimsTest() // >>> y.shape // (2, 1) // - - #if TODO + +#if TODO given= y = np.expand_dims(x, axis=1) # Equivalent to x{:,np.newaxis}; given= y; expected= @@ -719,23 +719,23 @@ public void expand_dimsTest() expected= "(2, 1)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note that some examples may use None instead of np.newaxis. These // are the same objects: - + // >>> np.newaxis is None // True // - - #if TODO + +#if TODO given= np.newaxis is None; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void squeezeTest() { @@ -753,8 +753,8 @@ public void squeezeTest() // >>> np.squeeze(x, axis=2).shape // (1, 3) // - - #if TODO + +#if TODO var given= x = np.array({{{0}, {1}, {2}}}); given= x.shape; var expected= @@ -778,10 +778,10 @@ public void squeezeTest() expected= "(1, 3)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void asfarrayTest() { @@ -792,8 +792,8 @@ public void asfarrayTest() // >>> np.asfarray([2, 3], dtype='int8') // array([ 2., 3.]) // - - #if TODO + +#if TODO var given= np.asfarray({2, 3}); var expected= "array([ 2., 3.])"; @@ -806,10 +806,10 @@ public void asfarrayTest() expected= "array([ 2., 3.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void asfortranarrayTest() { @@ -820,8 +820,8 @@ public void asfortranarrayTest() // >>> y.flags['F_CONTIGUOUS'] // True // - - #if TODO + +#if TODO var given= x = np.arange(6).reshape(2,3); given= y = np.asfortranarray(x); given= x.flags['F_CONTIGUOUS']; @@ -832,33 +832,33 @@ public void asfortranarrayTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note: This function returns an array with at least one-dimension (1-d) // so it will not preserve 0-d arrays. - + } - - + + [TestMethod] public void asarray_chkfiniteTest() { // Convert a list into an array. If all elements are finite // asarray_chkfinite is identical to asarray. - + // >>> a = [1, 2] // >>> np.asarray_chkfinite(a, dtype=float) // array([1., 2.]) // - - #if TODO + +#if TODO var given= a = [1, 2]; given= np.asarray_chkfinite(a, dtype=float); var expected= "array([1., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Raises ValueError if array_like contains Nans or Infs. - + // >>> a = [1, 2, np.inf] // >>> try: // ... np.asarray_chkfinite(a) @@ -867,8 +867,8 @@ public void asarray_chkfiniteTest() // ... // ValueError // - - #if TODO + +#if TODO given= a = {1, 2, np.inf}; given= try:; expected= @@ -878,26 +878,26 @@ public void asarray_chkfiniteTest() "...\n" + "ValueError"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void asscalarTest() { // >>> np.asscalar(np.array([24])) // 24 // - - #if TODO + +#if TODO var given= np.asscalar(np.array({24})); var expected= "24"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void requireTest() { @@ -911,8 +911,8 @@ public void requireTest() // WRITEBACKIFCOPY : False // UPDATEIFCOPY : False // - - #if TODO + +#if TODO var given= x = np.arange(6).reshape(2,3); given= x.flags; var expected= @@ -924,7 +924,7 @@ public void requireTest() " WRITEBACKIFCOPY : False\n" + " UPDATEIFCOPY : False"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F']) // >>> y.flags // C_CONTIGUOUS : False @@ -935,8 +935,8 @@ public void requireTest() // WRITEBACKIFCOPY : False // UPDATEIFCOPY : False // - - #if TODO + +#if TODO given= y = np.require(x, dtype=np.float32, requirements={'A', 'O', 'W', 'F'}); given= y.flags; expected= @@ -948,10 +948,10 @@ public void requireTest() " WRITEBACKIFCOPY : False\n" + " UPDATEIFCOPY : False"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void concatenateTest() { @@ -967,28 +967,32 @@ public void concatenateTest() // >>> np.concatenate((a, b), axis=None) // array([1, 2, 3, 4, 5, 6]) // - - #if TODO - var given= a = np.array({{1, 2}, {3, 4}}); - given= b = np.array({{5, 6}}); - given= np.concatenate((a, b), axis=0); - var expected= + + + var a = np.array(new[,] { { 1, 2 }, { 3, 4 } }); + var b = np.array(new[,] { { 5, 6 } }); + var given = np.concatenate(new[] { a, b }, axis: 0); + var expected = "array([[1, 2],\n" + " [3, 4],\n" + " [5, 6]])"; Assert.AreEqual(expected, given.repr); - given= np.concatenate((a, b.T), axis=1); - expected= + given = np.concatenate((a, b.T), axis: 1); + expected = "array([[1, 2, 5],\n" + " [3, 4, 6]])"; Assert.AreEqual(expected, given.repr); - given= np.concatenate((a, b), axis=None); - expected= + given = np.concatenate((a, b), axis: null); + expected = "array([1, 2, 3, 4, 5, 6])"; Assert.AreEqual(expected, given.repr); - #endif + } + + [Ignore("np.ma not wrapped yet")] + public void ConcatenateMaskedArrayTest() + { // This function will not preserve masking of MaskedArray inputs. - + // >>> a = np.ma.arange(3) // >>> a[1] = np.ma.masked // >>> b = np.arange(2, 5) @@ -1007,8 +1011,8 @@ public void concatenateTest() // mask=[False, True, False, False, False, False], // fill_value=999999) // - - #if TODO + +#if TODO given= a = np.ma.arange(3); given= a{1} = np.ma.masked; given= b = np.arange(2, 5); @@ -1034,10 +1038,10 @@ public void concatenateTest() " mask=[False, True, False, False, False, False],\n" + " fill_value=999999)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void stackTest() { @@ -1045,42 +1049,42 @@ public void stackTest() // >>> np.stack(arrays, axis=0).shape // (10, 3, 4) // - - #if TODO + +#if TODO var given= arrays = {np.random.randn(3, 4) for _ in range(10)}; given= np.stack(arrays, axis=0).shape; var expected= "(10, 3, 4)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.stack(arrays, axis=1).shape // (3, 10, 4) // - - #if TODO + +#if TODO given= np.stack(arrays, axis=1).shape; expected= "(3, 10, 4)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.stack(arrays, axis=2).shape // (3, 4, 10) // - - #if TODO + +#if TODO given= np.stack(arrays, axis=2).shape; expected= "(3, 4, 10)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.array([1, 2, 3]) // >>> b = np.array([2, 3, 4]) // >>> np.stack((a, b)) // array([[1, 2, 3], // [2, 3, 4]]) // - - #if TODO + +#if TODO given= a = np.array({1, 2, 3}); given= b = np.array({2, 3, 4}); given= np.stack((a, b)); @@ -1088,24 +1092,24 @@ public void stackTest() "array([[1, 2, 3],\n" + " [2, 3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.stack((a, b), axis=-1) // array([[1, 2], // [2, 3], // [3, 4]]) // - - #if TODO + +#if TODO given= np.stack((a, b), axis=-1); expected= "array([[1, 2],\n" + " [2, 3],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void column_stackTest() { @@ -1116,20 +1120,18 @@ public void column_stackTest() // [2, 3], // [3, 4]]) // - - #if TODO - var given= a = np.array((1,2,3)); - given= b = np.array((2,3,4)); - given= np.column_stack((a,b)); - var expected= + + var a = np.array(1, 2, 3); + var b = np.array(2, 3, 4); + var given = np.column_stack(a, b); + var expected = "array([[1, 2],\n" + " [2, 3],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif } - - + + [TestMethod] public void dstackTest() { @@ -1140,8 +1142,8 @@ public void dstackTest() // [2, 3], // [3, 4]]]) // - - #if TODO + +#if TODO var given= a = np.array((1,2,3)); given= b = np.array((2,3,4)); given= np.dstack((a,b)); @@ -1150,7 +1152,7 @@ public void dstackTest() " [2, 3],\n" + " [3, 4]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.array([[1],[2],[3]]) // >>> b = np.array([[2],[3],[4]]) // >>> np.dstack((a,b)) @@ -1158,8 +1160,8 @@ public void dstackTest() // [[2, 3]], // [[3, 4]]]) // - - #if TODO + +#if TODO given= a = np.array({{1},{2},{3}}); given= b = np.array({{2},{3},{4}}); given= np.dstack((a,b)); @@ -1168,10 +1170,10 @@ public void dstackTest() " [[2, 3]],\n" + " [[3, 4]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void hstackTest() { @@ -1186,8 +1188,8 @@ public void hstackTest() // [2, 3], // [3, 4]]) // - - #if TODO + +#if TODO var given= a = np.array((1,2,3)); given= b = np.array((2,3,4)); given= np.hstack((a,b)); @@ -1202,10 +1204,10 @@ public void hstackTest() " [2, 3],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void vstackTest() { @@ -1215,8 +1217,8 @@ public void vstackTest() // array([[1, 2, 3], // [2, 3, 4]]) // - - #if TODO + +#if TODO var given= a = np.array({1, 2, 3}); given= b = np.array({2, 3, 4}); given= np.vstack((a,b)); @@ -1224,7 +1226,7 @@ public void vstackTest() "array([[1, 2, 3],\n" + " [2, 3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.array([[1], [2], [3]]) // >>> b = np.array([[2], [3], [4]]) // >>> np.vstack((a,b)) @@ -1235,8 +1237,8 @@ public void vstackTest() // [3], // [4]]) // - - #if TODO + +#if TODO given= a = np.array({{1}, {2}, {3}}); given= b = np.array({{2}, {3}, {4}}); given= np.vstack((a,b)); @@ -1248,15 +1250,15 @@ public void vstackTest() " [3],\n" + " [4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void blockTest() { // The most common use of this function is to build a block matrix - + // >>> A = np.eye(2) * 2 // >>> B = np.eye(3) * 3 // >>> np.block([ @@ -1269,8 +1271,8 @@ public void blockTest() // [ 1., 1., 0., 3., 0.], // [ 1., 1., 0., 0., 3.]]) // - - #if TODO + +#if TODO var given= A = np.eye(2) * 2; given= B = np.eye(3) * 3; given= np.block({; @@ -1284,41 +1286,41 @@ public void blockTest() " [ 1., 1., 0., 3., 0.],\n" + " [ 1., 1., 0., 0., 3.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // With a list of depth 1, block can be used as hstack - + // >>> np.block([1, 2, 3]) # hstack([1, 2, 3]) // array([1, 2, 3]) // - - #if TODO + +#if TODO given= np.block({1, 2, 3}) # hstack({1, 2, 3}); expected= "array([1, 2, 3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.array([1, 2, 3]) // >>> b = np.array([2, 3, 4]) // >>> np.block([a, b, 10]) # hstack([a, b, 10]) // array([1, 2, 3, 2, 3, 4, 10]) // - - #if TODO + +#if TODO given= a = np.array({1, 2, 3}); given= b = np.array({2, 3, 4}); given= np.block({a, b, 10}) # hstack({a, b, 10}); expected= "array([1, 2, 3, 2, 3, 4, 10])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> A = np.ones((2, 2), int) // >>> B = 2 * A // >>> np.block([A, B]) # hstack([A, B]) // array([[1, 1, 2, 2], // [1, 1, 2, 2]]) // - - #if TODO + +#if TODO given= A = np.ones((2, 2), int); given= B = 2 * A; given= np.block({A, B}) # hstack({A, B}); @@ -1326,17 +1328,17 @@ public void blockTest() "array([[1, 1, 2, 2],\n" + " [1, 1, 2, 2]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // With a list of depth 2, block can be used in place of vstack: - + // >>> a = np.array([1, 2, 3]) // >>> b = np.array([2, 3, 4]) // >>> np.block([[a], [b]]) # vstack([a, b]) // array([[1, 2, 3], // [2, 3, 4]]) // - - #if TODO + +#if TODO given= a = np.array({1, 2, 3}); given= b = np.array({2, 3, 4}); given= np.block({{a}, {b}}) # vstack({a, b}); @@ -1344,7 +1346,7 @@ public void blockTest() "array([[1, 2, 3],\n" + " [2, 3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> A = np.ones((2, 2), int) // >>> B = 2 * A // >>> np.block([[A], [B]]) # vstack([A, B]) @@ -1353,8 +1355,8 @@ public void blockTest() // [2, 2], // [2, 2]]) // - - #if TODO + +#if TODO given= A = np.ones((2, 2), int); given= B = 2 * A; given= np.block({{A}, {B}}) # vstack({A, B}); @@ -1364,9 +1366,9 @@ public void blockTest() " [2, 2],\n" + " [2, 2]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // It can also be used in places of atleast_1d and atleast_2d - + // >>> a = np.array(0) // >>> b = np.array([1]) // >>> np.block([a]) # atleast_1d(a) @@ -1374,8 +1376,8 @@ public void blockTest() // >>> np.block([b]) # atleast_1d(b) // array([1]) // - - #if TODO + +#if TODO given= a = np.array(0); given= b = np.array({1}); given= np.block({a}) # atleast_1d(a); @@ -1386,14 +1388,14 @@ public void blockTest() expected= "array([1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.block([[a]]) # atleast_2d(a) // array([[0]]) // >>> np.block([[b]]) # atleast_2d(b) // array([[1]]) // - - #if TODO + +#if TODO given= np.block({{a}}) # atleast_2d(a); expected= "array([[0]])"; @@ -1402,10 +1404,10 @@ public void blockTest() expected= "array([[1]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void splitTest() { @@ -1413,14 +1415,14 @@ public void splitTest() // >>> np.split(x, 3) // [array([ 0., 1., 2.]), array([ 3., 4., 5.]), array([ 6., 7., 8.])] // - - #if TODO + +#if TODO var given= x = np.arange(9.0); given= np.split(x, 3); var expected= "[array([ 0., 1., 2.]), array([ 3., 4., 5.]), array([ 6., 7., 8.])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(8.0) // >>> np.split(x, [3, 5, 6, 10]) // [array([ 0., 1., 2.]), @@ -1429,8 +1431,8 @@ public void splitTest() // array([ 6., 7.]), // array([], dtype=float64)] // - - #if TODO + +#if TODO given= x = np.arange(8.0); given= np.split(x, {3, 5, 6, 10}); expected= @@ -1440,10 +1442,10 @@ public void splitTest() " array([ 6., 7.]),\n" + " array([], dtype=float64)]"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void tileTest() { @@ -1457,8 +1459,8 @@ public void tileTest() // array([[[0, 1, 2, 0, 1, 2]], // [[0, 1, 2, 0, 1, 2]]]) // - - #if TODO + +#if TODO var given= a = np.array({0, 1, 2}); given= np.tile(a, 2); var expected= @@ -1474,7 +1476,7 @@ public void tileTest() "array([[[0, 1, 2, 0, 1, 2]],\n" + " [[0, 1, 2, 0, 1, 2]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> b = np.array([[1, 2], [3, 4]]) // >>> np.tile(b, 2) // array([[1, 2, 1, 2], @@ -1485,8 +1487,8 @@ public void tileTest() // [1, 2], // [3, 4]]) // - - #if TODO + +#if TODO given= b = np.array({{1, 2}, {3, 4}}); given= np.tile(b, 2); expected= @@ -1500,7 +1502,7 @@ public void tileTest() " [1, 2],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> c = np.array([1,2,3,4]) // >>> np.tile(c,(4,1)) // array([[1, 2, 3, 4], @@ -1508,8 +1510,8 @@ public void tileTest() // [1, 2, 3, 4], // [1, 2, 3, 4]]) // - - #if TODO + +#if TODO given= c = np.array({1,2,3,4}); given= np.tile(c,(4,1)); expected= @@ -1518,10 +1520,10 @@ public void tileTest() " [1, 2, 3, 4],\n" + " [1, 2, 3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void repeatTest() { @@ -1538,8 +1540,8 @@ public void repeatTest() // [3, 4], // [3, 4]]) // - - #if TODO + +#if TODO var given= np.repeat(3, 4); var expected= "array([3, 3, 3, 3])"; @@ -1560,10 +1562,10 @@ public void repeatTest() " [3, 4],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void deleteTest() { @@ -1576,21 +1578,20 @@ public void deleteTest() // array([[ 1, 2, 3, 4], // [ 9, 10, 11, 12]]) // - - #if TODO - var given= arr = np.array({{1,2,3,4}, {5,6,7,8}, {9,10,11,12}}); - given= arr; - var expected= + + NDarray given = np.array(new[,] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } }); + var arr = given; + var expected = "array([[ 1, 2, 3, 4],\n" + " [ 5, 6, 7, 8],\n" + " [ 9, 10, 11, 12]])"; Assert.AreEqual(expected, given.repr); - given= np.delete(arr, 1, 0); - expected= - "array([[ 1, 2, 3, 4],\n" + - " [ 9, 10, 11, 12]])"; + given = np.delete(arr, 1, 0); + expected = + "array([[ 1, 2, 3, 4],\n" + + " [ 9, 10, 11, 12]])"; Assert.AreEqual(expected, given.repr); - #endif + // >>> np.delete(arr, np.s_[::2], 1) // array([[ 2, 4], // [ 6, 8], @@ -1598,22 +1599,21 @@ public void deleteTest() // >>> np.delete(arr, [1,3,5], None) // array([ 1, 3, 5, 7, 8, 9, 10, 11, 12]) // - - #if TODO - given= np.delete(arr, np.s_{::2}, 1); - expected= - "array([[ 2, 4],\n" + - " [ 6, 8],\n" + - " [10, 12]])"; + + + given = np.delete(arr, new Slice("::2"), 1); + expected = + "array([[ 2, 4],\n" + + " [ 6, 8],\n" + + " [10, 12]])"; Assert.AreEqual(expected, given.repr); - given= np.delete(arr, {1,3,5}, None); - expected= - "array([ 1, 3, 5, 7, 8, 9, 10, 11, 12])"; + given = np.delete(arr, new[] { 1, 3, 5 }, null); + expected = + "array([ 1, 3, 5, 7, 8, 9, 10, 11, 12])"; Assert.AreEqual(expected, given.repr); - #endif } - - + + [TestMethod] public void insertTest() { @@ -1629,149 +1629,127 @@ public void insertTest() // [2, 5, 2], // [3, 5, 3]]) // - - #if TODO - var given= a = np.array({{1, 1}, {2, 2}, {3, 3}}); - given= a; - var expected= + + NDarray a = np.array(new[,] { { 1, 1 }, { 2, 2 }, { 3, 3 } }); + var given = a; + var expected = "array([[1, 1],\n" + " [2, 2],\n" + " [3, 3]])"; Assert.AreEqual(expected, given.repr); - given= np.insert(a, 1, 5); - expected= + given = np.insert(a, 1, 5); + expected = "array([1, 5, 1, 2, 2, 3, 3])"; Assert.AreEqual(expected, given.repr); - given= np.insert(a, 1, 5, axis=1); - expected= + given = np.insert(a, 1, 5, axis: 1); + expected = "array([[1, 5, 1],\n" + " [2, 5, 2],\n" + " [3, 5, 3]])"; Assert.AreEqual(expected, given.repr); - #endif + // Difference between sequence and scalars: - + // >>> np.insert(a, [1], [[1],[2],[3]], axis=1) // array([[1, 1, 1], // [2, 2, 2], // [3, 3, 3]]) + given = np.insert(a, np.array(1), np.array(new[,] { { 1 }, { 2 }, { 3 } }), axis: 1); + expected = + "array([[1, 1, 1],\n" + + " [2, 2, 2],\n" + + " [3, 3, 3]])"; + // >>> np.array_equal(np.insert(a, 1, [1, 2, 3], axis=1), // ... np.insert(a, [1], [[1],[2],[3]], axis=1)) // True // - - #if TODO - given= np.insert(a, {1}, {{1},{2},{3}}, axis=1); - expected= - "array([[1, 1, 1],\n" + - " [2, 2, 2],\n" + - " [3, 3, 3]])"; Assert.AreEqual(expected, given.repr); - given= np.array_equal(np.insert(a, 1, {1, 2, 3}, axis=1),; - expected= - "... np.insert(a, [1], [[1],[2],[3]], axis=1))\n" + - "True"; - Assert.AreEqual(expected, given.repr); - #endif + var equal = np.array_equal(np.insert(a, 1, np.array(new[] { 1, 2, 3 }), axis: 1), + np.insert(a, np.array(1), np.array(new[,] { { 1 }, { 2 }, { 3 } }), axis: 1)); + Assert.AreEqual(true, equal); + // >>> b = a.flatten() // >>> b // array([1, 1, 2, 2, 3, 3]) // >>> np.insert(b, [2, 2], [5, 6]) // array([1, 1, 5, 6, 2, 2, 3, 3]) // - - #if TODO - given= b = a.flatten(); - given= b; - expected= - "array([1, 1, 2, 2, 3, 3])"; + + var b = a.flatten(); + given = b; + expected = + "array([1, 1, 2, 2, 3, 3])"; Assert.AreEqual(expected, given.repr); - given= np.insert(b, {2, 2}, {5, 6}); - expected= - "array([1, 1, 5, 6, 2, 2, 3, 3])"; + given = np.insert(b, np.array(new[] { 2, 2 }), np.array(new[] { 5, 6 })); + expected = + "array([1, 1, 5, 6, 2, 2, 3, 3])"; Assert.AreEqual(expected, given.repr); - #endif + // >>> np.insert(b, slice(2, 4), [5, 6]) // array([1, 1, 5, 2, 6, 2, 3, 3]) // - - #if TODO - given= np.insert(b, slice(2, 4), {5, 6}); - expected= - "array([1, 1, 5, 2, 6, 2, 3, 3])"; + + given = np.insert(b, new Slice(2, 4), np.array(new[] { 5, 6 })); + expected = + "array([1, 1, 5, 2, 6, 2, 3, 3])"; Assert.AreEqual(expected, given.repr); - #endif // >>> np.insert(b, [2, 2], [7.13, False]) # type casting // array([1, 1, 7, 0, 2, 2, 3, 3]) // - - #if TODO - given= np.insert(b, {2, 2}, {7.13, False}) # type casting; - expected= + +#if NOT_SUPPORTED + given = np.insert(b, np.array(new[] { 2, 2 }), np.array(new object[] { 7.13, false })); // type casting + expected= "array([1, 1, 7, 0, 2, 2, 3, 3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif + // >>> x = np.arange(8).reshape(2, 4) // >>> idx = (1, 3) // >>> np.insert(x, idx, 999, axis=1) // array([[ 0, 999, 1, 2, 999, 3], // [ 4, 999, 5, 6, 999, 7]]) // - - #if TODO - given= x = np.arange(8).reshape(2, 4); - given= idx = (1, 3); - given= np.insert(x, idx, 999, axis=1); - expected= - "array([[ 0, 999, 1, 2, 999, 3],\n" + - " [ 4, 999, 5, 6, 999, 7]])"; + + + var x = np.arange(8).reshape(2, 4); + NDarray idx = np.array(1, 3); + given = np.insert(x, idx, np.array(999), axis: 1); + expected = + "array([[ 0, 999, 1, 2, 999, 3],\n" + + " [ 4, 999, 5, 6, 999, 7]])"; Assert.AreEqual(expected, given.repr); - #endif } - - + + [TestMethod] public void appendTest() { // >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) // array([1, 2, 3, 4, 5, 6, 7, 8, 9]) // - - #if TODO - var given= np.append({1, 2, 3}, {{4, 5, 6}, {7, 8, 9}}); - var expected= + + var given = np.append(new int[] { 1, 2, 3 }, new int[,] { { 4, 5, 6 }, { 7, 8, 9 } }); + var expected = "array([1, 2, 3, 4, 5, 6, 7, 8, 9])"; Assert.AreEqual(expected, given.repr); - #endif // When axis is specified, values must have the correct shape. - + // >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) // array([[1, 2, 3], // [4, 5, 6], // [7, 8, 9]]) - // >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) - // Traceback (most recent call last): - // ... - // ValueError: arrays must have same number of dimensions - // - - #if TODO - given= np.append({{1, 2, 3}, {4, 5, 6}}, {{7, 8, 9}}, axis=0); - expected= - "array([[1, 2, 3],\n" + - " [4, 5, 6],\n" + - " [7, 8, 9]])"; - Assert.AreEqual(expected, given.repr); - given= np.append({{1, 2, 3}, {4, 5, 6}}, {7, 8, 9}, axis=0); - expected= - "Traceback (most recent call last):\n" + - "...\n" + - "ValueError: arrays must have same number of dimensions"; + + given = np.append(new int[,] { { 1, 2, 3 }, { 4, 5, 6 } }, new int[,] { { 7, 8, 9 } }, axis: 0); + expected = + "array([[1, 2, 3],\n" + + " [4, 5, 6],\n" + + " [7, 8, 9]])"; Assert.AreEqual(expected, given.repr); - #endif } - - + + [TestMethod] public void resizeTest() { @@ -1785,8 +1763,8 @@ public void resizeTest() // array([[0, 1, 2, 3], // [0, 1, 2, 3]]) // - - #if TODO + +#if TODO var given= a=np.array({{0,1},{2,3}}); given= np.resize(a,(2,3)); var expected= @@ -1802,10 +1780,10 @@ public void resizeTest() "array([[0, 1, 2, 3],\n" + " [0, 1, 2, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void trim_zerosTest() { @@ -1813,39 +1791,38 @@ public void trim_zerosTest() // >>> np.trim_zeros(a) // array([1, 2, 3, 0, 2, 1]) // - - #if TODO + +#if TODO var given= a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0)); given= np.trim_zeros(a); var expected= "array([1, 2, 3, 0, 2, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.trim_zeros(a, 'b') // array([0, 0, 0, 1, 2, 3, 0, 2, 1]) // - - #if TODO + +#if TODO given= np.trim_zeros(a, 'b'); expected= "array([0, 0, 0, 1, 2, 3, 0, 2, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The input data type is preserved, list/tuple in means list/tuple out. - + // >>> np.trim_zeros([0, 1, 2, 0]) // [1, 2] // - - #if TODO + +#if TODO given= np.trim_zeros({0, 1, 2, 0}); expected= "[1, 2]"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + [TestMethod] public void uniqueTest() { @@ -1855,34 +1832,32 @@ public void uniqueTest() // >>> np.unique(a) // array([1, 2, 3]) // - - #if TODO - var given= np.unique({1, 1, 2, 2, 3, 3}); - var expected= + + var given = np.unique(new[] { 1, 1, 2, 2, 3, 3 }); + var expected = "array([1, 2, 3])"; Assert.AreEqual(expected, given.repr); - given= a = np.array({{1, 1}, {2, 3}}); - given= np.unique(a); - expected= - "array([1, 2, 3])"; + var a = np.array(new[,] { { 1, 1 }, { 2, 3 } }); + given = np.unique(a); + expected = + "array([1, 2, 3])"; Assert.AreEqual(expected, given.repr); - #endif // Return the unique rows of a 2D array - + // >>> a = np.array([[1, 0, 0], [1, 0, 0], [2, 3, 4]]) // >>> np.unique(a, axis=0) // array([[1, 0, 0], [2, 3, 4]]) // - - #if TODO - given= a = np.array({{1, 0, 0}, {1, 0, 0}, {2, 3, 4}}); - given= np.unique(a, axis=0); - expected= - "array([[1, 0, 0], [2, 3, 4]])"; + + + a = np.array(new[,] { { 1, 0, 0 }, { 1, 0, 0 }, { 2, 3, 4 } }); + given = np.unique(a, axis: 0); + expected = + "array([[1, 0, 0],\n [2, 3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif + // Return the indices of the original array that give the unique values: - + // >>> a = np.array(['a', 'b', 'b', 'c', 'a']) // >>> u, indices = np.unique(a, return_index=True) // >>> u @@ -1894,27 +1869,25 @@ public void uniqueTest() // array(['a', 'b', 'c'], // dtype='|S1') // - - #if TODO - given= a = np.array({'a', 'b', 'b', 'c', 'a'}); - given= u, indices = np.unique(a, return_index=True); - given= u; - expected= - "array(['a', 'b', 'c'],\n" + - " dtype='|S1')"; - Assert.AreEqual(expected, given.repr); - given= indices; - expected= - "array([0, 1, 3])"; - Assert.AreEqual(expected, given.repr); - given= a[indices]; - expected= - "array(['a', 'b', 'c'],\n" + - " dtype='|S1')"; + + var a1 = np.array(new[] { 1, 2, 2, 3, 1 }); + var rv = np.unique(a1, return_index: true, return_inverse: false, return_counts: false); + var (u, indices) = (rv[0], rv[1]); + given = u; + expected = + "array([1, 2, 3])"; + Assert.AreEqual(expected, given.repr); + given = indices; + expected = + "array([0, 1, 3], dtype=int64)"; + Assert.AreEqual(expected, given.repr); + given = a1[indices]; + expected = + "array([1, 2, 3])"; Assert.AreEqual(expected, given.repr); - #endif + // Reconstruct the input array from the unique values: - + // >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) // >>> u, indices = np.unique(a, return_inverse=True) // >>> u @@ -1924,26 +1897,24 @@ public void uniqueTest() // >>> u[indices] // array([1, 2, 6, 4, 2, 3, 2]) // - - #if TODO - given= a = np.array({1, 2, 6, 4, 2, 3, 2}); - given= u, indices = np.unique(a, return_inverse=True); - given= u; - expected= - "array([1, 2, 3, 4, 6])"; + + a = np.array(new[] { 1, 2, 6, 4, 2, 3, 2 }); + rv = np.unique(a, return_inverse: true, return_counts: false, return_index: false); + (u, indices) = (rv[0], rv[1]); + given = u; + expected = + "array([1, 2, 3, 4, 6])"; Assert.AreEqual(expected, given.repr); - given= indices; - expected= - "array([0, 1, 4, 3, 1, 2, 1])"; + given = indices; + expected = + "array([0, 1, 4, 3, 1, 2, 1], dtype=int64)"; Assert.AreEqual(expected, given.repr); - given= u[indices]; - expected= - "array([1, 2, 6, 4, 2, 3, 2])"; + given = u[indices]; + expected = + "array([1, 2, 6, 4, 2, 3, 2])"; Assert.AreEqual(expected, given.repr); - #endif } - - + [TestMethod] public void flipTest() { @@ -1977,8 +1948,8 @@ public void flipTest() // >>> np.all(flip(A,2) == A[:,:,::-1,...]) // True // - - #if TODO + +#if TODO var given= A = np.arange(8).reshape((2,2,2)); given= A; var expected= @@ -2020,10 +1991,10 @@ public void flipTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fliplrTest() { @@ -2037,8 +2008,8 @@ public void fliplrTest() // [ 0., 2., 0.], // [ 3., 0., 0.]]) // - - #if TODO + +#if TODO var given= A = np.diag({1.,2.,3.}); given= A; var expected= @@ -2052,22 +2023,22 @@ public void fliplrTest() " [ 0., 2., 0.],\n" + " [ 3., 0., 0.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> A = np.random.randn(2,3,5) // >>> np.all(np.fliplr(A) == A[:,::-1,...]) // True // - - #if TODO + +#if TODO given= A = np.random.randn(2,3,5); given= np.all(np.fliplr(A) == A{:,::-1,...}); expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void flipudTest() { @@ -2081,8 +2052,8 @@ public void flipudTest() // [ 0., 2., 0.], // [ 1., 0., 0.]]) // - - #if TODO + +#if TODO var given= A = np.diag({1.0, 2, 3}); given= A; var expected= @@ -2096,32 +2067,32 @@ public void flipudTest() " [ 0., 2., 0.],\n" + " [ 1., 0., 0.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> A = np.random.randn(2,3,5) // >>> np.all(np.flipud(A) == A[::-1,...]) // True // - - #if TODO + +#if TODO given= A = np.random.randn(2,3,5); given= np.all(np.flipud(A) == A{::-1,...}); expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.flipud([1,2]) // array([2, 1]) // - - #if TODO + +#if TODO given= np.flipud({1,2}); expected= "array([2, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rollTest() { @@ -2129,14 +2100,14 @@ public void rollTest() // >>> np.roll(x, 2) // array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7]) // - - #if TODO + +#if TODO var given= x = np.arange(10); given= np.roll(x, 2); var expected= "array([8, 9, 0, 1, 2, 3, 4, 5, 6, 7])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x2 = np.reshape(x, (2,5)) // >>> x2 // array([[0, 1, 2, 3, 4], @@ -2151,8 +2122,8 @@ public void rollTest() // array([[4, 0, 1, 2, 3], // [9, 5, 6, 7, 8]]) // - - #if TODO + +#if TODO given= x2 = np.reshape(x, (2,5)); given= x2; expected= @@ -2174,10 +2145,10 @@ public void rollTest() "array([[4, 0, 1, 2, 3],\n" + " [9, 5, 6, 7, 8]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rot90Test() { @@ -2198,8 +2169,8 @@ public void rot90Test() // [[5, 7], // [4, 6]]]) // - - #if TODO + +#if TODO var given= m = np.array({{1,2},{3,4}}, int); given= m; var expected= @@ -2224,8 +2195,8 @@ public void rot90Test() " [[5, 7],\n" + " [4, 6]]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - + } } diff --git a/test/Numpy.UnitTest/NumPy_datetime.tests.cs b/test/Numpy.UnitTest/NumPy_datetime.tests.cs index a55cbae..bf3d764 100644 --- a/test/Numpy.UnitTest/NumPy_datetime.tests.cs +++ b/test/Numpy.UnitTest/NumPy_datetime.tests.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; -using Python.Runtime; using Numpy.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/Numpy.UnitTest/NumPy_financial.tests.cs b/test/Numpy.UnitTest/NumPy_financial.tests.cs index bbfe762..17d78d2 100644 --- a/test/Numpy.UnitTest/NumPy_financial.tests.cs +++ b/test/Numpy.UnitTest/NumPy_financial.tests.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; -using Python.Runtime; using Numpy.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/Numpy.UnitTest/NumPy_indexing.tests.cs b/test/Numpy.UnitTest/NumPy_indexing.tests.cs index f0a732f..623eba3 100644 --- a/test/Numpy.UnitTest/NumPy_indexing.tests.cs +++ b/test/Numpy.UnitTest/NumPy_indexing.tests.cs @@ -152,19 +152,19 @@ public void nonzeroTest() // (array([0, 1, 2, 2]), array([0, 1, 0, 1])) // - #if TODO - var given= x = np.array({{3, 0, 0}, {0, 4, 0}, {5, 6, 0}}); - given= x; + + var x = np.array(new [,]{{3, 0, 0}, {0, 4, 0}, {5, 6, 0}}); + NDarray given= x; var expected= "array([[3, 0, 0],\n" + " [0, 4, 0],\n" + " [5, 6, 0]])"; Assert.AreEqual(expected, given.repr); - given= np.nonzero(x); - expected= - "(array([0, 1, 2, 2]), array([0, 1, 0, 1]))"; - Assert.AreEqual(expected, given.repr); - #endif + var given1= np.nonzero(x); + expected= + "(array([0, 1, 2, 2], dtype=int64), array([0, 1, 0, 1], dtype=int64))"; + Assert.AreEqual(expected, given1.repr()); + // >>> x[np.nonzero(x)] // array([3, 4, 5, 6]) // >>> np.transpose(np.nonzero(x)) @@ -173,25 +173,25 @@ public void nonzeroTest() // [2, 0], // [2, 1]) // - - #if TODO - given= x{np.nonzero(x)}; - expected= + + + given = x[np.nonzero(x)]; + expected = "array([3, 4, 5, 6])"; Assert.AreEqual(expected, given.repr); - given= np.transpose(np.nonzero(x)); - expected= + given = np.transpose(np.nonzero(x)); + expected = "array([[0, 0],\n" + " [1, 1],\n" + " [2, 0],\n" + - " [2, 1])"; + " [2, 1]], dtype=int64)"; Assert.AreEqual(expected, given.repr); - #endif + // A common use for nonzero is to find the indices of an array, where // a condition is True. Given an array a, the condition a > 3 is a // boolean array and since False is interpreted as 0, np.nonzero(a > 3) // yields the indices of the a where the condition is true. - + // >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) // >>> a > 3 // array([[False, False, False], @@ -200,53 +200,47 @@ public void nonzeroTest() // >>> np.nonzero(a > 3) // (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) // - - #if TODO - given= a = np.array({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}); - given= a > 3; - expected= + var a = np.array(new [,]{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}); + given = a > 3; + expected = "array([[False, False, False],\n" + " [ True, True, True],\n" + " [ True, True, True]])"; Assert.AreEqual(expected, given.repr); - given= np.nonzero(a > 3); - expected= - "(array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2]))"; - Assert.AreEqual(expected, given.repr); - #endif + given1 = np.nonzero(a > 3); + expected = + "(array([1, 1, 1, 2, 2, 2], dtype=int64), array([0, 1, 2, 0, 1, 2], dtype=int64))"; + Assert.AreEqual(expected, given1.repr()); + // Using this result to index a is equivalent to using the mask directly: - + // >>> a[np.nonzero(a > 3)] // array([4, 5, 6, 7, 8, 9]) // >>> a[a > 3] # prefer this spelling // array([4, 5, 6, 7, 8, 9]) // - - #if TODO - given= a{np.nonzero(a > 3)}; - expected= + given = a[np.nonzero(a > 3)]; + expected = "array([4, 5, 6, 7, 8, 9])"; Assert.AreEqual(expected, given.repr); - given= a[a > 3] # prefer this spelling; - expected= + given = a[a > 3]; // prefer this spelling + expected = "array([4, 5, 6, 7, 8, 9])"; Assert.AreEqual(expected, given.repr); - #endif - // nonzero can also be called as a method of the array. + + // nonzero can also be called as a method of the array. + // >>> (a > 3).nonzero() // (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) // - - #if TODO - given= (a > 3).nonzero(); - expected= - "(array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2]))"; - Assert.AreEqual(expected, given.repr); - #endif + given1 = (a > 3).nonzero(); + expected = + "(array([1, 1, 1, 2, 2, 2], dtype=int64), array([0, 1, 2, 0, 1, 2], dtype=int64))"; + Assert.AreEqual(expected, given1.repr()); } - - + + [TestMethod] public void whereTest() { @@ -257,9 +251,8 @@ public void whereTest() // array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) // - #if TODO - var given= a = np.arange(10); - given= a; + var a= np.arange(10); + var given= a; var expected= "array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"; Assert.AreEqual(expected, given.repr); @@ -267,7 +260,7 @@ public void whereTest() expected= "array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90])"; Assert.AreEqual(expected, given.repr); - #endif + // This can be used on multidimensional arrays too: // >>> np.where([[True, False], [True, True]], @@ -277,15 +270,12 @@ public void whereTest() // [3, 4]]) // - #if TODO - given= np.where({{True, False}, {True, True}},; + given= np.where(np.array(new[,]{{true, false}, {true, true}}), np.array(new[,] { { 1, 2 }, { 3, 4 } }), np.array(new[,] { { 9, 8 }, { 7, 6 } })); expected= - "... [[1, 2], [3, 4]],\n" + - "... [[9, 8], [7, 6]])\n" + "array([[1, 8],\n" + " [3, 4]])"; Assert.AreEqual(expected, given.repr); - #endif + // The shapes of x, y, and the condition are broadcast together: // >>> x, y = np.ogrid[:3, :4] @@ -295,6 +285,7 @@ public void whereTest() // [10, 11, 12, 2]]) // + // TODO: implement np.ogrid ! #if TODO given= x, y = np.ogrid{:3, :4}; given= np.where(x < y, x, 10 + y) # both x and 10+y are broadcast; @@ -304,6 +295,7 @@ public void whereTest() " [10, 11, 12, 2]])"; Assert.AreEqual(expected, given.repr); #endif + // >>> a = np.array([[0, 1, 2], // ... [0, 2, 4], // ... [0, 3, 6]]) @@ -313,19 +305,14 @@ public void whereTest() // [ 0, 3, -1]]) // - #if TODO - given= a = np.array({{0, 1, 2},; - expected= - "... [0, 2, 4],\n" + - "... [0, 3, 6]])"; - Assert.AreEqual(expected, given.repr); - given= np.where(a < 4, a, -1) # -1 is broadcast; - expected= + + a = np.array(new [,]{{0, 1, 2}, { 0, 2, 4}, { 0, 3, 6}}); + given = np.where(a < 4, a, np.array(-1)); // -1 is broadcast; + expected= "array([[ 0, 1, 2],\n" + " [ 0, 2, -1],\n" + " [ 0, 3, -1]])"; Assert.AreEqual(expected, given.repr); - #endif } @@ -907,15 +894,12 @@ public void takeTest() public void take_along_axisTest() { // For this sample array - + // >>> a = np.array([[10, 30, 20], [60, 40, 50]]) - // - - #if TODO - var given= a = np.array({{10, 30, 20}, {60, 40, 50}}); - #endif + var a= np.array(new[,]{{10, 30, 20}, {60, 40, 50}}); + // We can sort either by using sort directly, or argsort and this function - + // >>> np.sort(a, axis=1) // array([[10, 20, 30], // [40, 50, 60]]) @@ -927,23 +911,23 @@ public void take_along_axisTest() // [40, 50, 60]]) // - #if TODO - given= np.sort(a, axis=1); + var given= np.sort(a, axis: 1); var expected= "array([[10, 20, 30],\n" + " [40, 50, 60]])"; Assert.AreEqual(expected, given.repr); - given= ai = np.argsort(a, axis=1); ai; + var ai = np.argsort(a, axis: 1); + given = ai; expected= "array([[0, 2, 1],\n" + " [1, 2, 0]], dtype=int64)"; Assert.AreEqual(expected, given.repr); - given= np.take_along_axis(a, ai, axis=1); + given= np.take_along_axis(a, ai, axis: 1); expected= "array([[10, 20, 30],\n" + " [40, 50, 60]])"; Assert.AreEqual(expected, given.repr); - #endif + // The same works for max and min, if you expand the dimensions: // >>> np.expand_dims(np.max(a, axis=1), axis=1) @@ -957,25 +941,24 @@ public void take_along_axisTest() // array([[30], // [60]]) // - - #if TODO - given= np.expand_dims(np.max(a, axis=1), axis=1); + + given= np.expand_dims(np.max(a, axis:new int[]{1}), axis:1); expected= "array([[30],\n" + " [60]])"; Assert.AreEqual(expected, given.repr); - given= ai = np.expand_dims(np.argmax(a, axis=1), axis=1); + given= ai = np.expand_dims(np.argmax(a, axis:1), axis:1); given= ai; expected= "array([[1],\n" + - " [0], dtype=int64)"; + " [0]], dtype=int64)"; Assert.AreEqual(expected, given.repr); - given= np.take_along_axis(a, ai, axis=1); + given= np.take_along_axis(a, ai, axis:1); expected= "array([[30],\n" + " [60]])"; Assert.AreEqual(expected, given.repr); - #endif + // If we want to get the max and min at the same time, we can stack the // indices first @@ -989,22 +972,19 @@ public void take_along_axisTest() // array([[10, 30], // [40, 60]]) // - - #if TODO - given= ai_min = np.expand_dims(np.argmin(a, axis=1), axis=1); - given= ai_max = np.expand_dims(np.argmax(a, axis=1), axis=1); - given= ai = np.concatenate({ai_min, ai_max}, axis=axis); + + var ai_min = np.expand_dims(np.argmin(a, axis:1), axis:1); + var ai_max = np.expand_dims(np.argmax(a, axis:1), axis:1); + given= ai = np.concatenate(new[]{ai_min, ai_max}, axis: 1); expected= - ">> ai\n" + "array([[0, 1],\n" + " [1, 0]], dtype=int64)"; Assert.AreEqual(expected, given.repr); - given= np.take_along_axis(a, ai, axis=1); + given= np.take_along_axis(a, ai, axis:1); expected= "array([[10, 30],\n" + " [40, 60]])"; Assert.AreEqual(expected, given.repr); - #endif } diff --git a/test/Numpy.UnitTest/NumPy_linalg.tests.cs b/test/Numpy.UnitTest/NumPy_linalg.tests.cs index bedb379..6a652e9 100644 --- a/test/Numpy.UnitTest/NumPy_linalg.tests.cs +++ b/test/Numpy.UnitTest/NumPy_linalg.tests.cs @@ -18,42 +18,42 @@ namespace Numpy.UnitTest [TestClass] public class NumPy_linalgTest : BaseTestCase { - + [TestMethod] public void dotTest() { // >>> np.dot(3, 4) // 12 // - - #if TODO + +#if TODO var given= np.dot(3, 4); var expected= "12"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Neither argument is complex-conjugated: - + // >>> np.dot([2j, 3j], [2j, 3j]) // (-13+0j) // - - #if TODO + +#if TODO given= np.dot({2j, 3j}, {2j, 3j}); expected= "(-13+0j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // For 2-D arrays it is the matrix product: - + // >>> a = [[1, 0], [0, 1]] // >>> b = [[4, 1], [2, 2]] // >>> np.dot(a, b) // array([[4, 1], // [2, 2]]) // - - #if TODO + +#if TODO given= a = [[1, 0], [0, 1]]; given= b = [[4, 1], [2, 2]]; given= np.dot(a, b); @@ -61,7 +61,7 @@ public void dotTest() "array([[4, 1],\n" + " [2, 2]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.arange(3*4*5*6).reshape((3,4,5,6)) // >>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3)) // >>> np.dot(a, b)[2,3,2,1,2,2] @@ -69,8 +69,8 @@ public void dotTest() // >>> sum(a[2,3,2,:] * b[1,2,:,2]) // 499128 // - - #if TODO + +#if TODO given= a = np.arange(3*4*5*6).reshape((3,4,5,6)); given= b = np.arange(3*4*5*6){::-1}.reshape((5,4,6,3)); given= np.dot(a, b){2,3,2,1,2,2}; @@ -81,15 +81,15 @@ public void dotTest() expected= "499128"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void multi_dotTest() { // multi_dot allows you to write: - + // >>> from numpy.linalg import multi_dot // >>> # Prepare some data // >>> A = np.random.random(10000, 100) @@ -99,8 +99,8 @@ public void multi_dotTest() // >>> # the actual dot multiplication // >>> multi_dot([A, B, C, D]) // - - #if TODO + +#if TODO var given= from numpy.linalg import multi_dot; given= # Prepare some data; given= A = np.random.random(10000, 100); @@ -109,22 +109,22 @@ public void multi_dotTest() given= D = np.random.random(5, 333); given= # the actual dot multiplication; given= multi_dot([A, B, C, D]); - #endif +#endif // instead of: - + // >>> np.dot(np.dot(np.dot(A, B), C), D) // >>> # or // >>> A.dot(B).dot(C).dot(D) // - - #if TODO + +#if TODO given= np.dot(np.dot(np.dot(A, B), C), D); given= # or; given= A.dot(B).dot(C).dot(D); - #endif +#endif } - - + + [TestMethod] public void vdotTest() { @@ -135,8 +135,8 @@ public void vdotTest() // >>> np.vdot(b, a) // (70+8j) // - - #if TODO + +#if TODO var given= a = np.array({1+2j,3+4j}); given= b = np.array({5+6j,7+8j}); given= np.vdot(a, b); @@ -147,9 +147,9 @@ public void vdotTest() expected= "(70+8j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note that higher-dimensional arrays are flattened! - + // >>> a = np.array([[1, 4], [5, 6]]) // >>> b = np.array([[4, 1], [2, 2]]) // >>> np.vdot(a, b) @@ -159,8 +159,8 @@ public void vdotTest() // >>> 1*4 + 4*1 + 5*2 + 6*2 // 30 // - - #if TODO + +#if TODO given= a = np.array({{1, 4}, {5, 6}}); given= b = np.array({{4, 1}, {2, 2}}); given= np.vdot(a, b); @@ -175,39 +175,39 @@ public void vdotTest() expected= "30"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void innerTest() { // Ordinary inner product for vectors: - + // >>> a = np.array([1,2,3]) // >>> b = np.array([0,1,0]) // >>> np.inner(a, b) // 2 // - - #if TODO + +#if TODO var given= a = np.array({1,2,3}); given= b = np.array({0,1,0}); given= np.inner(a, b); var expected= "2"; Assert.AreEqual(expected, given.repr); - #endif +#endif // A multidimensional example: - + // >>> a = np.arange(24).reshape((2,3,4)) // >>> b = np.arange(4) // >>> np.inner(a, b) // array([[ 14, 38, 62], // [ 86, 110, 134]]) // - - #if TODO + +#if TODO given= a = np.arange(24).reshape((2,3,4)); given= b = np.arange(4); given= np.inner(a, b); @@ -215,29 +215,29 @@ public void innerTest() "array([[ 14, 38, 62],\n" + " [ 86, 110, 134]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // An example where b is a scalar: - + // >>> np.inner(np.eye(2), 7) // array([[ 7., 0.], // [ 0., 7.]]) // - - #if TODO + +#if TODO given= np.inner(np.eye(2), 7); expected= "array([[ 7., 0.],\n" + " [ 0., 7.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void outerTest() { // Make a (very coarse) grid for computing a Mandelbrot set: - + // >>> rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)) // >>> rl // array([[-2., -1., 0., 1., 2.], @@ -260,8 +260,8 @@ public void outerTest() // [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j], // [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]]) // - - #if TODO + +#if TODO var given= rl = np.outer(np.ones((5,)), np.linspace(-2, 2, 5)); given= rl; var expected= @@ -289,17 +289,17 @@ public void outerTest() " [-2.-1.j, -1.-1.j, 0.-1.j, 1.-1.j, 2.-1.j],\n" + " [-2.-2.j, -1.-2.j, 0.-2.j, 1.-2.j, 2.-2.j]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // An example using a “vector” of letters: - + // >>> x = np.array(['a', 'b', 'c'], dtype=object) // >>> np.outer(x, [1, 2, 3]) // array([[a, aa, aaa], // [b, bb, bbb], // [c, cc, ccc]], dtype=object) // - - #if TODO + +#if TODO given= x = np.array({'a', 'b', 'c'}, dtype=object); given= np.outer(x, {1, 2, 3}); expected= @@ -307,15 +307,15 @@ public void outerTest() " [b, bb, bbb],\n" + " [c, cc, ccc]], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void matmulTest() { // For 2-D arrays it is the matrix product: - + // >>> a = np.array([[1, 0], // ... [0, 1]]) // >>> b = np.array([[4, 1], @@ -324,8 +324,8 @@ public void matmulTest() // array([[4, 1], // [2, 2]]) // - - #if TODO + +#if TODO var given= a = np.array({{1, 0},; var expected= "... [0, 1]])"; @@ -339,9 +339,9 @@ public void matmulTest() "array([[4, 1],\n" + " [2, 2]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // For 2-D mixed with 1-D, the result is the usual. - + // >>> a = np.array([[1, 0], // ... [0, 1]] // >>> b = np.array([1, 2]) @@ -350,8 +350,8 @@ public void matmulTest() // >>> np.matmul(b, a) // array([1, 2]) // - - #if TODO + +#if TODO given= a = np.array({{1, 0},; expected= "... [0, 1]]"; @@ -365,9 +365,9 @@ public void matmulTest() expected= "array([1, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Broadcasting is conventional for stacks of arrays - + // >>> a = np.arange(2 * 2 * 4).reshape((2, 2, 4)) // >>> b = np.arange(2 * 2 * 4).reshape((2, 4, 2)) // >>> np.matmul(a,b).shape @@ -377,8 +377,8 @@ public void matmulTest() // >>> sum(a[0, 1, :] * b[0 , :, 1]) // 98 // - - #if TODO + +#if TODO given= a = np.arange(2 * 2 * 4).reshape((2, 2, 4)); given= b = np.arange(2 * 2 * 4).reshape((2, 4, 2)); given= np.matmul(a,b).shape; @@ -393,44 +393,44 @@ public void matmulTest() expected= "98"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Vector, vector returns the scalar inner product, but neither argument // is complex-conjugated: - + // >>> np.matmul([2j, 3j], [2j, 3j]) // (-13+0j) // - - #if TODO + +#if TODO given= np.matmul({2j, 3j}, {2j, 3j}); expected= "(-13+0j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Scalar multiplication raises an error. - + // >>> np.matmul([1,2], 3) // Traceback (most recent call last): // ... // ValueError: matmul: Input operand 1 does not have enough dimensions ... // - - #if TODO + +#if TODO given= np.matmul({1,2}, 3); expected= "Traceback (most recent call last):\n" + "...\n" + "ValueError: matmul: Input operand 1 does not have enough dimensions ..."; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void tensordotTest() { // A “traditional” example: - + // >>> a = np.arange(60.).reshape(3,4,5) // >>> b = np.arange(24.).reshape(4,3,2) // >>> c = np.tensordot(a,b, axes=([1,0],[0,1])) @@ -456,8 +456,8 @@ public void tensordotTest() // [ True, True], // [ True, True]]) // - - #if TODO + +#if TODO var given= a = np.arange(60.).reshape(3,4,5); given= b = np.arange(24.).reshape(4,3,2); given= c = np.tensordot(a,b, axes=({1,0},{0,1})); @@ -490,9 +490,9 @@ public void tensordotTest() " [ True, True],\n" + " [ True, True]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // An extended example taking advantage of the overloading of + and *: - + // >>> a = np.array(range(1, 9)) // >>> a.shape = (2, 2, 2) // >>> A = np.array(('a', 'b', 'c', 'd'), dtype=object) @@ -505,8 +505,8 @@ public void tensordotTest() // array([[a, b], // [c, d]], dtype=object) // - - #if TODO + +#if TODO given= a = np.array(range(1, 9)); given= a.shape = (2, 2, 2); given= A = np.array(('a', 'b', 'c', 'd'), dtype=object); @@ -520,25 +520,25 @@ public void tensordotTest() "array([[a, b],\n" + " [c, d]], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A) # third argument default is 2 for double-contraction // array([abbcccdddd, aaaaabbbbbbcccccccdddddddd], dtype=object) // - - #if TODO + +#if TODO given= np.tensordot(a, A) # third argument default is 2 for double-contraction; expected= "array([abbcccdddd, aaaaabbbbbbcccccccdddddddd], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A, 1) // array([[[acc, bdd], // [aaacccc, bbbdddd]], // [[aaaaacccccc, bbbbbdddddd], // [aaaaaaacccccccc, bbbbbbbdddddddd]]], dtype=object) // - - #if TODO + +#if TODO given= np.tensordot(a, A, 1); expected= "array([[[acc, bdd],\n" + @@ -546,29 +546,29 @@ public void tensordotTest() " [[aaaaacccccc, bbbbbdddddd],\n" + " [aaaaaaacccccccc, bbbbbbbdddddddd]]], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A, 0) # tensor product (result too long to incl.) // array([[[[[a, b], // [c, d]], // ... // - - #if TODO + +#if TODO given= np.tensordot(a, A, 0) # tensor product (result too long to incl.); expected= "array([[[[[a, b],\n" + " [c, d]],\n" + " ..."; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A, (0, 1)) // array([[[abbbbb, cddddd], // [aabbbbbb, ccdddddd]], // [[aaabbbbbbb, cccddddddd], // [aaaabbbbbbbb, ccccdddddddd]]], dtype=object) // - - #if TODO + +#if TODO given= np.tensordot(a, A, (0, 1)); expected= "array([[[abbbbb, cddddd],\n" + @@ -576,15 +576,15 @@ public void tensordotTest() " [[aaabbbbbbb, cccddddddd],\n" + " [aaaabbbbbbbb, ccccdddddddd]]], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A, (2, 1)) // array([[[abb, cdd], // [aaabbbb, cccdddd]], // [[aaaaabbbbbb, cccccdddddd], // [aaaaaaabbbbbbbb, cccccccdddddddd]]], dtype=object) // - - #if TODO + +#if TODO given= np.tensordot(a, A, (2, 1)); expected= "array([[[abb, cdd],\n" + @@ -592,30 +592,30 @@ public void tensordotTest() " [[aaaaabbbbbb, cccccdddddd],\n" + " [aaaaaaabbbbbbbb, cccccccdddddddd]]], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A, ((0, 1), (0, 1))) // array([abbbcccccddddddd, aabbbbccccccdddddddd], dtype=object) // - - #if TODO + +#if TODO given= np.tensordot(a, A, ((0, 1), (0, 1))); expected= "array([abbbcccccddddddd, aabbbbccccccdddddddd], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.tensordot(a, A, ((2, 1), (1, 0))) // array([acccbbdddd, aaaaacccccccbbbbbbdddddddd], dtype=object) // - - #if TODO + +#if TODO given= np.tensordot(a, A, ((2, 1), (1, 0))); expected= "array([acccbbdddd, aaaaacccccccbbbbbbdddddddd], dtype=object)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void einsumTest() { @@ -623,14 +623,12 @@ public void einsumTest() // >>> b = np.arange(5) // >>> c = np.arange(6).reshape(2,3) // - - #if TODO - var given= a = np.arange(25).reshape(5,5); - given= b = np.arange(5); - given= c = np.arange(6).reshape(2,3); - #endif + + var a = np.arange(25).reshape(5, 5); + var b = np.arange(5); + var c = np.arange(6).reshape(2, 3); // Trace of a matrix: - + // >>> np.einsum('ii', a) // 60 // >>> np.einsum(a, [0,0]) @@ -638,23 +636,24 @@ public void einsumTest() // >>> np.trace(a) // 60 // - - #if TODO - given= np.einsum('ii', a); - var expected= + + var given = np.einsum("ii", a); + var expected = "60"; +#if TODO Assert.AreEqual(expected, given.repr); - given= np.einsum(a, {0,0}); - expected= - "60"; + given = np.einsum(new[] { a, (NDarray)np.array(0, 0) }); + expected = + "60"; Assert.AreEqual(expected, given.repr); - given= np.trace(a); - expected= - "60"; +#endif + given = np.trace(a); + expected = + "60"; Assert.AreEqual(expected, given.repr); - #endif + // Extract the diagonal (requires explicit form): - + // >>> np.einsum('ii->i', a) // array([ 0, 6, 12, 18, 24]) // >>> np.einsum(a, [0,0], [0]) @@ -662,23 +661,23 @@ public void einsumTest() // >>> np.diag(a) // array([ 0, 6, 12, 18, 24]) // - - #if TODO - given= np.einsum('ii->i', a); - expected= - "array([ 0, 6, 12, 18, 24])"; + + given = np.einsum("ii->i", a); + expected = + "array([ 0, 6, 12, 18, 24])"; Assert.AreEqual(expected, given.repr); - given= np.einsum(a, {0,0}, {0}); +#if TODO + given= np.einsum(a, {0,0}, {0}); expected= "array([ 0, 6, 12, 18, 24])"; Assert.AreEqual(expected, given.repr); - given= np.diag(a); - expected= - "array([ 0, 6, 12, 18, 24])"; +#endif + given = np.diag(a); + expected = + "array([ 0, 6, 12, 18, 24])"; Assert.AreEqual(expected, given.repr); - #endif // Sum over an axis (requires explicit form): - + // >>> np.einsum('ij->i', a) // array([ 10, 35, 60, 85, 110]) // >>> np.einsum(a, [0,1], [0]) @@ -686,41 +685,42 @@ public void einsumTest() // >>> np.sum(a, axis=1) // array([ 10, 35, 60, 85, 110]) // - - #if TODO - given= np.einsum('ij->i', a); - expected= - "array([ 10, 35, 60, 85, 110])"; + + given = np.einsum("ij->i", a); + expected = + "array([ 10, 35, 60, 85, 110])"; Assert.AreEqual(expected, given.repr); +#if TODO given= np.einsum(a, {0,1}, {0}); expected= "array([ 10, 35, 60, 85, 110])"; Assert.AreEqual(expected, given.repr); - given= np.sum(a, axis=1); - expected= - "array([ 10, 35, 60, 85, 110])"; +#endif + + given = np.sum(a, axis: 1); + expected = + "array([ 10, 35, 60, 85, 110])"; Assert.AreEqual(expected, given.repr); - #endif // For higher dimensional arrays summing a single axis can be done with ellipsis: - + // >>> np.einsum('...j->...', a) // array([ 10, 35, 60, 85, 110]) // >>> np.einsum(a, [Ellipsis,1], [Ellipsis]) // array([ 10, 35, 60, 85, 110]) // - - #if TODO - given= np.einsum('...j->...', a); - expected= - "array([ 10, 35, 60, 85, 110])"; + + given = np.einsum("...j->...", a); + expected = + "array([ 10, 35, 60, 85, 110])"; Assert.AreEqual(expected, given.repr); +#if TODO given= np.einsum(a, {Ellipsis,1}, {Ellipsis}); expected= "array([ 10, 35, 60, 85, 110])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Compute a matrix transpose, or reorder any number of axes: - + // >>> np.einsum('ji', c) // array([[0, 3], // [1, 4], @@ -738,35 +738,36 @@ public void einsumTest() // [1, 4], // [2, 5]]) // - - #if TODO - given= np.einsum('ji', c); - expected= - "array([[0, 3],\n" + - " [1, 4],\n" + - " [2, 5]])"; + + given = np.einsum("ji", c); + expected = + "array([[0, 3],\n" + + " [1, 4],\n" + + " [2, 5]])"; Assert.AreEqual(expected, given.repr); - given= np.einsum('ij->ji', c); - expected= - "array([[0, 3],\n" + - " [1, 4],\n" + - " [2, 5]])"; + given = np.einsum("ij->ji", c); + expected = + "array([[0, 3],\n" + + " [1, 4],\n" + + " [2, 5]])"; Assert.AreEqual(expected, given.repr); - given= np.einsum(c, {1,0}); +#if TODO + given= np.einsum(c, {1,0}); expected= "array([[0, 3],\n" + " [1, 4],\n" + " [2, 5]])"; Assert.AreEqual(expected, given.repr); - given= np.transpose(c); - expected= - "array([[0, 3],\n" + - " [1, 4],\n" + - " [2, 5]])"; +#endif + given = np.transpose(c); + expected = + "array([[0, 3],\n" + + " [1, 4],\n" + + " [2, 5]])"; Assert.AreEqual(expected, given.repr); - #endif + // Vector inner products: - + // >>> np.einsum('i,i', b, b) // 30 // >>> np.einsum(b, [0], b, [0]) @@ -774,23 +775,24 @@ public void einsumTest() // >>> np.inner(b,b) // 30 // - - #if TODO - given= np.einsum('i,i', b, b); - expected= - "30"; + + given = np.einsum("i,i", b, b); + expected = + "30"; Assert.AreEqual(expected, given.repr); +#if TODO given= np.einsum(b, {0}, b, {0}); expected= "30"; Assert.AreEqual(expected, given.repr); - given= np.inner(b,b); - expected= - "30"; +#endif + given = np.inner(b, b); + expected = + "30"; Assert.AreEqual(expected, given.repr); - #endif + // Matrix vector multiplication: - + // >>> np.einsum('ij,j', a, b) // array([ 30, 80, 130, 180, 230]) // >>> np.einsum(a, [0,1], b, [1]) @@ -800,27 +802,28 @@ public void einsumTest() // >>> np.einsum('...j,j', a, b) // array([ 30, 80, 130, 180, 230]) // - - #if TODO - given= np.einsum('ij,j', a, b); - expected= - "array([ 30, 80, 130, 180, 230])"; + + given = np.einsum("ij,j", a, b); + expected = + "array([ 30, 80, 130, 180, 230])"; Assert.AreEqual(expected, given.repr); +#if TODO given= np.einsum(a, {0,1}, b, {1}); expected= "array([ 30, 80, 130, 180, 230])"; Assert.AreEqual(expected, given.repr); - given= np.dot(a, b); - expected= - "array([ 30, 80, 130, 180, 230])"; +#endif + given = np.dot(a, b); + expected = + "array([ 30, 80, 130, 180, 230])"; Assert.AreEqual(expected, given.repr); - given= np.einsum('...j,j', a, b); - expected= - "array([ 30, 80, 130, 180, 230])"; + given = np.einsum("...j,j", a, b); + expected = + "array([ 30, 80, 130, 180, 230])"; Assert.AreEqual(expected, given.repr); - #endif + // Broadcasting and scalar multiplication: - + // >>> np.einsum('..., ...', 3, c) // array([[ 0, 3, 6], // [ 9, 12, 15]]) @@ -834,31 +837,31 @@ public void einsumTest() // array([[ 0, 3, 6], // [ 9, 12, 15]]) // - - #if TODO - given= np.einsum('..., ...', 3, c); - expected= - "array([[ 0, 3, 6],\n" + - " [ 9, 12, 15]])"; + + given = np.einsum("..., ...", np.asarray(3), c); + expected = + "array([[ 0, 3, 6],\n" + + " [ 9, 12, 15]])"; Assert.AreEqual(expected, given.repr); - given= np.einsum(',ij', 3, c); - expected= - "array([[ 0, 3, 6],\n" + - " [ 9, 12, 15]])"; + given = np.einsum(",ij", np.asarray(3), c); + expected = + "array([[ 0, 3, 6],\n" + + " [ 9, 12, 15]])"; Assert.AreEqual(expected, given.repr); +#if TODO given= np.einsum(3, {Ellipsis}, c, {Ellipsis}); expected= "array([[ 0, 3, 6],\n" + " [ 9, 12, 15]])"; Assert.AreEqual(expected, given.repr); - given= np.multiply(3, c); - expected= - "array([[ 0, 3, 6],\n" + - " [ 9, 12, 15]])"; +#endif + given = np.multiply(np.asarray(3), c); + expected = + "array([[ 0, 3, 6],\n" + + " [ 9, 12, 15]])"; Assert.AreEqual(expected, given.repr); - #endif // Vector outer product: - + // >>> np.einsum('i,j', np.arange(2)+1, b) // array([[0, 1, 2, 3, 4], // [0, 2, 4, 6, 8]]) @@ -869,26 +872,27 @@ public void einsumTest() // array([[0, 1, 2, 3, 4], // [0, 2, 4, 6, 8]]) // - - #if TODO - given= np.einsum('i,j', np.arange(2)+1, b); - expected= - "array([[0, 1, 2, 3, 4],\n" + - " [0, 2, 4, 6, 8]])"; + + + given = np.einsum("i,j", np.arange(2) + 1, b); + expected = + "array([[0, 1, 2, 3, 4],\n" + + " [0, 2, 4, 6, 8]])"; Assert.AreEqual(expected, given.repr); - given= np.einsum(np.arange(2)+1, {0}, b, {1}); +#if TODO + given= np.einsum(np.arange(2)+1, {0}, b, {1}); expected= "array([[0, 1, 2, 3, 4],\n" + " [0, 2, 4, 6, 8]])"; Assert.AreEqual(expected, given.repr); - given= np.outer(np.arange(2)+1, b); - expected= - "array([[0, 1, 2, 3, 4],\n" + - " [0, 2, 4, 6, 8]])"; +#endif + given = np.outer(np.arange(2) + 1, b); + expected = + "array([[0, 1, 2, 3, 4],\n" + + " [0, 2, 4, 6, 8]])"; Assert.AreEqual(expected, given.repr); - #endif // Tensor contraction: - + // >>> a = np.arange(60.).reshape(3,4,5) // >>> b = np.arange(24.).reshape(4,3,2) // >>> np.einsum('ijk,jil->kl', a, b) @@ -910,18 +914,18 @@ public void einsumTest() // [ 4796., 5162.], // [ 4928., 5306.]]) // - - #if TODO - given= a = np.arange(60.).reshape(3,4,5); - given= b = np.arange(24.).reshape(4,3,2); - given= np.einsum('ijk,jil->kl', a, b); - expected= - "array([[ 4400., 4730.],\n" + - " [ 4532., 4874.],\n" + - " [ 4664., 5018.],\n" + - " [ 4796., 5162.],\n" + - " [ 4928., 5306.]])"; - Assert.AreEqual(expected, given.repr); + + given = a = np.arange(60.0).reshape(3, 4, 5); + given = b = np.arange(24.0).reshape(4, 3, 2); + given = np.einsum("ijk,jil->kl", a, b); + expected = + "array([[4400., 4730.],\n" + + " [4532., 4874.],\n" + + " [4664., 5018.],\n" + + " [4796., 5162.],\n" + + " [4928., 5306.]])"; + Assert.AreEqual(expected, given.repr); +#if TODO given= np.einsum(a, {0,1,2}, b, {1,0,3}, {2,3}); expected= "array([[ 4400., 4730.],\n" + @@ -930,7 +934,8 @@ public void einsumTest() " [ 4796., 5162.],\n" + " [ 4928., 5306.]])"; Assert.AreEqual(expected, given.repr); - given= np.tensordot(a,b, axes=({1,0},{0,1})); + + given = np.tensordot(a,b, axes:new int[,]{{1,0},{0,1}}); expected= "array([[ 4400., 4730.],\n" + " [ 4532., 4874.],\n" + @@ -938,9 +943,10 @@ public void einsumTest() " [ 4796., 5162.],\n" + " [ 4928., 5306.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif + // Writeable returned arrays (since version 1.10.0): - + // >>> a = np.zeros((3, 3)) // >>> np.einsum('ii->i', a)[:] = 1 // >>> a @@ -948,19 +954,19 @@ public void einsumTest() // [ 0., 1., 0.], // [ 0., 0., 1.]]) // - - #if TODO - given= a = np.zeros((3, 3)); - given= np.einsum('ii->i', a){:} = 1; - given= a; - expected= - "array([[ 1., 0., 0.],\n" + - " [ 0., 1., 0.],\n" + - " [ 0., 0., 1.]])"; + + + a = np.zeros((3, 3)); + np.einsum("ii->i", a)[":"] = np.asarray(1); + given = a; + expected = + "array([[1., 0., 0.],\n" + + " [0., 1., 0.],\n" + + " [0., 0., 1.]])"; Assert.AreEqual(expected, given.repr); - #endif + // Example of ellipsis use: - + // >>> a = np.arange(6).reshape((3,2)) // >>> b = np.arange(12).reshape((4,3)) // >>> np.einsum('ki,jk->ij', a, b) @@ -973,32 +979,31 @@ public void einsumTest() // array([[10, 28, 46, 64], // [13, 40, 67, 94]]) // - - #if TODO - given= a = np.arange(6).reshape((3,2)); - given= b = np.arange(12).reshape((4,3)); - given= np.einsum('ki,jk->ij', a, b); - expected= - "array([[10, 28, 46, 64],\n" + - " [13, 40, 67, 94]])"; - Assert.AreEqual(expected, given.repr); - given= np.einsum('ki,...k->i...', a, b); - expected= - "array([[10, 28, 46, 64],\n" + - " [13, 40, 67, 94]])"; - Assert.AreEqual(expected, given.repr); - given= np.einsum('k...,jk', a, b); - expected= - "array([[10, 28, 46, 64],\n" + - " [13, 40, 67, 94]])"; + + given = a = np.arange(6).reshape((3, 2)); + given = b = np.arange(12).reshape((4, 3)); + given = np.einsum("ki,jk->ij", a, b); + expected = + "array([[10, 28, 46, 64],\n" + + " [13, 40, 67, 94]])"; + Assert.AreEqual(expected, given.repr); + given = np.einsum("ki,...k->i...", a, b); + expected = + "array([[10, 28, 46, 64],\n" + + " [13, 40, 67, 94]])"; + Assert.AreEqual(expected, given.repr); + given = np.einsum("k...,jk", a, b); + expected = + "array([[10, 28, 46, 64],\n" + + " [13, 40, 67, 94]])"; Assert.AreEqual(expected, given.repr); - #endif + // Chained array operations. For more complicated contractions, speed ups // might be achieved by repeatedly computing a ‘greedy’ path or pre-computing the // ‘optimal’ path and repeatedly applying it, using an // einsum_path insertion (since version 1.12.0). Performance improvements can be // particularly significant with larger arrays: - + // >>> a = np.ones(64).reshape(2,4,8) // # Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) // >>> for iteration in range(500): @@ -1014,8 +1019,8 @@ public void einsumTest() // >>> for iteration in range(500): // ... np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path) // - - #if TODO + +#if TODO given= a = np.ones(64).reshape(2,4,8); // Basic `einsum`: ~1520ms (benchmarked on 3.1GHz Intel i5.) given= for iteration in range(500):; @@ -1038,10 +1043,10 @@ public void einsumTest() expected= "... np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void einsum_pathTest() { @@ -1050,7 +1055,7 @@ public void einsum_pathTest() // element of the path (1, 2). The resulting tensor is added to the end // of the contraction and the remaining contraction (0, 1) is then // completed. - + // >>> a = np.random.rand(2, 2) // >>> b = np.random.rand(2, 5) // >>> c = np.random.rand(5, 2) @@ -1071,8 +1076,8 @@ public void einsum_pathTest() // 3 kl,jk->jl ij,jl->il // 3 jl,ij->il il->il // - - #if TODO + +#if TODO var given= a = np.random.rand(2, 2); given= b = np.random.rand(2, 5); given= c = np.random.rand(5, 2); @@ -1096,23 +1101,23 @@ public void einsum_pathTest() " 3 kl,jk->jl ij,jl->il\n" + " 3 jl,ij->il il->il"; Assert.AreEqual(expected, given.repr); - #endif +#endif // A more complex index transformation example. - + // >>> I = np.random.rand(10, 10, 10, 10) // >>> C = np.random.rand(10, 10) // >>> path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, // optimize='greedy') // - - #if TODO + +#if TODO given= I = np.random.rand(10, 10, 10, 10); given= C = np.random.rand(10, 10); given= path_info = np.einsum_path('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C,; expected= " optimize='greedy')"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> print(path_info[0]) // ['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)] // >>> print(path_info[1]) @@ -1131,8 +1136,8 @@ public void einsum_pathTest() // 5 cdef,gc->defg hd,defg->efgh // 5 defg,hd->efgh efgh->efgh // - - #if TODO + +#if TODO given= print(path_info[0]); expected= "['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)]"; @@ -1154,10 +1159,10 @@ public void einsum_pathTest() " 5 cdef,gc->defg hd,defg->efgh\n" + " 5 defg,hd->efgh efgh->efgh"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void matrix_powerTest() { @@ -1173,8 +1178,8 @@ public void matrix_powerTest() // array([[ 0., 1.], // [-1., 0.]]) // - - #if TODO + +#if TODO var given= from numpy.linalg import matrix_power; given= i = np.array({{0, 1}, {-1, 0}}) # matrix equiv. of the imaginary unit; given= matrix_power(i, 3) # should = -i; @@ -1192,9 +1197,9 @@ public void matrix_powerTest() "array([[ 0., 1.],\n" + " [-1., 0.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Somewhat more sophisticated example - + // >>> q = np.zeros((4, 4)) // >>> q[0:2, 0:2] = -i // >>> q[2:4, 2:4] = i @@ -1209,8 +1214,8 @@ public void matrix_powerTest() // [ 0., 0., -1., 0.], // [ 0., 0., 0., -1.]]) // - - #if TODO + +#if TODO given= q = np.zeros((4, 4)); given= q[0:2, 0:2] = -i; given= q[2:4, 2:4] = i; @@ -1228,10 +1233,10 @@ public void matrix_powerTest() " [ 0., 0., -1., 0.],\n" + " [ 0., 0., 0., -1.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void kronTest() { @@ -1240,8 +1245,8 @@ public void kronTest() // >>> np.kron([5,6,7], [1,10,100]) // array([ 5, 50, 500, 6, 60, 600, 7, 70, 700]) // - - #if TODO + +#if TODO var given= np.kron({1,10,100}, {5,6,7}); var expected= "array([ 5, 6, 7, 50, 60, 70, 500, 600, 700])"; @@ -1250,15 +1255,15 @@ public void kronTest() expected= "array([ 5, 50, 500, 6, 60, 600, 7, 70, 700])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.kron(np.eye(2), np.ones((2,2))) // array([[ 1., 1., 0., 0.], // [ 1., 1., 0., 0.], // [ 0., 0., 1., 1.], // [ 0., 0., 1., 1.]]) // - - #if TODO + +#if TODO given= np.kron(np.eye(2), np.ones((2,2))); expected= "array([[ 1., 1., 0., 0.],\n" + @@ -1266,7 +1271,7 @@ public void kronTest() " [ 0., 0., 1., 1.],\n" + " [ 0., 0., 1., 1.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.arange(100).reshape((2,5,2,5)) // >>> b = np.arange(24).reshape((2,3,4)) // >>> c = np.kron(a,b) @@ -1280,8 +1285,8 @@ public void kronTest() // >>> c[K] == a[I]*b[J] // True // - - #if TODO + +#if TODO given= a = np.arange(100).reshape((2,5,2,5)); given= b = np.arange(24).reshape((2,3,4)); given= c = np.kron(a,b); @@ -1298,10 +1303,10 @@ public void kronTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void qrTest() { @@ -1317,83 +1322,77 @@ public void qrTest() // >>> np.allclose(r, np.triu(r3[:6,:6], k=0)) // True // - - #if TODO - var given= a = np.random.randn(9, 6); - given= q, r = np.linalg.qr(a); - given= np.allclose(a, np.dot(q, r)) # a does equal qr; - var expected= - "True"; - Assert.AreEqual(expected, given.repr); - given= r2 = np.linalg.qr(a, mode='r'); - given= r3 = np.linalg.qr(a, mode='economic'); - given= np.allclose(r, r2) # mode='r' returns the same r as mode='full'; - expected= - "True"; - Assert.AreEqual(expected, given.repr); - given= # But only triu parts are guaranteed equal when mode='economic'; - given= np.allclose(r, np.triu(r3{:6,:6}, k=0)); + + { + var a = np.random.randn(9, 6); + var (q, r, _) = np.linalg.qr(a); + //Console.WriteLine("r: " + r.repr); + var given = np.allclose(a, np.dot(q, r)); // a does equal qr; + Assert.AreEqual(true, given); + (var r2, _, _) = np.linalg.qr(a, mode: "r"); + //Console.WriteLine("r2: " + r2.repr); + (var r3, _, _) = np.linalg.qr(a, mode: "economic"); + given = np.allclose(r, r2); // mode='r' returns the same r as mode='full'; + Assert.AreEqual(true, given); + } +#if TODO + // But only triu parts are guaranteed equal when mode='economic'; + given= np.allclose(r, np.triu(r3{:6,:6}, k=0)); expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif + // Example illustrating a common use of qr: solving of least squares // problems - + // What are the least-squares-best m and y0 in y = y0 + mx for // the following data: {(0,1), (1,0), (1,2), (2,1)}. (Graph the points // and you’ll see that it should be y0 = 0, m = 1.) The answer is provided // by solving the over-determined matrix equation Ax = b, where: - + // A = array([[0, 1], [1, 1], [1, 1], [2, 1]]) // x = array([[y0], [m]]) // b = array([[1], [0], [2], [1]]) // - - #if TODO - expected= - "A = array([[0, 1], [1, 1], [1, 1], [2, 1]])\n" + - "x = array([[y0], [m]])\n" + - "b = array([[1], [0], [2], [1]])"; - Assert.AreEqual(expected, given.repr); - #endif + // If A = qr such that q is orthonormal (which is always possible via // Gram-Schmidt), then x = inv(r) * (q.T) * b. (In numpy practice, // however, we simply use lstsq.) - - // >>> A = np.array([[0, 1], [1, 1], [1, 1], [2, 1]]) - // >>> A - // array([[0, 1], - // [1, 1], - // [1, 1], - // [2, 1]]) - // >>> b = np.array([1, 0, 2, 1]) - // >>> q, r = LA.qr(A) - // >>> p = np.dot(q.T, b) - // >>> np.dot(LA.inv(r), p) - // array([ 1.1e-16, 1.0e+00]) + + //A = np.array([[0, 1], [1, 1], [1, 1], [2, 1]]) + //A + //array([[0, 1], + // [1, 1], + // [1, 1], + // [2, 1]]) + //b = np.array([1, 2, 2, 3]) + //q, r = np.linalg.qr(A) + //p = np.dot(q.T, b) + //np.dot(np.linalg.inv(r), p) + //array([ 1., 1.]) // - - #if TODO - given= A = np.array({{0, 1}, {1, 1}, {1, 1}, {2, 1}}); - given= A; - expected= - "array([[0, 1],\n" + - " [1, 1],\n" + - " [1, 1],\n" + - " [2, 1]])"; - Assert.AreEqual(expected, given.repr); - given= b = np.array({1, 0, 2, 1}); - given= q, r = LA.qr(A); - given= p = np.dot(q.T, b); - given= np.dot(LA.inv(r), p); - expected= - "array([ 1.1e-16, 1.0e+00])"; - Assert.AreEqual(expected, given.repr); - #endif + { + var A = np.array(new[,] { { 0, 1 }, { 1, 1 }, { 1, 1 }, { 2, 1 } }); + NDarray given = A; + var expected = + "array([[0, 1],\n" + + " [1, 1],\n" + + " [1, 1],\n" + + " [2, 1]])"; + Assert.AreEqual(expected, given.repr); + var b = np.array(new[]{ 1, 2, 2, 3 }); + (var q, var r, _) = np.linalg.qr(A); + var p = np.dot(q.T, b); + //Console.WriteLine("p:" + p.repr); + var r_inv = np.linalg.inv(r); + given = np.dot(r_inv, p); + expected = "array([1., 1.])"; + Assert.AreEqual(expected, given.repr); + } } - - + + [TestMethod] public void condTest() { @@ -1422,8 +1421,8 @@ public void condTest() // >>> min(LA.svd(a, compute_uv=0))*min(LA.svd(LA.inv(a), compute_uv=0)) // 0.70710678118654746 // - - #if TODO + +#if TODO var given= from numpy import linalg as LA; given= a = np.array({{1, 0, -1}, {0, 1, 0}, {1, 0, 1}}); given= a; @@ -1468,10 +1467,10 @@ public void condTest() expected= "0.70710678118654746"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void matrix_rankTest() { @@ -1486,8 +1485,8 @@ public void matrix_rankTest() // >>> matrix_rank(np.zeros((4,))) // 0 // - - #if TODO + +#if TODO var given= from numpy.linalg import matrix_rank; given= matrix_rank(np.eye(4)) # Full rank matrix; var expected= @@ -1506,15 +1505,15 @@ public void matrix_rankTest() expected= "0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void slogdetTest() { // The determinant of a 2-D array [[a, b], [c, d]] is ad - bc: - + // >>> a = np.array([[1, 2], [3, 4]]) // >>> (sign, logdet) = np.linalg.slogdet(a) // >>> (sign, logdet) @@ -1522,8 +1521,8 @@ public void slogdetTest() // >>> sign * np.exp(logdet) // -2.0 // - - #if TODO + +#if TODO var given= a = np.array({{1, 2}, {3, 4}}); given= (sign, logdet) = np.linalg.slogdet(a); given= (sign, logdet); @@ -1534,9 +1533,9 @@ public void slogdetTest() expected= "-2.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Computing log-determinants for a stack of matrices: - + // >>> a = np.array([ [[1, 2], [3, 4]], [[1, 2], [2, 1]], [[1, 3], [3, 1]] ]) // >>> a.shape // (3, 2, 2) @@ -1546,8 +1545,8 @@ public void slogdetTest() // >>> sign * np.exp(logdet) // array([-2., -3., -8.]) // - - #if TODO + +#if TODO given= a = np.array({ {{1, 2}, {3, 4}}, {{1, 2}, {2, 1}}, {{1, 3}, {3, 1}} }); given= a.shape; expected= @@ -1562,16 +1561,16 @@ public void slogdetTest() expected= "array([-2., -3., -8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // This routine succeeds where ordinary det does not: - + // >>> np.linalg.det(np.eye(500) * 0.1) // 0.0 // >>> np.linalg.slogdet(np.eye(500) * 0.1) // (1, -1151.2925464970228) // - - #if TODO + +#if TODO given= np.linalg.det(np.eye(500) * 0.1); expected= "0.0"; @@ -1580,10 +1579,10 @@ public void slogdetTest() expected= "(1, -1151.2925464970228)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void traceTest() { @@ -1593,8 +1592,8 @@ public void traceTest() // >>> np.trace(a) // array([6, 8]) // - - #if TODO + +#if TODO var given= np.trace(np.eye(3)); var expected= "3.0"; @@ -1604,22 +1603,22 @@ public void traceTest() expected= "array([6, 8])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.arange(24).reshape((2,2,2,3)) // >>> np.trace(a).shape // (2, 3) // - - #if TODO + +#if TODO given= a = np.arange(24).reshape((2,2,2,3)); given= np.trace(a).shape; expected= "(2, 3)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void tensorsolveTest() { @@ -1632,8 +1631,8 @@ public void tensorsolveTest() // >>> np.allclose(np.tensordot(a, x, axes=3), b) // True // - - #if TODO + +#if TODO var given= a = np.eye(2*3*4); given= a.shape = (2*3, 4, 2, 3, 4); given= b = np.random.randn(2*3, 4); @@ -1646,10 +1645,10 @@ public void tensorsolveTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void tensorinvTest() { @@ -1662,8 +1661,8 @@ public void tensorinvTest() // >>> np.allclose(np.tensordot(ainv, b), np.linalg.tensorsolve(a, b)) // True // - - #if TODO + +#if TODO var given= a = np.eye(4*6); given= a.shape = (4, 6, 8, 3); given= ainv = np.linalg.tensorinv(a, ind=2); @@ -1676,7 +1675,7 @@ public void tensorinvTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> a = np.eye(4*6) // >>> a.shape = (24, 8, 3) // >>> ainv = np.linalg.tensorinv(a, ind=1) @@ -1686,8 +1685,8 @@ public void tensorinvTest() // >>> np.allclose(np.tensordot(ainv, b, 1), np.linalg.tensorsolve(a, b)) // True // - - #if TODO + +#if TODO given= a = np.eye(4*6); given= a.shape = (24, 8, 3); given= ainv = np.linalg.tensorinv(a, ind=1); @@ -1700,10 +1699,10 @@ public void tensorinvTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void LinAlgErrorTest() { @@ -1718,8 +1717,8 @@ public void LinAlgErrorTest() // raise LinAlgError('Singular matrix') // numpy.linalg.LinAlgError: Singular matrix // - - #if TODO + +#if TODO var given= from numpy import linalg as LA; given= LA.inv(np.zeros((2,2))); var expected= @@ -1732,8 +1731,8 @@ public void LinAlgErrorTest() " raise LinAlgError('Singular matrix')\n" + "numpy.linalg.LinAlgError: Singular matrix"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - + } } diff --git a/test/Numpy.UnitTest/NumPy_linalg_fft.tests.cs b/test/Numpy.UnitTest/NumPy_linalg_fft.tests.cs index fca0e08..4589741 100644 --- a/test/Numpy.UnitTest/NumPy_linalg_fft.tests.cs +++ b/test/Numpy.UnitTest/NumPy_linalg_fft.tests.cs @@ -117,12 +117,7 @@ public void detTest() [TestMethod] public void eigTest() { - // >>> from numpy import linalg as LA - // - - #if TODO - var given= from numpy import linalg as LA; - #endif + // (Almost) trivial example with real e-values and e-vectors. // >>> w, v = LA.eig(np.diag((1, 2, 3))) @@ -133,27 +128,24 @@ public void eigTest() // [ 0., 0., 1.]]) // - #if TODO - given= w, v = LA.eig(np.diag((1, 2, 3))); - given= w; v; - var expected= - "array([ 1., 2., 3.])\n" + - "array([[ 1., 0., 0.],\n" + - " [ 0., 1., 0.],\n" + - " [ 0., 0., 1.]])"; - Assert.AreEqual(expected, given.repr); - #endif + var ( w, v) = LA.eig(np.diag(new double[]{1, 2, 3})); + Assert.AreEqual("array([1., 2., 3.])", w.repr); + var expected = + "array([[1., 0., 0.],\n" + + " [0., 1., 0.],\n" + + " [0., 0., 1.]])"; + Assert.AreEqual(expected, v.repr); // Real matrix possessing complex e-values and e-vectors; note that the // e-values are complex conjugates of each other. - + // >>> w, v = LA.eig(np.array([[1, -1], [1, 1]])) // >>> w; v // array([ 1. + 1.j, 1. - 1.j]) // array([[ 0.70710678+0.j , 0.70710678+0.j ], // [ 0.00000000-0.70710678j, 0.00000000+0.70710678j]]) // - - #if TODO + +#if TODO given= w, v = LA.eig(np.array({{1, -1}, {1, 1}})); given= w; v; expected= @@ -161,10 +153,10 @@ public void eigTest() "array([[ 0.70710678+0.j , 0.70710678+0.j ],\n" + " [ 0.00000000-0.70710678j, 0.00000000+0.70710678j]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Complex-valued matrix with real e-values (but complex-valued e-vectors); // note that a.conj().T = a, i.e., a is Hermitian. - + // >>> a = np.array([[1, 1j], [-1j, 1]]) // >>> w, v = LA.eig(a) // >>> w; v @@ -172,8 +164,8 @@ public void eigTest() // array([[ 0.00000000+0.70710678j, 0.70710678+0.j ], // [ 0.70710678+0.j , 0.00000000+0.70710678j]]) // - - #if TODO + +#if TODO given= a = np.array({{1, 1j}, {-1j, 1}}); given= w, v = LA.eig(a); given= w; v; @@ -182,9 +174,9 @@ public void eigTest() "array([[ 0.00000000+0.70710678j, 0.70710678+0.j ],\n" + " [ 0.70710678+0.j , 0.00000000+0.70710678j]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Be careful about round-off error! - + // >>> a = np.array([[1 + 1e-9, 0], [0, 1 - 1e-9]]) // >>> # Theor. e-values are 1 +/- 1e-9 // >>> w, v = LA.eig(a) @@ -193,8 +185,8 @@ public void eigTest() // array([[ 1., 0.], // [ 0., 1.]]) // - - #if TODO + +#if TODO given= a = np.array({{1 + 1e-9, 0}, {0, 1 - 1e-9}}); given= # Theor. e-values are 1 +/- 1e-9; given= w, v = LA.eig(a); @@ -204,10 +196,10 @@ public void eigTest() "array([[ 1., 0.],\n" + " [ 0., 1.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void eighTest() { @@ -625,8 +617,8 @@ public void normTest() // 2.0 // - Assert.GreaterOrEqual(7.74596669f, LA.norm(a)); - Assert.GreaterOrEqual(7.74596669f, LA.norm(b)); + Assert.GreaterOrEqual(7.74596669f, (float)LA.norm(a)); + Assert.GreaterOrEqual(7.74596669f, (float)LA.norm(b)); Assert.GreaterOrEqual(7.74596669f, LA.norm(b, "fro")); Assert.AreEqual(4, LA.norm(a, Constants.inf)); Assert.AreEqual(9, LA.norm(b, Constants.inf)); @@ -647,43 +639,28 @@ public void normTest() // 7.3484692283495345 // - Assert.AreEqual(20, LA.norm(a, 1)); - Assert.AreEqual(7, LA.norm(b, 1)); - Assert.GreaterOrEqual(0f, LA.norm(a, -1)); - Assert.GreaterOrEqual(6, LA.norm(b, -1)); - Assert.GreaterOrEqual(7.74596669f, LA.norm(a, 2)); - Assert.GreaterOrEqual(7.34846922f, LA.norm(b, 2)); + Assert.AreEqual(20f, (float)LA.norm(a, 1)); + Assert.AreEqual(7f, (float)LA.norm(b, 1)); + Assert.GreaterOrEqual(0f, (float)LA.norm(a, -1)); + Assert.GreaterOrEqual(6, (float)LA.norm(b, -1)); + Assert.GreaterOrEqual(7.74596669f, (float)LA.norm(a, 2)); + Assert.GreaterOrEqual(7.34846922f, (float)LA.norm(b, 2)); // >>> LA.norm(a, -2) - // nan + // 0.0 // >>> LA.norm(b, -2) // 1.8570331885190563e-016 // >>> LA.norm(a, 3) // 5.8480354764257312 // >>> LA.norm(a, -3) - // nan + // 0.0 // + Assert.AreEqual(0f, (float)LA.norm(a, -2)); + Assert.AreEqual(1.8570331885190563e-016f, (float)LA.norm(b, -2)); + Assert.AreEqual(5.8480354764257312f, (float)LA.norm(a, 3)); + Assert.AreEqual(0f, (float)LA.norm(a, -3)); + -#if TODO - object given = null; - object expected = null; - given= LA.norm(a, -2); - expected= - "nan"; - Assert.AreEqual(expected, given.repr); - given= LA.norm(b, -2); - expected= - "1.8570331885190563e-016"; - Assert.AreEqual(expected, given.repr); - given= LA.norm(a, 3); - expected= - "5.8480354764257312"; - Assert.AreEqual(expected, given.repr); - given= LA.norm(a, -3); - expected= - "nan"; - Assert.AreEqual(expected, given.repr); -#endif // Using the axis argument to compute vector norms: // >>> c = np.array([[ 1, 2, 3], @@ -695,27 +672,21 @@ public void normTest() // >>> LA.norm(c, ord=1, axis=1) // array([ 6., 6.]) // - -#if TODO - object given = null; - object expected = null; - given= c = np.array([[ 1, 2, 3],; - expected= - "... [-1, 1, 4]])"; - Assert.AreEqual(expected, given.repr); - given= LA.norm(c, axis=0); + var c = np.array(new[,]{{ 1, 2, 3},{-1, 1, 4}}); + given= LA.norm(c, axis:0); expected= - "array([ 1.41421356, 2.23606798, 5. ])"; + "array([1.41421356, 2.23606798, 5. ])"; Assert.AreEqual(expected, given.repr); - given= LA.norm(c, axis=1); + given= LA.norm(c, axis:1); expected= - "array([ 3.74165739, 4.24264069])"; + "array([3.74165739, 4.24264069])"; Assert.AreEqual(expected, given.repr); - given= LA.norm(c, ord=1, axis=1); + given= LA.norm(c, ord:1, axis:1); expected= - "array([ 6., 6.])"; + "array([6., 6.])"; Assert.AreEqual(expected, given.repr); -#endif + + // Using the axis argument to compute matrix norms: // >>> m = np.arange(8).reshape(2,2,2) @@ -724,20 +695,16 @@ public void normTest() // >>> LA.norm(m[0, :, :]), LA.norm(m[1, :, :]) // (3.7416573867739413, 11.224972160321824) // - -#if TODO - object given = null; - object expected = null; - given= m = np.arange(8).reshape(2,2,2); - given= LA.norm(m, axis=(1,2)); + var m = np.arange(8).reshape(2,2,2); + given= LA.norm(m, axis: new[]{1,2}); expected= - "array([ 3.74165739, 11.22497216])"; + "array([ 3.74165739, 11.22497216])"; Assert.AreEqual(expected, given.repr); - given= LA.norm(m[0, :, :]), LA.norm(m[1, :, :]); + var given1= new[]{ LA.norm(m["0, :, :"]), LA.norm(m["1, :, :"])}; expected= "(3.7416573867739413, 11.224972160321824)"; - Assert.AreEqual(expected, given.repr); -#endif + Assert.AreEqual(expected, given1.repr()); + } [TestMethod] diff --git a/test/Numpy.UnitTest/NumPy_math.tests.cs b/test/Numpy.UnitTest/NumPy_math.tests.cs index 47d19f7..4dfad8b 100644 --- a/test/Numpy.UnitTest/NumPy_math.tests.cs +++ b/test/Numpy.UnitTest/NumPy_math.tests.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Numerics; using System.Runtime.InteropServices; using System.Text; using Numpy.Models; @@ -18,36 +19,36 @@ namespace Numpy.UnitTest [TestClass] public class NumPy_mathTest : BaseTestCase { - + [TestMethod] public void sinTest() { // Print sine of one angle: - + // >>> np.sin(np.pi/2.) // 1.0 // - - #if TODO + +#if TODO var given= np.sin(np.pi/2.); var expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Print sines of an array of angles given in degrees: - + // >>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) // array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ]) // - - #if TODO + +#if TODO given= np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ); expected= "array([ 0. , 0.5 , 0.70710678, 0.8660254 , 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot the sine function: - + // >>> import matplotlib.pylab as plt // >>> x = np.linspace(-np.pi, np.pi, 201) // >>> plt.plot(x, np.sin(x)) @@ -56,8 +57,8 @@ public void sinTest() // >>> plt.axis('tight') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pylab as plt; given= x = np.linspace(-np.pi, np.pi, 201); given= plt.plot(x, np.sin(x)); @@ -65,10 +66,10 @@ public void sinTest() given= plt.ylabel('sin(x)'); given= plt.axis('tight'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void cosTest() { @@ -86,8 +87,8 @@ public void cosTest() // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO var given= np.cos(np.array({0, np.pi/2, np.pi})); var expected= "array([ 1.00000000e+00, 6.12303177e-17, -1.00000000e+00])"; @@ -107,10 +108,10 @@ public void cosTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void tanTest() { @@ -130,8 +131,8 @@ public void tanTest() // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO var given= from math import pi; given= np.tan(np.array({-pi,pi/2,pi})); var expected= @@ -153,10 +154,10 @@ public void tanTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arcsinTest() { @@ -167,8 +168,8 @@ public void arcsinTest() // >>> np.arcsin(0) // 0.0 // - - #if TODO + +#if TODO var given= np.arcsin(1) # pi/2; var expected= "1.5707963267948966"; @@ -181,88 +182,88 @@ public void arcsinTest() expected= "0.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arccosTest() { // We expect the arccos of 1 to be 0, and of -1 to be pi: - + // >>> np.arccos([1, -1]) // array([ 0. , 3.14159265]) // - - #if TODO + +#if TODO var given= np.arccos({1, -1}); var expected= "array([ 0. , 3.14159265])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot arccos: - + // >>> import matplotlib.pyplot as plt // >>> x = np.linspace(-1, 1, num=100) // >>> plt.plot(x, np.arccos(x)) // >>> plt.axis('tight') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= x = np.linspace(-1, 1, num=100); given= plt.plot(x, np.arccos(x)); given= plt.axis('tight'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void arctanTest() { // We expect the arctan of 0 to be 0, and of 1 to be pi/4: - + // >>> np.arctan([0, 1]) // array([ 0. , 0.78539816]) // - - #if TODO + +#if TODO var given= np.arctan({0, 1}); var expected= "array([ 0. , 0.78539816])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.pi/4 // 0.78539816339744828 // - - #if TODO + +#if TODO given= np.pi/4; expected= "0.78539816339744828"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot arctan: - + // >>> import matplotlib.pyplot as plt // >>> x = np.linspace(-10, 10) // >>> plt.plot(x, np.arctan(x)) // >>> plt.axis('tight') // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= x = np.linspace(-10, 10); given= plt.plot(x, np.arctan(x)); given= plt.axis('tight'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void hypotTest() { @@ -271,64 +272,64 @@ public void hypotTest() // [ 5., 5., 5.], // [ 5., 5., 5.]]) // - - #if TODO + +#if TODO var given= np.hypot(3*np.ones((3, 3)), 4*np.ones((3, 3))); var expected= "array([[ 5., 5., 5.],\n" + " [ 5., 5., 5.],\n" + " [ 5., 5., 5.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Example showing broadcast of scalar_like argument: - + // >>> np.hypot(3*np.ones((3, 3)), [4]) // array([[ 5., 5., 5.], // [ 5., 5., 5.], // [ 5., 5., 5.]]) // - - #if TODO + +#if TODO given= np.hypot(3*np.ones((3, 3)), {4}); expected= "array([[ 5., 5., 5.],\n" + " [ 5., 5., 5.],\n" + " [ 5., 5., 5.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arctan2Test() { // Consider four points in different quadrants: - + // >>> x = np.array([-1, +1, +1, -1]) // >>> y = np.array([-1, -1, +1, +1]) // >>> np.arctan2(y, x) * 180 / np.pi // array([-135., -45., 45., 135.]) // - - #if TODO + +#if TODO var given= x = np.array({-1, +1, +1, -1}); given= y = np.array({-1, -1, +1, +1}); given= np.arctan2(y, x) * 180 / np.pi; var expected= "array([-135., -45., 45., 135.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Note the order of the parameters. arctan2 is defined also when x2 = 0 // and at several other special points, obtaining values in // the range [-pi, pi]: - + // >>> np.arctan2([1., -1.], [0., 0.]) // array([ 1.57079633, -1.57079633]) // >>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf]) // array([ 0. , 3.14159265, 0.78539816]) // - - #if TODO + +#if TODO given= np.arctan2({1., -1.}, {0., 0.}); expected= "array([ 1.57079633, -1.57079633])"; @@ -337,59 +338,59 @@ public void arctan2Test() expected= "array([ 0. , 3.14159265, 0.78539816])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void degreesTest() { // Convert a radian array to degrees - + // >>> rad = np.arange(12.)*np.pi/6 // >>> np.degrees(rad) // array([ 0., 30., 60., 90., 120., 150., 180., 210., 240., // 270., 300., 330.]) // - - #if TODO + +#if TODO var given= rad = np.arange(12.)*np.pi/6; given= np.degrees(rad); var expected= "array([ 0., 30., 60., 90., 120., 150., 180., 210., 240.,\n" + " 270., 300., 330.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> out = np.zeros((rad.shape)) // >>> r = degrees(rad, out) // >>> np.all(r == out) // True // - - #if TODO + +#if TODO given= out = np.zeros((rad.shape)); given= r = degrees(rad, out); given= np.all(r == out); expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void radiansTest() { // Convert a degree array to radians - + // >>> deg = np.arange(12.) * 30. // >>> np.radians(deg) // array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , // 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, // 5.23598776, 5.75958653]) // - - #if TODO + +#if TODO var given= deg = np.arange(12.) * 30.; given= np.radians(deg); var expected= @@ -397,24 +398,24 @@ public void radiansTest() " 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898,\n" + " 5.23598776, 5.75958653])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> out = np.zeros((deg.shape)) // >>> ret = np.radians(deg, out) // >>> ret is out // True // - - #if TODO + +#if TODO given= out = np.zeros((deg.shape)); given= ret = np.radians(deg, out); given= ret is out; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void unwrapTest() { @@ -425,8 +426,8 @@ public void unwrapTest() // >>> np.unwrap(phase) // array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) // - - #if TODO + +#if TODO var given= phase = np.linspace(0, np.pi, num=5); given= phase{3:} += np.pi; given= phase; @@ -437,42 +438,42 @@ public void unwrapTest() expected= "array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void deg2radTest() { // >>> np.deg2rad(180) // 3.1415926535897931 // - - #if TODO + +#if TODO var given= np.deg2rad(180); var expected= "3.1415926535897931"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rad2degTest() { // >>> np.rad2deg(np.pi/2) // 90.0 // - - #if TODO + +#if TODO var given= np.rad2deg(np.pi/2); var expected= "90.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void sinhTest() { @@ -484,8 +485,8 @@ public void sinhTest() // 1.2246063538223773e-016j // >>> # Discrepancy due to vagaries of floating point arithmetic. // - - #if TODO + +#if TODO var given= np.sinh(0); var expected= "0.0"; @@ -499,29 +500,29 @@ public void sinhTest() "1.2246063538223773e-016j"; Assert.AreEqual(expected, given.repr); given= # Discrepancy due to vagaries of floating point arithmetic.; - #endif +#endif // >>> # Example of providing the optional output parameter // >>> out2 = np.sinh([0.1], out1) // >>> out2 is out1 // True // - - #if TODO + +#if TODO given= # Example of providing the optional output parameter; given= out2 = np.sinh({0.1}, out1); given= out2 is out1; expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> # Example of ValueError due to provision of shape mis-matched `out` // >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) // Traceback (most recent call last): // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO given= # Example of ValueError due to provision of shape mis-matched `out`; given= np.sinh(np.zeros((3,3)),np.zeros((2,2))); expected= @@ -529,61 +530,61 @@ public void sinhTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void coshTest() { // >>> np.cosh(0) // 1.0 // - - #if TODO + +#if TODO var given= np.cosh(0); var expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The hyperbolic cosine describes the shape of a hanging cable: - + // >>> import matplotlib.pyplot as plt // >>> x = np.linspace(-4, 4, 1000) // >>> plt.plot(x, np.cosh(x)) // >>> plt.show() // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; given= x = np.linspace(-4, 4, 1000); given= plt.plot(x, np.cosh(x)); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void tanhTest() { // >>> np.tanh((0, np.pi*1j, np.pi*1j/2)) // array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j]) // - - #if TODO + +#if TODO var given= np.tanh((0, np.pi*1j, np.pi*1j/2)); var expected= "array([ 0. +0.00000000e+00j, 0. -1.22460635e-16j, 0. +1.63317787e+16j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> # Example of providing the optional output parameter illustrating // >>> # that what is returned is a reference to said parameter // >>> out2 = np.tanh([0.1], out1) // >>> out2 is out1 // True // - - #if TODO + +#if TODO given= # Example of providing the optional output parameter illustrating; given= # that what is returned is a reference to said parameter; given= out2 = np.tanh({0.1}, out1); @@ -591,15 +592,15 @@ public void tanhTest() expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> # Example of ValueError due to provision of shape mis-matched `out` // >>> np.tanh(np.zeros((3,3)),np.zeros((2,2))) // Traceback (most recent call last): // File "", line 1, in // ValueError: invalid return array shape // - - #if TODO + +#if TODO given= # Example of ValueError due to provision of shape mis-matched `out`; given= np.tanh(np.zeros((3,3)),np.zeros((2,2))); expected= @@ -607,26 +608,26 @@ public void tanhTest() " File "", line 1, in \n" + "ValueError: invalid return array shape"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arcsinhTest() { // >>> np.arcsinh(np.array([np.e, 10.0])) // array([ 1.72538256, 2.99822295]) // - - #if TODO + +#if TODO var given= np.arcsinh(np.array({np.e, 10.0})); var expected= "array([ 1.72538256, 2.99822295])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arccoshTest() { @@ -635,8 +636,8 @@ public void arccoshTest() // >>> np.arccosh(1) // 0.0 // - - #if TODO + +#if TODO var given= np.arccosh({np.e, 10.0}); var expected= "array([ 1.65745445, 2.99322285])"; @@ -645,26 +646,26 @@ public void arccoshTest() expected= "0.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void arctanhTest() { // >>> np.arctanh([0, -0.5]) // array([ 0. , -0.54930614]) // - - #if TODO + +#if TODO var given= np.arctanh({0, -0.5}); var expected= "array([ 0. , -0.54930614])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void aroundTest() { @@ -679,8 +680,8 @@ public void aroundTest() // >>> np.around([1,2,3,11], decimals=-1) // array([ 0, 0, 0, 10]) // - - #if TODO + +#if TODO var given= np.around({0.37, 1.64}); var expected= "array([ 0., 2.])"; @@ -701,10 +702,10 @@ public void aroundTest() expected= "array([ 0, 0, 0, 10])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void rintTest() { @@ -712,17 +713,17 @@ public void rintTest() // >>> np.rint(a) // array([-2., -2., -0., 0., 2., 2., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.rint(a); var expected= "array([-2., -2., -0., 0., 2., 2., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fixTest() { @@ -733,8 +734,8 @@ public void fixTest() // >>> np.fix([2.1, 2.9, -2.1, -2.9]) // array([ 2., 2., -2., -2.]) // - - #if TODO + +#if TODO var given= np.fix(3.14); var expected= "3.0"; @@ -747,10 +748,10 @@ public void fixTest() expected= "array([ 2., 2., -2., -2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void floorTest() { @@ -758,17 +759,17 @@ public void floorTest() // >>> np.floor(a) // array([-2., -2., -1., 0., 1., 1., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.floor(a); var expected= "array([-2., -2., -1., 0., 1., 1., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ceilTest() { @@ -776,17 +777,17 @@ public void ceilTest() // >>> np.ceil(a) // array([-1., -1., -0., 1., 2., 2., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.ceil(a); var expected= "array([-1., -1., -0., 1., 2., 2., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void truncTest() { @@ -794,14 +795,14 @@ public void truncTest() // >>> np.trunc(a) // array([-1., -1., -0., 0., 1., 1., 2.]) // - - #if TODO + +#if TODO var given= a = np.array({-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0}); given= np.trunc(a); var expected= "array([-1., -1., -0., 0., 1., 1., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } @@ -870,56 +871,55 @@ public void sumTest() // >>> np.sum([[0, 1], [0, 5]], axis=1) // array([1, 5]) // - - #if TODO - var given= np.sum({0.5, 1.5}); - var expected= + + var given = np.sum(new[] { 0.5, 1.5 }); + var expected = "2.0"; Assert.AreEqual(expected, given.repr); - given= np.sum({0.5, 0.7, 0.2, 1.5}, dtype=np.int32); - expected= - "1"; + given = np.sum(new[] { 0.5, 0.7, 0.2, 1.5 }, dtype: np.int32); + expected = + "1"; Assert.AreEqual(expected, given.repr); - given= np.sum({{0, 1}, {0, 5}}); - expected= - "6"; + given = np.sum(new[,] { { 0, 1 }, { 0, 5 } }); + expected = + "6"; Assert.AreEqual(expected, given.repr); - given= np.sum({{0, 1}, {0, 5}}, axis=0); - expected= - "array([0, 6])"; + given = np.sum(new[,] { { 0, 1 }, { 0, 5 } }, axis: 0); + expected = + "array([0, 6])"; Assert.AreEqual(expected, given.repr); - given= np.sum({{0, 1}, {0, 5}}, axis=1); - expected= - "array([1, 5])"; + given = np.sum(new[,] { { 0, 1 }, { 0, 5 } }, axis: 1); + expected = + "array([1, 5])"; Assert.AreEqual(expected, given.repr); - #endif + // If the accumulator is too small, overflow occurs: - + // >>> np.ones(128, dtype=np.int8).sum(dtype=np.int8) // -128 // - - #if TODO + +#if TODO given= np.ones(128, dtype=np.int8).sum(dtype=np.int8); expected= "-128"; Assert.AreEqual(expected, given.repr); - #endif +#endif // You can also start the sum with a value other than zero: - + // >>> np.sum([10], initial=5) // 15 // - - #if TODO + +#if TODO given= np.sum({10}, initial=5); expected= "15"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nanprodTest() { @@ -935,8 +935,8 @@ public void nanprodTest() // >>> np.nanprod(a, axis=0) // array([ 3., 2.]) // - - #if TODO + +#if TODO var given= np.nanprod(1); var expected= "1"; @@ -958,10 +958,10 @@ public void nanprodTest() expected= "array([ 3., 2.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nansumTest() { @@ -983,8 +983,8 @@ public void nansumTest() // >>> np.nansum([1, np.nan, np.inf, -np.inf]) # both +/- infinity present // nan // - - #if TODO + +#if TODO var given= np.nansum(1); var expected= "1"; @@ -1018,10 +1018,10 @@ public void nansumTest() expected= "nan"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void cumprodTest() { @@ -1033,8 +1033,8 @@ public void cumprodTest() // >>> np.cumprod(a, dtype=float) # specify type of output // array([ 1., 2., 6., 24., 120., 720.]) // - - #if TODO + +#if TODO var given= a = np.array({1,2,3}); given= np.cumprod(a) # intermediate results 1, 1*2; var expected= @@ -1046,38 +1046,38 @@ public void cumprodTest() expected= "array([ 1., 2., 6., 24., 120., 720.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The cumulative product for each column (i.e., over the rows) of a: - + // >>> np.cumprod(a, axis=0) // array([[ 1, 2, 3], // [ 4, 10, 18]]) // - - #if TODO + +#if TODO given= np.cumprod(a, axis=0); expected= "array([[ 1, 2, 3],\n" + " [ 4, 10, 18]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The cumulative product for each row (i.e. over the columns) of a: - + // >>> np.cumprod(a,axis=1) // array([[ 1, 2, 6], // [ 4, 20, 120]]) // - - #if TODO + +#if TODO given= np.cumprod(a,axis=1); expected= "array([[ 1, 2, 6],\n" + " [ 4, 20, 120]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void cumsumTest() { @@ -1090,8 +1090,8 @@ public void cumsumTest() // >>> np.cumsum(a, dtype=float) # specifies type of output value(s) // array([ 1., 3., 6., 10., 15., 21.]) // - - #if TODO + +#if TODO var given= a = np.array({{1,2,3}, {4,5,6}}); given= a; var expected= @@ -1106,7 +1106,7 @@ public void cumsumTest() expected= "array([ 1., 3., 6., 10., 15., 21.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns // array([[1, 2, 3], // [5, 7, 9]]) @@ -1114,8 +1114,8 @@ public void cumsumTest() // array([[ 1, 3, 6], // [ 4, 9, 15]]) // - - #if TODO + +#if TODO given= np.cumsum(a,axis=0) # sum over rows for each of the 3 columns; expected= "array([[1, 2, 3],\n" + @@ -1126,10 +1126,10 @@ public void cumsumTest() "array([[ 1, 3, 6],\n" + " [ 4, 9, 15]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nancumprodTest() { @@ -1149,8 +1149,8 @@ public void nancumprodTest() // array([[ 1., 2.], // [ 3., 3.]]) // - - #if TODO + +#if TODO var given= np.nancumprod(1); var expected= "array([1])"; @@ -1178,10 +1178,10 @@ public void nancumprodTest() "array([[ 1., 2.],\n" + " [ 3., 3.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nancumsumTest() { @@ -1201,8 +1201,8 @@ public void nancumsumTest() // array([[ 1., 3.], // [ 3., 3.]]) // - - #if TODO + +#if TODO var given= np.nancumsum(1); var expected= "array([1])"; @@ -1230,10 +1230,10 @@ public void nancumsumTest() "array([[ 1., 3.],\n" + " [ 3., 3.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void diffTest() { @@ -1243,8 +1243,8 @@ public void diffTest() // >>> np.diff(x, n=2) // array([ 1, 1, -10]) // - - #if TODO + +#if TODO var given= x = np.array({1, 2, 4, 7, 0}); given= np.diff(x); var expected= @@ -1254,7 +1254,7 @@ public void diffTest() expected= "array([ 1, 1, -10])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]]) // >>> np.diff(x) // array([[2, 3, 4], @@ -1262,8 +1262,8 @@ public void diffTest() // >>> np.diff(x, axis=0) // array([[-1, 2, 0, -2]]) // - - #if TODO + +#if TODO given= x = np.array({{1, 3, 6, 10}, {0, 5, 6, 8}}); given= np.diff(x); expected= @@ -1274,22 +1274,22 @@ public void diffTest() expected= "array([[-1, 2, 0, -2]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64) // >>> np.diff(x) // array([1, 1], dtype='timedelta64[D]') // - - #if TODO + +#if TODO given= x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64); given= np.diff(x); expected= "array([1, 1], dtype='timedelta64[D]')"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ediff1dTest() { @@ -1297,41 +1297,41 @@ public void ediff1dTest() // >>> np.ediff1d(x) // array([ 1, 2, 3, -7]) // - - #if TODO + +#if TODO var given= x = np.array({1, 2, 4, 7, 0}); given= np.ediff1d(x); var expected= "array([ 1, 2, 3, -7])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99])) // array([-99, 1, 2, 3, -7, 88, 99]) // - - #if TODO + +#if TODO given= np.ediff1d(x, to_begin=-99, to_end=np.array({88, 99})); expected= "array([-99, 1, 2, 3, -7, 88, 99])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The returned array is always 1D. - + // >>> y = [[1, 2, 4], [1, 6, 24]] // >>> np.ediff1d(y) // array([ 1, 2, -3, 5, 18]) // - - #if TODO + +#if TODO given= y = [[1, 2, 4], [1, 6, 24]]; given= np.ediff1d(y); expected= "array([ 1, 2, -3, 5, 18])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void gradientTest() { @@ -1341,8 +1341,8 @@ public void gradientTest() // >>> np.gradient(f, 2) // array([ 0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) // - - #if TODO + +#if TODO var given= f = np.array({1, 2, 4, 7, 11, 16}, dtype=float); given= np.gradient(f); var expected= @@ -1352,58 +1352,58 @@ public void gradientTest() expected= "array([ 0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Spacing can be also specified with an array that represents the coordinates // of the values F along the dimensions. // For instance a uniform spacing: - + // >>> x = np.arange(f.size) // >>> np.gradient(f, x) // array([ 1. , 1.5, 2.5, 3.5, 4.5, 5. ]) // - - #if TODO + +#if TODO given= x = np.arange(f.size); given= np.gradient(f, x); expected= "array([ 1. , 1.5, 2.5, 3.5, 4.5, 5. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Or a non uniform one: - + // >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float) // >>> np.gradient(f, x) // array([ 1. , 3. , 3.5, 6.7, 6.9, 2.5]) // - - #if TODO + +#if TODO given= x = np.array({0., 1., 1.5, 3.5, 4., 6.}, dtype=float); given= np.gradient(f, x); expected= "array([ 1. , 3. , 3.5, 6.7, 6.9, 2.5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // For two dimensional arrays, the return will be two arrays ordered by // axis. In this example the first array stands for the gradient in // rows and the second one in columns direction: - + // >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float)) // [array([[ 2., 2., -1.], // [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ], // [ 1. , 1. , 1. ]])] // - - #if TODO + +#if TODO given= np.gradient(np.array({{1, 2, 6}, {3, 4, 5}}, dtype=float)); expected= "[array([[ 2., 2., -1.],\n" + " [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ],\n" + " [ 1. , 1. , 1. ]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // In this example the spacing is also specified: // uniform for axis=0 and non uniform for axis=1 - + // >>> dx = 2. // >>> y = [1., 1.5, 3.5] // >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y) @@ -1411,8 +1411,8 @@ public void gradientTest() // [ 1. , 1. , -0.5]]), array([[ 2. , 2. , 2. ], // [ 2. , 1.7, 0.5]])] // - - #if TODO + +#if TODO given= dx = 2.; given= y = [1., 1.5, 3.5]; given= np.gradient(np.array({{1, 2, 6}, {3, 4, 5}}, dtype=float), dx, y); @@ -1421,9 +1421,9 @@ public void gradientTest() " [ 1. , 1. , -0.5]]), array([[ 2. , 2. , 2. ],\n" + " [ 2. , 1.7, 0.5]])]"; Assert.AreEqual(expected, given.repr); - #endif +#endif // It is possible to specify how boundaries are treated using edge_order - + // >>> x = np.array([0, 1, 2, 3, 4]) // >>> f = x**2 // >>> np.gradient(f, edge_order=1) @@ -1431,8 +1431,8 @@ public void gradientTest() // >>> np.gradient(f, edge_order=2) // array([-0., 2., 4., 6., 8.]) // - - #if TODO + +#if TODO given= x = np.array({0, 1, 2, 3, 4}); given= f = x**2; given= np.gradient(f, edge_order=1); @@ -1443,103 +1443,103 @@ public void gradientTest() expected= "array([-0., 2., 4., 6., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The axis keyword can be used to specify a subset of axes of which the // gradient is calculated - + // >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0) // array([[ 2., 2., -1.], // [ 2., 2., -1.]]) // - - #if TODO + +#if TODO given= np.gradient(np.array({{1, 2, 6}, {3, 4, 5}}, dtype=float), axis=0); expected= "array([[ 2., 2., -1.],\n" + " [ 2., 2., -1.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void crossTest() { // Vector cross-product. - + // >>> x = [1, 2, 3] // >>> y = [4, 5, 6] // >>> np.cross(x, y) // array([-3, 6, -3]) // - - #if TODO + +#if TODO var given= x = [1, 2, 3]; given= y = [4, 5, 6]; given= np.cross(x, y); var expected= "array([-3, 6, -3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // One vector with dimension 2. - + // >>> x = [1, 2] // >>> y = [4, 5, 6] // >>> np.cross(x, y) // array([12, -6, -3]) // - - #if TODO + +#if TODO given= x = [1, 2]; given= y = [4, 5, 6]; given= np.cross(x, y); expected= "array([12, -6, -3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Equivalently: - + // >>> x = [1, 2, 0] // >>> y = [4, 5, 6] // >>> np.cross(x, y) // array([12, -6, -3]) // - - #if TODO + +#if TODO given= x = [1, 2, 0]; given= y = [4, 5, 6]; given= np.cross(x, y); expected= "array([12, -6, -3])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Both vectors with dimension 2. - + // >>> x = [1,2] // >>> y = [4,5] // >>> np.cross(x, y) // -3 // - - #if TODO + +#if TODO given= x = [1,2]; given= y = [4,5]; given= np.cross(x, y); expected= "-3"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Multiple vector cross-products. Note that the direction of the cross // product vector is defined by the right-hand rule. - + // >>> x = np.array([[1,2,3], [4,5,6]]) // >>> y = np.array([[4,5,6], [1,2,3]]) // >>> np.cross(x, y) // array([[-3, 6, -3], // [ 3, -6, 3]]) // - - #if TODO + +#if TODO given= x = np.array({{1,2,3}, {4,5,6}}); given= y = np.array({{4,5,6}, {1,2,3}}); given= np.cross(x, y); @@ -1547,25 +1547,25 @@ public void crossTest() "array([[-3, 6, -3],\n" + " [ 3, -6, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The orientation of c can be changed using the axisc keyword. - + // >>> np.cross(x, y, axisc=0) // array([[-3, 3], // [ 6, -6], // [-3, 3]]) // - - #if TODO + +#if TODO given= np.cross(x, y, axisc=0); expected= "array([[-3, 3],\n" + " [ 6, -6],\n" + " [-3, 3]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Change the vector definition of x and y using axisa and axisb. - + // >>> x = np.array([[1,2,3], [4,5,6], [7, 8, 9]]) // >>> y = np.array([[7, 8, 9], [4,5,6], [1,2,3]]) // >>> np.cross(x, y) @@ -1577,8 +1577,8 @@ public void crossTest() // [-30, 60, -30], // [-36, 72, -36]]) // - - #if TODO + +#if TODO given= x = np.array({{1,2,3}, {4,5,6}, {7, 8, 9}}); given= y = np.array({{7, 8, 9}, {4,5,6}, {1,2,3}}); given= np.cross(x, y); @@ -1593,10 +1593,10 @@ public void crossTest() " [-30, 60, -30],\n" + " [-36, 72, -36]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void trapzTest() { @@ -1615,8 +1615,8 @@ public void trapzTest() // >>> np.trapz(a, axis=1) // array([ 2., 8.]) // - - #if TODO + +#if TODO var given= np.trapz({1,2,3}); var expected= "4.0"; @@ -1643,53 +1643,53 @@ public void trapzTest() expected= "array([ 2., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void expTest() { // Plot the magnitude and phase of exp(x) in the complex plane: - + // >>> import matplotlib.pyplot as plt // - - #if TODO + +#if TODO var given= import matplotlib.pyplot as plt; - #endif +#endif // >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) // >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane // >>> out = np.exp(xx) // - - #if TODO + +#if TODO given= x = np.linspace(-2*np.pi, 2*np.pi, 100); given= xx = x + 1j * x{:, np.newaxis} # a + ib over complex plane; given= out = np.exp(xx); - #endif +#endif // >>> plt.subplot(121) // >>> plt.imshow(np.abs(out), // ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray') // >>> plt.title('Magnitude of exp(x)') // - - #if TODO + +#if TODO given= plt.subplot(121); given= plt.imshow(np.abs(out),; var expected= "... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray')"; Assert.AreEqual(expected, given.repr); given= plt.title('Magnitude of exp(x)'); - #endif +#endif // >>> plt.subplot(122) // >>> plt.imshow(np.angle(out), // ... extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv') // >>> plt.title('Phase (angle) of exp(x)') // >>> plt.show() // - - #if TODO + +#if TODO given= plt.subplot(122); given= plt.imshow(np.angle(out),; expected= @@ -1697,24 +1697,24 @@ public void expTest() Assert.AreEqual(expected, given.repr); given= plt.title('Phase (angle) of exp(x)'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void expm1Test() { // The true value of exp(1e-10) - 1 is 1.00000000005e-10 to // about 32 significant digits. This example shows the superiority of // expm1 in this case. - + // >>> np.expm1(1e-10) // 1.00000000005e-10 // >>> np.exp(1e-10) - 1 // 1.000000082740371e-10 // - - #if TODO + +#if TODO var given= np.expm1(1e-10); var expected= "1.00000000005e-10"; @@ -1723,58 +1723,58 @@ public void expm1Test() expected= "1.000000082740371e-10"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void exp2Test() { // >>> np.exp2([2, 3]) // array([ 4., 8.]) // - - #if TODO + +#if TODO var given= np.exp2({2, 3}); var expected= "array([ 4., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void logTest() { // >>> np.log([1, np.e, np.e**2, 0]) // array([ 0., 1., 2., -Inf]) // - - #if TODO + +#if TODO var given= np.log({1, np.e, np.e**2, 0}); var expected= "array([ 0., 1., 2., -Inf])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void log10Test() { // >>> np.log10([1e-15, -3.]) // array([-15., NaN]) // - - #if TODO + +#if TODO var given= np.log10({1e-15, -3.}); var expected= "array([-15., NaN])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void log2Test() { @@ -1782,29 +1782,29 @@ public void log2Test() // >>> np.log2(x) // array([-Inf, 0., 1., 4.]) // - - #if TODO + +#if TODO var given= x = np.array({0, 1, 2, 2**4}); given= np.log2(x); var expected= "array([-Inf, 0., 1., 4.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) // >>> np.log2(xi) // array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) // - - #if TODO + +#if TODO given= xi = np.array({0+1.j, 1, 2+0.j, 4.j}); given= np.log2(xi); expected= "array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void log1pTest() { @@ -1813,8 +1813,8 @@ public void log1pTest() // >>> np.log(1 + 1e-99) // 0.0 // - - #if TODO + +#if TODO var given= np.log1p(1e-99); var expected= "1e-99"; @@ -1823,10 +1823,10 @@ public void log1pTest() expected= "0.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void logaddexpTest() { @@ -1838,8 +1838,8 @@ public void logaddexpTest() // >>> np.exp(prob12) // 3.5000000000000057e-50 // - - #if TODO + +#if TODO var given= prob1 = np.log(1e-50); given= prob2 = np.log(2.5e-50); given= prob12 = np.logaddexp(prob1, prob2); @@ -1851,10 +1851,10 @@ public void logaddexpTest() expected= "3.5000000000000057e-50"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void logaddexp2Test() { @@ -1866,8 +1866,8 @@ public void logaddexp2Test() // >>> 2**prob12 // 3.4999999999999914e-50 // - - #if TODO + +#if TODO var given= prob1 = np.log2(1e-50); given= prob2 = np.log2(2.5e-50); given= prob12 = np.logaddexp2(prob1, prob2); @@ -1879,10 +1879,10 @@ public void logaddexp2Test() expected= "3.4999999999999914e-50"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void sincTest() { @@ -1904,8 +1904,8 @@ public void sincTest() // -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, // -4.92362781e-02, -3.89804309e-17]) // - - #if TODO + +#if TODO var given= import matplotlib.pyplot as plt; given= x = np.linspace(-4, 4, 41); given= np.sinc(x); @@ -1925,7 +1925,7 @@ public void sincTest() " -5.84680802e-02, -8.90384387e-02, -8.40918587e-02,\n" + " -4.92362781e-02, -3.89804309e-17])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> plt.plot(x, np.sinc(x)) // [] // >>> plt.title("Sinc Function") @@ -1936,8 +1936,8 @@ public void sincTest() // // >>> plt.show() // - - #if TODO + +#if TODO given= plt.plot(x, np.sinc(x)); expected= "[]"; @@ -1955,26 +1955,26 @@ public void sincTest() ""; Assert.AreEqual(expected, given.repr); given= plt.show(); - #endif +#endif // It works in 2-D as well: - + // >>> x = np.linspace(-4, 4, 401) // >>> xx = np.outer(x, x) // >>> plt.imshow(np.sinc(xx)) // // - - #if TODO + +#if TODO given= x = np.linspace(-4, 4, 401); given= xx = np.outer(x, x); given= plt.imshow(np.sinc(xx)); expected= ""; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void signbitTest() { @@ -1983,8 +1983,8 @@ public void signbitTest() // >>> np.signbit(np.array([1, -2.3, 2.1])) // array([False, True, False]) // - - #if TODO + +#if TODO var given= np.signbit(-1.2); var expected= "True"; @@ -1993,10 +1993,10 @@ public void signbitTest() expected= "array([False, True, False])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void copysignTest() { @@ -2007,8 +2007,8 @@ public void copysignTest() // >>> 1/np.copysign(0, -1) // -inf // - - #if TODO + +#if TODO var given= np.copysign(1.3, -1); var expected= "-1.3"; @@ -2021,14 +2021,14 @@ public void copysignTest() expected= "-inf"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.copysign([-1, 0, 1], -1.1) // array([-1., -0., -1.]) // >>> np.copysign([-1, 0, 1], np.arange(3)-1) // array([-1., 0., 1.]) // - - #if TODO + +#if TODO given= np.copysign({-1, 0, 1}, -1.1); expected= "array([-1., -0., -1.])"; @@ -2037,10 +2037,10 @@ public void copysignTest() expected= "array([-1., 0., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void frexpTest() { @@ -2054,8 +2054,8 @@ public void frexpTest() // >>> y1 * 2**y2 // array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) // - - #if TODO + +#if TODO var given= x = np.arange(9); given= y1, y2 = np.frexp(x); given= y1; @@ -2071,38 +2071,38 @@ public void frexpTest() expected= "array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void ldexpTest() { // >>> np.ldexp(5, np.arange(4)) // array([ 5., 10., 20., 40.], dtype=float32) // - - #if TODO + +#if TODO var given= np.ldexp(5, np.arange(4)); var expected= "array([ 5., 10., 20., 40.], dtype=float32)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.arange(6) // >>> np.ldexp(*np.frexp(x)) // array([ 0., 1., 2., 3., 4., 5.]) // - - #if TODO + +#if TODO given= x = np.arange(6); given= np.ldexp(*np.frexp(x)); expected= "array([ 0., 1., 2., 3., 4., 5.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nextafterTest() { @@ -2112,8 +2112,8 @@ public void nextafterTest() // >>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps] // array([ True, True]) // - - #if TODO + +#if TODO var given= eps = np.finfo(np.float64).eps; given= np.nextafter(1, 2) == eps + 1; var expected= @@ -2123,26 +2123,26 @@ public void nextafterTest() expected= "array([ True, True])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void spacingTest() { // >>> np.spacing(1) == np.finfo(np.float64).eps // True // - - #if TODO + +#if TODO var given= np.spacing(1) == np.finfo(np.float64).eps; var expected= "True"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void lcmTest() { @@ -2155,8 +2155,8 @@ public void lcmTest() // >>> np.lcm(np.arange(6), 20) // array([ 0, 20, 20, 60, 20, 20]) // - - #if TODO + +#if TODO var given= np.lcm(12, 20); var expected= "60"; @@ -2173,10 +2173,10 @@ public void lcmTest() expected= "array([ 0, 20, 20, 60, 20, 20])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void gcdTest() { @@ -2187,8 +2187,8 @@ public void gcdTest() // >>> np.gcd(np.arange(6), 20) // array([20, 1, 2, 1, 4, 5]) // - - #if TODO + +#if TODO var given= np.gcd(12, 20); var expected= "4"; @@ -2201,10 +2201,10 @@ public void gcdTest() expected= "array([20, 1, 2, 1, 4, 5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void addTest() { @@ -2217,8 +2217,8 @@ public void addTest() // [ 3., 5., 7.], // [ 6., 8., 10.]]) // - - #if TODO + +#if TODO var given= np.add(1.0, 4.0); var expected= "5.0"; @@ -2231,10 +2231,10 @@ public void addTest() " [ 3., 5., 7.],\n" + " [ 6., 8., 10.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void reciprocalTest() { @@ -2243,8 +2243,8 @@ public void reciprocalTest() // >>> np.reciprocal([1, 2., 3.33]) // array([ 1. , 0.5 , 0.3003003]) // - - #if TODO + +#if TODO var given= np.reciprocal(2.); var expected= "0.5"; @@ -2253,39 +2253,39 @@ public void reciprocalTest() expected= "array([ 1. , 0.5 , 0.3003003])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void negativeTest() { // >>> np.negative([1.,-1.]) // array([-1., 1.]) // - - #if TODO + +#if TODO var given= np.negative({1.,-1.}); var expected= "array([-1., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void multiplyTest() { // >>> np.multiply(2.0, 4.0) // 8.0 // - - #if TODO + +#if TODO var given= np.multiply(2.0, 4.0); var expected= "8.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x1 = np.arange(9.0).reshape((3, 3)) // >>> x2 = np.arange(3.0) // >>> np.multiply(x1, x2) @@ -2293,8 +2293,8 @@ public void multiplyTest() // [ 0., 4., 10.], // [ 0., 7., 16.]]) // - - #if TODO + +#if TODO given= x1 = np.arange(9.0).reshape((3, 3)); given= x2 = np.arange(3.0); given= np.multiply(x1, x2); @@ -2303,10 +2303,10 @@ public void multiplyTest() " [ 0., 4., 10.],\n" + " [ 0., 7., 16.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void divideTest() { @@ -2314,21 +2314,21 @@ public void divideTest() // >>> np.true_divide(x, 4) // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // - - #if TODO + +#if TODO var given= x = np.arange(5); given= np.true_divide(x, 4); var expected= "array([ 0. , 0.25, 0.5 , 0.75, 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x/4 // array([0, 0, 0, 0, 1]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= x/4; expected= "array([0, 0, 0, 0, 1])"; @@ -2337,15 +2337,15 @@ public void divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> from __future__ import division // >>> x/4 // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= from __future__ import division; given= x/4; expected= @@ -2355,23 +2355,23 @@ public void divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void powerTest() { // Cube each element in a list. - + // >>> x1 = range(6) // >>> x1 // [0, 1, 2, 3, 4, 5] // >>> np.power(x1, 3) // array([ 0, 1, 8, 27, 64, 125]) // - - #if TODO + +#if TODO var given= x1 = range(6); given= x1; var expected= @@ -2381,23 +2381,23 @@ public void powerTest() expected= "array([ 0, 1, 8, 27, 64, 125])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Raise the bases to different exponents. - + // >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] // >>> np.power(x1, x2) // array([ 0., 1., 8., 27., 16., 5.]) // - - #if TODO + +#if TODO given= x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0]; given= np.power(x1, x2); expected= "array([ 0., 1., 8., 27., 16., 5.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The effect of broadcasting. - + // >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) // >>> x2 // array([[1, 2, 3, 3, 2, 1], @@ -2406,8 +2406,8 @@ public void powerTest() // array([[ 0, 1, 8, 27, 16, 5], // [ 0, 1, 8, 27, 16, 5]]) // - - #if TODO + +#if TODO given= x2 = np.array({{1, 2, 3, 3, 2, 1}, {1, 2, 3, 3, 2, 1}}); given= x2; expected= @@ -2419,23 +2419,23 @@ public void powerTest() "array([[ 0, 1, 8, 27, 16, 5],\n" + " [ 0, 1, 8, 27, 16, 5]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void subtractTest() { // >>> np.subtract(1.0, 4.0) // -3.0 // - - #if TODO + +#if TODO var given= np.subtract(1.0, 4.0); var expected= "-3.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x1 = np.arange(9.0).reshape((3, 3)) // >>> x2 = np.arange(3.0) // >>> np.subtract(x1, x2) @@ -2443,8 +2443,8 @@ public void subtractTest() // [ 3., 3., 3.], // [ 6., 6., 6.]]) // - - #if TODO + +#if TODO given= x1 = np.arange(9.0).reshape((3, 3)); given= x2 = np.arange(3.0); given= np.subtract(x1, x2); @@ -2453,10 +2453,10 @@ public void subtractTest() " [ 3., 3., 3.],\n" + " [ 6., 6., 6.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void true_divideTest() { @@ -2464,21 +2464,21 @@ public void true_divideTest() // >>> np.true_divide(x, 4) // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // - - #if TODO + +#if TODO var given= x = np.arange(5); given= np.true_divide(x, 4); var expected= "array([ 0. , 0.25, 0.5 , 0.75, 1. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x/4 // array([0, 0, 0, 0, 1]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= x/4; expected= "array([0, 0, 0, 0, 1])"; @@ -2487,15 +2487,15 @@ public void true_divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> from __future__ import division // >>> x/4 // array([ 0. , 0.25, 0.5 , 0.75, 1. ]) // >>> x//4 // array([0, 0, 0, 0, 1]) // - - #if TODO + +#if TODO given= from __future__ import division; given= x/4; expected= @@ -2505,10 +2505,10 @@ public void true_divideTest() expected= "array([0, 0, 0, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void floor_divideTest() { @@ -2517,8 +2517,8 @@ public void floor_divideTest() // >>> np.floor_divide([1., 2., 3., 4.], 2.5) // array([ 0., 0., 1., 1.]) // - - #if TODO + +#if TODO var given= np.floor_divide(7,3); var expected= "2"; @@ -2527,23 +2527,23 @@ public void floor_divideTest() expected= "array([ 0., 0., 1., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void float_powerTest() { // Cube each element in a list. - + // >>> x1 = range(6) // >>> x1 // [0, 1, 2, 3, 4, 5] // >>> np.float_power(x1, 3) // array([ 0., 1., 8., 27., 64., 125.]) // - - #if TODO + +#if TODO var given= x1 = range(6); given= x1; var expected= @@ -2553,23 +2553,23 @@ public void float_powerTest() expected= "array([ 0., 1., 8., 27., 64., 125.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Raise the bases to different exponents. - + // >>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0] // >>> np.float_power(x1, x2) // array([ 0., 1., 8., 27., 16., 5.]) // - - #if TODO + +#if TODO given= x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0]; given= np.float_power(x1, x2); expected= "array([ 0., 1., 8., 27., 16., 5.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The effect of broadcasting. - + // >>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]]) // >>> x2 // array([[1, 2, 3, 3, 2, 1], @@ -2578,8 +2578,8 @@ public void float_powerTest() // array([[ 0., 1., 8., 27., 16., 5.], // [ 0., 1., 8., 27., 16., 5.]]) // - - #if TODO + +#if TODO given= x2 = np.array({{1, 2, 3, 3, 2, 1}, {1, 2, 3, 3, 2, 1}}); given= x2; expected= @@ -2591,10 +2591,10 @@ public void float_powerTest() "array([[ 0., 1., 8., 27., 16., 5.],\n" + " [ 0., 1., 8., 27., 16., 5.]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fmodTest() { @@ -2603,8 +2603,8 @@ public void fmodTest() // >>> np.remainder([-3, -2, -1, 1, 2, 3], 2) // array([1, 0, 1, 1, 0, 1]) // - - #if TODO + +#if TODO var given= np.fmod({-3, -2, -1, 1, 2, 3}, 2); var expected= "array([-1, 0, -1, 1, 0, 1])"; @@ -2613,7 +2613,7 @@ public void fmodTest() expected= "array([1, 0, 1, 1, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmod([5, 3], [2, 2.]) // array([ 1., 1.]) // >>> a = np.arange(-3, 3).reshape(3, 2) @@ -2626,8 +2626,8 @@ public void fmodTest() // [-1, 0], // [ 1, 0]]) // - - #if TODO + +#if TODO given= np.fmod({5, 3}, {2, 2.}); expected= "array([ 1., 1.])"; @@ -2645,10 +2645,10 @@ public void fmodTest() " [-1, 0],\n" + " [ 1, 0]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void modTest() { @@ -2657,8 +2657,8 @@ public void modTest() // >>> np.remainder(np.arange(7), 5) // array([0, 1, 2, 3, 4, 0, 1]) // - - #if TODO + +#if TODO var given= np.remainder({4, 7}, {2, 3}); var expected= "array([0, 1])"; @@ -2667,10 +2667,10 @@ public void modTest() expected= "array([0, 1, 2, 3, 4, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void modfTest() { @@ -2679,8 +2679,8 @@ public void modfTest() // >>> np.modf(-0.5) // (-0.5, -0) // - - #if TODO + +#if TODO var given= np.modf({0, 3.5}); var expected= "(array([ 0. , 0.5]), array([ 0., 3.]))"; @@ -2689,10 +2689,10 @@ public void modfTest() expected= "(-0.5, -0)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void remainderTest() { @@ -2701,8 +2701,8 @@ public void remainderTest() // >>> np.remainder(np.arange(7), 5) // array([0, 1, 2, 3, 4, 0, 1]) // - - #if TODO + +#if TODO var given= np.remainder({4, 7}, {2, 3}); var expected= "array([0, 1])"; @@ -2711,26 +2711,26 @@ public void remainderTest() expected= "array([0, 1, 2, 3, 4, 0, 1])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void divmodTest() { // >>> np.divmod(np.arange(5), 3) // (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) // - - #if TODO + +#if TODO var given= np.divmod(np.arange(5), 3); var expected= "(array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1]))"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void angleTest() { @@ -2739,8 +2739,8 @@ public void angleTest() // >>> np.angle(1+1j, deg=True) # in degrees // 45.0 // - - #if TODO + +#if TODO var given= np.angle({1.0, 1.0j, 1+1j}) # in radians; var expected= "array([ 0. , 1.57079633, 0.78539816])"; @@ -2749,10 +2749,10 @@ public void angleTest() expected= "45.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void realTest() { @@ -2768,8 +2768,8 @@ public void realTest() // >>> np.real(1 + 1j) // 1.0 // - - #if TODO + +#if TODO var given= a = np.array({1+2j, 3+4j, 5+6j}); given= a.real; var expected= @@ -2789,10 +2789,10 @@ public void realTest() expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void imagTest() { @@ -2805,8 +2805,8 @@ public void imagTest() // >>> np.imag(1 + 1j) // 1.0 // - - #if TODO + +#if TODO var given= a = np.array({1+2j, 3+4j, 5+6j}); given= a.imag; var expected= @@ -2821,86 +2821,86 @@ public void imagTest() expected= "1.0"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void conjTest() { // >>> np.conjugate(1+2j) // (1-2j) // - - #if TODO + +#if TODO var given= np.conjugate(1+2j); var expected= "(1-2j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> x = np.eye(2) + 1j * np.eye(2) // >>> np.conjugate(x) // array([[ 1.-1.j, 0.-0.j], // [ 0.-0.j, 1.-1.j]]) // - - #if TODO + +#if TODO given= x = np.eye(2) + 1j * np.eye(2); given= np.conjugate(x); expected= "array([[ 1.-1.j, 0.-0.j],\n" + " [ 0.-0.j, 1.-1.j]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void convolveTest() { // Note how the convolution operator flips the second array // before “sliding” the two across one another: - + // >>> np.convolve([1, 2, 3], [0, 1, 0.5]) // array([ 0. , 1. , 2.5, 4. , 1.5]) // - - #if TODO + +#if TODO var given= np.convolve({1, 2, 3}, {0, 1, 0.5}); var expected= "array([ 0. , 1. , 2.5, 4. , 1.5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Only return the middle values of the convolution. // Contains boundary effects, where zeros are taken // into account: - + // >>> np.convolve([1,2,3],[0,1,0.5], 'same') // array([ 1. , 2.5, 4. ]) // - - #if TODO + +#if TODO given= np.convolve({1,2,3},{0,1,0.5}, 'same'); expected= "array([ 1. , 2.5, 4. ])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // The two arrays are of the same length, so there // is only one position where they completely overlap: - + // >>> np.convolve([1,2,3],[0,1,0.5], 'valid') // array([ 2.5]) // - - #if TODO + +#if TODO given= np.convolve({1,2,3},{0,1,0.5}, 'valid'); expected= "array([ 2.5])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void clipTest() { @@ -2917,8 +2917,8 @@ public void clipTest() // >>> np.clip(a, [3, 4, 1, 1, 1, 4, 4, 4, 4, 4], 8) // array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8]) // - - #if TODO + +#if TODO var given= a = np.arange(10); given= np.clip(a, 1, 8); var expected= @@ -2941,78 +2941,78 @@ public void clipTest() expected= "array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void sqrtTest() { // >>> np.sqrt([1,4,9]) // array([ 1., 2., 3.]) // - - #if TODO + +#if TODO var given= np.sqrt({1,4,9}); var expected= "array([ 1., 2., 3.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.sqrt([4, -1, -3+4J]) // array([ 2.+0.j, 0.+1.j, 1.+2.j]) // - - #if TODO + +#if TODO given= np.sqrt({4, -1, -3+4J}); expected= "array([ 2.+0.j, 0.+1.j, 1.+2.j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.sqrt([4, -1, numpy.inf]) // array([ 2., NaN, Inf]) // - - #if TODO + +#if TODO given= np.sqrt({4, -1, numpy.inf}); expected= "array([ 2., NaN, Inf])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void cbrtTest() { // >>> np.cbrt([1,8,27]) // array([ 1., 2., 3.]) // - - #if TODO + +#if TODO var given= np.cbrt({1,8,27}); var expected= "array([ 1., 2., 3.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void squareTest() { // >>> np.square([-1j, 1]) // array([-1.-0.j, 1.+0.j]) // - - #if TODO + +#if TODO var given= np.square({-1j, 1}); var expected= "array([-1.-0.j, 1.+0.j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void absoluteTest() { @@ -3022,8 +3022,8 @@ public void absoluteTest() // >>> np.absolute(1.2 + 1j) // 1.5620499351813308 // - - #if TODO + +#if TODO var given= x = np.array({-1.2, 1.2}); given= np.absolute(x); var expected= @@ -3033,40 +3033,40 @@ public void absoluteTest() expected= "1.5620499351813308"; Assert.AreEqual(expected, given.repr); - #endif +#endif // Plot the function over [-10, 10]: - + // >>> import matplotlib.pyplot as plt // - - #if TODO + +#if TODO given= import matplotlib.pyplot as plt; - #endif +#endif // >>> x = np.linspace(start=-10, stop=10, num=101) // >>> plt.plot(x, np.absolute(x)) // >>> plt.show() // - - #if TODO + +#if TODO given= x = np.linspace(start=-10, stop=10, num=101); given= plt.plot(x, np.absolute(x)); given= plt.show(); - #endif +#endif // Plot the function over the complex plane: - + // >>> xx = x + 1j * x[:, np.newaxis] // >>> plt.imshow(np.abs(xx), extent=[-10, 10, -10, 10], cmap='gray') // >>> plt.show() // - - #if TODO + +#if TODO given= xx = x + 1j * x{:, np.newaxis}; given= plt.imshow(np.abs(xx), extent={-10, 10, -10, 10}, cmap='gray'); given= plt.show(); - #endif +#endif } - - + + [TestMethod] public void fabsTest() { @@ -3075,8 +3075,8 @@ public void fabsTest() // >>> np.fabs([-1.2, 1.2]) // array([ 1.2, 1.2]) // - - #if TODO + +#if TODO var given= np.fabs(-1); var expected= "1.0"; @@ -3085,10 +3085,10 @@ public void fabsTest() expected= "array([ 1.2, 1.2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void signTest() { @@ -3099,8 +3099,8 @@ public void signTest() // >>> np.sign(5-2j) // (1+0j) // - - #if TODO + +#if TODO var given= np.sign({-5., 4.5}); var expected= "array([-1., 1.])"; @@ -3113,10 +3113,10 @@ public void signTest() expected= "(1+0j)"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void heavisideTest() { @@ -3125,8 +3125,8 @@ public void heavisideTest() // >>> np.heaviside([-1.5, 0, 2.0], 1) // array([ 0., 1., 1.]) // - - #if TODO + +#if TODO var given= np.heaviside({-1.5, 0, 2.0}, 0.5); var expected= "array([ 0. , 0.5, 1. ])"; @@ -3135,42 +3135,42 @@ public void heavisideTest() expected= "array([ 0., 1., 1.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void maximumTest() { // >>> np.maximum([2, 3, 4], [1, 5, 2]) // array([2, 5, 4]) // - - #if TODO + +#if TODO var given= np.maximum({2, 3, 4}, {1, 5, 2}); var expected= "array([2, 5, 4])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.maximum(np.eye(2), [0.5, 2]) # broadcasting // array([[ 1. , 2. ], // [ 0.5, 2. ]]) // - - #if TODO + +#if TODO given= np.maximum(np.eye(2), {0.5, 2}) # broadcasting; expected= "array([[ 1. , 2. ],\n" + " [ 0.5, 2. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.maximum([np.nan, 0, np.nan], [0, np.nan, np.nan]) // array([ NaN, NaN, NaN]) // >>> np.maximum(np.Inf, 1) // inf // - - #if TODO + +#if TODO given= np.maximum({np.nan, 0, np.nan}, {0, np.nan, np.nan}); expected= "array([ NaN, NaN, NaN])"; @@ -3179,42 +3179,42 @@ public void maximumTest() expected= "inf"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void minimumTest() { // >>> np.minimum([2, 3, 4], [1, 5, 2]) // array([1, 3, 2]) // - - #if TODO + +#if TODO var given= np.minimum({2, 3, 4}, {1, 5, 2}); var expected= "array([1, 3, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.minimum(np.eye(2), [0.5, 2]) # broadcasting // array([[ 0.5, 0. ], // [ 0. , 1. ]]) // - - #if TODO + +#if TODO given= np.minimum(np.eye(2), {0.5, 2}) # broadcasting; expected= "array([[ 0.5, 0. ],\n" + " [ 0. , 1. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.minimum([np.nan, 0, np.nan],[0, np.nan, np.nan]) // array([ NaN, NaN, NaN]) // >>> np.minimum(-np.Inf, 1) // -inf // - - #if TODO + +#if TODO given= np.minimum({np.nan, 0, np.nan},{0, np.nan, np.nan}); expected= "array([ NaN, NaN, NaN])"; @@ -3223,86 +3223,86 @@ public void minimumTest() expected= "-inf"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fmaxTest() { // >>> np.fmax([2, 3, 4], [1, 5, 2]) // array([ 2., 5., 4.]) // - - #if TODO + +#if TODO var given= np.fmax({2, 3, 4}, {1, 5, 2}); var expected= "array([ 2., 5., 4.])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmax(np.eye(2), [0.5, 2]) // array([[ 1. , 2. ], // [ 0.5, 2. ]]) // - - #if TODO + +#if TODO given= np.fmax(np.eye(2), {0.5, 2}); expected= "array([[ 1. , 2. ],\n" + " [ 0.5, 2. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmax([np.nan, 0, np.nan],[0, np.nan, np.nan]) // array([ 0., 0., NaN]) // - - #if TODO + +#if TODO given= np.fmax({np.nan, 0, np.nan},{0, np.nan, np.nan}); expected= "array([ 0., 0., NaN])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void fminTest() { // >>> np.fmin([2, 3, 4], [1, 5, 2]) // array([1, 3, 2]) // - - #if TODO + +#if TODO var given= np.fmin({2, 3, 4}, {1, 5, 2}); var expected= "array([1, 3, 2])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmin(np.eye(2), [0.5, 2]) // array([[ 0.5, 0. ], // [ 0. , 1. ]]) // - - #if TODO + +#if TODO given= np.fmin(np.eye(2), {0.5, 2}); expected= "array([[ 0.5, 0. ],\n" + " [ 0. , 1. ]])"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.fmin([np.nan, 0, np.nan],[0, np.nan, np.nan]) // array([ 0., 0., NaN]) // - - #if TODO + +#if TODO given= np.fmin({np.nan, 0, np.nan},{0, np.nan, np.nan}); expected= "array([ 0., 0., NaN])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void nan_to_numTest() { @@ -3322,8 +3322,8 @@ public void nan_to_numTest() // 0.00000000e+000 +0.00000000e+000j, // 0.00000000e+000 +1.79769313e+308j]) // - - #if TODO + +#if TODO var given= np.nan_to_num(np.inf); var expected= "1.7976931348623157e+308"; @@ -3349,30 +3349,30 @@ public void nan_to_numTest() " 0.00000000e+000 +0.00000000e+000j,\n" + " 0.00000000e+000 +1.79769313e+308j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void real_if_closeTest() { // >>> np.finfo(float).eps // 2.2204460492503131e-16 // - - #if TODO + +#if TODO var given= np.finfo(float).eps; var expected= "2.2204460492503131e-16"; Assert.AreEqual(expected, given.repr); - #endif +#endif // >>> np.real_if_close([2.1 + 4e-14j], tol=1000) // array([ 2.1]) // >>> np.real_if_close([2.1 + 4e-13j], tol=1000) // array([ 2.1 +4.00000000e-13j]) // - - #if TODO + +#if TODO given= np.real_if_close({2.1 + 4e-14j}, tol=1000); expected= "array([ 2.1])"; @@ -3381,10 +3381,10 @@ public void real_if_closeTest() expected= "array([ 2.1 +4.00000000e-13j])"; Assert.AreEqual(expected, given.repr); - #endif +#endif } - - + + [TestMethod] public void interpTest() { @@ -3398,91 +3398,53 @@ public void interpTest() // >>> np.interp(3.14, xp, fp, right=UNDEF) // -99.0 // - - #if TODO - var given= xp = [1, 2, 3]; - given= fp = [3, 2, 0]; - given= np.interp(2.5, xp, fp); - var expected= - "1.0"; - Assert.AreEqual(expected, given.repr); - given= np.interp({0, 1, 1.5, 2.72, 3.14}, xp, fp); - expected= - "array([ 3. , 3. , 2.5 , 0.56, 0. ])"; - Assert.AreEqual(expected, given.repr); - given= UNDEF = -99.0; - given= np.interp(3.14, xp, fp, right=UNDEF); - expected= - "-99.0"; - Assert.AreEqual(expected, given.repr); - #endif - // Plot an interpolant to the sine function: - - // >>> x = np.linspace(0, 2*np.pi, 10) - // >>> y = np.sin(x) - // >>> xvals = np.linspace(0, 2*np.pi, 50) - // >>> yinterp = np.interp(xvals, x, y) - // >>> import matplotlib.pyplot as plt - // >>> plt.plot(x, y, 'o') - // [] - // >>> plt.plot(xvals, yinterp, '-x') - // [] - // >>> plt.show() - // - - #if TODO - given= x = np.linspace(0, 2*np.pi, 10); - given= y = np.sin(x); - given= xvals = np.linspace(0, 2*np.pi, 50); - given= yinterp = np.interp(xvals, x, y); - given= import matplotlib.pyplot as plt; - given= plt.plot(x, y, 'o'); - expected= - "[]"; - Assert.AreEqual(expected, given.repr); - given= plt.plot(xvals, yinterp, '-x'); - expected= - "[]"; + + var xp = new float[] { 1, 2, 3 }; + var fp = new float[] { 3, 2, 0 }; + Assert.AreEqual(1.0f, np.interp(2.5f, xp, fp)); + + var given = np.interp(new float[] { 0, 1, 1.5f, 2.72f, 3.14f }, xp, fp); + var expected = + "array([3. , 3. , 2.5 , 0.55999994, 0. ])"; Assert.AreEqual(expected, given.repr); - given= plt.show(); - #endif + + var UNDEF = -99.0f; + Assert.AreEqual(-99.0f, np.interp(3.14f, xp, fp, right: UNDEF)); + // Interpolation with periodic x-coordinates: - + // >>> x = [-180, -170, -185, 185, -10, -5, 0, 365] // >>> xp = [190, -190, 350, -350] // >>> fp = [5, 10, 3, 4] // >>> np.interp(x, xp, fp, period=360) // array([7.5, 5., 8.75, 6.25, 3., 3.25, 3.5, 3.75]) // - - #if TODO - given= x = [-180, -170, -185, 185, -10, -5, 0, 365]; - given= xp = [190, -190, 350, -350]; - given= fp = [5, 10, 3, 4]; - given= np.interp(x, xp, fp, period=360); - expected= - "array([7.5, 5., 8.75, 6.25, 3., 3.25, 3.5, 3.75])"; + + //var x = [-180, -170, -185, 185, -10, -5, 0, 365]; + var x = new float[] { -180, -170, -185, 185, -10, -5, 0, 365 }; + xp = new float[] { 190, -190, 350, -350 }; + fp = new float[] { 5, 10, 3, 4 }; + given = np.interp(x, xp, fp, period: 360); + expected = + "array([7.5 , 5. , 8.75, 6.25, 3. , 3.25, 3.5 , 3.75])"; Assert.AreEqual(expected, given.repr); - #endif + // Complex interpolation: - + // >>> x = [1.5, 4.0] // >>> xp = [2,3,5] // >>> fp = [1.0j, 0, 2+3j] // >>> np.interp(x, xp, fp) // array([ 0.+1.j , 1.+1.5j]) - // - - #if TODO - given= x = [1.5, 4.0]; - given= xp = [2,3,5]; - given= fp = [1.0j, 0, 2+3j]; - given= np.interp(x, xp, fp); - expected= - "array([ 0.+1.j , 1.+1.5j])"; + + x = new float[] { 1.5f, 4.0f }; + xp = new float[] { 2, 3, 5 }; + var fp2 = new [] { new Complex(0, 1), new Complex(0, 0), new Complex(2, 3) }; + given = np.interp(x, xp, fp2); + expected = + "array([0.+1.j , 1.+1.5j])"; Assert.AreEqual(expected, given.repr); - #endif } - + } } diff --git a/test/Numpy.UnitTest/NumPy_other.tests.cs b/test/Numpy.UnitTest/NumPy_other.tests.cs new file mode 100644 index 0000000..6ded422 --- /dev/null +++ b/test/Numpy.UnitTest/NumPy_other.tests.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp) +// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion + +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 + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Assert = NUnit.Framework.Assert; + +namespace Numpy.UnitTest +{ + [TestClass] + public class NumPy_otherTest : BaseTestCase + { + + [TestMethod] + public void rootsTest() + { + // >>> coeff = [3.2, 2, 1] + // >>> np.roots(coeff) + // array([-0.3125+0.46351241j, -0.3125-0.46351241j]) + // + + #if TODO + var given= coeff = [3.2, 2, 1]; + given= np.roots(coeff); + var expected= + "array([-0.3125+0.46351241j, -0.3125-0.46351241j])"; + Assert.AreEqual(expected, given.repr); + #endif + } + + } +} diff --git a/test/Numpy.UnitTest/NumPy_random.tests.cs b/test/Numpy.UnitTest/NumPy_random.tests.cs index a53e847..12424a8 100644 --- a/test/Numpy.UnitTest/NumPy_random.tests.cs +++ b/test/Numpy.UnitTest/NumPy_random.tests.cs @@ -11,6 +11,7 @@ using Numpy.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Python.Runtime; using Assert = NUnit.Framework.Assert; namespace Numpy.UnitTest @@ -28,14 +29,14 @@ public void randTest() // [ 0.49313049, 0.94909878]]) #random // -#if TODO - var given= np.random.rand(3,2); - var expected= - "array([[ 0.14022471, 0.96360618], #random\n" + - " [ 0.37601032, 0.25528411], #random\n" + - " [ 0.49313049, 0.94909878]]) #random"; + np.random.seed(0); + var given= np.random.rand(1,2); + var expected = "array([[0.5488135 , 0.71518937]])"; + Assert.AreEqual(expected, given.repr); -#endif + np.random.seed(0); + float x = np.random.rand(); + Assert.AreEqual(0.5488135039273248f, x); } @@ -46,12 +47,9 @@ public void randnTest() // 2.1923875335537315 #random // -#if TODO - var given= np.random.randn(); - var expected= - "2.1923875335537315 #random"; - Assert.AreEqual(expected, given.repr); -#endif + np.random.seed(0); + var given = np.random.randn(); + Assert.AreEqual(1.76405239f, given); // Two-by-four array of samples from N(3, 6.25): // >>> 2.5 * np.random.randn(2, 4) + 3 @@ -59,13 +57,11 @@ public void randnTest() // [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random // -#if TODO - given= 2.5 * np.random.randn(2, 4) + 3; - expected= - "array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random\n" + - " [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random"; - Assert.AreEqual(expected, given.repr); -#endif + np.random.seed(0); + var a = 2.5 * np.random.randn(1, 2) + 3; + var expected= "array([[7.41013086, 4.00039302]])"; + Assert.AreEqual(expected, a.repr); + } @@ -94,6 +90,7 @@ public void randintTest() given= np.random.randint(5, size:new int[]{2, 4}); Assert.LessOrEqual((int)given.max(), 4); Assert.GreaterOrEqual((int)given.min(), 0); + } @@ -1309,54 +1306,28 @@ public void normalTest() // >>> mu, sigma = 0, 0.1 # mean and standard deviation // >>> s = np.random.normal(mu, sigma, 1000) // + var (mu, sigma) = (0.0f, 0.1f); // mean and standard deviation; + var s = np.random.normal(mu, sigma, 1000); -#if TODO - var given= mu, sigma = 0, 0.1 # mean and standard deviation; - given= s = np.random.normal(mu, sigma, 1000); -#endif // Verify the mean and the variance: // >>> abs(mu - np.mean(s)) < 0.01 // True // + Assert.IsTrue( Math.Abs(mu - np.mean(s)) < 0.01); -#if TODO - given= abs(mu - np.mean(s)) < 0.01; - var expected= - "True"; - Assert.AreEqual(expected, given.repr); -#endif - // >>> abs(sigma - np.std(s, ddof=1)) < 0.01 + // >>> abs(sigma - np.std(s, ddof=1)) < 0.01 // True // + Assert.IsTrue(Math.Abs(sigma - np.std(s, ddof: 1)) < 0.01); -#if TODO - given= abs(sigma - np.std(s, ddof=1)) < 0.01; - expected= - "True"; - Assert.AreEqual(expected, given.repr); -#endif - // Display the histogram of the samples, along with - // the probability density function: + // Two-by-four array of samples from N(3, 6.25): - // >>> import matplotlib.pyplot as plt - // >>> count, bins, ignored = plt.hist(s, 30, density=True) - // >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) * - // ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ), - // ... linewidth=2, color='r') - // >>> plt.show() - // + // >>> np.random.normal(3, 2.5, size = (2, 4)) + // array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random + // [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random -#if TODO - given= import matplotlib.pyplot as plt; - given= count, bins, ignored = plt.hist(s, 30, density=True); - given= plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *; - expected= - "... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),\n" + - "... linewidth=2, color='r')"; - Assert.AreEqual(expected, given.repr); - given= plt.show(); -#endif + Assert.AreEqual(new Shape(2,4), np.random.normal(3, 2.5f, new []{2, 4}).shape ); } diff --git a/test/Numpy.UnitTest/NumPy_staticstics.tests.cs b/test/Numpy.UnitTest/NumPy_staticstics.tests.cs index 5d0316a..4b4946c 100644 --- a/test/Numpy.UnitTest/NumPy_staticstics.tests.cs +++ b/test/Numpy.UnitTest/NumPy_staticstics.tests.cs @@ -853,21 +853,18 @@ public void meanTest() // array([ 1.5, 3.5]) // - #if TODO - var given= a = np.array({{1, 2}, {3, 4}}); - given= np.mean(a); + NDarray a = np.array(new [,]{{1, 2}, {3, 4}}); + var given_scalar= np.mean(a); + Assert.AreEqual(2.5, given_scalar); + var given= np.mean(a, axis:0); var expected= - "2.5"; + "array([2., 3.])"; Assert.AreEqual(expected, given.repr); - given= np.mean(a, axis=0); - expected= - "array([ 2., 3.])"; + given= np.mean(a, axis:1); + expected= + "array([1.5, 3.5])"; Assert.AreEqual(expected, given.repr); - given= np.mean(a, axis=1); - expected= - "array([ 1.5, 3.5])"; - Assert.AreEqual(expected, given.repr); - #endif + // In single precision, mean can be inaccurate: // >>> a = np.zeros((2, 512*512), dtype=np.float32) @@ -877,27 +874,24 @@ public void meanTest() // 0.54999924 // - #if TODO - given= a = np.zeros((2, 512*512), dtype=np.float32); - given= a[0, :] = 1.0; - given= a[1, :] = 0.1; - given= np.mean(a); - expected= - "0.54999924"; - Assert.AreEqual(expected, given.repr); - #endif + a = np.zeros((2, 512*512), dtype: np.float32); + a["0, :"] = (NDarray)1.0; + a["1, :"] = (NDarray)0.1; + given_scalar= Math.Round( np.mean(a), 8); + var expected_scalar= + 0.54999924; + Assert.AreEqual(expected_scalar, given_scalar); + // Computing the mean in float64 is more accurate: // >>> np.mean(a, dtype=np.float64) // 0.55000000074505806 // - #if TODO - given= np.mean(a, dtype=np.float64); - expected= - "0.55000000074505806"; - Assert.AreEqual(expected, given.repr); - #endif + given_scalar= np.mean(a, dtype: np.float64); + expected_scalar= + 0.55000000074505806; + Assert.AreEqual(expected_scalar, given_scalar); } diff --git a/test/Numpy.UnitTest/NumPy_string.tests.cs b/test/Numpy.UnitTest/NumPy_string.tests.cs index 5462c9c..3010980 100644 --- a/test/Numpy.UnitTest/NumPy_string.tests.cs +++ b/test/Numpy.UnitTest/NumPy_string.tests.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; -using Python.Runtime; using Numpy.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/Numpy.UnitTest/Numpy.Bare.UnitTest.csproj b/test/Numpy.UnitTest/Numpy.Bare.UnitTest.csproj index 8a344e7..535f85a 100644 --- a/test/Numpy.UnitTest/Numpy.Bare.UnitTest.csproj +++ b/test/Numpy.UnitTest/Numpy.Bare.UnitTest.csproj @@ -6,6 +6,8 @@ false Numpy.UnitTest + + true diff --git a/test/Numpy.UnitTest/Numpy.UnitTest.csproj b/test/Numpy.UnitTest/Numpy.UnitTest.csproj index e431c47..4b4c1f7 100644 --- a/test/Numpy.UnitTest/Numpy.UnitTest.csproj +++ b/test/Numpy.UnitTest/Numpy.UnitTest.csproj @@ -6,9 +6,12 @@ false Numpy.UnitTest + + true + diff --git a/test/Numpy.UnitTest/NumpyTest.cs b/test/Numpy.UnitTest/NumpyTest.cs index 09c9d7a..e65c58c 100644 --- a/test/Numpy.UnitTest/NumpyTest.cs +++ b/test/Numpy.UnitTest/NumpyTest.cs @@ -1,137 +1,177 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Numpy; -using Numpy.Models; -using Assert = NUnit.Framework.Assert; - -namespace Numpy.UnitTest -{ - [TestClass] - public class NumpyTest - { - [TestMethod] - public void empty() - { - // initialize an array with random integers - var a = np.empty(new Shape(2, 3), np.int32); - Console.WriteLine(a.repr); - Assert.IsNotNull(a.ToString()); - // this should print out the exact integers of the array +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Numerics; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Numpy; +using Numpy.Models; +using Python.Runtime; +using Assert = NUnit.Framework.Assert; + +namespace Numpy.UnitTest +{ + [TestClass] + public class NumpyTest + { + [AssemblyCleanup()] + public static void AssemblyCleanup() + { + PythonEngine.BeginAllowThreads(); + } + + [TestMethod] + public void empty() + { + // initialize an array with random integers + var a = np.empty(new Shape(2, 3), np.int32); + Console.WriteLine(a.repr); + Assert.IsNotNull(a.ToString()); + // this should print out the exact integers of the array foreach (var x in a.GetData()) Console.WriteLine(x); - } - - [TestMethod] - public void efficient_array_copy() - { - var a = np.empty(new Shape(2, 3), np.int32); - Console.WriteLine(a.repr); - Assert.IsNotNull(a.ToString()); - long ptr = a.PyObject.ctypes.data; - Console.WriteLine("ptr: " + ptr); - var array = new int[] { 1, 2, 3, 4, 5, 6 }; - Marshal.Copy(array, 0, new IntPtr(ptr), array.Length); - Console.WriteLine(a.ToString()); - } - - [TestMethod] - public void array() - { - var array = new int[] { 1, 2, 3, 4, 5, 6 }; - var a = np.array(array); - Console.WriteLine(a.repr); - Assert.AreEqual(array, a.GetData()); - } - - [TestMethod] - public void ndarray_shape() - { - var array = new int[] { 1, 2, 3, 4, 5, 6 }; - var a = np.array(array); - Assert.AreEqual(new Shape(6), a.shape); - Assert.AreEqual(new Shape(100), np.arange(100).shape); - } - - [TestMethod] - public void ndarray_strides() - { - Assert.AreEqual(new int[] { 4 }, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).strides); - Assert.AreEqual(new int[] { 8 }, np.arange(10, dtype: np.longlong).strides); - } - - [TestMethod] - public void ndarray_ndim() - { - Assert.AreEqual(1, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).ndim); - Assert.AreEqual(1, np.arange(10, dtype: np.longlong).ndim); - } - - [TestMethod] - public void ndarray_size() - { - Assert.AreEqual(6, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).size); - Assert.AreEqual(10, np.arange(10, dtype: np.longlong).size); - } - - [TestMethod] - public void ndarray_len() - { - Assert.AreEqual(6, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).len); - Assert.AreEqual(10, np.arange(10, dtype: np.longlong).len); - } - - [TestMethod] - public void ndarray_itemsize() - { - Assert.AreEqual(4, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).itemsize); - Assert.AreEqual(8, np.arange(10, dtype: np.longlong).itemsize); - } - - [TestMethod] - public void ndarray_nbytes() - { - Assert.AreEqual(24, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).nbytes); - Assert.AreEqual(80, np.arange(10, dtype: np.longlong).nbytes); - } - - [TestMethod] - public void ndarray_base() - { - var a = np.array(new int[] { 1, 2, 3, 4, 5, 6 }); - var b = a.reshape(new Shape(2, 3)); - Assert.AreEqual(null, a.@base); - Assert.AreEqual(a, b.@base); - } - - [TestMethod] - public void ndarray_dtype() - { - Assert.AreEqual(np.int32, np.array(new int[] { 1, 2, 3, 4, 5, 6 }, dtype: np.int32).dtype); - Assert.AreEqual(np.longlong, np.arange(10, dtype: np.longlong).dtype); - Assert.AreEqual(np.float32, np.arange(10, dtype: np.float32).dtype); - Assert.AreEqual(np.@double, np.arange(10, dtype: np.float64).dtype); - } - - [TestMethod] - public void ndarray_multidim_source_array() - { - var a = np.array(new float[,] { { 1f, 2f }, { 3f, 4f }, { 3f, 4f } }); - Console.WriteLine(a.repr); - Assert.AreEqual(new Shape(3, 2), a.shape); - Assert.AreEqual(np.float32, a.dtype); - } - - [TestMethod] - public void ndarray_T() - { - var x = np.array(new float[,] { { 1f, 2f }, { 3f, 4f } }); - Assert.AreEqual("[[1. 2.]\n [3. 4.]]", x.ToString()); - var t = x.T; - Console.WriteLine(t.repr); - Assert.AreEqual("[[1. 3.]\n [2. 4.]]", t.ToString()); - Assert.AreEqual(new[] { 1f, 2f, 3f, 4f }, t.GetData()); + } + + [TestMethod] + public unsafe void create_from_pointer_without_copying() + { + IntPtr pointer = IntPtr.Zero; + try { + var dtype = np.int32; + const int length = 1024; + pointer = Marshal.AllocHGlobal(length); + var ptr = (int*)pointer; + // fill the buffer with index numbers + for (int i = 0; i < length / sizeof(int); i++) + ptr[i] = i; + var a = new NDarray(pointer, length, dtype); + Console.WriteLine(a.ToString()); + var b = np.arange(length / sizeof(int)); + Console.WriteLine(b); + var truth1 = b.Equals(a); + var truth2 = a.Equals(b); + Assert.AreEqual(b, a); + } + finally { + if (pointer != IntPtr.Zero) + Marshal.FreeHGlobal(pointer); + } + } + + [TestMethod] + public void efficient_array_copy() + { + var a = np.empty(new Shape(2, 3), np.int32); + Console.WriteLine(a.repr); + Assert.IsNotNull(a.ToString()); + long ptr = a.PyObject.ctypes.data; + Console.WriteLine("ptr: " + ptr); + var array = new int[] { 1, 2, 3, 4, 5, 6 }; + Marshal.Copy(array, 0, new IntPtr(ptr), array.Length); + Console.WriteLine(a.ToString()); + } + + [TestMethod] + public void array() + { + var array = new int[] { 1, 2, 3, 4, 5, 6 }; + var a = np.array(array); + Console.WriteLine(a.repr); + Assert.AreEqual(array, a.GetData()); + } + + [TestMethod] + public void ndarray_shape() + { + var array = new int[] { 1, 2, 3, 4, 5, 6 }; + var a = np.array(array); + Assert.AreEqual(new Shape(6), a.shape); + Assert.AreEqual(new Shape(100), np.arange(100).shape); + } + + [TestMethod] + public void ndarray_strides() + { + Assert.AreEqual(new int[] { 4 }, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).strides); + Assert.AreEqual(new int[] { 8 }, np.arange(10, dtype: np.longlong).strides); + } + + [TestMethod] + public void ndarray_ndim() + { + Assert.AreEqual(1, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).ndim); + Assert.AreEqual(1, np.arange(10, dtype: np.longlong).ndim); + } + + [TestMethod] + public void ndarray_size() + { + Assert.AreEqual(6, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).size); + Assert.AreEqual(10, np.arange(10, dtype: np.longlong).size); + } + + [TestMethod] + public void ndarray_len() + { + Assert.AreEqual(6, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).len); + Assert.AreEqual(10, np.arange(10, dtype: np.longlong).len); + } + + [TestMethod] + public void ndarray_itemsize() + { + Assert.AreEqual(4, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).itemsize); + Assert.AreEqual(8, np.arange(10, dtype: np.longlong).itemsize); + } + + [TestMethod] + public void ndarray_nbytes() + { + Assert.AreEqual(24, np.array(new int[] { 1, 2, 3, 4, 5, 6 }).nbytes); + Assert.AreEqual(80, np.arange(10, dtype: np.longlong).nbytes); + } + + [TestMethod] + public void ndarray_base() + { + var a = np.array(new int[] { 1, 2, 3, 4, 5, 6 }); + var b = a.reshape(new Shape(2, 3)); + Assert.AreEqual(null, a.@base); + Assert.AreEqual(a, b.@base); + } + + [TestMethod] + public void ndarray_dtype() + { + Assert.AreEqual(np.int32, np.array(new int[] { 1, 2, 3, 4, 5, 6 }, dtype: np.int32).dtype); + Assert.AreEqual(np.longlong, np.arange(10, dtype: np.longlong).dtype); + Assert.AreEqual(np.float32, np.arange(10, dtype: np.float32).dtype); + Assert.AreEqual(np.@double, np.arange(10, dtype: np.float64).dtype); + } + + [TestMethod] + public void ndarray_multidim_source_array() + { + var a = np.array(new float[,] { { 1f, 2f }, { 3f, 4f }, { 3f, 4f } }); + Console.WriteLine(a.repr); + Assert.AreEqual(new Shape(3, 2), a.shape); + Assert.AreEqual(np.float32, a.dtype); + } + + [TestMethod] + public void ndarray_T() + { + var x = np.array(new float[,] { { 1f, 2f }, { 3f, 4f } }); + Assert.AreEqual("[[1. 2.]\n [3. 4.]]", x.ToString()); + var t = x.T; + Console.WriteLine(t.repr); + Assert.AreEqual("[[1. 3.]\n [2. 4.]]", t.ToString()); + // getting data of transposed array returns transposed array! + Assert.AreEqual(new[] { 1f, 3f, 2f, 4f }, t.GetData()); } [TestMethod] @@ -141,253 +181,969 @@ public void ndarray_flatten() Assert.AreEqual("[1. 2. 3. 4.]", x.flatten().ToString()); var t = x.T; Assert.AreEqual("[1. 3. 2. 4.]", t.flatten().ToString()); - Assert.AreEqual(new[] { 1f, 3f, 2f, 4f }, t.flatten().GetData()); - } - - [TestMethod] - public void ndarray_reshape() - { - var a = np.array(new int[] { 1, 2, 3, 4, 5, 6 }); - var b = a.reshape(new Shape(2, 3)); - Assert.AreEqual("[[1 2 3]\n [4 5 6]]", b.str); - Assert.AreEqual(new Shape(2, 3), b.shape); - Assert.AreEqual(null, a.@base); - Assert.AreEqual(a, b.@base); - } - - [TestMethod] - public void ndarray_indexing() - { + Assert.AreEqual(new[] { 1f, 3f, 2f, 4f }, t.flatten().GetData()); + } + + [TestMethod] + public void ndarray_reshape() + { + var a = np.array(new int[] { 1, 2, 3, 4, 5, 6 }); + var b = a.reshape(new Shape(2, 3)); + Assert.AreEqual("[[1 2 3]\n [4 5 6]]", b.str); + Assert.AreEqual(new Shape(2, 3), b.shape); + Assert.AreEqual(null, a.@base); + Assert.AreEqual(a, b.@base); + } + + [TestMethod] + public void ndarray_indexing() + { // using string indices - var x = np.arange(10); - Assert.AreEqual("2", x["2"].str); - Assert.AreEqual("8", x["-2"].str); - Assert.AreEqual("[2 3 4 5 6 7]", x["2:-2"].str); - var y = x.reshape(new Shape(2, 5)); - Assert.AreEqual("8", y["1,3"].str); - Assert.AreEqual("9", y["1,-1"].str); - Assert.AreEqual("array([0, 1, 2, 3, 4])", y["0"].repr); - Assert.AreEqual("2", y["0"]["2"].str); - } - - [TestMethod] - public void ndarray_indexing1() - { + var x = np.arange(10); + Assert.AreEqual("2", x["2"].str); + Assert.AreEqual("8", x["-2"].str); + Assert.AreEqual("[2 3 4 5 6 7]", x["2:-2"].str); + var y = x.reshape(new Shape(2, 5)); + Assert.AreEqual("8", y["1,3"].str); + Assert.AreEqual("9", y["1,-1"].str); + Assert.AreEqual("array([0, 1, 2, 3, 4])", y["0"].repr); + Assert.AreEqual("2", y["0"]["2"].str); + } + + [TestMethod] + public void ndarray_indexing1() + { + // using int indices + var x = np.arange(10); + Assert.AreEqual("2", x[2].str); + Assert.AreEqual("8", x[-2].str); + var y = x.reshape(new Shape(2, 5)); + Assert.AreEqual("8", y[1, 3].str); + Assert.AreEqual("9", y[1, -1].str); + Assert.AreEqual("array([0, 1, 2, 3, 4])", y[0].repr); + Assert.AreEqual("2", y[0][2].str); + } + + [TestMethod] + public void ndarray_indexing2() + { + var x = np.arange(10, 1, -1); + Assert.AreEqual("array([10, 9, 8, 7, 6, 5, 4, 3, 2])", x.repr); + Assert.AreEqual("array([7, 7, 9, 2])", x[np.array(new[] { 3, 3, 1, 8 })].repr); + Assert.AreEqual("array([7, 7, 4, 2])", x[np.array(new[] { 3, 3, -3, 8 })].repr); + Assert.AreEqual("array([[9, 9],\n [8, 7]])", x[np.array(new int[,] { { 1, 1 }, { 2, 3 } })].repr); + } + + [TestMethod] + public void ndarray_indexing3() + { + var y = np.arange(35).reshape(5, 7); + Assert.AreEqual("array([ 0, 15, 30])", y[np.array(0, 2, 4), np.array(0, 1, 2)].repr); + Assert.AreEqual("array([ 1, 15, 29])", y[np.array(0, 2, 4), 1].repr); + Assert.AreEqual( + "array([[ 0, 1, 2, 3, 4, 5, 6],\n [14, 15, 16, 17, 18, 19, 20],\n [28, 29, 30, 31, 32, 33, 34]])", + y[np.array(0, 2, 4)].repr); + } + + [TestMethod] + public void ndarray_indexing_setter1() + { // using int indices - var x = np.arange(10); - Assert.AreEqual("2", x[2].str); - Assert.AreEqual("8", x[-2].str); - var y = x.reshape(new Shape(2, 5)); - Assert.AreEqual("8", y[1, 3].str); - Assert.AreEqual("9", y[1, -1].str); - Assert.AreEqual("array([0, 1, 2, 3, 4])", y[0].repr); - Assert.AreEqual("2", y[0][2].str); - } - - [TestMethod] - public void ndarray_indexing2() - { - var x = np.arange(10, 1, -1); - Assert.AreEqual("array([10, 9, 8, 7, 6, 5, 4, 3, 2])", x.repr); - Assert.AreEqual("array([7, 7, 9, 2])", x[np.array(new[] { 3, 3, 1, 8 })].repr); - Assert.AreEqual("array([7, 7, 4, 2])", x[np.array(new[] { 3, 3, -3, 8 })].repr); - Assert.AreEqual("array([[9, 9],\n [8, 7]])", x[np.array(new int[,] { { 1, 1 }, { 2, 3 } })].repr); - } - - [TestMethod] - public void ndarray_indexing3() - { - var y = np.arange(35).reshape(5, 7); - Assert.AreEqual("array([ 0, 15, 30])", y[np.array(0, 2, 4), np.array(0, 1, 2)].repr); - Assert.AreEqual("array([ 1, 15, 29])", y[np.array(0, 2, 4), 1].repr); - Assert.AreEqual( - "array([[ 0, 1, 2, 3, 4, 5, 6],\n [14, 15, 16, 17, 18, 19, 20],\n [28, 29, 30, 31, 32, 33, 34]])", - y[np.array(0, 2, 4)].repr); - } - - [TestMethod] - public void ndarray_indexing_setter1() - { - // using int indices - var x = np.arange(10); - Assert.AreEqual("2", x[2].str); - x[2] = (NDarray)22; - Assert.AreEqual("22", x[2].str); - Assert.AreEqual("8", x[-2].str); - x[-2] = (NDarray)88; - Assert.AreEqual("88", x[-2].str); - var y = x.reshape(new Shape(2, 5)); - Assert.AreEqual("88", y[1, 3].str); - y[1,3] = (NDarray)888; - Assert.AreEqual("888", y[1, 3].str); - Assert.AreEqual("array([ 0, 1, 22, 3, 4])", y[0].repr); - Assert.AreEqual("22", y[0][2].str); - y[0][2] = (NDarray)222; - Assert.AreEqual("222", y[0][2].str); - } - - [TestMethod] - public void ndarray_indexing_setter2() - { - // using string indices - var x = np.arange(10); - Assert.AreEqual("2", x[2].str); - x["2"] = (NDarray)22; - Assert.AreEqual("22", x[2].str); - Assert.AreEqual("8", x[-2].str); - x["-2"] = (NDarray)88; - Assert.AreEqual("88", x[-2].str); - var y = x.reshape(new Shape(2, 5)); - Assert.AreEqual("88", y[1, 3].str); - y["1, 3"] = (NDarray)888; - Assert.AreEqual("888", y[1, 3].str); - Assert.AreEqual("array([ 0, 1, 22, 3, 4])", y[0].repr); - Assert.AreEqual("22", y[0][2].str); - y["0"]["2"] = (NDarray)222; - Assert.AreEqual("222", y[0][2].str); - } - - [TestMethod] - public void ndarray_indexing_setter3() - { - var a = np.array(new int[] { 1, 2, 3, 4, 5, 6 }).reshape(new Shape(2, 3)); - Assert.AreEqual("[[1 2 3]\n [4 5 6]]", a.str); - a[":", 1] = a[":", 1] * 2; - Assert.AreEqual("[[ 1 4 3]\n [ 4 10 6]]", a.str); - } - - [TestMethod] - public void ndarray_indexing_setter4() - { - var x = np.arange(10, 1, -1); - Assert.AreEqual("array([10, 9, 8, 7, 6, 5, 4, 3, 2])", x.repr); - Assert.AreEqual("array([7, 7, 9, 2])", x[np.array(new[] { 3, 3, 1, 8 })].repr); - x[np.array(new[] {3, 3, 1, 8})] = np.arange(4); - Assert.AreEqual("array([10, 2, 8, 1, 6, 5, 4, 3, 3])", x.repr); - } - - [TestMethod] - public void ndarray_slice() - { - var x = np.arange(10); - Assert.AreEqual("array([2, 3, 4])", x["2:5"].repr); - Assert.AreEqual("array([0, 1, 2])", x[":-7"].repr); - Assert.AreEqual("array([1, 3, 5])", x["1:7:2"].repr); - var y = np.arange(35).reshape(new Shape(5, 7)); - Assert.AreEqual("array([[ 7, 10, 13],\n [21, 24, 27]])", y["1:5:2,::3"].repr); - } - - [TestMethod] - public void ndarray_slice1() - { - var y = np.arange(35).reshape(5, 7); - var b = y > 20; - Assert.AreEqual( - "array([[ 1, 2],\n" + - " [15, 16],\n" + - " [29, 30]])", - y[np.array(0, 2, 4), "1:3"].repr); - Assert.AreEqual("array([[22, 23],\n [29, 30]])", y[b[":", 5], "1:3"].repr); - } - - [TestMethod] - public void ndarray_masking() - { - var y = np.arange(35).reshape(5, 7); - var b = y > 20; - Assert.AreEqual("array([21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34])", y[b].repr); - // use a 1-D boolean whose first dim agrees with the first dim of y - Assert.AreEqual("array([False, False, False, True, True])", b[":", 5].repr); - Assert.AreEqual("array([[21, 22, 23, 24, 25, 26, 27],\n [28, 29, 30, 31, 32, 33, 34]])", y[b[":", 5]].repr); - } - - [TestMethod] - public void ndarray_masking1() - { - var x = np.arange(30).reshape(2, 3, 5); - Assert.AreEqual( - "array([[[ 0, 1, 2, 3, 4],\n" + - " [ 5, 6, 7, 8, 9],\n" + - " [10, 11, 12, 13, 14]],\n\n" + - " [[15, 16, 17, 18, 19],\n" + - " [20, 21, 22, 23, 24],\n" + - " [25, 26, 27, 28, 29]]])", - x.repr); - var b = np.array(new[,] {{true, true, false}, {false, true, true}}); - Assert.AreEqual( - "array([[ 0, 1, 2, 3, 4],\n"+ - " [ 5, 6, 7, 8, 9],\n" + - " [20, 21, 22, 23, 24],\n" + - " [25, 26, 27, 28, 29]])", - x[b].repr); - } - - [TestMethod] - public void ndarray_comparison_operators() - { - var a = np.array(1, 2, 3); - // comparison with a scalar - Assert.AreEqual(new[] {true, false, false}, (a < 2).GetData()); - Assert.AreEqual(new[] {true, true, false}, (a <= 2).GetData()); - Assert.AreEqual(new[] {false, false, true}, (a > 2).GetData()); - Assert.AreEqual(new[] {false, true, true}, (a >= 2).GetData()); - Assert.AreEqual(new[] {false, true, false}, (a.equals(2)).GetData()); - Assert.AreEqual(new[] {true, false, true}, (a.not_equals(2)).GetData()); - // comparison with an array - var b = (np.ones(new Shape(3), np.int32) * 2); - Assert.AreEqual(new[] {true, false, false}, (a < b).GetData()); - Assert.AreEqual(new[] {true, true, false}, (a <= b).GetData()); - Assert.AreEqual(new[] {false, false, true}, (a > b).GetData()); - Assert.AreEqual(new[] {false, true, true}, (a >= b).GetData()); - Assert.AreEqual(new[] {false, true, false}, (a.equals(b)).GetData()); - Assert.AreEqual(new[] {true, false, true}, (a.not_equals(b)).GetData()); - } - - [TestMethod] - public void ndarray_unary_operators() - { - // unary operations - var a = np.array(1, 2, 3); - Assert.AreEqual(new[] {-1, -2, -3}, (-a).GetData()); - Assert.AreEqual(new[] {1, 2, 3}, (+a).GetData()); - // todo: test operator ~ - } - - [TestMethod] - public void ndarray_arithmetic_operators() - { - // arithmetic operators - var a = np.array(1, 2, 3); - var b = (np.ones(new Shape(3), np.int32) * 2); - Assert.AreEqual(new[] { 11, 12, 13 }, (a+10).GetData()); - Assert.AreEqual(new[] { 3, 4, 5 }, (a + b).GetData()); - Assert.AreEqual(new[] { -9, -8, -7 }, (a - 10).GetData()); - Assert.AreEqual(new[] { -1, 0, 1 }, (a - b).GetData()); - Assert.AreEqual(new[] { 10, 20, 30 }, (a * 10).GetData()); - Assert.AreEqual(new[] { 2, 4, 6 }, (a * b).GetData()); - a = np.array(2, 4, 16); - Console.WriteLine((a / 2).repr); - Assert.AreEqual(new[] { 1, 2, 8 }, (a / 2).GetData()); - Assert.AreEqual(new[] { 1, 2, 8 }, (a / b).GetData()); - } - - [TestMethod] - public void ndarray_arithmetic_inplace_operators() - { - var a = np.array(1, 2, 3); - var b = (np.ones(new Shape(3), np.int32) * 2); - a.iadd(10); - Assert.AreEqual(new[] { 11, 12, 13 }, a.GetData()); - a.isub(10); - Assert.AreEqual(new[] { 1, 2, 3 }, a.GetData()); - a.iadd(b); - Assert.AreEqual(new[] { 3, 4, 5 }, a.GetData()); - a.isub(b); - Assert.AreEqual(new[] { 1, 2, 3 }, a.GetData()); - } - - // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools - // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays - // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs - } -} + var x = np.arange(10); + Assert.AreEqual("2", x[2].str); + x[2] = (NDarray)22; + Assert.AreEqual("22", x[2].str); + Assert.AreEqual("8", x[-2].str); + x[-2] = (NDarray)88; + Assert.AreEqual("88", x[-2].str); + var y = x.reshape(new Shape(2, 5)); + Assert.AreEqual("88", y[1, 3].str); + y[1, 3] = (NDarray)888; + Assert.AreEqual("888", y[1, 3].str); + Assert.AreEqual("array([ 0, 1, 22, 3, 4])", y[0].repr); + Assert.AreEqual("22", y[0][2].str); + y[0][2] = (NDarray)222; + Assert.AreEqual("222", y[0][2].str); + } + + [TestMethod] + public void ndarray_indexing_setter2() + { + // using string indices + var x = np.arange(10); + Assert.AreEqual("2", x[2].str); + x["2"] = (NDarray)22; + Assert.AreEqual("22", x[2].str); + Assert.AreEqual("8", x[-2].str); + x["-2"] = (NDarray)88; + Assert.AreEqual("88", x[-2].str); + var y = x.reshape(new Shape(2, 5)); + Assert.AreEqual("88", y[1, 3].str); + y["1, 3"] = (NDarray)888; + Assert.AreEqual("888", y[1, 3].str); + Assert.AreEqual("array([ 0, 1, 22, 3, 4])", y[0].repr); + Assert.AreEqual("22", y[0][2].str); + y["0"]["2"] = (NDarray)222; + Assert.AreEqual("222", y[0][2].str); + } + + [TestMethod] + public void ndarray_indexing_setter3() + { + var a = np.array(new int[] { 1, 2, 3, 4, 5, 6 }).reshape(new Shape(2, 3)); + Assert.AreEqual("[[1 2 3]\n [4 5 6]]", a.str); + a[":", 1] = a[":", 1] * 2; + Assert.AreEqual("[[ 1 4 3]\n [ 4 10 6]]", a.str); + } + + [TestMethod] + public void ndarray_indexing_setter4() + { + var x = np.arange(10, 1, -1); + Assert.AreEqual("array([10, 9, 8, 7, 6, 5, 4, 3, 2])", x.repr); + Assert.AreEqual("array([7, 7, 9, 2])", x[np.array(new[] { 3, 3, 1, 8 })].repr); + x[np.array(new[] { 3, 3, 1, 8 })] = np.arange(4); + Assert.AreEqual("array([10, 2, 8, 1, 6, 5, 4, 3, 3])", x.repr); + } + + [TestMethod] + public void ndarray_slice() + { + var x = np.arange(10); + Assert.AreEqual("array([2, 3, 4])", x["2:5"].repr); + Assert.AreEqual("array([0, 1, 2])", x[":-7"].repr); + Assert.AreEqual("array([1, 3, 5])", x["1:7:2"].repr); + var y = np.arange(35).reshape(new Shape(5, 7)); + Assert.AreEqual("array([[ 7, 10, 13],\n [21, 24, 27]])", y["1:5:2,::3"].repr); + } + + [TestMethod] + public void ndarray_slice1() + { + var y = np.arange(35).reshape(5, 7); + var b = y > 20; + Assert.AreEqual( + "array([[ 1, 2],\n" + + " [15, 16],\n" + + " [29, 30]])", + y[np.array(0, 2, 4), "1:3"].repr); + Assert.AreEqual("array([[22, 23],\n [29, 30]])", y[b[":", 5], "1:3"].repr); + } + + [TestMethod] + public void ndarray_masking() + { + var y = np.arange(35).reshape(5, 7); + var b = y > 20; + Assert.AreEqual("array([21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34])", y[b].repr); + // use a 1-D boolean whose first dim agrees with the first dim of y + Assert.AreEqual("array([False, False, False, True, True])", b[":", 5].repr); + Assert.AreEqual("array([[21, 22, 23, 24, 25, 26, 27],\n [28, 29, 30, 31, 32, 33, 34]])", y[b[":", 5]].repr); + } + + [TestMethod] + public void ndarray_masking1() + { + var x = np.arange(30).reshape(2, 3, 5); + Assert.AreEqual( + "array([[[ 0, 1, 2, 3, 4],\n" + + " [ 5, 6, 7, 8, 9],\n" + + " [10, 11, 12, 13, 14]],\n\n" + + " [[15, 16, 17, 18, 19],\n" + + " [20, 21, 22, 23, 24],\n" + + " [25, 26, 27, 28, 29]]])", + x.repr); + var b = np.array(new[,] { { true, true, false }, { false, true, true } }); + Assert.AreEqual( + "array([[ 0, 1, 2, 3, 4],\n" + + " [ 5, 6, 7, 8, 9],\n" + + " [20, 21, 22, 23, 24],\n" + + " [25, 26, 27, 28, 29]])", + x[b].repr); + } + + [TestMethod] + public void ndarray_comparison_operators() + { + var a = np.array(1, 2, 3); + // comparison with a scalar + Assert.AreEqual(new[] { true, false, false }, (a < 2).GetData()); + Assert.AreEqual(new[] { true, true, false }, (a <= 2).GetData()); + Assert.AreEqual(new[] { false, false, true }, (a > 2).GetData()); + Assert.AreEqual(new[] { false, true, true }, (a >= 2).GetData()); + Assert.AreEqual(new[] { false, true, false }, (a.equals(2)).GetData()); + Assert.AreEqual(new[] { true, false, true }, (a.not_equals(2)).GetData()); + // comparison with an array + var b = (np.ones(new Shape(3), np.int32) * 2); + Assert.AreEqual(new[] { true, false, false }, (a < b).GetData()); + Assert.AreEqual(new[] { true, true, false }, (a <= b).GetData()); + Assert.AreEqual(new[] { false, false, true }, (a > b).GetData()); + Assert.AreEqual(new[] { false, true, true }, (a >= b).GetData()); + Assert.AreEqual(new[] { false, true, false }, (a.equals(b)).GetData()); + Assert.AreEqual(new[] { true, false, true }, (a.not_equals(b)).GetData()); + } + + [TestMethod] + public void ndarray_unary_operators() + { + // unary operations + var a = np.array(1, 2, 3); + Assert.AreEqual(new[] { -1, -2, -3 }, (-a).GetData()); + Assert.AreEqual(new[] { 1, 2, 3 }, (+a).GetData()); + // todo: test operator ~ + } + + [TestMethod] + public void ndarray_arithmetic_operators() + { + // arithmetic operators + var a = np.array(1, 2, 3); + var b = (np.ones(new Shape(3), np.int32) * 2); + Assert.AreEqual(new[] { 11, 12, 13 }, (a + 10).GetData()); + Assert.AreEqual(new[] { 3, 4, 5 }, (a + b).GetData()); + Assert.AreEqual(new[] { -9, -8, -7 }, (a - 10).GetData()); + Assert.AreEqual(new[] { -1, 0, 1 }, (a - b).GetData()); + Assert.AreEqual(new[] { 10, 20, 30 }, (a * 10).GetData()); + Assert.AreEqual(new[] { 2, 4, 6 }, (a * b).GetData()); + a = np.array(2, 4, 16); + Assert.AreEqual(new[] { 1, 2, 8 }, (a / 2).GetData()); + Assert.AreEqual(new[] { 1, 2, 8 }, (a / b).GetData()); + Assert.AreEqual(new[] { 4, 2, .5 }, (8 / a).GetData()); + Assert.AreEqual(new[] { 4, 2, -10 }, (6 - a).GetData()); + } + + [TestMethod] + public void ndarray_arithmetic_inplace_operators() + { + var a = np.array(1, 2, 3); + var b = (np.ones(new Shape(3), np.int32) * 2); + a.iadd(10); + Assert.AreEqual(new[] { 11, 12, 13 }, a.GetData()); + a.isub(10); + Assert.AreEqual(new[] { 1, 2, 3 }, a.GetData()); + a.iadd(b); + Assert.AreEqual(new[] { 3, 4, 5 }, a.GetData()); + a.isub(b); + Assert.AreEqual(new[] { 1, 2, 3 }, a.GetData()); + } + + [TestMethod] + public void ndarray_value_div_ndarray() + { + // division operator + var a = np.array(1.0, 2.0, 3.0); + Assert.AreEqual(new[] { 0.5, 1.0, 1.5 }, (a / 2.0).GetData()); + Assert.AreEqual(new[] { 6.0, 3.0, 2.0 }, (6.0 / a).GetData()); + // minus operator + Assert.AreEqual(new[] { -1.0, 0.0, 1.0 }, (a - 2.0).GetData()); + Assert.AreEqual(new[] { 1.0, 0.0, -1.0 }, (2.0 - a).GetData()); + } + + [TestMethod] + public void np_where() + { + //>>> import numpy as np + //>>> a = [1, 2, 3, 4, 0, 0, 1, 2] + //>>> a = np.array(a) + //>>> b = np.where(a == 0) + //>>> b[0] + //array([4, 5], dtype = int64) + var a = np.array(new[] { 1, 2, 3, 4, 0, 0, 1, 2 }); + var b = np.where(a.equals(0)); + Assert.AreEqual("array([4, 5], dtype=int64)", b[0].repr); + } + + [TestMethod] + public void GetData_noncontiguous() + { + int[,] X = new int[3, 3]; + X[0, 0] = -1; + + NDarray npX = np.array(X, dtype: np.int32); // control + NDarray npY = np.array(X, dtype: np.int32); // test + + Console.WriteLine("Control:"); + Console.WriteLine(npX); + + Console.WriteLine("Test:"); + Console.WriteLine(npY); + + // flip on the row axis + npY = np.flip(npY, new int[] { 0 }); + Console.WriteLine("Test flipped on axis 0:"); + Console.WriteLine(npY); + + // get their data + int[] cX = npX.GetData(); + int[] cY = npY.GetData(); + + Console.WriteLine("Control extracted back to C#:\n" + string.Join(" ", cX)); + Assert.AreEqual("-1 0 0 0 0 0 0 0 0", string.Join(" ", cX)); + Console.WriteLine("Test extracted back to C#:\n" + string.Join(" ", cY)); + Assert.AreEqual("0 0 0 0 0 0 -1 0 0", string.Join(" ", cY)); + } + + [TestMethod] + public void CopyDataInAndOutExample() + { + var a = np.array(new[] { 2, 4, 9, 25 }); + Console.WriteLine("a: " + a.repr); + // a: array([ 2, 4, 9, 25]) + var roots = np.sqrt(a); + Console.WriteLine(roots.repr); + // array([1.41421356, 2. , 3. , 5. ]) + Assert.AreEqual("array([1.41421356, 2. , 3. , 5. ])", roots.repr); + Console.WriteLine(string.Join(", ", roots.GetData())); + // 1719614413, 1073127582, 0, 1073741824 + Console.WriteLine("roots.dtype: " + roots.dtype); + // roots.dtype: float64 + Console.WriteLine(string.Join(", ", roots.GetData())); + // 1.4142135623731, 2, 3, 5 + Assert.AreEqual(new double[] { 1.41, 2, 3, 5 }, roots.GetData().Select(x => Math.Round(x, 2)).ToArray()); + } + + [TestMethod] + public void QuestionByPiyushspss() + { + // np.column_stack(np.where(mat > 0)) + + //>>> a = np.array([1, 0, 0, 1, 2, 3, 0, 1]).reshape(2, 4) + // >>> a + //array([[1, 0, 0, 1], + // [2, 3, 0, 1]]) + //>>> np.column_stack(a) + //array([[1, 2], + // [0, 3], + // [0, 0], + // [1, 1]]) + //>>> np.where(a > 0) + //(array([0, 0, 1, 1, 1], dtype = int64), array([0, 3, 0, 1, 3], dtype = int64)) + //>>> np.column_stack(np.where(a > 0)) + //array([[0, 0], + // [0, 3], + // [1, 0], + // [1, 1], + // [1, 3]], dtype = int64) + //>>> + var a = np.array(new[] { 1, 0, 0, 1, 2, 3, 0, 1 }).reshape(2, 4); + var expected = + "array([[1, 2],\n" + + " [0, 3],\n" + + " [0, 0],\n" + + " [1, 1]])"; + Assert.AreEqual(expected, np.column_stack(a).repr); + // note: this was a bug, now you don't get a python tuple back, but an array of NDarrays instead so the following line just doesn't compile any more + //Assert.AreEqual("(array([0, 0, 1, 1, 1], dtype=int64), array([0, 3, 0, 1, 3], dtype=int64))", np.where(a > 0).repr); + expected = + "array([[0, 0],\n" + + " [0, 3],\n" + + " [1, 0],\n" + + " [1, 1],\n" + + " [1, 3]], dtype=int64)"; + Assert.AreEqual(expected, np.column_stack(np.where(a > 0)).repr); + } + + [TestMethod] + public void QuestionByGurelsoycaner() + { + //>>> import numpy as np + //>>> P1 = np.array([1, 2, 3, 4]) + //>>> P2 = np.array([4, 3, 2, 1]) + //>>> ex = (P2 - P1) / (np.linalg.norm(P2 - P1)) + //>>> ex + //array([0.67082039, 0.2236068, -0.2236068, -0.67082039]) + var P1 = np.array(new[] { 1, 2, 3, 4 }); + var P2 = np.array(new[] { 4, 3, 2, 1 }); + var ex = (P2 - P1) / (np.linalg.norm(P2 - P1)); + Assert.AreEqual("array([ 0.67082039, 0.2236068 , -0.2236068 , -0.67082039])", ex.repr); + } + + [TestMethod] + public void QuestionBySimonBuehler() + { + //import numpy as np + //bboxes = np.empty([999, 4]) + //keep_idx = np.array([2, 6, 7, 8, 9, 13]) + //bboxes = bboxes[keep_idx] + //>>> bboxes.shape + //(6, 4) + var bboxes = np.empty(new Shape(999, 4)); + var keep_idx = np.array(new[] { 2, 6, 7, 8, 9, 13 }); + bboxes = bboxes[keep_idx]; + Assert.AreEqual("(6, 4)", bboxes.shape.ToString()); + + //>>> np.where(keep_idx > 4)[0] + //array([1, 2, 3, 4, 5], dtype = int64) + var x = np.where(keep_idx > 4)[0]; + Assert.AreEqual("array([1, 2, 3, 4, 5], dtype=int64)", x.repr); + } + + [TestMethod] + public void StringArray() + { + //>>> a = numpy.array(['apples', 'foobar', 'cowboy']) + //>>> a[2] = 'bananas' + //>>> a + //array(['apples', 'foobar', 'banana'], + // dtype = '|S6') + var a = np.array(new string[] { "apples", "foobar", "cowboy" }); + Assert.AreEqual("array(['apples', 'foobar', 'cowboy'], dtype='>> a = numpy.array(['apples', 'foobar', 'cowboy'], dtype = object) + //>>> a + //array([apples, foobar, cowboy], dtype = object) + //>>> a[2] = 'bananas' + //>>> a + //array([apples, foobar, bananas], dtype = object) + a = np.array(new string[] { "apples", "foobar", "cowboy" }, dtype: np.object_); + Assert.AreEqual("array(['apples', 'foobar', 'cowboy'], dtype=object)", a.repr); + // todo: a[2]="banana"; + a.self.SetItem(new PyInt(2), new PyString("banana")); + Assert.AreEqual("array(['apples', 'foobar', 'banana'], dtype=object)", a.repr); + } + + [TestMethod] + public void ComplexNumbers() + { + //>>> a = np.array([1+2j, 3+4j, 5+6j]) + //>>> a.imag + //array([2., 4., 6.]) + var a = np.array(new Complex[] { new Complex(1, 2), new Complex(3, 4), new Complex(5, 6), }); + Assert.AreEqual("array([1., 3., 5.])", a.real.repr); + Assert.AreEqual("array([2., 4., 6.])", a.imag.repr); + //>>> np.imag(a) + //array([2., 4., 6.]) + //>>> np.real(a) + //array([1., 3., 5.]) + Assert.AreEqual("array([1., 3., 5.])", np.real(a).repr); + Assert.AreEqual("array([2., 4., 6.])", np.imag(a).repr); + //>>> a.imag = np.array([8, 10, 12]) + //>>> a + //array([1. +8.j, 3.+10.j, 5.+12.j]) + a.imag = np.array(new[] { 8, 10, 12 }); + Assert.AreEqual("array([1. +8.j, 3.+10.j, 5.+12.j])", a.repr); + //>>> np.imag(1 + 1j) + //1.0 + Assert.AreEqual(1.0, np.imag(new Complex(1, 1)).asscalar()); + + // getting the complex numbers out again + var c = a.GetData(); + Assert.IsTrue(Enumerable.SequenceEqual(new Complex[] { new Complex(1, 8), new Complex(3, 10), new Complex(5, 12), }, c)); + + // accessing scalar values + var b = new NDarray(a); + Assert.AreEqual(new Complex(1, 8), b[0].asscalar()); + } + + [TestMethod] + public void IssueByXlient() + { + var points = new Point[] { new Point(0, 0), new Point(17, 4), new Point(2, 22), new Point(10, 7), }; + int[,] Pts = new int[,] { + { points[0].X, points[0].Y }, + { points[1].X, points[1].Y }, + { points[2].X, points[2].Y }, + { points[3].X, points[3].Y } + }; + + // exception here / deadlock + Dtype dtype = Pts.GetDtype(); + + NDarray pts = np.array(Pts); + NDarray rectangle = np.zeros(new Shape(4, 2), dtype); + + NDarray sum = np.sum(pts, 1); + NDarray differnce = np.diff(pts, axis: 1); + + rectangle[0] = pts[sum.argmin()]; + rectangle[2] = pts[sum.argmax()]; + rectangle[1] = pts[differnce.argmin()]; + rectangle[3] = pts[differnce.argmax()]; + } + + [TestMethod] + public void IssueByVolgaone() + { + var n = np.array(new float[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }); + var row0 = n[0]; //extract 1st row + Assert.AreEqual("array([1., 2., 3.], dtype=float32)", row0.repr); + var row0Data = row0.GetData(); //this is correct - {1,2,3} + Assert.AreEqual("1,2,3", string.Join(",", row0Data)); + var col1 = n[":,1"]; //extract 1st column - NDarray is [2 5 8] as expected + Assert.AreEqual("array([2., 5., 8.], dtype=float32)", col1.repr); + var col1Data = col1.GetData(); //this is wrong - {2,3,4} + Assert.AreEqual("2,5,8", string.Join(",", col1Data)); + } + + [TestMethod] + public void IssueByNbustins() + { + int[,,,] iarr = new int[3, 25, 25, 3]; + NDarray nd = np.array(iarr); + Assert.AreEqual(new Shape(3, 25, 25, 3), nd.shape); + } + + [TestMethod] + public void IssueByBanyc1() + { + //a = np.array([[1, 2, 3], [4, 5, 6]]) + //b = np.array([1, 2]) + //np.savez('/tmp/123.npz', a = a, b = b) + //data = np.load('/tmp/123.npz') + //data['a'] + //array([[1, 2, 3], + //[4, 5, 6]]) + //data['b'] + //array([1, 2]) + //data.close() + var a = np.array(new[,] { { 1, 2, 3 }, { 4, 5, 6 } }); + var b = np.array(new[] { 1, 2 }); + string tempFile = Path.GetTempFileName() + ".npz"; + Console.WriteLine(tempFile); + np.savez(tempFile, kwds: new Dictionary() { ["a"] = a, ["b"] = b }); + var data = np.load(tempFile, allow_pickle: true); + var a1 = new NDarray(data.self["a"]); + Console.WriteLine(a1.repr); + var b1 = new NDarray(data.self["b"]); + Console.WriteLine(b1.repr); + Assert.AreEqual("array([[1, 2, 3],\n [4, 5, 6]])", a1.repr); + Assert.AreEqual(@"array([1, 2])", b1.repr); + } + + [TestMethod] + public void IssueByBanyc2() + { + var a = np.array(new[,] { { 1, 2, 3 }, { 4, 5, 6 } }); + var b = np.array(new[] { 1, 2 }); + string tempFile = Path.GetTempFileName() + ".npz"; + Console.WriteLine(tempFile); + np.savez(tempFile, new[] { a, b }); + var data = np.load(tempFile, allow_pickle: true); + var a1 = new NDarray(data.self["arr_0"]); + Console.WriteLine(a1.repr); + var b1 = new NDarray(data.self["arr_1"]); + Console.WriteLine(b1.repr); + Assert.AreEqual("array([[1, 2, 3],\n [4, 5, 6]])", a1.repr); + Assert.AreEqual(@"array([1, 2])", b1.repr); + } + + [TestMethod] + public void IssueByBanyc3() + { + //>>> a = np.ones((1, 2, 3, 4)) + //>>> a + //array([[[[1., 1., 1., 1.], + // [1., 1., 1., 1.], + // [1., 1., 1., 1.]], + + // [[1., 1., 1., 1.], + // [1., 1., 1., 1.], + // [1., 1., 1., 1.]]]]) + //>>> c = np.transpose(a, (0, 2, 3, 1)) + //>>> c + //array([[[[1., 1.], + // [1., 1.], + // [1., 1.], + // [1., 1.]], + + // [[1., 1.], + // [1., 1.], + // [1., 1.], + // [1., 1.]], + + // [[1., 1.], + // [1., 1.], + // [1., 1.], + // [1., 1.]]]]) + //>>> b = a.transpose((0, 2, 3, 1)) + //>>> b + //array([[[[1., 1.], + // [1., 1.], + // [1., 1.], + // [1., 1.]], + + // [[1., 1.], + // [1., 1.], + // [1., 1.], + // [1., 1.]], + + // [[1., 1.], + // [1., 1.], + // [1., 1.], + // [1., 1.]]]]) + //>>> + NDarray a = np.ones(1, 2, 3, 4); + NDarray c = np.transpose(a, new int[] { 0, 2, 3, 1 }); + + string s = "array([[[[1., 1.],\n [1., 1.],\n [1., 1.],\n [1., 1.]],\n\n [[1., 1.],\n [1., 1.],\n [1., 1.],\n [1., 1.]],\n\n [[1., 1.],\n [1., 1.],\n [1., 1.],\n [1., 1.]]]])"; + Assert.AreEqual(s, c.repr); + NDarray b = a.transpose(0, 2, 3, 1); + Assert.AreEqual(s, b.repr); + } + + [TestMethod] + public void IssueBybeanels01() + { + //sample = [np.array([[1., 2., 3.]]),np.array([[4., 5., 6.]]),np.array([[7., 8., 9.]])] + //for test in sample: + // n = np.argmax(test[0]) + // print(n) + //# expected: + //# 2 + //# 2 + //# 2 + var result = new List(); + var nc = np.array(new[] { np.array(new[] { 1, 2, 3 }), np.array(new[] { 4, 5, 6 }), np.array(new[] { 7, 8, 9 }) }); + for (int i = 0; i < nc.len; i++) { + var n = np.argmax(nc[i]).asscalar(); + result.Add(n); + } + Assert.AreEqual("2, 2, 2", string.Join(", ", result)); + } + + [TestMethod] + public void IssueBybeanels01a() + { + //sample = [np.array([[1., 2., 3.]]),np.array([[4., 5., 6.]]),np.array([[7., 8., 9.]])] + //for test in sample: + // n = np.argmax(test[0]) + // print(n) + //# expected: + //# 2 + //# 2 + //# 2 + var result = new List(); + var nc = np.array(new[] { np.array(new[] { 1, 2, 3 }), np.array(new[] { 4, 5, 6 }), np.array(new[] { 7, 8, 9 }) }); + for (int i = 0; i < nc.len; i++) { + var n = np.argmax(nc[i]).asscalar(); + result.Add(n); + } + Assert.AreEqual("2, 2, 2", string.Join(", ", result)); + } + + [TestMethod] + public void IssueByMatteo_0() + { + //>>> x = np.array([0, 1, 2, 3]) + //>>> y = np.array([-1, 0.2, 0.9, 2.1]) + //>>> A = np.vstack([x, np.ones(len(x))]).T + //>>> A + //array([[0., 1.], + // [1., 1.], + // [2., 1.], + // [3., 1.]]) + //>>> np.linalg.lstsq(A, y, rcond = None) + //(array([1. , -0.95]), array([0.05]), 2, array([4.10003045, 1.09075677])) + var x = np.array(new[] { 0, 1, 2, 3 }); + var y = np.array(new[] { -1, 0.2, 0.9, 2.1 }); + var A = np.vstack(x, np.ones(x.len)).T; + Assert.AreEqual("array([[0., 1.],\n [1., 1.],\n [2., 1.],\n [3., 1.]])", A.repr); + var tuple = np.linalg.lstsq(A, y, null); + Assert.AreEqual("array([ 1. , -0.95])", tuple.Item1.repr); + Assert.AreEqual("array([0.05])", tuple.Item2.repr); + Assert.AreEqual(2, tuple.Item3); + Assert.AreEqual("array([4.10003045, 1.09075677])", tuple.Item4.repr); + } + + [TestMethod] + public void IssueByDecemberDream() + { + //a = np.array([1, 2, -2, -4, 0]) + //np.roots(a) + //# returns array([ 1.41421356, -2., -1.41421356, 0.]) + var a = np.array(new[] { 1, 2, -2, -4, 0 }); + var b = np.roots(a); + Assert.AreEqual("array([ 1.41421356, -2. , -1.41421356, 0. ])", b.repr); + } + + [TestMethod] + public void IssueByDecemberDream2() + { + NDarray test = np.array(new int[,] { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 }, { 9, 10, 11 } }); + NDarray rows = np.array(new int[,] { { 0, 0 }, { 3, 3 } }); + NDarray cols = np.array(new int[,] { { 0, 2 }, { 0, 2 } }); + + var b = test[rows, cols]; + // should return + // [[0, 2], + // [9, 11]] + Assert.AreEqual("array([[ 0, 2],\n [ 9, 11]])", b.repr); + } + + [TestMethod] + public void IssueByAmpangboy() + { + var arr = np.array(1.0); + var result = np.insert(arr, 0, 1.0); + Assert.AreEqual("array([1., 1.])", result.repr); + } + + [TestMethod] + public void IssueByBigpo() + { + var a = np.random.randn(3, 3); + var tmp = np.linalg.qr(a); + } + + [TestMethod] + public void IssueByAllenP() + { + //>>> dx = 4.0 + //>>> dy = 5.0 + //>>> zX =[[1, 2, 3],[4,5,6],[8,9,0]] + //>>> np.gradient(zX, dx, dy) + //[array([[0.75, 0.75, 0.75], + // [0.875, 0.875, -0.375], + // [1. , 1. , -1.5]]), array([[0.2, 0.2, 0.2], + // [ 0.2, 0.2, 0.2], + // [ 0.2, -0.8, -1.8]])] + var zX = new NDarray(new[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 8, 9, 0 } }); + var result = np.gradient(zX, new List { 4.0, 5.0 }); + var expected = @"[array([[ 0.75 , 0.75 , 0.75 ], + [ 0.875, 0.875, -0.375], + [ 1. , 1. , -1.5 ]]), array([[ 0.2, 0.2, 0.2], + [ 0.2, 0.2, 0.2], + [ 0.2, -0.8, -1.8]])]".Replace("\r", ""); + Assert.AreEqual(expected, result.repr); + } + + [TestMethod] + public void PrimitiveConversion() + { + dynamic np = Numpy.np.dynamic_self; + Assert.AreEqual(3, (new PyInt(3)).As()); + Assert.AreEqual(1_000_000_000_000_000, new PyInt(1_000_000_000_000_000).As()); + Console.WriteLine(((dynamic)new PyInt(1_000_000_000_000_000)).__class__); // => + Console.WriteLine(np.int64(1_000_000_000_000_000).__class__); // => + Assert.AreEqual(3, (np.int32(3).item() as PyObject).As()); + Assert.AreEqual(1_000_000_000_000_000, (np.int64(1_000_000_000_000_000).item() as PyObject).As()); + } + + [TestMethod] + public void IssueByMegawattFs() + { + var arr = np.array(new int[] { 1, 2, 3, 4, 5 }); + var slice0 = new Slice(2, 4); + var arr4 = arr[slice0]; + Assert.AreEqual("array([3, 4])", arr4.repr); + var slice1 = new Slice(2, -1); + var arr5 = arr[slice1]; + Assert.AreEqual("array([3, 4])", arr5.repr); + var arr1 = arr["2:4"]; + Assert.AreEqual("array([3, 4])", arr1.repr); + var arr2 = arr[":4"]; + Assert.AreEqual("array([1, 2, 3, 4])", arr2.repr); + var arr3 = arr[":-1"]; + Assert.AreEqual("array([1, 2, 3, 4])", arr3.repr); + } + + [TestMethod] + public async Task IssueByMrCOrrupted() + { + Dictionary arrays = new Dictionary(); + arrays["a"] = np.arange(6).reshape(2, 3); + arrays["b"] = np.arange(3); + + var filename = Path.Combine(Path.GetTempPath(), "test.npz"); + np.savez_compressed(filename, null, arrays); + var archive = np.load(filename); + Console.WriteLine(archive.repr); + var a = new NDarray(archive.PyObject["a"]); + var b = new NDarray(archive.PyObject["b"]); + Console.WriteLine(a.repr); + Console.WriteLine(b.repr); + Assert.AreEqual("array([[0, 1, 2],\n [3, 4, 5]])", a.repr); + Assert.AreEqual(@"array([0, 1, 2])", b.repr); + } + + [TestMethod] + public async Task AsscalarRemovedInNumpyV1_23() + { + Assert.AreEqual(143, new NDarray(new int[] { 143 }).asscalar()); + Assert.AreEqual(143d, new NDarray(new[] { 143d }).asscalar()); + Assert.AreEqual(143d, new NDarray(new[] { 143d }).item()); + } + + [TestMethod] + public async Task IssueByMaLichtenegger() + { + // byte array als uint32 array + var bytes = new byte[] { 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0 }; + var uints = np.zeros(new Shape(3), np.uint32); + Console.WriteLine(uints.repr); + var ctypes = uints.PyObject.ctypes; + long ptr = ctypes.data; + Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); + Console.WriteLine(uints.repr); + Assert.AreEqual("array([1, 2, 3], dtype=uint32)", uints.repr); + // byte array als float64 array + bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0 }; + var doubles = np.zeros(new Shape(2), np.float64); + Console.WriteLine(doubles.repr); + ctypes = doubles.PyObject.ctypes; + ptr = ctypes.data; + Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); + Console.WriteLine(doubles.repr); + Assert.IsTrue(doubles[0].asscalar() != 0); + Assert.IsTrue(doubles[1].asscalar() == 0); + } + + [TestMethod] + public async Task IssueByMartinDevans() + { + //>>> x = np.arange(9) + //>>> np.split(x, 3) + //[array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8])] + var x = np.arange(9); + var b = np.split(x, 3).repr(); + var a = "(array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]))"; + Assert.AreEqual(a, b); + Assert.AreEqual(a, x.split(3, axis: -1).repr()); + //>>> x = np.arange(8.0) + //>>> np.split(x, [3, 5, 6, 10]) + //[array([0., 1., 2.]), + //array([3., 4.]), + //array([5.]), + //array([6., 7.]), + //array([], dtype = float64)] + x = np.arange(8); + b = np.split(x, new[] { 3, 5, 6, 10 }).repr(); + a = "(array([0, 1, 2]), array([3, 4]), array([5]), array([6, 7]), array([], dtype=int32))"; + Assert.AreEqual(a, b); + Assert.AreEqual(a, x.split(new[] { 3, 5, 6, 10 }).repr()); + } + + + [TestMethod] + public async Task F16Workaround() + { + // use byte array to create float16 array + + // numbers in float16: + // 0 01111 0000000000 = 2^0 * (1 + 0/1024) = 1 + // 1 01111 0000000000 = -1 * 2 ^ 0 * (1 + 0 / 1024) = -1 + // 0 11110 1111111111 = -1^(0) * 2^(15) * (1 + 1023/1024) ≈ 65504 + // see: https://devblogs.microsoft.com/dotnet/introducing-the-half-type/ + + // these bytes in binary notation correspond to f16 numbers 1, -1 and 65504 (float16 max value) + // note, the bytes are in reversed order to the bits shown above + var bytes = new byte[] { + 0b00000000, 0b00111100, // 1 + 0b00000000, 0b10111100, // -1 + 0b11111111, 0b01111011, // 65504 + }; + var floats = np.zeros(new Shape(3), np.float16); + Console.WriteLine(floats.repr); + // note, the using prevents a mem-leak with ctypes + using (var ctypes = floats.PyObject.ctypes) { + long ptr = ctypes.data; + Marshal.Copy(bytes, 0, new IntPtr(ptr), bytes.Length); + } + Console.WriteLine(floats.repr); + Assert.AreEqual("array([ 1.00e+00, -1.00e+00, 6.55e+04], dtype=float16)", floats.repr); + } + + + [TestMethod] + public async Task IssueByTimiil() + { + //>>> img = np.arange(27).reshape(3, 3, 3) + //>>> img + //array([[[0, 1, 2], + // [ 3, 4, 5], + // [ 6, 7, 8]], + + // [[ 9, 10, 11], + // [12, 13, 14], + // [15, 16, 17]], + + // [[18, 19, 20], + // [21, 22, 23], + // [24, 25, 26]]]) + //>>> fft_img = np.fft.fft2(img) + //>>> fft_img = np.fft.fftshift(fft_img) + //>>> fft_img + //array([[[0. + 0.j, -13.5 - 7.79422863j, 0. + 0.j], + // [ -4.5 - 2.59807621j, 198. + 0.j , -4.5 + 2.59807621j], + // [ 0. + 0.j , -13.5 + 7.79422863j, 0. + 0.j ]], + + // [[ 0. + 0.j , -13.5 - 7.79422863j, 0. + 0.j ], + // [ -4.5 - 2.59807621j, 36. + 0.j , -4.5 + 2.59807621j], + // [ 0. + 0.j , -13.5 + 7.79422863j, 0. + 0.j ]], + + // [[ 0. + 0.j , -13.5 - 7.79422863j, 0. + 0.j ], + // [ -4.5 - 2.59807621j, 117. + 0.j , -4.5 + 2.59807621j], + // [ 0. + 0.j , -13.5 + 7.79422863j, 0. + 0.j ]]]) + var img = np.arange(27).reshape(3, 3, 3); + var fft_img = np.fft.fft2(img); + fft_img = np.fft.fftshift(fft_img); + Console.WriteLine(fft_img.repr); + Assert.AreEqual(@"array([[[ 0. +0.j , -13.5-7.79422863j, 0. +0.j ], + [ -4.5-2.59807621j, 198. +0.j , -4.5+2.59807621j], + [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]], + + [[ 0. +0.j , -13.5-7.79422863j, 0. +0.j ], + [ -4.5-2.59807621j, 36. +0.j , -4.5+2.59807621j], + [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]], + + [[ 0. +0.j , -13.5-7.79422863j, 0. +0.j ], + [ -4.5-2.59807621j, 117. +0.j , -4.5+2.59807621j], + [ 0. +0.j , -13.5+7.79422863j, 0. +0.j ]]])".Replace("\r", ""), fft_img.repr); + } + + [TestMethod] + public void IssueByPandath() + { + //>>> grid = np.array([[1, 2, 3, 0, 0, 4], [5, 6, 7, 0, 0, 8]]) + //>>> xs, ys = np.where(grid == 0) + //>>> xs + //array([0, 0, 1, 1], dtype = int64) + //>>> ys + //array([3, 4, 3, 4], dtype = int64) + + var grid = np.array(new[,] { { 1, 2, 3, 0, 0, 4 }, { 5, 6, 7, 0, 0, 8 } }); + var result = np.where(grid.equals(0)); + Console.WriteLine(result[0].repr); + Console.WriteLine(result[1].repr); + Assert.AreEqual("array([0, 0, 1, 1], dtype=int64)", result[0].repr); + Assert.AreEqual("array([3, 4, 3, 4], dtype=int64)", result[1].repr); + } + + [TestMethod] + public void IssueByXiaozhu1988() + { + //>>> data = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]) + //>>> (data >= 50) & (data < 100) + //array([False, False, False, False, True, True, True, True, True, + // False, False, False]) + + var data = np.array(new[] { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 }); + Console.WriteLine(((data >= 50) & (data < 100)).repr); + Assert.AreEqual("array([False, False, False, False, True, True, True, True, True,\n False, False, False])", ((data >= 50) & (data < 100)).repr); + Console.WriteLine(((data >= 50) | (data < 100)).repr); + Assert.AreEqual("array([ True, True, True, True, True, True, True, True, True,\n True, True, True])", ((data >= 50) | (data < 100)).repr); + Console.WriteLine(((data >= 50) ^ (data < 100)).repr); + Assert.AreEqual("array([ True, True, True, True, False, False, False, False, False,\n True, True, True])", ((data >= 50) ^ (data < 100)).repr); + } + + [TestMethod] + public void IssueByElinLiu0() + { + var x = np.array(new float[,] { { 1.1f, 2.2f }, { 3.141596f, 4.4f } }); + var y = string.Join(',', x.GetData().Select(z => z.ToString(CultureInfo.InvariantCulture))); + Console.WriteLine("Proof: " + y); + Assert.AreEqual("1.1,2.2,3.141596,4.4", y); + } + } + + + + + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#structural-indexing-tools + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#assigning-values-to-indexed-arrays + // TODO: https://docs.scipy.org/doc/numpy/user/basics.indexing.html?highlight=slice#dealing-with-variable-numbers-of-indices-within-programs + +} diff --git a/test/Numpy.UnitTest/TestingExtensions.cs b/test/Numpy.UnitTest/TestingExtensions.cs new file mode 100644 index 0000000..db8fa39 --- /dev/null +++ b/test/Numpy.UnitTest/TestingExtensions.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Numpy.UnitTest +{ + public static class TestingExtensions + { + // use this to simulate Python tuples, because we use arrays instead + public static string repr(this NDarray[] self) + { + return "(" + string.Join(", ", self.Select(a => a.repr)) + ")"; + } + } +}