116 template <
typename E>
118 const std::span<E>& data, std::size_t offset = 0,
119 std::size_t block_size = 1)
121 for (std::size_t b = 0; b < block_size; ++b)
123 for (std::size_t i = 0; i < perm.size(); ++i)
125 std::swap(data[block_size * (offset + i) + b],
126 data[block_size * (offset + perm[i]) + b]);
137 template <
typename E>
139 const std::span<E>& data,
140 std::size_t offset = 0,
141 std::size_t block_size = 1)
143 const std::size_t dim = perm.size();
144 const std::size_t data_size
145 = (data.size() + (dim < block_size ? block_size - dim : 0)) / block_size;
146 for (std::size_t b = 0; b < block_size; ++b)
148 for (std::size_t i = 0; i < dim; ++i)
150 std::swap(data[data_size * b + offset + i],
151 data[data_size * b + offset + perm[i]]);
170 std::vector<std::size_t>
171 prepare_matrix(std::pair<std::vector<double>, std::array<std::size_t, 2>>& A);
206 template <
typename T,
typename E>
208 const std::experimental::mdspan<
209 const T, std::experimental::dextents<std::size_t, 2>>& M,
210 const std::span<E>& data, std::size_t offset = 0,
211 std::size_t block_size = 1)
213 const std::size_t dim = v_size_t.size();
215 for (std::size_t b = 0; b < block_size; ++b)
217 for (std::size_t i = 0; i < dim; ++i)
219 for (std::size_t j = i + 1; j < dim; ++j)
221 data[block_size * (offset + i) + b]
222 += M(i, j) * data[block_size * (offset + j) + b];
225 for (std::size_t i = 1; i <= dim; ++i)
227 data[block_size * (offset + dim - i) + b] *= M(dim - i, dim - i);
228 for (std::size_t j = 0; j < dim - i; ++j)
230 data[block_size * (offset + dim - i) + b]
231 += M(dim - i, j) * data[block_size * (offset + j) + b];
243 template <
typename T,
typename E>
245 const std::span<const std::size_t>& v_size_t,
246 const std::experimental::mdspan<
247 const T, std::experimental::dextents<std::size_t, 2>>& M,
248 const std::span<E>& data, std::size_t offset = 0,
249 std::size_t block_size = 1)
251 const std::size_t dim = v_size_t.size();
252 const std::size_t data_size
253 = (data.size() + (dim < block_size ? block_size - dim : 0)) / block_size;
255 for (std::size_t b = 0; b < block_size; ++b)
257 for (std::size_t i = 0; i < dim; ++i)
259 for (std::size_t j = i + 1; j < dim; ++j)
261 data[data_size * b + offset + i]
262 += M(i, j) * data[data_size * b + offset + j];
265 for (std::size_t i = 1; i <= dim; ++i)
267 data[data_size * b + offset + dim - i] *= M(dim - i, dim - i);
268 for (std::size_t j = 0; j < dim - i; ++j)
270 data[data_size * b + offset + dim - i]
271 += M(dim - i, j) * data[data_size * b + offset + j];