Skip to content
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

length method not implemented #74

Open
RobinHankin opened this issue Oct 13, 2022 · 2 comments
Open

length method not implemented #74

RobinHankin opened this issue Oct 13, 2022 · 2 comments

Comments

@RobinHankin
Copy link
Owner

Currently, length() returns 2 when given a clifford object:

> x <- rcliff()
> x
Element of a Clifford algebra, equal to
+ 4 - 3e_34 - 2e_45 - 1e_1245 + 5e_345 + 3e_16 + 1e_1346 + 2e_2346 + 4e_1256
> length(x)
[1] 2
> seq_along(x)
[1] 1 2
> 

This is sub-optimal. The spray package has a length method and this should be implemented here, also in many other packages with similar structures.

@RobinHankin
Copy link
Owner Author

although note that nterms() is implemented.

@RobinHankin
Copy link
Owner Author

RobinHankin commented Jan 25, 2024

Following reprex does not include the "C stack usage too close to limit" error, but:

library("clifford")

a <- rcliff()
a
#> Element of a Clifford algebra, equal to
#> + 6 - 9e_1 - 7e_125 + 3e_1245 - 2e_345 - 6e_16 - 4e_46 + 4e_146 - 1e_1356
nterms(a)
#> [1] 9
length(a)
#> [1] 2
length.clifford <- function(x){nterms(x)}
nterms(a)
length(a)

Created on 2024-01-25 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant