我在过去一小时左右的时间环顾四周,但我找不到任何关于这个问题的帮助.我试图将这个伪代码转换为java并且无法弄清楚我做错了什么(它曾经打印过任何东西).
function line(x0, x1, y0, y1)
boolean steep := abs(y1 - y0) > abs(x1 - x0)
if steep then
swap(x0, y0)
swap(x1, y1)
if x0 > x1 then
swap(x0, x1)
swap(y0, y1)
int deltax := x1 - x0
int deltay := abs(y1 - y0)
real error := 0
real deltaerr := deltay / deltax
int ystep
int y := y0
if y0 < y1 then ystep := 1 else ystep := -1
for x from x0 to x1
if steep …Run Code Online (Sandbox Code Playgroud) 好的,我在这里做错了什么?我正在尝试将一些vb内容重写为c#(所以我可以学习一些c#),但是我很失败.
这是代码,我将发布之后发生的事情:
private object[] _PNs;
internal object[] ParameterNames { set { _PNs = value; } }
private object[] _PVs;
internal object[] ParameterValues { set { _PVs = value; } }
private Enumerations.DataType[] _DTs;
internal Enumerations.DataType[] ParameterDataTypes { set { _DTs = value; } }
protected void PrepareParams(SqlCommand objCmd)
{
try
{
long _DataSize = 0;
int _PCt = _PVs.GetUpperBound(0);
Type _t_dt = _DTs.GetType();
for (int i = 0; i <= _PCt; ++i)
{
if (_t_dt.IsArray)
{
switch (_DTs[i])
{
case …Run Code Online (Sandbox Code Playgroud) 我有一个复杂的MxN矩阵A,A显然有一些属性,呈现对角矩阵A'*A.A也是非常大(256x16384)所以我想不出一种方法来上传它在这里再现.
在MATLAB代码中,我有:
imshow(abs(A'*A),[]);
Run Code Online (Sandbox Code Playgroud)
python中转换的代码:
tmp=np.dot(A.T,A)
plt.imshow(np.absolute(tmp))
plt.show()
Run Code Online (Sandbox Code Playgroud)
生产:
对角似乎在旋转.这种轮换有什么理由吗?我正确地进行了转换吗?
我正在尝试将 C# 代码转换为 Visual Basic。
这是 C# 代码:
public static string RequestServer1(string methodName, List<string> parameters)
{
return RequestServer(methodName, parameters.Select(p => new JValue(p)).ToList<JToken>());
}
Run Code Online (Sandbox Code Playgroud)
这是 VB.Net 代码:
Public Shared Function RequestServer(ByVal methodName As String, ByVal parameters As List(Of String)) As String
Return RequestServer(methodName, parameters.Select(Function(p) New JValue(p)).ToList())
End Function
Run Code Online (Sandbox Code Playgroud)
这里的功能是List(Of JToken):
Public Shared Function RequestServer(ByVal methodName As String, ByVal parameters As List(Of JToken)) As JToken
Dim ServerIp As String = "http://localhost:8332"
Dim UserName As String = "hama"
Dim Password As …Run Code Online (Sandbox Code Playgroud)