Select Git revision
ChainComplex.cpp
-
Christophe Geuzaine authoredChristophe Geuzaine authored
optimization.cpp 560.67 KiB
/*************************************************************************
Copyright (c) Sergey Bochkanov (ALGLIB project).
>>> SOURCE LICENSE >>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation (www.fsf.org); either version 2 of the
License, or (at your option) any later version.
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
GNU General Public License for more details.
A copy of the GNU General Public License is available at
http://www.fsf.org/licensing/licenses
>>> END OF LICENSE >>>
*************************************************************************/
#include "stdafx.h"
#include "optimization.h"
// disable some irrelevant warnings
#if (AE_COMPILER==AE_MSVC)
#pragma warning(disable:4100)
#pragma warning(disable:4127)
#pragma warning(disable:4702)
#pragma warning(disable:4996)
#endif
using namespace std;
/////////////////////////////////////////////////////////////////////////
//
// THIS SECTION CONTAINS IMPLEMENTATION OF C++ INTERFACE
//
/////////////////////////////////////////////////////////////////////////
namespace alglib
{
/*************************************************************************
This object stores state of the nonlinear CG optimizer.
You should use ALGLIB functions to work with this object.
*************************************************************************/
_mincgstate_owner::_mincgstate_owner()
{
p_struct = (alglib_impl::mincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgstate), NULL);
if( p_struct==NULL )
throw ap_error("ALGLIB: malloc error");
if( !alglib_impl::_mincgstate_init(p_struct, NULL, ae_false) )
throw ap_error("ALGLIB: malloc error");
}
_mincgstate_owner::_mincgstate_owner(const _mincgstate_owner &rhs)
{
p_struct = (alglib_impl::mincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgstate), NULL);
if( p_struct==NULL )
throw ap_error("ALGLIB: malloc error");
if( !alglib_impl::_mincgstate_init_copy(p_struct, const_cast<alglib_impl::mincgstate*>(rhs.p_struct), NULL, ae_false) )
throw ap_error("ALGLIB: malloc error");
}
_mincgstate_owner& _mincgstate_owner::operator=(const _mincgstate_owner &rhs)
{
if( this==&rhs )
return *this;
alglib_impl::_mincgstate_clear(p_struct);
if( !alglib_impl::_mincgstate_init_copy(p_struct, const_cast<alglib_impl::mincgstate*>(rhs.p_struct), NULL, ae_false) )
throw ap_error("ALGLIB: malloc error");
return *this;