We show NP-hardness of a generalized quadratic programming problem, which we called unconstrained n-ary quadratic programming (UNQP). This problem has recently become practically relevant in the context of novel memristor-based neuromorphic microchip designs, where solving the UNQP is a key operation for on-chip training of the neural network implemented on the chip. UNQP is the problem of finding a vector v ∈ S N which minimizes v T Q v + v T c, where S = {s 1 , . . . , s n } ⊂ Z is a given set of eligible parameters for v, Q ∈ Z N ×N is positive semi-definite, and c ∈ Z N . In memristor-based neuromorphic hardware, S is physically given by a finite (and small) number of possible memristor states. The proof of NP-hardness is by reduction from the unconstrained binary quadratic programming problem, which is a special case of UNQP where S = {0, 1} and which is known to be NP-hard.