From e14e98f3c7948374bb414e76c203c8ad91b6fe64 Mon Sep 17 00:00:00 2001 From: Kamal Saleh Date: Mon, 15 Jul 2024 11:50:19 +0200 Subject: [PATCH] test display and latex method for affine transformations --- tst/categorical_vs_direct_constructions.tst | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tst/categorical_vs_direct_constructions.tst b/tst/categorical_vs_direct_constructions.tst index fd35006..0c69b63 100644 --- a/tst/categorical_vs_direct_constructions.tst +++ b/tst/categorical_vs_direct_constructions.tst @@ -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 ] );