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

ScaledMap issue for Unitful scaling factors #195

Open
JeffFessler opened this issue Dec 1, 2022 · 1 comment
Open

ScaledMap issue for Unitful scaling factors #195

JeffFessler opened this issue Dec 1, 2022 · 1 comment

Comments

@JeffFessler
Copy link
Member

Some of this package works fine with Unitful values thanks to its support for Numbers.
But maybe it hasn't actually been tested with Unitful values.
Now I am trying to use it with some and hit my first issue:

M = ones(3,2) * m
L = LinearMap(M)
Matrix(L) # works fine
S = 1s * L # runs, but has wrong eltype
Matrix(S) # throws

I think the issue is here:

ScaledMap{Base.promote_op(*, typeof(λ), eltype(lmap))}(λ, lmap)

I may know how to fix so I'll aim for a PR.

FWIW, the docstring for promote_op says "Due to its fragility, use of promote_op should be avoided."

@JeffFessler
Copy link
Member Author

Actually it is more subtle than I thought at first. Because Unitful values are Numbers but not Real, it is using the "non-commuting" constructor rather than a ScaledMap here:

function Base.:(*)(α::Number, A::LinearMap)

Still working on it...

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