We consider a protocol to perform the optimal quantum state discrimination of N linearly independent non-orthogonal pure quantum states and present a computational code. Through the extension of the original Hilbert space, it is possible to perform an unitary operation yielding a final configuration, which gives the best discrimination without ambiguity by means of von Neumann measurements. Our goal is to introduce a detailed general mathematical procedure to realize this task by means of semidefinite programming and norm minimization. The former is used to fix which is the best detection probability amplitude for each state of the ensemble. The latter determines the matrix which leads the states to the final configuration. In a final step, we decompose the unitary transformation in a sequence of two-level rotation matrices.