forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumPy.linspace.cs
More file actions
157 lines (152 loc) · 6.32 KB
/
NumPy.linspace.cs
File metadata and controls
157 lines (152 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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 partial class NumPy
{
/// <summary>
/// Return evenly spaced numbers over a specified interval.<br></br>
///
/// Returns num evenly spaced samples, calculated over the
/// interval [start, stop].<br></br>
///
/// The endpoint of the interval can optionally be excluded.
/// </summary>
/// <param name="start">
/// The starting value of the sequence.
/// </param>
/// <param name="stop">
/// The end value of the sequence, unless endpoint is set to False.<br></br>
///
/// In that case, the sequence consists of all but the last of num + 1
/// evenly spaced samples, so that stop is excluded.<br></br>
/// Note that the step
/// size changes when endpoint is False.
/// </param>
/// <param name="step">Returns the step which is the spacing
/// between samples.
/// </param>
/// <param name="num">
/// Number of samples to generate.<br></br>
/// Default is 50. Must be non-negative.
/// </param>
/// <param name="endpoint">
/// If True, stop is the last sample.<br></br>
/// Otherwise, it is not included.<br></br>
///
/// Default is True.
/// </param>
/// <param name="dtype">
/// The type of the output array.<br></br>
/// If dtype is not given, infer the data
/// type from the other input arguments.
/// </param>
/// <param name="axis">
/// The axis in the result to store the samples.<br></br>
/// Relevant only if start
/// or stop are array-like.<br></br>
/// By default (0), the samples will be along a
/// new axis inserted at the beginning.<br></br>
/// Use -1 to get an axis at the end.
/// </param>
/// <returns>
/// There are num equally spaced samples in the closed interval
/// [start, stop] or the half-open interval [start, stop)
/// </returns>
public 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<float>(t[1]);
return ToCsharp<NDarray>(t[0]);
}
/// <summary>
/// Return evenly spaced numbers over a specified interval.<br></br>
///
/// Returns num evenly spaced samples, calculated over the
/// interval [start, stop].<br></br>
///
/// The endpoint of the interval can optionally be excluded.
/// </summary>
/// <param name="start">
/// The starting value of the sequence.
/// </param>
/// <param name="stop">
/// The end value of the sequence, unless endpoint is set to False.<br></br>
///
/// In that case, the sequence consists of all but the last of num + 1
/// evenly spaced samples, so that stop is excluded.<br></br>
/// Note that the step
/// size changes when endpoint is False.
/// </param>
/// <param name="step">Returns the step which is the spacing
/// between samples.
/// </param>
/// <param name="num">
/// Number of samples to generate.<br></br>
/// Default is 50. Must be non-negative.
/// </param>
/// <param name="endpoint">
/// If True, stop is the last sample.<br></br>
/// Otherwise, it is not included.<br></br>
///
/// Default is True.
/// </param>
/// <param name="dtype">
/// The type of the output array.<br></br>
/// If dtype is not given, infer the data
/// type from the other input arguments.
/// </param>
/// <param name="axis">
/// The axis in the result to store the samples.<br></br>
/// Relevant only if start
/// or stop are array-like.<br></br>
/// By default (0), the samples will be along a
/// new axis inserted at the beginning.<br></br>
/// Use -1 to get an axis at the end.
/// </param>
/// <returns>
/// There are num equally spaced samples in the closed interval
/// [start, stop] or the half-open interval [start, stop)
/// </returns>
public 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<float>(t[1]);
return ToCsharp<NDarray>(t[0]);
}
}
}