import Complex from './Complex' ; import { coordsFromIndex } from './helpers' ; /**
 * Class for vector entires (also know as: vector values, cells).
 * To be used only within a Vector object, or to create such.
 */ export default class VectorEntry { readonly coord : readonly number [ ] ; readonly value : Complex ; param coord param value constructor ( coord , value ) { this . coord = coord ; this . value = value ; } param e2 outer ( e2 ) { const e1 = this ; return new VectorEntry ( e1 . coord . concat ( e2 . coord ) , e1 . value . mul ( e2 . value ) ) ; } returms toString ( ) { return `Sparse vector entry [${ this . coord . toString ( ) }] has value ${ this . value . toString ( ) }` ; } param index param sizes param value static fromIndexValue ( index , sizes , value ) { const coords = coordsFromIndex ( index , sizes ) ; return new VectorEntry ( coords , value ) ; } }