我想将此python代码转换为c ++ [英] I want to convert this python code to c++

查看:363
本文介绍了我想将此python代码转换为c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想用Python将这些函数转换为C ++。每个人都可以提供帮助吗?



Hi,

I want to convert these function in Python to C++. Everybody can help?

def rnd(a):
   h, w = a.shape[:2]
   T = np.zeros((2, 3))
   coef = 0.2
   ang = (np.random.rand()-0.5)*coef
   c, s = np.cos(ang), np.sin(ang)
   T[:2, :2] = [[c,-s], [s, c]]
   T[:2, :2] += (np.random.rand(2, 2) - 0.5)*coef
   c = (w/2, h/2)
   T[:,2] = c - np.dot(T[:2, :2], c)
return T

def div(A, B):
   Ar, Ai = A[...,0], A[...,1]
   Br, Bi = B[...,0], B[...,1]
   C = (Ar+1j*Ai)/(Br+1j*Bi)
   C = np.dstack([np.real(C), np.imag(C)]).copy()
return C





感谢提前,



Thank in advance,

推荐答案

好吧,如果您正在等待许可,请考虑给出。



否则。 ..这不是那样的工作。

我们不为你工作。

如果你想要别人写你的代码,你必须支付 - 我建议你去Freelancer.com并在那里问。



但请注意:你得到的是你付出的代价。支付花生,买猴子。
Well, if you are waiting for permission, consider it given.

Otherwise...it doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.

But be aware: you get what you pay for. Pay peanuts, get monkeys.


这篇关于我想将此python代码转换为c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