Ignore:
Timestamp:
05/29/18 16:24:39 (6 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/neuro/impl/neuroimpl-channels.cpp

    r286 r791  
    88void NI_Channelize::go()
    99{
    10 setChannelCount(getInputCount());
    11 for(int i=0;i<getInputCount();i++)
    12         setState(getWeightedInputState(i),i);
     10        setChannelCount(getInputCount());
     11        for (int i = 0; i < getInputCount(); i++)
     12                setState(getWeightedInputState(i), i);
    1313}
    1414
    1515void NI_ChMux::go()
    1616{
    17 int c=getInputChannelCount(1);
    18 if (c<2) {setState(getWeightedInputState(1)); return;}
    19 double s=getWeightedInputState(0);
    20 s=(max(-1.0,min(1.0,s))+1.0)/2.0; // 0..1
    21 int i1;
    22 i1=(int)(s*(c-1)); i1=max(0,min(i1,c-2));
    23 double sw=1.0/(c-1);
    24 double s1=sw*i1;
    25 double w1=fabs((s-s1)/sw);
    26 double w2=1.0-w1;
    27 double is1=getWeightedInputState(1,i1);
    28 double is2=getWeightedInputState(1,i1+1);
    29 setState(is1*w2 + is2*w1);
     17        int c = getInputChannelCount(1);
     18        if (c < 2) { setState(getWeightedInputState(1)); return; }
     19        double s = getWeightedInputState(0);
     20        s = (max(-1.0, min(1.0, s)) + 1.0) / 2.0; // 0..1
     21        int i1;
     22        i1 = (int)(s*(c - 1)); i1 = max(0, min(i1, c - 2));
     23        double sw = 1.0 / (c - 1);
     24        double s1 = sw*i1;
     25        double w1 = fabs((s - s1) / sw);
     26        double w2 = 1.0 - w1;
     27        double is1 = getWeightedInputState(1, i1);
     28        double is2 = getWeightedInputState(1, i1 + 1);
     29        setState(is1*w2 + is2*w1);
    3030}
    3131
    3232void NI_ChSel::go()
    3333{
    34 setState(getWeightedInputState(0,ch));
     34        setState(getWeightedInputState(0, ch));
    3535}
Note: See TracChangeset for help on using the changeset viewer.