Files
richard-churchman cc0a2bee21 Extensive modifications to the serialisation of Neural Network models to support Newtonsoft Json.net rather than Binary Serializer.
Included open-source Accord.net library code natively to the solution given the deprecated state of that project.  Accord.net will be supported inside Jube for own needs (such as upgrading to .Net 7+).

Accord.net libraries modified to compile to .Net 6.

Modified Accord.net libraries to better support Newtonsoft Json.net serialisation.

Included annotations in the Accord.net libraries to house important dependency statistics. Serialised json can be used independently of Jube to recall a Neural Network.

Removal of Binary Serializer totally as a precursor to the projects support of .Net 7+.

Extensive bug fixing in crucial functions of Neural Network training and recall.  While this part of the system remains in Alpha, it is substantially more fit for purpose.
2023-12-24 10:22:22 +01:00

141 lines
4.6 KiB
Plaintext

<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ output extension="Generated.cs" #>
<#@ import namespace="Microsoft.VisualStudio.TextTemplating" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ include file="T4Toolbox.tt" #>
// Accord Math Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © César Souza, 2009-2017
// cesarsouza at gmail.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// ======================================================================
// This code has been generated by a tool; do not edit manually. Instead,
// edit the T4 template Matrix.Product.tt so this file can be regenerated.
// ======================================================================
namespace Accord.Math
{
using Accord.Math;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
[GeneratedCode("Accord.NET T4 Templates", "3.3")]
public static partial class Jagged
{
<#
string[] types =
{
"int", "double", "float",
"long", "decimal", "byte",
"short", "sbyte",
};
foreach (string a in types)
{
foreach (string b in new HashSet<string>() { a, "double", "int", "float" })
{
string r = null;
if (a == b)
r = a;
else if (a == "double" || b == "double")
r = "double";
else if (a == "float" || b == "float")
r = "float";
else if (a == "int" || b == "int")
r = "int";
else if (a == "uint" || b == "uint")
r = "uint";
else continue;
string t = r;
if (a == "float" || b == "float")
t = "double";
#>
/// <summary>
/// Gets the outer product (matrix product) between two vectors (a*bT).
/// </summary>
///
/// <remarks>
/// In linear algebra, the outer product typically refers to the tensor
/// product of two vectors. The result of applying the outer product to
/// a pair of vectors is a matrix. The name contrasts with the inner product,
/// which takes as input a pair of vectors and produces a scalar.
/// </remarks>
///
#if NET45 || NET46 || NET462 || NETSTANDARD
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static <#=r#>[][] Outer(<#=a#>[] a, <#=b#>[] b)
{
return Outer(a, b, Jagged.Zeros<<#=r#>>(a.Length, b.Length));
}
<#
}
}
foreach (string a in types)
{
foreach (string b in new HashSet<string>() { a, "double", "int", "float" })
{
foreach (string r in new HashSet<string>() { a, b, "double", "int" })
{
string t = r;
if (a == "float" || b == "float")
t = "double";
#>
/// <summary>
/// Gets the outer product (matrix product) between two vectors (a*bT).
/// </summary>
///
/// <remarks>
/// In linear algebra, the outer product typically refers to the tensor
/// product of two vectors. The result of applying the outer product to
/// a pair of vectors is a matrix. The name contrasts with the inner product,
/// which takes as input a pair of vectors and produces a scalar.
/// </remarks>
///
#if NET45 || NET46 || NET462 || NETSTANDARD
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static <#=r#>[][] Outer(<#=a#>[] a, <#=b#>[] b, <#=r#>[][] result)
{
for (int i = 0; i < a.Length; i++)
for (int j = 0; j < b.Length; j++)
result[i][j] = (<#=r#>)((<#=t#>)a[i] * (<#=t#>)b[j]);
return result;
}
<#
}
}
}
#>
}
}