emergent 8.2.2 ConState_cpp Class Reference
emergent 8.2.2   Home · Wiki Docs For: ConState_cpp · Emergent Help Browser 

ConState_cpp Class Reference

connection group -- manages one projection's worth of connections at a unit level -- can be either Recv or Send

See for more info: Wiki Docs For: ConState_cpp

 #include <ConState_cpp>

defined at: /mnt/ssd/grey/local/include/Emergent/ConState_cpp.h :81-132

Inherited By: ConState_cpp*, ConState_cpp&, const ConState_cpp, LeabraConState_cpp

Index: SubTypes, Members, Methods, Static Members, Static Methods, Expert Members, Expert Methods

Sub Types


SubType Documentation

enum ConState_cpp::ConVars

Connection variables -- must align with Connection obj

ConstantValueDescription
ConState_cpp::WT0x00000000the synaptic weight of connection
ConState_cpp::DWT0x00000001change in synaptic weight as computed by learning mechanism

enum ConState_cpp::ConStateFlags

flags for this connection group

ConstantValueDescription
ConState_cpp::OWN_CONS0x00000001this guy owns the connections -- else gets links to others
ConState_cpp::RECV_CONS0x00000002we are a recv con group -- else a send con group
ConState_cpp::IS_ACTIVE0x00000004we are an active con group -- projection is active and size > 0
ConState_cpp::SHARING0x00000008this OWN_CONS group is sharing connection objects from another con group
ConState_cpp::CHUNKS_SAME_SUGP0x00000010for Leabra: chunks all have the same sender unit group -- important for optimization of netin


Regular (preferred) Member and Method Documentation

Members

Member Category: State

Member Category: _NoCategory

Methods

Method Category: Acccess

Method Category: Access

Method Category: Connect

Method Category: Learning

Method Category: Modify

Method Category: ObjectMgmt

Method Category: State

Method Category: Statistics

Method Category: Structure

Method Category: _NoCategory


Member Documentation

Member Category: State

ConState_cpp::alloc_size : int

allocated size -- no more than this number of connections may be created -- it is a hard limit set by the alloc function

ConState_cpp::flags : ConState_cpp::ConStateFlags

flags for this connection group

ConState_cpp::other_idx : int

index into other direction's list of cons objects (i.e., send_idx for RecvCons and recv_idx for SendCons)

ConState_cpp::share_idx : int

index of other unit that this congroup shares connection objects with -- unit must be in same layer with same number of connections, and in the same thread (i.e., the number of units in a unit group must be an even multiple of the number of threads), and must be *earlier* in the layer (typically the first unit group) -- projection must set this during the initial pre-allocation phase of connecting -- if -1 then this congroup has its own unique connection objects

ConState_cpp::size : int

number of connections currently active

ConState_cpp::vec_chunked_size : int

number of connections at start of list that are chunked according to vec_chunk_targ -- for sender-based, this means that the recv unit_idx's are sequential for each of the chunks (individually) -- between chunks can be non-sequential

Member Category: _NoCategory

ConState_cpp::temp1 : float

temporary compute value -- e.g., net input


Method Documentation

Method Category: Acccess

int ConState_cpp::FindConFromIdx ( int trg_idx )

find connection from given unit flat index -- optimized search uses index relative to un_lo_idx, un_hi_idx as starting point for bidirectional search from there -- should be realtively quick to find connection in general

Show Source Code

Method Category: Access

bool ConState_cpp::InRange ( int idx )

is index in range?

Show Source Code

int ConState_cpp::NConVars ( )

number of connection-level variables

Show Source Code

float& ConState_cpp::OwnCn ( int idx, int var_no )

