import numpy as np
from scipy.optimize import fsolve
musun = 132712000000
T = 365.25 * 86400 * 2 / 3
e = 581.2392124070273
def f(x):
return ((T * musun ** 2 / (2 * np.pi)) ** (1 / 3) * np.sqrt(1 - x ** 2)
- np.sqrt(.5 * musun ** 2 / e * (1 - x ** 2)))
x = fsolve(f, 0.01)
f(x)
print x
Run Code Online (Sandbox Code Playgroud)
这段代码有什么问题?它似乎行不通.
我想在Irrlicht 3D场景中从点(x1,y1,z1)到点(x2,y2,z2)绘制3D段.
我知道line3d类和这个addLine3d方法,但我不明白如何使用它们.这个IAttributes类是什么?
有人可以提供如何绘制3D线的最小示例吗?
您可以假设我知道如何添加相机并绘制场景.
我刚刚开始使用 C 和 HDF5,所以我的问题可能很容易回答。
我尝试使用http://beige.ucs.indiana.edu/I590/node122.html中的示例代码来创建 HDF5 文件。
#include "hdf5.h"
#define FILE "file.h5"
main() {
hid_t file_id; /* file identifier */
herr_t status;
/* Create a new file using default properties. */
file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Terminate access to the file. */
status = H5Fclose(file_id);
}
Run Code Online (Sandbox Code Playgroud)
我尝试用 Eclipse 编译它并收到 5 条错误消息:
make: *** [Read_HDF5] Error 1
skipping incompatible /usr/lib/libc.so when searching for -lc
undefined reference to `H5check_version'
undefined reference to `H5Fcreate'
undefined reference to `H5Fclose'
Run Code Online (Sandbox Code Playgroud)
什么地方出了错?
谢谢你的帮助!
我有一个git控制目录(实际上是我的主目录),其中有被忽略的目录(例如垃圾空间和其他VCS控制的目录).我希望能够让我的bash提示符显示目录是否受版本控制,如果是,则由哪个VCS控制,但是例如git rev-parse总是找到最顶层的.git目录.
有没有办法问git我是否在一个未跟踪的目录中?
我发现这个工作:
if ! git rev-parse 2>&/dev/null; then
echo "not in git"
else
PREFIX=$(git rev-parse --show-prefix)
if [ -z "$PREFIX" ]; then
echo "at git top level"
elif [ -z $(cd $(git rev-parse --show-toplevel); \
git ls-files -o --directory "${PREFIX%%/}")
echo "tracked by git"
else
echo "untracked"
fi
fi
Run Code Online (Sandbox Code Playgroud)
然而,它似乎非常hackish和脆弱.有没有更好的办法?
我在我们的论文(文凭)中使用了 OpenCV 的 MeanShift 算法。QT4.6中的示例效果很好。仅在我们自己的 GUI 应用程序中,我们收到 320x3x240 RGB 流时,才会给出以下错误消息:
OpenCV Error: Assertion failed (j < nimages) in histPrepareImages, file /home/luca/OpenCvSDK/opencv-src/modules/imgproc/src/histogram.cpp, line 148
terminate called after throwing an instance of 'cv::Exception'
what(): /home/luca/OpenCvSDK/opencv-src/modules/imgproc/src/histogram.cpp:148: error: (-215) j < nimages in function histPrepareImages
Run Code Online (Sandbox Code Playgroud)
GUI是在Ubuntu下使用Eclipse/QT4.6进行编程的。这是代码:
// Mean Shift Algorithm On
minSat=65;
ch[1]={0};
if (m_meanShiftAlgoOn)
{
if (m_firstFrame)
{
m_firstFrame = false;
// Define ROI
imageROI= m_currentFrame( cv::Rect(m_meanShift_xPos,m_meanShift_yPos,
m_meanShift_width,m_meanShift_height));
cv::rectangle(m_currentFrame, cv::Rect(m_meanShift_xPos,m_meanShift_yPos,m_meanShift_width,
m_meanShift_height),cv::Scalar(0,0,255));
// Get the Hue histogram
ColorHistogram hc;
cv::MatND colorhist= hc.getHueHistogram(imageROI,minSat);
finder.setHistogram(colorhist);
finder.setThreshold(0.2f); …Run Code Online (Sandbox Code Playgroud) 我一直在看这个lib Random123和相关的报价:
一位神秘男子来到我的展位,问我对使用OpenCL生成随机数的了解。我告诉他有关Mersenne Twister的实现,但他没有留下深刻的印象。他告诉我一篇新的技术论文,该论文解释了如何通过结合整数计数器和分组密码在GPU上生成随机数。他说,以计数调为基础,基于计数器的随机数生成器(CBRNG)产生的数字具有比MT更大的统计随机性,并且速度更快。
我能够使用此内核运行一个演示:
__kernel void counthits(unsigned n, __global uint2 *hitsp) {
unsigned tid = get_global_id(0);
unsigned hits = 0, tries = 0;
threefry4x32_key_t k = {{tid, 0xdecafbad, 0xfacebead, 0x12345678}};
threefry4x32_ctr_t c = {{0, 0xf00dcafe, 0xdeadbeef, 0xbeeff00d}};
while (tries < n) {
union {
threefry4x32_ctr_t c;
int4 i;
} u;
c.v[0]++;
u.c = threefry4x32(c, k);
long x1 = u.i.x, y1 = u.i.y;
long x2 = u.i.z, y2 = u.i.w;
if ((x1*x1 + y1*y1) < (1L<<62)) {
hits++;
} …Run Code Online (Sandbox Code Playgroud) Last login: Wed Aug 15 18:31:40 on console
unknown68a86d4e0c2c:~ pessimisticoptimism$ curl -O http://python-distribute.org/distribute_setup.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16295 100 16295 0 0 3389 0 0:00:04 0:00:04 --:--:-- 5813
unknown68a86d4e0c2c:~ pessimisticoptimism$ python distribute_setup.py
Downloading #
Extracting in /var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0
Now working in /var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28
Installing Distribute
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Non-egg installation
Removing elements out of the way...
Renaming /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools-0.6c12dev_r85381-py2.7.egg-info into …Run Code Online (Sandbox Code Playgroud) 出于某种原因,我的分支机构没有出现在Github.然而,当我执行git tag --all它们时,它们显示在那里表明它们没有丢失.
当我在本地存储库中明显有多个分支时,为什么我只能在Github中看到Master Branch?
我需要为i486架构编译OpenCV.我想将优化标志设置为O3.问题是无法找到在cmake文件中或使用配置脚本设置编译器标志的方法.
我刚刚复制hadoop-eclipse-plugin-1.0.3.jar到eclipse/plugins目录以便开始工作.但不幸的是,它对我不起作用.当我尝试将eclipse连接到我的Hadoop Version 1.1.1集群时,它抛出了这个错误:
An internal error occurred during: "Map/Reduce location status updater". org/codehaus/jackson/map/JsonMappingException
Run Code Online (Sandbox Code Playgroud)
有没有办法解决这个问题?