Encode float values into a C array values. The result contains the number of values followed by pairs of doubles representing complex numbers.
(values: dict[complex, int])
| 285 | |
| 286 | |
| 287 | def _encode_complex_values(values: dict[complex, int]) -> list[str]: |
| 288 | """Encode float values into a C array values. |
| 289 | |
| 290 | The result contains the number of values followed by pairs of doubles |
| 291 | representing complex numbers. |
| 292 | """ |
| 293 | value_by_index = {index: value for value, index in values.items()} |
| 294 | result = [] |
| 295 | num = len(values) |
| 296 | result.append(str(num)) |
| 297 | for i in range(num): |
| 298 | value = value_by_index[i] |
| 299 | result.append(float_to_c(value.real)) |
| 300 | result.append(float_to_c(value.imag)) |
| 301 | return result |
no test coverage detected
searching dependent graphs…