Beispiel #1
0
 public void Activate()
 {
     FastMath.MatrixMultiply(Activations, Connections, _tempActivations);
     FastMath.Add(Bias, _tempActivations, _tempActivations);
     ApplyTransferFunction(_tempActivations);
     _tempActivations.CopyTo(Activations, InputCount);
 }
Beispiel #2
0
 public void SevenArgs()
 {
     Array.Clear(Float3, 0, 3);
     FastMath.Add(Float123, 0, Float123, 1, Float3, 0, 2);
     Assert.AreEqual(3, Float3[0]);
     Assert.AreEqual(5, Float3[1]);
     Assert.AreEqual(0, Float3[2]);
 }
Beispiel #3
0
 public void ThreeArgs()
 {
     Array.Clear(Float3, 0, 3);
     FastMath.Add(Float123, Float123, Float3);
     Assert.AreEqual(2, Float3[0]);
     Assert.AreEqual(4, Float3[1]);
     Assert.AreEqual(6, Float3[2]);
 }
Beispiel #4
0
                public void TwoArgs()
                {
                    var ret = FastMath.Add(Float123, Float123);

                    Assert.AreEqual(3, ret.Length);
                    Assert.AreEqual(2, ret[0]);
                    Assert.AreEqual(4, ret[1]);
                    Assert.AreEqual(6, ret[2]);
                }
Beispiel #5
0
                public void NullANS()
                {
                    var e = Assert.ThrowsException <ArgumentNullException>(
                        () => FastMath.Add(Float0, Float0, null));

                    Assert.AreEqual(ANS, e.ParamName);
                    e = Assert.ThrowsException <ArgumentNullException>(
                        () => FastMath.Add(Float0, 0, Float0, 0, null, 0, 0));
                    Assert.AreEqual(ANS, e.ParamName);
                }
Beispiel #6
0
 public void InvalidIndices()
 {
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float0, 0, Float0, 0, Float0, 0, 1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float1, 1, Float1, 0, Float1, 0, 1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float1, 0, Float1, 1, Float1, 0, 1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float1, 0, Float1, 0, Float1, 1, 1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float1, 0, Float1, 0, Float1, 0, 2));
 }
Beispiel #7
0
 public void InvalidLengths()
 {
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float0, Float1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float1, Float0));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float0, Float0, Float1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float0, Float1, Float1));
     Assert.ThrowsException <IndexOutOfRangeException>(
         () => FastMath.Add(Float0, Float1, Float0));
 }
Beispiel #8
0
 public void Add() => FastMath.Add(new MyStruct[0], new MyStruct[0]);