You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.
partial class MyMath{
INum SumOfSquares(INum a,INum b)
{
return a.op_Multiply(a).op_Addition(b.op_Multiply(b));
}
}
generate
partial class MyMath
{
int SumOfSquares(int a,int b)
{
return a*a + b*b;
}
float SumOfSquares(float a,float b)
{
return a*a + b*b;
}
// also this subject to what numeric `casts`
int SumOfSquares(int a,float b)
{
return a*a + b*b;
}
}
Kind of allowing to write down generic numeric algorithms.
I know that there are not so much of really generic algorithms in the end cause numeric sized influence algorithms, performance, precisions, but this may be useful for some implementations.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Given code
and
generate
Some items to consider:
op_* names in .NET:
http://msdn.microsoft.com/en-us/library/dd233204.aspx
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.matrix.op_addition.aspx
Interfaces implemented by numeric values:
Approach with defining 2 pseudo numeric of 2
size
with implicit/explicit operators:https://github.com/asd-and-Rizzo/matrixextensions/blob/master/MatrixExtensionsCodeBase/NumericBroad.cs
https://github.com/asd-and-Rizzo/matrixextensions/blob/master/MatrixExtensionsCodeBase/NumericNarrow.cs
some matrix operations
https://github.com/asd-and-Rizzo/matrixextensions/blob/master/MatrixExtensionsCodeBase/NumericArray2DManipulationExtensions.cs
and generate code for each defined type (int,float,complex) etc.
https://github.com/asd-and-Rizzo/matrixextensions/blob/master/MatrixExtensionsCodeTransformator/Program.cs
Runtime code generation http://www.yoda.arachsys.com/csharp/genericoperators.html
Kind of allowing to write down generic numeric algorithms.
I know that there are not so much of really generic algorithms in the end cause numeric sized influence algorithms, performance, precisions, but this may be useful for some implementations.
The text was updated successfully, but these errors were encountered: