Skip to content

Commit

Permalink
test display and latex method for affine transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalsaleh committed Jul 15, 2024
1 parent 295cff4 commit e14e98f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tst/categorical_vs_direct_constructions.tst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,34 @@ gap> Assert( 0, Para.SoftmaxCrossEntropyLoss_( 3 ) = Para.SoftmaxCrossEntropyLos
gap> Assert( 0, Para.QuadraticLoss_( 3 ) = Para.QuadraticLoss( 3 ) );
gap> Assert( 0, Para.SigmoidBinaryCrossEntropyLoss_( 1 ) = Para.SigmoidBinaryCrossEntropyLoss( 1 ) );
gap> Assert( 0, Para.AffineTransformation_( 3, 4 ) = Para.AffineTransformation( 3, 4 ) );
gap> l := Para.AffineTransformation( 3, 4 );
^3 ->^4 defined by:

Parameter Object:
-----------------
^16

Parametrised Morphism:
----------------------
^19 ->^4
gap> dummy_input := DummyInputForAffineTransformation( 3, 4, "w", "b", "x" );;
gap> Display( l : dummy_input := dummy_input );
^3 ->^4 defined by:

Parameter Object:
-----------------
^16

Parametrised Morphism:
----------------------
^19 ->^4

‣ w1_1 * x1 + w2_1 * x2 + w3_1 * x3 + b_1
‣ w1_2 * x1 + w2_2 * x2 + w3_2 * x3 + b_2
‣ w1_3 * x1 + w2_3 * x2 + w3_3 * x3 + b_3
‣ w1_4 * x1 + w2_4 * x2 + w3_4 * x3 + b_4
gap> LaTeXOutput( UnderlyingMorphism( l ) : dummy_input := dummy_input );
"\\begin{array}{c}\n\\mathbb{R}^{19}\\rightarrow\\mathbb{R}^{4}\\\\ \n \\hline \\\\ \n \\left( \\begin{array}{l}\nb_{1} + w_{1 1} x_{1} + w_{2 1} x_{2} + w_{3 1} x_{3} \\\\ \n b_{2} + w_{1 2} x_{1} + w_{2 2} x_{2} + w_{3 2} x_{3} \\\\ \n b_{3} + w_{1 3} x_{1} + w_{2 3} x_{2} + w_{3 3} x_{3} \\\\ \n b_{4} + w_{1 4} x_{1} + w_{2 4} x_{2} + w_{3 4} x_{3}\n\\end{array} \\right)\\\\ \n \\\\ \n \\hline \\\\ \n \\left( \\begin{array}{lllllllllllllllllll}\nx_{1} & x_{2} & x_{3} & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & w_{1 1} & w_{2 1} & w_{3 1} \\\\ \n 0 & 0 & 0 & 0 & x_{1} & x_{2} & x_{3} & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & w_{1 2} & w_{2 2} & w_{3 2} \\\\ \n 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_{1} & x_{2} & x_{3} & 1 & 0 & 0 & 0 & 0 & w_{1 3} & w_{2 3} & w_{3 3} \\\\ \n 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_{1} & x_{2} & x_{3} & 1 & w_{1 4} & w_{2 4} & w_{3 4}\n\\end{array} \\right)\n\\end{array}"
gap> Eval( Smooth.PolynomialTransformation( 2, 3, 4 ), [ 1 .. 47 ] );
[ 122341573, 479204128, 836066683 ]
gap> EvalJacobianMatrix( Smooth.PolynomialTransformation( 2, 3, 4 ), [ 1 .. 47 ] );
Expand Down

0 comments on commit e14e98f

Please sign in to comment.