Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17782/qlo
Added Files:
sequencestatistics.cpp sequencestatistics.hpp
Log Message:
--- NEW FILE: sequencestatistics.cpp ---
/*
Copyright (C) 2006 Cristina Duminuco
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/sequencestatistics.hpp>
namespace QuantLibAddin {
SequenceStatistics::SequenceStatistics(QuantLib::Size dimension,
QuantLib::Matrix values,
std::vector<QuantLib::Real> weights)
{
libraryObject_ = boost::shared_ptr<QuantLib::SequenceStatistics>(
new QuantLib::SequenceStatistics(dimension));
QL_REQUIRE(weights.size()==0 || values.rows()==weights.size(),
"Values and weights vectors must have the same number of elements.");
if (values.rows()!=0) {
if (weights.size()!=0) {
for (QuantLib::Size i=0; i<values.rows(); i++) {
libraryObject_->add(values.row_begin(i),
values.row_end(i),
weights[i]);
}
} else {
for (QuantLib::Size i=0; i<values.rows(); i++) {
libraryObject_->add(values.row_begin(i),
values.row_end(i));
}
}
}
}
}
--- NEW FILE: sequencestatistics.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_sequencestatistics_hpp
#define qla_sequencestatistics_hpp
#include <oh/objhandler.hpp>
#include <ql/Math/sequencestatistics.hpp>
#include <ql/Math/riskstatistics.hpp>
#include <ql/Math/matrix.hpp>
namespace QuantLibAddin {
class SequenceStatistics :
public ObjHandler::LibraryObject<QuantLib::SequenceStatistics> {
public:
SequenceStatistics(QuantLib::Size dimension,
QuantLib::Matrix values,
std::vector<QuantLib::Real> weights);
};
}
#endif
|