void LiborQuotes::print(const std::string& filename, const bool erase_file) const
{
	std::string path_OutPut = LMMPATH::get_output_path() + filename;
	std::vector<PrintElement_PTR> elements_print;

	PrintElement_PTR date_print_ptr  = PrintElement_PTR(new VectorPrintElement<std::vector<double> >("Dates", lmmTenorStructure_->get_tenorDate() ));
	PrintElement_PTR df_print_ptr    = PrintElement_PTR(new VectorPrintElement<std::vector<double> >("Discount Rate", discountFactor_ ));
	PrintElement_PTR libor_print_ptr = PrintElement_PTR(new VectorPrintElement<std::vector<double> >("LIBOR", liborInit_ ));

	elements_print.push_back(date_print_ptr);
	elements_print.push_back(df_print_ptr);
	elements_print.push_back(libor_print_ptr);

	{
		Printer printer(path_OutPut, elements_print);
		printer.print(erase_file);
	}
}
void Shifted_HGVolatilityFunction::print(const std::string& filename) const  // OK: test passed.
{
	//std::string fileName = "HGVolatilityFunction.csv";
	std::string path = LMMPATH::get_output_path() + filename;

	std::vector<PrintElement_PTR> elements_print;

	//! h,g,hgMatrix
	typedef boost::numeric::ublas::matrix<double> matrix;
	size_t horizon_ = this->get_LMMTenorStructure()->get_horizon();
	matrix hMatrix(horizon_+1, horizon_+1);
	matrix gMatrix(horizon_+1, horizon_+1);
	matrix hgMatrix(horizon_+1, horizon_+1);

	for(size_t indexLibor = 1; indexLibor<=horizon_; ++indexLibor)
	{
		for(size_t indexT = 1; indexT<=indexLibor; ++indexT)
		{
			hMatrix(indexLibor,indexT)  = pShifted_HGVolatilityParam_->h(indexLibor,indexT);
			gMatrix(indexLibor,indexT)  = pShifted_HGVolatilityParam_->g(indexLibor,indexT);
			hgMatrix(indexLibor,indexT) = get_varSigma_timeIndexVersion(indexLibor,indexT);
		}
	}

	//seems a problem of shared ptr polymorphisms ... 
	//PrintElement_PTR tenorType_print    = PrintElement_PTR(new ScalarPrintElement<std::string>("tenorType", tenorType_));
	//PrintElement_PTR horizon_print      = PrintElement_PTR(new ScalarPrintElement<LMM::Index>("horizon", horizon_));
	PrintElement_PTR hMatrix_print   = PrintElement_PTR(new MatrixPrintElement<matrix>("hMatrix",  hMatrix));
	PrintElement_PTR gMatrix_print   = PrintElement_PTR(new MatrixPrintElement<matrix>("gMatrix",  gMatrix));
	PrintElement_PTR hgMatrix_print  = PrintElement_PTR(new MatrixPrintElement<matrix>("hgMatrix", hgMatrix));


	//elements_print.push_back(tenorType_print);
	elements_print.push_back(hMatrix_print);
	elements_print.push_back(gMatrix_print);
	elements_print.push_back(hgMatrix_print);

	Printer printer(path, elements_print);
	printer.print();
}
void UpperTriangleVanillaSwaptionQuotes::print(const std::string& filename, const bool erase_file) const
{
	std::string path_OutPut = LMMPATH::get_output_path() + filename;

	{
		std::vector<PrintElement_PTR> elements_print;
		UpperTriangularIndexPairMatrix swap_indices_matrix = get_UpperTriangularSwaptionIndexMatrix();	
		PrintElement_PTR swapMatrix_print = PrintElement_PTR(new MatrixPrintElement<UpperTriangularIndexPairMatrix>("swaps",  swap_indices_matrix));
		PrintElement_PTR mapMatrix_print = PrintElement_PTR(new MatrixPrintElement<UpperTriangularIndexPairMatrix>("mapping Indices",  indexMapping_gDelegate_gTransformed_));

		elements_print.push_back(swapMatrix_print);
		elements_print.push_back(mapMatrix_print);

		Printer printer(path_OutPut, elements_print);
		printer.print(erase_file);
	}


	{
		std::ofstream data_stream ;
		data_stream.open(path_OutPut.c_str(), std::ios::app);
		data_stream<<std::endl<<"--------"<<std::endl;
		data_stream.close();
	}

	{
		std::vector<PrintElement_PTR> elements_print;

		UpperTriangularDoubleMatrix quote_matrix  = get_UpperTriangularQuoteValues() ;
		UpperTriangularDoubleMatrix strike_matrix = get_UpperTriangularStrike() ;
		PrintElement_PTR quoteMatrix_print = PrintElement_PTR(new MatrixPrintElement<UpperTriangularDoubleMatrix>("Quote",  quote_matrix));
		PrintElement_PTR strikeMatrix_print = PrintElement_PTR(new MatrixPrintElement<UpperTriangularDoubleMatrix>("Strike",  strike_matrix));

		elements_print.push_back(quoteMatrix_print);
		elements_print.push_back(strikeMatrix_print);
		Printer printer(path_OutPut, elements_print);
		printer.print(false);
	}
}