Partial inner product spaces: Theory and Applications