A vector quantization apparatus for generating a code for a speech signal, the apparatus comprising: a first vector calculation section that is configured to calculate a first reference vector by applying a perceptual weighting linear prediction coding synthesis filter to a target vector to be encoded, the target vector to be encoded being generated by subtracting an adaptive excitation filtered by the perceptual weighting linear prediction coding, LPC, synthesis filter and multiplied by an ideal gain acquired upon an adaptive codebook search for the speech signal from the speech signal filtered by a perceptual weighting LPC filter; a second vector calculation section that is configured to calculate a second reference vector by multiplying the first reference vector by a filter having a high-pass characteristic; a polarity selecting section that is configured to generate a polarity vector by arranging a unit pulse in which one of the positive and the negative is selected as a polarity in a position of an element based on a polarity of the element of the second reference vector; a matrix calculation section that is configured to calculate a reference matrix by matrix calculation using the perceptual weighting LPC synthesis filter; and a pulse position search section that is configured to search, using an algebraic codebook formed with a plurality of code vectors, for an optimal pulse position that minimizes the coding distortion, wherein the polarity selecting section is configured to generate an adjusted vector by multiplying the first reference vector by the polarity vector and to generate an adjusted matrix by multiplying the reference matrix by the polarity vector; and wherein the pulse position search section is configured to search for the optimal pulse position using the adjusted vector and the adjusted matrix and to acquire a code indicating a code vector for the speech signal that minimizes coding distortion. a first vector calculation section that is configured to calculate a first reference vector by applying a perceptual weighting linear prediction coding synthesis filter to a target vector to be encoded, the target vector to be encoded being generated by subtracting an adaptive excitation filtered by the perceptual weighting linear prediction coding, LPC, synthesis filter and multiplied by an ideal gain acquired upon an adaptive codebook search for the speech signal from the speech signal filtered by a perceptual weighting LPC filter; a second vector calculation section that is configured to calculate a second reference vector by multiplying the first reference vector by a filter having a high-pass characteristic; a polarity selecting section that is configured to generate a polarity vector by arranging a unit pulse in which one of the positive and the negative is selected as a polarity in a position of an element based on a polarity of the element of the second reference vector; a matrix calculation section that is configured to calculate a reference matrix by matrix calculation using the perceptual weighting LPC synthesis filter; and a pulse position search section that is configured to search, using an algebraic codebook formed with a plurality of code vectors, for an optimal pulse position that minimizes the coding distortion, wherein the polarity selecting section is configured to generate an adjusted vector by multiplying the first reference vector by the polarity vector and to generate an adjusted matrix by multiplying the reference matrix by the polarity vector; and wherein the pulse position search section is configured to search for the optimal pulse position using the adjusted vector and the adjusted matrix and to acquire a code indicating a code vector for the speech signal that minimizes coding distortion.