Skip to content
Snippets Groups Projects
ConnectionFunctionIdentity.cpp 1.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • /**
     * DESCRIPTION OF THE FILE
     *
     * @author Michal Kravčenko
     * @date 14.6.18 -
     */
    
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
    #include "ConnectionFunctionIdentity.h"
    
    #include "ConnectionFunctionIdentitySerialization.h"
    #include "ConnectionFunctionGeneralSerialization.h"
    
    BOOST_CLASS_EXPORT_IMPLEMENT(ConnectionFunctionIdentity);
    
    ConnectionFunctionIdentity::ConnectionFunctionIdentity( ) {
    
    //    this->type = CONNECTION_TYPE::IDENTITY;
    
        this->is_unitary = true;
    }
    
    ConnectionFunctionIdentity::ConnectionFunctionIdentity( size_t pidx ) {
    
    //    this->type = CONNECTION_TYPE::IDENTITY;
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
        this->param_idx = pidx;
    
    double ConnectionFunctionIdentity::eval( std::vector<double> &parameter_space ) {
    
        if( this->is_unitary ){
            return 1.0;
        }
    
        return parameter_space.at(this->param_idx);
    
    void ConnectionFunctionIdentity::eval_partial_derivative(std::vector<double> &parameter_space, std::vector<double> &weight_gradient, double alpha) {
    
        if( this->is_unitary ){
            return;
        }
    
    
    Michal Kravcenko's avatar
    Michal Kravcenko committed
        weight_gradient[this->param_idx] += alpha;