public void initalizeWeights(FolkRankPref pref, double[][] weights, double[] prefWeights, double[] prefWeightsNormFactors) {
        /*
         * check input arguments
         */
        if (weights.length != prefWeights.length || weights.length != prefWeightsNormFactors.length) 
            throw new IllegalArgumentException("Sizes of first dimension of input parameters do not match.");
        
        double[] basePrefWeight = pref.getBasePrefWeight();
        double[][] prefValues   = pref.getPrefValues();

        for (int dim = 0; dim < weights.length; dim++) {
            /*
             * Initialize weights:
             * every item gets the reciprocal of the number of items in the 
             * dimensions it belongs to.
             */
            Arrays.fill(weights[dim], 1.0 / weights[dim].length);

            /*
             * Calculate the sum of the preference weights.
             */
            prefWeightsNormFactors[dim] = 0.0;
            if (prefValues != null) {
                for (double prefValue:prefValues[dim]) {
                    prefWeightsNormFactors[dim] += prefValue;
                }
            }
            
            /*
             * Calculate, how many additional weight is spread by the preference
             */
            prefWeightsNormFactors[dim] = basePrefWeight[dim] * weights[dim].length + prefWeightsNormFactors[dim];

            /*
             * initialize the preference weights each item gets
             */
            if (basePrefWeight[dim] == 0.0) {
                /*
                 * prevent 0.0 / 0.0 = NaN
                 */
                prefWeights[dim] = 0.0;
            } else {
                prefWeights[dim] = basePrefWeight[dim] / prefWeightsNormFactors[dim];
            }
        }
    }