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

RFC: Fix type instability for \ #9196

Closed
wants to merge 2 commits into from
Closed

RFC: Fix type instability for \ #9196

wants to merge 2 commits into from

Conversation

andreasnoack
Copy link
Member

The first of these two commits is a straight forward fix of JuliaLang/LinearAlgebra.jl#152 for 0.3 and it partly fixes the issue for 0.4. However, the type inference problems (see JuliaLang/LinearAlgebra.jl#144) for Triangular on 0.4 requires move work to make \ type stable.

The second commit makes Triangular type stable by introducing a dummy parametric immutable to use for dispatch only. Hence, this pr supersedes #8796. I have decided to use as the name for the dummy type because it is short and fairly easy to type on an American Mac keyboard. Hence, a matrix is declared triangular with Triangular(A,€{:L}) instead of Triangular(A,:L). This change also makes it possible to extract properties from a Factorization in a type stable way, e.g. lufact(A)[€{:L}].

The extra methods doesn't have an impact on the time consumption of the LinAlg test suite and for the performance tests, it improves stockcorr (which was broken again), laplace_vec and vectorize as far as I can see.

@StefanKarpinski
Copy link
Member

Is the part a joke? I really don't think we should be exporting that from Base...

@ivarne
Copy link
Member

ivarne commented Nov 29, 2014

Seems like we need some sort of canonical way to do symbol types for dispatch. In the MIME framework we use string macros and we should have a strong reason for doing this differently in two contexts in Base.

@ivarne ivarne added the linear algebra Linear algebra label Nov 29, 2014
@andreasnoack
Copy link
Member Author

@ivarne I wasn't aware of that so thank you for mentioning that.

@StefanKarpinski I thought this functionality would be useful beyond linear algebra and therefore I'm not joking, although I expected a mixed reception of the suggestion. In JuliaLang/LinearAlgebra.jl#144, we discussed the possibilities and either we'd have to define many method like upperTriangularUnitDiagonal, getQ, getU etc. or many typed like Upper, Lower, Left, Right or, as in this PR, use the type parameters for dispatch which requires a wrapper. Everyone would like the name of the wrapper to be as short as possible and here is winner. Furthermore $ has a long tradition in programming so I thought it be fair to introduce as well.

@nalimilan
Copy link
Member

I've always found that the use of $ everywhere in R was an outrageously American-centric choice. Now Europeans fight back in Julia! And it's good to hear it improves the performance of stockcorr.

Seriously, though, it looks a bit weird, but as in #8450, we're running out of free symbols that are present on a keyboard... Here on mine there are still § and ¤.

@ivarne
Copy link
Member

ivarne commented Nov 30, 2014

Just as we are discussing dispatch on symbols. I haven't yet seen the proposal to make the Symbol type abstract and have all instances of symbols as singleton type. I'll probably get a negative response from Jeff about "killing the type system", but all these ad hoc singleton types for dispatch is also problematic.

@ViralBShah
Copy link
Member

I am not sure I like the notation as much. I wonder if we can have a more self explanatory name.

@StefanKarpinski
Copy link
Member

If the sly reason for using €{:L} here was to warm me up to Val{:L}, mission accomplished – I'm all for Val{:L} over €{:L} any day.

@ViralBShah
Copy link
Member

BTW, I am all for introducing to have a more trans-continental representation of symbols. My vote is for the Indian Rupee symbol . :-)

@andreasnoack
Copy link
Member Author

@StefanKarpinski Val is fine with me although it is a bit longer. The main issue here is to introduce the dispatch on construction that makes these special linear algebra types work nicely with the type system. The name is secondary, so I'll change it Val is people agree on that name.

@ViralBShah I've forgotten how to type the Rupee symbol on my Mac.

@pao
Copy link
Member

pao commented Nov 30, 2014

Seriously, though, it looks a bit weird, but as in #8450, we're running out of free symbols that are present on a keyboard

On some keyboards. The Euro symbol is not available on EN-US keyboards. Is there a TeX-style input string for this character defined already?

@vchuravy
Copy link
Member

@pao \euro works on the Julia REPL

@andreasnoack
Copy link
Member Author

It's option+shift+2 on a US MacBook. I don't have access to a Windows machine, but a brief search suggests that either right Alt+5 or Ctrl+Alt+e should work for US Windows layout.

@ViralBShah I cannot get \Rupee or \rupee to tab-complete in the REPL. I'm I really the first to encounter this bug?

@ViralBShah
Copy link
Member

Some googling suggests that you have to have an English(India) keyboard layout for the Rupee key bindings. I think we should perhaps get all the currency tab completions in the REPL. Open a separate issue for that?

@andreasnoack
Copy link
Member Author

Superseded by #9779

@andreasnoack andreasnoack deleted the anj/ts branch March 6, 2015 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants