C++ コードを Python に埋め込むのは初めてです。weave.inline をテストしています。ただし、コードを実行するとセグメンテーション違反が発生します。誰かが私が間違っていることを教えてもらえますか? これが私のコードです:
from scipy import weave
def cpp_call(np_points):
assert(type(np_points) == type(1))
code = """
double z[np_points+1][np_points+1];
for (int x = 0; x <= np_points; x++)
{
for (int y = 0; y <= np_points; y++)
{
z[x][y] = x*y;
}
}
"""
return weave.inline(code,'np_points')