小编win*_*opi的帖子

我可以使用 Numba、矢量化或多处理来加速这种空气动力学计算吗?

问题:

我正在尝试提高 Python 中空气动力学函数的速度。

功能集:

import numpy as np
from numba import njit

def calculate_velocity_induced_by_line_vortices(
    points, origins, terminations, strengths, collapse=True
):

    # Expand the dimensionality of the points input. It is now of shape (N x 1 x 3).
    # This will allow NumPy to broadcast the upcoming subtractions.
    points = np.expand_dims(points, axis=1)
    
    # Define the vectors from the vortex to the points. r_1 and r_2 now both are of
    # shape (N x M x 3). Each row/column pair …
Run Code Online (Sandbox Code Playgroud)

python performance numpy multiprocessing numba

5
推荐指数
1
解决办法
136
查看次数

标签 统计

multiprocessing ×1

numba ×1

numpy ×1

performance ×1

python ×1