我正在尝试使用以下命令将包添加到 dotnet:
dotnet add package JetBrains.dotCover.CommandLineTools --version 2018.2.0-eap07
Run Code Online (Sandbox Code Playgroud)
但是,我收到错误:
The project does not support adding package references through the add package command.
Run Code Online (Sandbox Code Playgroud)
我该怎么做?我无法通过 NuGet 安装该包,因为我的 dotnet 命令行无法检测到 dotcover。我看到一些通过 .csproj 为 dotnet.core 应用程序添加包的示例:
<DotNetCliToolReference Include="JetBrains.dotCover.CommandLineTools" Version="2018.2.0-eap03" />
Run Code Online (Sandbox Code Playgroud)
然后运行 dotnet Restore。但我不知道如何为 WPF 应用程序执行此操作。我的最终目标是对 WPF 应用程序使用以下命令来生成测试覆盖率:
dotnet dotcover test
Run Code Online (Sandbox Code Playgroud) 我试图合并具有相同数量的参数的两个数组.
输入:
first = [[650001.88, 300442.2, 18.73, 0.575, 650002.094, 300441.668, 18.775],
[650001.96, 300443.4, 18.7, 0.65, 650002.571, 300443.182, 18.745],
[650002.95, 300442.54, 18.82, 0.473, 650003.056, 300442.085, 18.745]]
second = [[1],
[2],
[3]]
Run Code Online (Sandbox Code Playgroud)
我的预期产量:
final = [[650001.88, 300442.2, 18.73, 0.575, 650002.094, 300441.668, 18.775, 1],
[650001.96, 300443.4, 18.7, 0.65, 650002.571, 300443.182, 18.745, 2],
[650002.95, 300442.54, 18.82, 0.473, 650003.056, 300442.085, 18.745, 3]]
Run Code Online (Sandbox Code Playgroud)
要做到这一点,我创建简单的循环:
for i in first:
for j in second:
final += np.append(j, i)
Run Code Online (Sandbox Code Playgroud)
我得到了我填补我遗失的东西.首先,我的循环非常慢.其次我的数据非常多,我有超过2毫升的行循环.所以我尝试使用此代码找到更快的方法:
final = [np.append(i, second[0]) for i in first]
Run Code Online (Sandbox Code Playgroud)
它的工作速度比前一个循环快得多,但它仅附加第二个数组的第一个值.你能帮助我吗?
我需要计算海量数据中2 xyz点之间的距离(100 Gb,大约20个trylion点).我想加快这个循环.我创建了KDtree,添加了并行计算,将我的数组拆分为更小的部分.所以我想加速的就是这个循环.我的纯python计算时间大约需要10小时42分钟.增加numpy减少时间为5小时34分钟.添加numba速度可达4小时15分钟.但它仍然不够快.我听说Cython是python计算的最快方式,但我没有任何c经验,我不知道如何将我的函数转换为cython代码.如何使用cython或任何其他方式让这个循环更快地运行?
def controller(point_array, las_point_array):
empty = []
tree = spatial.cKDTree(point_array, leafsize=1000, copy_data = True)
empty = __pure_calc(las_point_array, point_array, empty, tree)
return ptList
#############################################################################################
@autojit
def __pure_calc(las_point_array, point_array, empty, tree):
for i in las_point_array:
p = tree.query(i)
euc_dist = math.sqrt(np.sum((point_array[p[1]]-i)**2))
##add one row at a time to empty list
empty.append([i[0], i[1], i[2], euc_dist, point_array[p[1]][0], point_array[p[1]][1], point_array[p[1]][2]])
return empty
Run Code Online (Sandbox Code Playgroud)
我附上样本数据进行测试: