Solution (source code)

= Solution

Use an immutable index and mutable value and links:
``
class Node(var value: Double, val index: Int,
           var prev: Node = null, var next: Node = null)
``
For the <sparse linked vector representation>, a header `h` has `h.index >= 0`, records that <vector>'s dimension, and lies on a finite <circular linked list>. Every ordinary <linked list node> has an index in `[0,h.index)`, a nonzero finite value, and a unique index; indices increase strictly from `h.next` to `h.prev`. For every reachable <linked list node>, including `h`, `p.next.prev eq p` and `p.prev.next eq p`. The <abstraction function> fills unspecified coordinates with zero. The header's value has no meaning. Finite real coordinates are assumed throughout; infinities and `NaN` are not ordinary <real number> coordinates for a mathematical <inner product>.