-
Notifications
You must be signed in to change notification settings - Fork 28
Geometric Algebra Types #4009
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
base: main
Are you sure you want to change the base?
Geometric Algebra Types #4009
Changes from all commits
02737ae
aadf409
b8c5bbd
4ecf77d
c5fd09b
7dcb188
5b3c919
aca77d1
d55288e
905a96b
ebebbf3
f32335a
2b24b9b
1af0625
3d6d52a
fb06419
960c0a5
f921ccf
87675e8
ded720e
f323dbc
b4b6cb5
e58564a
f16d784
8887c09
5274725
3025324
8d4747d
38aba8b
5e3a82e
ba0f0da
47207ae
9bce503
01d5aee
b48ac7e
30fe9ea
445440d
5ab549d
599361b
7eaf629
8c25b38
f03bf6c
8be1c15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ spaceToCodeType S.Rational = [Double, Float] | |
| spaceToCodeType S.Boolean = [Boolean] | ||
| spaceToCodeType S.Char = [Char] | ||
| spaceToCodeType S.String = [String] | ||
| spaceToCodeType (S.Vect s) = map List (spaceToCodeType s) | ||
| spaceToCodeType (S.ClifS _ s) = map List (spaceToCodeType s) | ||
| spaceToCodeType (S.Matrix _ _ s) = map (List . List) (spaceToCodeType s) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess you're choosing not to replace
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops - I should have included that as another question. I didn't because I wasn't quite sure what kind of clif it should be represented as. Do you have thoughts? Would an m-by-n matrix be represented as something like an n-grade clif in an m-dimensional space? Dr. Smith and I did some research and there's not much about using clifs to represent matrices. The geometric algebra people have this attitude of "we don't need matrices" so they seem not to even think about them.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://math.stackexchange.com/questions/850869/linear-algebra-without-matrices is one place to start reading. It points to the nice book "Linear Algebra Done Right" which is really quite a gem. [In a sense, chapter 1 of https://arkadiusz-jadczyk.eu/docs/clifford.pdf says that concrete Clifford Algebras are equivalent to some spaces of matrices...] However, we will still want to be able to enter 'concrete' matrices (in a basis). The book "Guide to Geometric Algebra in Practice " is available for download from McMaster's library - I think that one would help most.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JacquesCarette these look to be good resources. @CSchank can you please add links to these resources to your slide show on Clifford algebra. I worry that if we the links only appear here, we won't be able to find them in the future if we go looking. 😄
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| spaceToCodeType (S.Set s) = map List (spaceToCodeType s) | ||
| spaceToCodeType (S.Array s) = map Array (spaceToCodeType s) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ import Language.Drasil hiding (Data, Matrix, CodeVarChunk) | |
| import Language.Drasil.Code.DataDesc (DataDesc'(..), Data'(..), DataItem'(..), | ||
| Delimiter, dataDesc, junk, list, singleton') | ||
| import Language.Drasil.Chunk.Code (CodeVarChunk) | ||
| import Language.Drasil.Expr.Development (Expr(Matrix)) | ||
| import Language.Drasil.Expr.Development (Expr(Matrix)) -- TODO: remove Matrix entirely | ||
|
|
||
| import Control.Lens ((^.)) | ||
| import Data.List (intersperse, isPrefixOf, transpose) | ||
|
|
@@ -66,7 +66,7 @@ readWithDataDesc fp ddsc = do | |
| sampleInputDD :: [CodeVarChunk] -> DataDesc' | ||
| sampleInputDD ds = dataDesc (junk : intersperse junk (map toData ds)) "\n" | ||
| where toData d = toData' (d ^. typ) d | ||
| toData' t@(Vect _) d = list d | ||
| toData' t@(ClifS _ _) d = list d | ||
| (take (getDimension t) ([", ", "; "] ++ iterate (':':) ":")) | ||
| toData' _ d = singleton' d | ||
|
|
||
|
|
@@ -82,8 +82,9 @@ strAsExpr String s = str s | |
| strAsExpr _ _ = error "strAsExpr should only be numeric space or string" | ||
|
|
||
| -- | Gets the dimension of a 'Space'. | ||
| -- TODO: investigate getting rid of the need for this | ||
| getDimension :: Space -> Int | ||
| getDimension (Vect t) = 1 + getDimension t | ||
| getDimension (ClifS _ s) = 1 + getDimension s -- TODO: Does this make sense? Maybe we're overloading the term "dimension" now. | ||
| getDimension _ = 0 | ||
|
|
||
| -- | Splits a string at the first (and only the first) occurrence of a delimiter. | ||
|
|
@@ -98,12 +99,12 @@ splitAtFirst = splitAtFirst' [] | |
| dropDelim [] s = s | ||
| dropDelim _ [] = error "impossible" | ||
|
|
||
| -- | Converts a list of 'String's to a Matrix 'Expr' of a given 'Space'. | ||
| -- | Converts a list of 'String's to a Clif 'Expr' of a given 'Space'. | ||
| strListAsExpr :: Space -> [String] -> Expr | ||
| strListAsExpr (Vect t) ss = Matrix [map (strAsExpr t) ss] | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you shouldn't do |
||
| strListAsExpr (ClifS _ _) _ = undefined -- TODO: fill this in | ||
| strListAsExpr _ _ = error "strListsAsExpr called on non-vector space" | ||
|
|
||
| -- | Converts a 2D list of 'String's to a Matrix 'Expr' of a given 'Space'. | ||
| -- | Converts a 2D list of 'String's to a Clif 'Expr' of a given 'Space'. | ||
| strList2DAsExpr :: Space -> [[String]] -> Expr | ||
| strList2DAsExpr (Vect (Vect t)) sss = Matrix $ map (map (strAsExpr t)) sss | ||
| strList2DAsExpr (ClifS _ (ClifS _ _)) _ = undefined -- TODO: fill this in | ||
| strList2DAsExpr _ _ = error "strLists2DAsExprs called on non-2D-vector space" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CSchank Do you think you could give an example please? Of the change you'd like to see, that is.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we specify the dimension in each example to match its requirements? So here it must remain abstract?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!!!