|
18 | 18 |
|
19 | 19 |
|
20 | 20 | __all__ = [ |
21 | | - 'sum_vectors_numba', |
| 21 | + # 'sum_vectors_numba', |
22 | 22 | 'norm_vector_numba', |
23 | 23 | 'norm_vectors_numba', |
24 | 24 | 'length_vector_numba', |
|
69 | 69 |
|
70 | 70 | # ============================================================================== |
71 | 71 |
|
72 | | -@jit(float64[:](float64[:, :], int64), nogil=True, nopython=True) |
73 | | -def sum_vectors_numba(a, axis=0): |
74 | | - """ Calculate the sum of an array of vectors along the specified axis. |
75 | 72 |
|
76 | | - Parameters: |
77 | | - a (array): Array of vectors (m x 3). |
78 | | - axis (int): Dimension to sum through. |
| 73 | +# @jit(float64[:](float64[:, :], int64), nogil=True, nopython=True) |
| 74 | +# def sum_vectors_numba(a, axis=0): |
| 75 | +# """ Calculate the sum of an array of vectors along the specified axis. |
79 | 76 |
|
80 | | - Returns: |
81 | | - array: The summed values according to the axis of choice. |
82 | | - """ |
83 | | - return sum(a, axis=axis) |
| 77 | +# Parameters: |
| 78 | +# a (array): Array of vectors (m x 3). |
| 79 | +# axis (int): Dimension to sum through. |
| 80 | + |
| 81 | +# Returns: |
| 82 | +# array: The summed values according to the axis of choice. |
| 83 | +# """ |
| 84 | +# return sum(a, axis=axis) |
84 | 85 |
|
85 | 86 |
|
86 | 87 | @jit(float64(float64[:]), nogil=True, nopython=True) |
@@ -167,6 +168,7 @@ def length_vector_sqrd_xy_numba(a): |
167 | 168 |
|
168 | 169 | # ============================================================================== |
169 | 170 |
|
| 171 | + |
170 | 172 | @jit(float64[:](float64[:], float64), nogil=True, nopython=True) |
171 | 173 | def scale_vector_numba(a, factor): |
172 | 174 | """ Scale a vector by a given factor. |
@@ -356,6 +358,7 @@ def square_vectors_numba(a): |
356 | 358 |
|
357 | 359 | # ============================================================================== |
358 | 360 |
|
| 361 | + |
359 | 362 | @jit(float64[:](float64[:], float64[:]), nogil=True, nopython=True) |
360 | 363 | def add_vectors_numba(u, v): |
361 | 364 | """ Add two vectors. |
@@ -470,6 +473,7 @@ def divide_vectors_xy_numba(u, v): |
470 | 473 |
|
471 | 474 | # ============================================================================== |
472 | 475 |
|
| 476 | + |
473 | 477 | @jit(float64[:](float64[:], float64[:]), nogil=True, nopython=True) |
474 | 478 | def cross_vectors_numba(u, v): |
475 | 479 | """ Compute the cross product of two vectors. |
@@ -532,6 +536,7 @@ def dot_vectors_xy_numba(u, v): |
532 | 536 |
|
533 | 537 | # ============================================================================== |
534 | 538 |
|
| 539 | + |
535 | 540 | @jit(float64[:, :](float64[:, :], float64[:, :]), nogil=True, nopython=True) |
536 | 541 | def multiply_matrices_numba(A, B): |
537 | 542 | """ The multiplication of matrices. |
@@ -585,7 +590,7 @@ def multiply_matrix_vector_numba(A, b): |
585 | 590 | e = array([[1., 2.], [0., 2.]]) |
586 | 591 | f = array([[4., 5.], [1., 2.]]) |
587 | 592 |
|
588 | | - print(sum_vectors_numba(c, axis=1)) |
| 593 | + # print(sum_vectors_numba(c, axis=1)) |
589 | 594 | print(norm_vector_numba(u)) |
590 | 595 | print(norm_vectors_numba(c)) |
591 | 596 | print(length_vector_numba(u)) |
|
0 commit comments