1. A method implemented on a computer with a processor executing instructions from a memory to compute weights of binary outputs of any algorithmically computable function given weights of binary inputs, comprising: storing an input state as a plurality of matrices, each matrix representing a binary state for a bit; storing an algorithmic function as instructions to implement interconnected gates that each represents a matrix operation, at least one of the gates performing a matrix operation on at least one matrix that is input to the respective gate; and applying the instructions to the stored input state to obtain a plurality of matrices that represent an output state.