fast access (no range checking) to owned connection variable value at given index -- OwnCnVar with index in loop is preferred for fastest access -- var_no is defined in ConSpec (e.g., ConSpec::WT, DWT or algorithm-specific types (e.g., LeabraConSpec::PDW)

Show Source Code

int32_t& ConState_cpp::OwnCnInt ( int idx, int var_no )

fast access (no range checking) to owned connection INTEGER variable value at given index -- OwnCnVar with index in loop is preferred for fastest access -- var_no is defined in ConSpec (e.g., ConSpec::WT, DWT or algorithm-specific types (e.g., LeabraConSpec::PDW)

Show Source Code

float* ConState_cpp::OwnCnVar ( int var_no )

fastest access (no range checking) to owned connection variable value -- get this float* and then index it directly with loop index -- var_no is defined in ConSpec (e.g., ConSpec::WT, DWT or algorithm-specific types (e.g., LeabraConSpec::SCALE)

Show Source Code

int32_t* ConState_cpp::OwnCnVarInt ( int var_no )

fastest access (no range checking) to owned connection variable value of INTEGER type -- get this float* and then index it directly with loop index -- var_no is defined in ConSpec

Show Source Code

int32_t& ConState_cpp::PtrCnIdx ( int idx )

fast access (no range checking) to index of connection within unit cons on other side of connection

Show Source Code

float& ConState_cpp::SafeCn ( NetworkState_cpp* net, int idx, int var_no )

fully safe generic access of connection variable value at given index, regardless of whether it is owned or a pointer -- var_no is defined in ConSpec (e.g., ConSpec::WT, DWT or algorithm-specific types (e.g., LeabraConSpec::PDW) -- this is mainly for program access -- do not use in compute algorithm code that knows the ownership status of the connections (use OwnCn* or PtrCn*)

Show Source Code

float& ConState_cpp::SafeCnName ( NetworkState_cpp* net, int idx, char* var_nm )

generic safe access of connection variable value by name (e.g., wt, dwt, pdw, etc) at given index, regardless of whether it is owned or a pointer -- mainly for program access -- do not use in compute algorithm code that knows the ownership status of the connections (use OwnCn* or PtrCn*)

Show Source Code

bool ConState_cpp::SetCnVal ( NetworkState_cpp* net, float val, int idx, int var_no )

set connection variable to given value -- for use by programs, which cannot assign the value through the SafeCn function -- var_no is defined in ConSpec (e.g., ConSpec::WT, DWT or algorithm-specific types (e.g., LeabraConSpec::PDW) --

Show Source Code

bool ConState_cpp::SetCnValName ( NetworkState_cpp* net, float val, int idx, char* var_nm )

set connection variable (specified by name, e.g., wt, dwt, pdw) to given value -- for use by programs, which cannot assign the value through the SafeCn function

Show Source Code

bool ConState_cpp::SetShareFrom ( NetworkState_cpp* net, UnitState_cpp* shu )

set this connection group to share from given other unit -- checks to make sure this works -- returns false if not (will have already emitted warning message)

Show Source Code

ConState_cpp* ConState_cpp::SharedUnCons ( NetworkState_cpp* net )

get the con group of the unit that we share connections from

Show Source Code

int32_t& ConState_cpp::UnIdx ( int idx )

fast access (no range checking) to unit flat index at given connection index

Show Source Code

bool ConState_cpp::VarInRange ( int var_no )

is var number valid?

Show Source Code

Method Category: Connect

void ConState_cpp::AllocConsFmSize ( NetworkState_cpp* net )

allocate connections from accumulated size during first pass of connection algo

Show Source Code

void ConState_cpp::ConnectAllocInc ( int inc_n = 1 )

use this for dynamically figuring out how many connections to allocate, if it is not possible to compute directly -- increments size by given number -- later call AllocConsFmSize to allocate connections based on the size value

Show Source Code

int ConState_cpp::ConnectUnOwnCn ( NetworkState_cpp* net, UnitState_cpp* un, bool ignore_alloc_errs = false, bool allow_null_unit = false )

add a new connection from given unit for OwnCons case -- returns -1 if no more room relative to alloc_size (flag will turn off err msg) -- default is to not allow connections from a unit with flat_idx = 0 (null_unit) but this can be overridden -- returns index of new connection (-1 if failed)

Show Source Code

bool ConState_cpp::ConnectUnPtrCn ( NetworkState_cpp* net, UnitState_cpp* un, int con_idx, bool ignore_alloc_errs = false )

add a new connection from given unit and connection index for PtrCons case -- returns false if no more room, else true

Show Source Code

int ConState_cpp::ConnectUnits ( NetworkState_cpp* net, UnitState_cpp* our_un, UnitState_cpp* oth_un, ConState_cpp* oth_cons, bool ignore_alloc_errs = false, bool set_init_wt = false, float init_wt = 0.0f )

add a new connection betwee our unit and an other unit and its appropriate cons -- does appropriate things depending on who owns the connects, etc. enough room must already be allocated on both sides (flag will turn off err msg) -- returns index of new connection (-1 if failed) -- can also optionally set initial weight value

Show Source Code

Method Category: Learning

void ConState_cpp::AddNoiseToWeights ( NetworkState_cpp* net, Random& noise_spec )

add noise to weights using given noise specification -- must call Init_Weights_post at network level after running this!

Show Source Code

void ConState_cpp::RenormWeights ( NetworkState_cpp* net, bool mult_norm, float avg_wt )

renormalize the weight values using either multiplicative (for positive-only weight values such as Leabra) or subtractive normalization (for pos/neg weight values, such as backprop) to hit the given average weight value -- must call Init_Weights_post at network level after running this!

Show Source Code

void ConState_cpp::RescaleWeights ( NetworkState_cpp* net, const float rescale_factor )

rescale the weight values by multiplying by rescaling factor -- must call Init_Weights_post at network level after running this, to keep other weight values synchronized

Show Source Code

void ConState_cpp::TransformWeights ( NetworkState_cpp* net, SimpleMathSpec& trans )

apply given transformation to weights -- must call Init_Weights_post at network level after running this, to keep other weight values synchronized

Show Source Code

Method Category: Modify

void ConState_cpp::Copy_Weights ( ConState_cpp* src, NetworkState_cpp* net )

copies weights from other con_state

Show Source Code

void ConState_cpp::RemoveAll ( )

remove all conections -- frees all associated memory

Show Source Code

bool ConState_cpp::RemoveConIdx ( int i, NetworkState_cpp* net )

remove connection at given index, also updating other unit's information about this connection

Show Source Code

bool ConState_cpp::RemoveConUn ( int trg_idx, NetworkState_cpp* net )

remove connection from given unit with trg_idx flat index number (if found)

Show Source Code

void ConState_cpp::Reset ( )

remove all conections -- frees all associated memory

Show Source Code

Method Category: ObjectMgmt

void ConState_cpp::ChangeConStateFlag ( int flag, bool set )

sets or clears the flag(s)

Show Source Code

void ConState_cpp::ClearConStateFlag ( int flag )

clears the flag(s)

Show Source Code

bool ConState_cpp::HasConStateFlag ( int flag )

true if flag set, or if multiple, any set

Show Source Code

void ConState_cpp::SetConStateFlag ( int flag )

sets the flag(s)

Show Source Code

Method Category: State

bool ConState_cpp::CopyCons ( ConState_cpp& cp )

copy connections from other connections

Show Source Code

void ConState_cpp::FreeCons ( )

deallocate all connection-level storage (cons and units)

Show Source Code

ConSpec_cpp* ConState_cpp::GetConSpec ( NetworkState_cpp* net )

get connection spec that manages these connections

Show Source Code

PrjnState_cpp* ConState_cpp::GetPrjnState ( NetworkState_cpp* net )

get projection state that manages these connections

Show Source Code

LayerState_cpp* ConState_cpp::GetRecvLayer ( NetworkState_cpp* net )

get recv layer for this projection

Show Source Code

LayerState_cpp* ConState_cpp::GetSendLayer ( NetworkState_cpp* net )

get send layer for this projection

Show Source Code

bool ConState_cpp::IsActive ( )

is this an active connection group, with connections and an active projection?

Show Source Code

bool ConState_cpp::IsRecv ( )

is this a receiving con group? else sending

Show Source Code

bool ConState_cpp::IsSend ( )

is this a sending con group? else receiving

Show Source Code

bool ConState_cpp::NotActive ( )

is this NOT an active connection group, with connections and an active projection?

Show Source Code

bool ConState_cpp::OwnCons ( )

do we own the connections? else just point to them

Show Source Code

bool ConState_cpp::PrjnIsActive ( NetworkState_cpp* net )

is the projection active for this connection group?

Show Source Code

bool ConState_cpp::PtrCons ( )

do we have pointers to connections? else we own them

Show Source Code

void ConState_cpp::SetInactive ( )

set to inactive status

Show Source Code

bool ConState_cpp::Sharing ( )

is this group sharing connections from another connection group?

Show Source Code

void ConState_cpp::UpdtIsActive ( NetworkState_cpp* net )

update active status: is this an active connection group, with connections and an active projection?

Show Source Code

float ConState_cpp::VecChunkPct ( )

return percent of our cons that are vec chunked

Show Source Code

Method Category: Statistics

DataTable* ConState_cpp::ConVarsToTable ( DataTable* dt, UnitState_cpp* ru, NetworkState_cpp* net, taString& var1, taString& var2, taString& var3, taString& var4, taString& var5, taString& var6, taString& var7, taString& var8, taString& var9, taString& var10, taString& var11, taString& var12, taString& var13, taString& var14 )

record given connection-level variable to data table with column names the same as the variable names, and one row per *connection* (unlike monitor-based operations which create matrix columns) -- this is useful for performing analyses on learning rules as a function of sending and receiving unit variables -- uses receiver-based connection traversal -- connection variables are just specified directly by name -- corresponding receiver unit variables are 'r.var' and sending unit variables are 's.var'

Show Source Code

Method Category: Structure

bool ConState_cpp::ConValuesFromArray ( NetworkState_cpp* net, float_Array& ary, taString& variable )

sets values of variable in the connections from the given array (false if var not found) -- must call Init_Weights_post at network level after running this!

Show Source Code

bool ConState_cpp::ConValuesFromMatrix ( NetworkState_cpp* net, float_Matrix& mat, taString& variable )

sets values of variable in the connections from the given array (false if var not found) -- uses flat index of cons to set: 0..size-1 -- must call Init_Weights_post at network level after running this!

Show Source Code

bool ConState_cpp::ConValuesToArray ( NetworkState_cpp* net, float_Array& ary, taString& variable )

adds values of variable from the connections into the given array (false if var not found)

Show Source Code

bool ConState_cpp::ConValuesToMatrix ( NetworkState_cpp* net, float_Matrix& mat, taString& variable )

sets values of variable from the connections into the given matrix (uses flat index of cons to set: 0..size-1), returns false if matrix is not appropriately sized

Show Source Code

int ConState_cpp::LesionCons ( NetworkState_cpp* net, UnitState_cpp* un, float p_lesion, bool permute = true )

remove weights with prob p_lesion (permute = fixed no. lesioned)

Show Source Code

int ConState_cpp::PruneCons ( NetworkState_cpp* net, UnitState_cpp* un, SimpleMathSpec& pre_proc, Relation::Relations rel, float cmp_val )

remove weights that (after pre-proc) meet relation to compare val

Show Source Code

Method Category: _NoCategory

void ConState_cpp::AllocCons ( NetworkState_cpp* net, int sz )

Show Source Code

void ConState_cpp::Initialize_core ( int own_flt_idx = 0, int own_th_idx = 0, int spec_dx = 0, int flgs = 0, int prj_dx = 0, int n_con_vr = 0, int oth_idx = 0 )

Show Source Code

Static Member and Method Documentation

Static Members

Static Methods


Static Method Documentation


Expert Member and Method Documentation

Expert Members

Expert Member Category: State

Expert Methods


Expert Member Documentation

Expert Member Category: State

ConState_cpp::n_con_vars : int

number of connection variables

ConState_cpp::own_flat_idx : int

unit flat index of unit that owns us

ConState_cpp::own_thr_idx : int

unit thread-specific index of unit that owns us

ConState_cpp::prjn_idx : int

index into network state projection state list for the projection that we correspond to

ConState_cpp::spec_idx : int

index into network state conspecs list for our conspec

ConState_cpp::un_hi_idx : int

highest flat_idx of units that we are connected to -- cached after connections are made -- optimizes finding connections

ConState_cpp::un_lo_idx : int

lowest flat_idx of units that we are connected to -- cached after connections are made -- optimizes finding connections


Expert Method Documentation


Copyright © 2017Regents of the University of Colorado, Carnegie Mellon University, Princeton University.
emergent 8.2.2