00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SPARSEMATRIXLINKER_H
00021 #define SPARSEMATRIXLINKER_H
00022
00026 #include "types.h"
00027 #include "linker.h"
00028 #include "matrixlinker.h"
00029
00030 namespace nnfw {
00031
00037 class NNFW_API SparseMatrixLinker : public MatrixLinker {
00038 public:
00041
00044 SparseMatrixLinker( Cluster* from, Cluster* to, const char* name = "unnamed" );
00045
00048 SparseMatrixLinker( Real prob, Cluster* from, Cluster* to, const char* name = "unnamed" );
00049
00055 SparseMatrixLinker( Cluster* from, Cluster* to, Real prob, bool zeroDiagonal = false, bool symmetricMask = false, const char* name = "unnamed" );
00056
00059 SparseMatrixLinker( PropertySettings& prop );
00060
00063 virtual ~SparseMatrixLinker();
00064
00066
00068
00071 virtual void setWeight( u_int from, u_int to, Real weight );
00072
00075 virtual void randomize( Real min, Real max );
00076
00079 void update();
00080
00083 void connect( u_int from, u_int to );
00084
00087 void connectRandom( Real prob );
00088
00091 void connectAll();
00092
00095 void disconnect( u_int from, u_int to );
00096
00099 void disconnectRandom( Real prob );
00100
00103 void disconnectAll();
00104
00108 MatrixData<bool>& getMask() {
00109 return maskm;
00110 };
00111
00113 MatrixData<bool>& mask() {
00114 return maskm;
00115 };
00116
00118 Variant maskP() {
00119 return Variant( &maskm );
00120 };
00121
00123 void setMask( const MatrixData<bool>& mask );
00124
00126 bool setMask( const Variant& v );
00127
00129 virtual SparseMatrixLinker* clone() const;
00130
00132
00133 private:
00135 MatrixData<bool> maskm;
00136 };
00137
00138 }
00139
00140 #endif