phillipstanleymarbell / Noisy-lang-compiler

Noisy language compiler
MIT License
17 stars 1 forks source link

Update the dimensionalMatrixPiGroupsConvertToList and others before the nextup parser update, after #372,#383 and #384 are merged #388

Open Siegfriedchao opened 5 years ago

Siegfriedchao commented 5 years ago

Once #372, #383 and #384 are merged, update dimensionalMatrixPiGroupsConvertToList to take the new reordered null space, this will likely solve the bug reported in #382 . See line 367 to line 410 in newton-irPass-dimensionalMatrixConvertToList.c for more.

Also, update the implementation to reuse dimensionalMatrixKernelPrinter pass in the following order:

    irPassDimensionalMatrixAnnotation(N);
    irPassDimensionalMatrixPiGroups(N);                 
    irPassDimensionalMatrixKernelRowCanonicalization(N);
    irPassDimensionalMatrixPiGroupSorted(N);
    irPassDimensionalMatrixPiGroupsWeedOutDuplicates(N);
    irPassDimensionalMatrixKernelPrinter(N);
    irPassDimensionalMatrixConvertToList(N);
Siegfriedchao commented 5 years ago

Book-keeping: Refer to #382, see the new comments for the current bug present.

Root cause: the printer IRs have not yet been updated to reflect the changes of the reordered kernels. Will update the newton-irPass-dimensionalMatrixPiGroupWeedOut to restore the nullspaces for printer IRs to use.

Quote from the Slack channel discussion: Youchao: Currently saving nullSpace, nullSpaceRowReordered, nullSpaceCanonicallyReordered and nullSpaceWithouDuplicates, so that they might be of use in the future. Phillip: The print routines should take the null space as a parameter, then can reuse

Siegfriedchao commented 5 years ago

This issue is a bundle update and code clean-up for the passes created after #367. Including passes implementation and bug fixes for #372, #382, #383, #384, #386, #387, #393. (TODO: clean-up the comments in this issue for future information referencing, and git-blaming)

Siegfriedchao commented 5 years ago

Demonstration of Newton as of Jan 10, 2019

dhcp-10-248-119-199:newton youchaowang$ ./newton-darwin-EN -v 2 -p -g output.c  ../../applications/newton/invariants/Pendulum-pigroups.nt 

Informational Report:
---------------------
Dimensional matrix for invariant "PendulumForPiGroups":

    Parameter name mapping (autogenerated for shorter column headings):

    distance --> P0
    acceleration --> P1
    mass --> P2
    time --> P3

                P0 P1 P2 P3 
    second       0 -2  0  1 
    meter        1  1  0  0 
    kilogram     0  0  1  0 

Invariant "PendulumForPiGroups" has 1 unique kernels, each with 1 column(s)...

    Kernel 0 is a valid kernel:

           1
          -1
           0
           2

        The ordering of parameters is:  P1 P0 P2 P3 

            Pi group 0, Pi 0 is:    P0^(-1)  P1^( 1)  P2^( 0)  P3^( 2)  

C Backend output:
---------------------
/*
 *  Generated .c file from Newton
 */

#include <math.h>

double
g_paramRHS0(double l_param, double T_param)
{
    double calculatedValue = 0.0;
    calculatedValue =pow( l_param , 1.000000)  * pow( T_param , -2.000000);

    return calculatedValue;
}

double
l_paramRHS1(double g_param, double T_param)
{
    double calculatedValue = 0.0;
    calculatedValue =pow( g_param , -1.000000)  * pow( T_param , -2.000000);

    return calculatedValue;
}

double
T_paramRHS2(double g_param, double l_param)
{
    double calculatedValue = 0.0;
    calculatedValue =pow( g_param , -1.000000)  * pow( l_param , 1.000000);

    return calculatedValue;
}

/*
 *  End of the generated .c file
 */
Siegfriedchao commented 5 years ago
Informational Report:
---------------------
Dimensional matrix for invariant "selectiveLaserMelting":

    Parameter name mapping (autogenerated for shorter column headings):

    oxygenLevel --> P0
    beamQuality --> P1
    dynamicViscosity --> P2
    surfaceTension --> P3
    work --> P4
    power --> P5
    distance --> P6
    distance --> P7
    speed --> P8
    distance --> P9
    thermalDiffusivity --> Q0
    density --> Q1
    latentHeatOfFusion --> Q2
    temperature --> Q3
    density --> Q4

                P0 P1 P2 P3 P4 P5 P6 P7 P8 P9 Q0 Q1 Q2 Q3 Q4 
    second       0  0 -1 -2 -2 -3  0  0 -1  0 -1  0 -2  0  0 
    meter        0  0 -1  0  2  2  1  1  1  1  2 -3  2  0 -3 
    kilogram     0  0  1  1  1  1  0  0  0  0  0  1  0  0  1 
    Kelvin       0  0  0  0  0  0  0  0  0  0  0  0  0  1  0 

Invariant "selectiveLaserMelting" has 94 unique kernels, each with 11 column(s)...
phillipstanleymarbell commented 5 years ago

This looks like it is complete. If it is not, close and create a new issue. Moving to verify.