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

Avg scale #58

Merged
merged 6 commits into from Mar 12, 2014

Conversation

Projects
None yet
2 participants
@jeffreyrosenbluth
Member

jeffreyrosenbluth commented Mar 10, 2014

Moved avgScale to core

@jeffreyrosenbluth

This comment has been minimized.

Show comment
Hide comment
@jeffreyrosenbluth

jeffreyrosenbluth Mar 10, 2014

Member

I guess we could be slightly more general and have Floating (Scalar v) instead of Double ?

Member

jeffreyrosenbluth commented on src/Diagrams/Core/Transform.hs in e0b53fb Mar 10, 2014

I guess we could be slightly more general and have Floating (Scalar v) instead of Double ?

This comment has been minimized.

Show comment
Hide comment
@byorgey

byorgey Mar 11, 2014

Member

Yes, that sounds like a nice generalization, and I don't think it will cause any problems for type inference. It matches the general type of determinant.

Member

byorgey replied Mar 11, 2014

Yes, that sounds like a nice generalization, and I don't think it will cause any problems for type inference. It matches the general type of determinant.

@jeffreyrosenbluth

This comment has been minimized.

Show comment
Hide comment
@jeffreyrosenbluth

jeffreyrosenbluth Mar 11, 2014

Member

I think this is a little nicer. Should be ready to merge, if someone wants to have a look

Member

jeffreyrosenbluth commented Mar 11, 2014

I think this is a little nicer. Should be ready to merge, if someone wants to have a look

@jeffreyrosenbluth

This comment has been minimized.

Show comment
Hide comment
@jeffreyrosenbluth

jeffreyrosenbluth Mar 11, 2014

Member

Is there a way to write a function that just gives the dimension of the vector space it lives in.
something like

dimension :: forall v. HasLinearMap v => Int
dimension  = length (decompose (zeroV :: v))
Member

jeffreyrosenbluth commented on src/Diagrams/Core/Transform.hs in 3cbab1f Mar 11, 2014

Is there a way to write a function that just gives the dimension of the vector space it lives in.
something like

dimension :: forall v. HasLinearMap v => Int
dimension  = length (decompose (zeroV :: v))
@byorgey

This comment has been minimized.

Show comment
Hide comment
@byorgey

byorgey Mar 11, 2014

Member

The problem with that is there's no way for type inference to figure out what v is supposed to be. So dimension has to take at least one argument. However, we can probably do something like this (untested):

dimension :: forall a. HasLinearMap (V a) => a -> Int
dimension _ = length (decompose (zeroV :: V a))

so you can ask for the dimension not just of a transformation but of a diagram, a path, etc. etc.

Member

byorgey commented Mar 11, 2014

The problem with that is there's no way for type inference to figure out what v is supposed to be. So dimension has to take at least one argument. However, we can probably do something like this (untested):

dimension :: forall a. HasLinearMap (V a) => a -> Int
dimension _ = length (decompose (zeroV :: V a))

so you can ask for the dimension not just of a transformation but of a diagram, a path, etc. etc.

Show outdated Hide outdated src/Diagrams/Core/Transform.hs Outdated
@jeffreyrosenbluth

This comment has been minimized.

Show comment
Hide comment
@jeffreyrosenbluth

jeffreyrosenbluth Mar 11, 2014

Member

@byorgey s more general version of dimension works well :)

Member

jeffreyrosenbluth commented Mar 11, 2014

@byorgey s more general version of dimension works well :)

byorgey added a commit that referenced this pull request Mar 12, 2014

@byorgey byorgey merged commit 249e57a into master Mar 12, 2014

1 check passed

default The Travis CI build passed
Details

@byorgey byorgey deleted the avg-scale branch Mar 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment