ArgMax.emadl 401 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package lenet;

component ArgMax<Z(1:oo) n = 2>{
    ports in Q^{n} inputVector,
          out Z(0:oo) maxIndex,
          out Q maxValue;

    implementation Math{
         maxIndex = 0;
         maxValue = inputVector(1);

         for i = 2:n
            if inputVector(i) > maxValue
                maxIndex = i - 1;
                maxValue = inputVector(i);
            end
         end
    }

}