| 227 | |
| 228 | |
| 229 | CPUComplexTensor::CPUComplexTensor(const CPUComplexTensor &old) |
| 230 | :m_max_rank(old.m_max_rank), m_rank(old.m_rank) |
| 231 | { |
| 232 | auto size = 1ull << old.m_rank; |
| 233 | m_tensor = (qcomplex_data_t *)calloc(size, sizeof(qcomplex_data_t)); |
| 234 | |
| 235 | if (nullptr == m_tensor) |
| 236 | { |
| 237 | QCERR("calloc_fail"); |
| 238 | throw calloc_fail(); |
| 239 | } |
| 240 | int threads = get_num_threads(m_rank); |
| 241 | #pragma omp parallel for num_threads(threads) |
| 242 | for (long long i = 0; i < size; i++) |
| 243 | { |
| 244 | m_tensor[i] = old.m_tensor[i]; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | CPUComplexTensor::CPUComplexTensor(size_t rank, qstate_t &tensor, size_t max_rank) |
| 249 | :m_max_rank(max_rank), m_rank(rank), m_backend(ComputeBackend::CPU) |
nothing calls this directly
no test coverage detected