Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3999/qlo
Modified Files:
.cvsignore
Added Files:
statistics.cpp statistics.hpp
Removed Files:
riskstatistics.cpp riskstatistics.hpp
Log Message:
typedef RiskStatistics Statistics;
--- riskstatistics.hpp DELETED ---
--- NEW FILE: statistics.hpp ---
/*
Copyright (C) 2006 Ferdinando Ametrano
Copyright (C) 2006 Duminuco Cristina
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it under the
terms of the QuantLib license. You should have received a copy of the
license along with this program; if not, please email qua...@li...
The license is also available online at http://quantlib.org/html/license.html
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#ifndef qla_riskstatistics_hpp
#define qla_riskstatistics_hpp
#include <oh/objhandler.hpp>
#include <ql/Math/statistics.hpp>
namespace QuantLibAddin {
class Statistics :
public ObjHandler::LibraryObject<QuantLib::Statistics> {
public:
Statistics(std::vector<QuantLib::Real> values,
std::vector<QuantLib::Real> weights);
};
#define TYPICAL_GAUSSIAN_2DOUBLE_STAT_FUNCTION(METHOD) \
inline double METHOD(double mean, double stdDev) { \
QuantLib::StatsHolder h(mean, stdDev); \
QuantLib::GenericGaussianStatistics< QuantLib::StatsHolder > s(h); \
return s.METHOD(); \
}
TYPICAL_GAUSSIAN_2DOUBLE_STAT_FUNCTION(gaussianDownsideVariance)
TYPICAL_GAUSSIAN_2DOUBLE_STAT_FUNCTION(gaussianDownsideDeviation)
#define TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(METHOD) \
inline double METHOD(double x, double mean, double stdDev) { \
QuantLib::StatsHolder h(mean, stdDev); \
QuantLib::GenericGaussianStatistics< QuantLib::StatsHolder > s(h); \
return s.METHOD(x); \
}
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianRegret)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianPercentile)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianTopPercentile)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianPotentialUpside)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianValueAtRisk)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianExpectedShortfall)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianShortfall)
TYPICAL_GAUSSIAN_3DOUBLE_STAT_FUNCTION(gaussianAverageShortfall)
}
#endif
--- NEW FILE: statistics.cpp ---
/*
Copyright (C) 2006 Ferdinando Ametrano
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it under the
terms of the QuantLib license. You should have received a copy of the
license along with this program; if not, please email qua...@li...
The license is also available online at http://quantlib.org/html/license.html
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#if defined(HAVE_CONFIG_H)
#include <qlo/config.hpp>
#endif
#include <qlo/statistics.hpp>
namespace QuantLibAddin {
Statistics::Statistics(std::vector<QuantLib::Real> values,
std::vector<QuantLib::Real> weights)
{
libraryObject_ = boost::shared_ptr<QuantLib::Statistics>(
new QuantLib::Statistics());
QL_REQUIRE(weights.size()==0 || values.size()==weights.size(),
"Values and weights vectors must have the same number of elements.");
if (values.size()!=0) {
if (weights.size()!=0)
libraryObject_->addSequence(values.begin(),
values.end(),
weights.begin());
else
libraryObject_->addSequence(values.begin(),
values.end());
}
}
}
--- riskstatistics.cpp DELETED ---
Index: .cvsignore
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/.cvsignore,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** .cvsignore 17 Aug 2006 08:30:43 -0000 1.16
--- .cvsignore 28 Aug 2006 16:00:14 -0000 1.17
***************
*** 30,37 ****
vo_randomsequencegenerator.*pp
vo_ratehelpers.*pp
- vo_riskstatistics.*pp
vo_schedule.*pp
vo_sequencestatistics.*pp
vo_shortratemodels.*pp
vo_swap.*pp
vo_swaption.*pp
--- 30,37 ----
vo_randomsequencegenerator.*pp
vo_ratehelpers.*pp
vo_schedule.*pp
vo_sequencestatistics.*pp
vo_shortratemodels.*pp
+ vo_statistics.*pp
vo_swap.*pp
vo_swaption.*pp
|