import Complex from './Complex' ; import { coordsFromIndex } from './helpers' ; /**
 * Class for operarator entires.
 * To be used only within a Operator object, or to create such.
 */ export default class OperatorEntry { readonly coordOut : readonly number [ ] ; readonly coordIn : readonly number [ ] ; readonly value : Complex ; param coordOut param coordIn param value constructor ( coordOut , coordIn , value ) { this . coordOut = coordOut ; this . coordIn = coordIn ; this . value = value ; } param e2 outer ( e2 ) { const e1 = this ; return new OperatorEntry ( e1 . coordOut . concat ( e2 . coordOut ) , e1 . coordIn . concat ( e2 . coordIn ) , e1 . value . mul ( e2 . value ) ) ; } returms toString ( ) { return ( `Sparse operator entry [${ this . coordOut . toString ( ) }, ${ this . coordIn . toString ( ) }] ` + `has value ${ this . value . toString ( ) }` ) ; } /**
     * Entry coordinates in string representation. Can be used for hashing.
     */ coordKey ( ) { return `${ this . coordOut . toString ( ) }-${ this . coordIn . toString ( ) }` ; } param indexOut param indexIn param sizesOut param sizesIn param value static fromIndexIndexValue ( indexOut , indexIn , sizesOut , sizesIn , value ) { const coordOut = coordsFromIndex ( indexOut , sizesOut ) ; const coordIn = coordsFromIndex ( indexIn , sizesIn ) ; return new OperatorEntry ( coordOut , coordIn , value ) ; } }