( ce: ComputeEngine, name: string, start: number, end: number, step: number = 1 )
| 885 | engine: ComputeEngine, |
| 886 | numericApproximation: boolean | undefined |
| 887 | ): number[] | undefined => { |
| 888 | if (isMultiIndex) return undefined; |
| 889 | offsets ??= lowerTermOffsets(recurrence!, name, variable); |
| 890 | for (const offset of offsets) { |
| 891 | const lower = [indices[0] - offset]; |
| 892 | const key = indexKeyOf(lower); |
| 893 | if (read.terms.has(key) || read.pending.has(key)) continue; |
| 894 | if (!isValidIndex(lower, engine)) continue; |
| 895 | if (base.has(lower[0])) continue; |
| 896 | if (memoizedTerm(engine, lower, numericApproximation) !== undefined) |
| 897 | continue; |
| 898 | return lower; |
| 899 | } |
| 900 | return undefined; |
| 901 | }; |
| 902 | |
| 903 | /** |
| 904 | * Compute the term at `indices` of a pure sequence with the recurrence. |
| 905 | * Return the indices of a term that the recurrence reads and that is |
| 906 | * not known yet: the computation is then stopped, and it is done again |
| 907 | * later. Otherwise, the term is put in `read.terms`, and in the memos |
| 908 | * when the state of the engine did not change during the computation. |
| 909 | */ |
| 910 | const computeOneTerm = ( |
| 911 | indices: number[], |
| 912 | read: SequenceRead, |
| 913 | engine: ComputeEngine, |
| 914 | numericApproximation: boolean | undefined |
| 915 | ): number[] | undefined => { |
| 916 | const termStamp = memo !== null ? currentStamp(engine) : undefined; |
| 917 | read.missing = undefined; |
| 918 | read.attempting = true; |
| 919 | read.attemptEpoch = restartEpoch; |
| 920 | |
| 921 | let result: Expression | undefined = undefined; |
| 922 | try { |
| 923 | result = evaluateRecurrence(indices, engine, numericApproximation); |
| 924 | } catch (e) { |
| 925 | if (e !== read.signal) throw e; |
| 926 | } finally { |
| 927 | read.attempting = false; |
nothing calls this directly
no test coverage detected