-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPC-GAP specific code for QuaternionAlgebraData
#2940
Comments
To help to quickly see the code: Lines 689 to 711 in 30c038b
|
@ThomasBreuer That's an interesting question, and I wondered the same -- but it actually has nothing to do with HPC-GAP; for HPC-GAP, we only tried to carefully replicate the existing behavior of ...
# Generators in the right family may be already available.
stored:= First( QuaternionAlgebraData,
t -> t[1] = a and t[2] = b
and IsIdenticalObj( t[3], FamilyObj( F ) ) );
if stored <> fail then
A:= AlgebraWithOne( F, GeneratorsOfAlgebra( stored[4] ), "basis" );
SetGeneratorsOfAlgebra( A, GeneratorsOfAlgebraWithOne( A ) );
else
...
A:= AlgebraByStructureConstantsArg(
...
# Store the data for the next call.
Add( QuaternionAlgebraData, [ a, b, FamilyObj( F ), A ] );
fi;
...
return A; My guess is that the function is supposed to return a fresh algebra every time, without stored knowledge about its properties. Whether that's desirable or not is another question, but it certainly matches what other group/algebra/... constructors do. |
@fingolfin Thanks for your reply. The idea behind this caching mechanism is that I think that now I understand the code better. Thus the handling of objects is logically correct. |
Sure, |
When I find some time, I will prepare a pull request for that. |
QuaternionAlgebraData
QuaternionAlgebraData
Also ensure that the exact same code is used to produce the resulting algebra regardless of whether it is created freshly or from the cache. This revealed a bug: `A.1` only worked in the former case, not the latter, which could lead to subtly broken code. Before this patch, the following happened: gap> A:= QuaternionAlgebra( [1], 2, 5 ); <algebra-with-one of dimension 4 over Rationals> gap> A.1; e gap> B:= QuaternionAlgebra( [1], 2, 5 ); <algebra-with-one of dimension 4 over Rationals> gap> B.1; Error, illegal access to record component `obj.1' This is now fixed. Resolves gap-system#2940
Also ensure that the exact same code is used to produce the resulting algebra regardless of whether it is created freshly or from the cache. This revealed a bug: `A.1` only worked in the former case, not the latter, which could lead to subtly broken code. Before this patch, the following happened: gap> A:= QuaternionAlgebra( [1], 2, 5 ); <algebra-with-one of dimension 4 over Rationals> gap> A.1; e gap> B:= QuaternionAlgebra( [1], 2, 5 ); <algebra-with-one of dimension 4 over Rationals> gap> B.1; Error, illegal access to record component `obj.1' This is now fixed. Resolves #2940
Just for curiosity:
I stumbled over HPCGAP specific code for dealing with the cache
QuaternionAlgebraData
,see
lib/algsc.gi
.The function
StoreQuaternionAlgebraData
adds the algebra and related data to this cache if necessary.In the case that no new entry is needed, this function creates a new algebra,
which is equal (in the sense of
\=
) to the given one, and returns it.Why is this new object necessary, and why would it be wrong to keep (in the function
QuaternionAlgebra
)the given algebra instead of replacing it by the one returned by
StoreQuaternionAlgebraData
?The text was updated successfully, but these errors were encountered: