Commit aabe886ccc78b7d288e7eebcdf8a8bc4a12806f0
Merge branch 'jack_matrix' into 'master'
fix some minor errors. fix minor error when using it in cooperating with function mat() from class matrix_sym! See merge request !10
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
stim/math/matrix.h
@@ -38,14 +38,14 @@ struct matrix | @@ -38,14 +38,14 @@ struct matrix | ||
38 | } | 38 | } |
39 | 39 | ||
40 | //create a symmetric matrix given the rhs values, given in column-major order | 40 | //create a symmetric matrix given the rhs values, given in column-major order |
41 | - CUDA_CALLABLE matrix<T, N> setsym(T rhs[(N*N+N)/2]){ | 41 | + CUDA_CALLABLE void setsym(T rhs[(N*N+N)/2]){ |
42 | const size_t L = (N*N+N)/2; //store the number of values | 42 | const size_t L = (N*N+N)/2; //store the number of values |
43 | 43 | ||
44 | size_t r, c; | 44 | size_t r, c; |
45 | r = c = 0; | 45 | r = c = 0; |
46 | for(size_t i = 0; i < L; i++){ //for each value | 46 | for(size_t i = 0; i < L; i++){ //for each value |
47 | - if(r == c) M[c * n + r] = rhs[i]; | ||
48 | - else M[c*n + r] = M[r * N + c] = rhs[i]; | 47 | + if(r == c) M[c * N + r] = rhs[i]; |
48 | + else M[c*N + r] = M[r * N + c] = rhs[i]; | ||
49 | r++; | 49 | r++; |
50 | if(r == N) r = ++c; | 50 | if(r == N) r = ++c; |
51 | } | 51 | } |