include/matrixlinker.h

Go to the documentation of this file.
00001 /********************************************************************************
00002  *  Neural Network Framework.                                                   *
00003  *  Copyright (C) 2005-2008 Gianluca Massera <emmegian@yahoo.it>                *
00004  *                                                                              *
00005  *  This program is free software; you can redistribute it and/or modify        *
00006  *  it under the terms of the GNU General Public License as published by        *
00007  *  the Free Software Foundation; either version 2 of the License, or           *
00008  *  (at your option) any later version.                                         *
00009  *                                                                              *
00010  *  This program is distributed in the hope that it will be useful,             *
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
00013  *  GNU General Public License for more details.                                *
00014  *                                                                              *
00015  *  You should have received a copy of the GNU General Public License           *
00016  *  along with this program; if not, write to the Free Software                 *
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  *
00018  ********************************************************************************/
00019 
00020 #ifndef MATRIXLINKER_H
00021 #define MATRIXLINKER_H
00022 
00026 #include "types.h"
00027 #include "linker.h"
00028 
00029 namespace nnfw {
00030 
00056 class NNFW_API MatrixLinker : public Linker {
00057 public:
00060 
00063     MatrixLinker( Cluster* from, Cluster* to, const char* name = "unnamed" );
00064 
00067     MatrixLinker( PropertySettings& prop );
00068 
00071     virtual ~MatrixLinker();
00072 
00074 
00076 
00079     u_int rows() {
00080         return nrows;
00081     };
00082 
00085     u_int cols() {
00086         return ncols;
00087     };
00088 
00091     u_int size() const;
00092 
00095     virtual void randomize( Real min, Real max );
00096 
00099     virtual void setWeight( u_int from, u_int to, Real weight );
00100 
00103     virtual Real getWeight( u_int from, u_int to );
00104 
00107     RealMat& matrix() {
00108         return w;
00109     };
00110 
00112     const RealMat& matrix() const {
00113         return w;
00114     };
00115 
00118     Variant matrixP() {
00119         return Variant( &w );
00120     };
00121 
00124     void setMatrix( const RealMat& mat );
00125 
00128     bool setMatrix( const Variant& v );
00129 
00131 
00132 private:
00134     u_int nrows, ncols;
00136     RealMat w;
00137 };
00138 
00139 }
00140 
00141 #endif
BerliOS Developer Logo Valid XHTML 1.0 Transitional Valid CSS!