Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/math_matrix.h
| Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | |||||
| ccl_device_inline void math_trimatrix_add_gramian(ccl_global float *A, | ccl_device_inline void math_trimatrix_add_gramian(ccl_global float *A, | ||||
| int n, | int n, | ||||
| ccl_private const float *ccl_restrict v, | ccl_private const float *ccl_restrict v, | ||||
| float weight) | float weight) | ||||
| { | { | ||||
| for (int row = 0; row < n; row++) { | for (int row = 0; row < n; row++) { | ||||
| for (int col = 0; col <= row; col++) { | for (int col = 0; col <= row; col++) { | ||||
| MATHS(A, row, col, 1) += v[row] * v[col] * weight; | atomic_add_and_fetch_float(&MATHS(A, row, col, 1), v[row] * v[col] * weight); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Transpose matrix A in place. */ | /* Transpose matrix A in place. */ | ||||
| ccl_device_inline void math_matrix_transpose(ccl_global float *A, int n, int stride) | ccl_device_inline void math_matrix_transpose(ccl_global float *A, int n, int stride) | ||||
| { | { | ||||
| for (int i = 0; i < n; i++) { | for (int i = 0; i < n; i++) { | ||||
| ▲ Show 20 Lines • Show All 281 Lines • Show Last 20 Lines | |||||