public RealMatrix generateMatrix(String dirName) throws IOException {

		List<TreeMap<String, Double>> listOfVectors = readVectorsFromDirectory("data/"
				+ dirName);

		List<String> listOfAllUniqueTokens = generateListOfUniqueTokens(listOfVectors);

		matrix = new BlockRealMatrix(listOfVectors.size(),
				listOfAllUniqueTokens.size());

		CSVWriter csvWriter = new CSVWriter(new FileWriter(
				"data/matrices/matrix1.csv"));

		String[] firstRow = new String[listOfAllUniqueTokens.size() + 1];
		firstRow[0] = "";

		TreeMap<String, Double> tempHashMap1 = generateTempHashMap(listOfAllUniqueTokens);

		int m = 1;
		Iterator it2 = tempHashMap1.entrySet().iterator();
		while (it2.hasNext()) {
			Map.Entry<String, Double> pairs = (Map.Entry<String, Double>) it2
					.next();
			firstRow[m] = pairs.getKey();
			m++;
		}

		csvWriter.writeNext(firstRow);

		// this should be the making of a row which will be
		// a Double[] for RealMatrix and String[] for CSV file

		int t = 0;

		for (TreeMap<String, Double> hashMap : listOfVectors) {
			TreeMap<String, Double> tempHashMap = generateTempHashMap(listOfAllUniqueTokens);
			double[] matrixRow = new double[tempHashMap.size()];
			String[] row = new String[tempHashMap.size() + 1];
			row[0] = "Desc_" + t;

			for (String token : listOfAllUniqueTokens) {

				if (hashMap.containsKey(token)) {
					tempHashMap.put(token, hashMap.get(token));
				}
			}

			int j = 1;
			Iterator it = tempHashMap.entrySet().iterator();
			while (it.hasNext()) {
				Map.Entry<String, Double> pairs = (Map.Entry<String, Double>) it
						.next();

				matrixRow[j - 1] = pairs.getValue();
				row[j] = pairs.getValue().toString();
				j++;
			}
			matrix.setRow(t, matrixRow);
			csvWriter.writeNext(row);
			t++;
		}

		csvWriter.close();

		return matrix;
	}