linearized scalar encoder

Nit: Two newlines between functions everywhere