Python
Luchang-Li
这个作者很懒,什么都没留下…
展开
-
C++通过pybind11调用Python 实现transpose
https://www.jianshu.com/p/c912a0a59af9https://stackoverflow.com/questions/44659924/returning-numpy-arrays-via-pybind11https://gist.github.com/terasakisatoshi/79d1f656be9023cc649732c5162b3fc4原创 2020-11-19 17:37:54 · 4136 阅读 · 0 评论 -
python代码格式化
除了pylint工具可以扫描代码不符合规范之处外,也有软件包可以自动对代码格式进行修改。自动将代码转换为pep8格式的python库autopep8,使用教程参考博客:Pycharm配置autopep8:自动调整代码为PEP8风格,in short:安装:pip install autopep8使用:autopep8 --in-place --aggressive <...原创 2020-01-17 09:43:35 · 439 阅读 · 0 评论 -
python 读写Matlab mat v7.3文件
主要使用了hdf5storage这个模块比h5py更好用,而且h5py还存在读入数据维度跟matlab不一致的问题import hdf5storage # get code on https://pypi.python.org/pypi/hdf5storage/0.1.3import numpy as np# 写入matdef WriteMatlab(data_np, VarN...原创 2019-01-09 23:49:42 · 7366 阅读 · 0 评论 -
python 通过pybind11向C++ dll 传递数组 图像
传递python中的Listpybind11 很贴心地帮你把 vector<T> 跟 python 的 list 做好了转换,你只需要 #include <pybind11/stl.h> 即可 [1]C++端代码#include <pybind11/pybind11.h>#include <pybind11/stl.h>#inclu...原创 2019-01-11 19:54:37 · 5434 阅读 · 0 评论 -
python 通过pybind11调用C++ dll 基础篇
https://github.com/pybind/pybind11 下载代码并解压创建visual sdudio(至少2015)win 32 console工程,选 dll设置为x64, release设置项目属性,General里面Target Name为你要创建的模块名字,Target Extension为.pyd,Configuration Type 为Dynamic ...原创 2019-01-11 16:38:03 · 4078 阅读 · 4 评论 -
Numpy将二维数组添加到空数组
使用append函数将一个二维数组添加到一个空数组,关键是维度要对的上a=np.empty([0,3])b = np.array([[1,2,3],[4,5,6]])c=[[7,8,9]]print(a.shape)print(b.shape)a = np.append(a, b, axis=0)a = np.append(a, c, axis=0)print(a.s...原创 2018-08-04 22:39:42 · 11291 阅读 · 0 评论
分享