static void randomizeMatrix(Matrix3d &matrix) { ssize_t size[3] = { (ssize_t)matrix.size(0), (ssize_t)matrix.size(1), (ssize_t)matrix.size(2) }; const ssize_t rim = matrix.rim(); for(ssize_t ix=-rim;ix<size[0]+rim;ix++) { for(ssize_t iy=-rim;iy<size[1]+rim;iy++) { for(ssize_t iz=-rim;iz<size[2]+rim;iz++) { matrix(ix,iy,iz) = matrix_func(ix,iy,iz); //(ix*ix) + ix*iy + iz; } } } }
static void diagonalizeMatrix(Matrix3d &matrix) { ssize_t size[3] = { (ssize_t)matrix.size(0), (ssize_t)matrix.size(1), (ssize_t)matrix.size(2) }; const ssize_t rim = matrix.rim(); for(ssize_t ix=-rim;ix<size[0]+rim;ix++) { for(ssize_t iy=-rim;iy<size[1]+rim;iy++) { for(ssize_t iz=-rim;iz<size[2]+rim;iz++) { bool isDiagonal = ix==iy;// && iy==iz; matrix(ix,iy,iz) = isDiagonal?1.0:0.0; } } } }