On Sun, Dec 13, 2015 at 7:06 PM, Dominique Orban
wrote:
> I'm writing Julia functions to perform a sparse matrix factorization and I'm
> wondering if what I'm observing is a manifestation of type instability. I'm
> using Julia 0.4 so I can use @code_warntype, but it's
I'm writing Julia functions to perform a sparse matrix factorization and
I'm wondering if what I'm observing is a manifestation of type instability.
I'm using Julia 0.4 so I can use @code_warntype, but it's surprisingly
quiet and doesn't reveal much (there are no ANYs or UNIONs; the "Variables"
In the Rational.jl
https://github.com/JuliaLang/julia/blob/master/base/rational.jl :
In Line 8: `num == den == zero(T)` uses `zero(T)` to represent 0
In Line 9: `g = den 0` uses `0` to represent 0
Why this difference? My intuition tells me that in Line 8, it can be
replaced by 0 without
There shouldn't be any penalty:
julia foo(x) = x == 0
foo (generic function with 1 method)
julia foo2(x) = x == zero(x)
foo2 (generic function with 1 method)
julia @code_llvm foo(3.2)
define i1 @julia_foo_21071(double) {
top:
%1 = fcmp oeq double %0, 0.00e+00
ret i1 %1
}
julia
One is being returned, the other isn't. You cannot change line 8 without
causing the returned type to depend on the value.
On Aug 16, 2015, at 10:10 AM, Sisyphuss zhengwend...@gmail.com wrote:
In the Rational.jl :
In Line 8: `num == den == zero(T)` uses `zero(T)` to represent 0
In Line
Sorry, yes, I misread the example. They're both fine with just 0.
On Aug 16, 2015, at 2:32 PM, Stefan Karpinski stefan.karpin...@gmail.com
wrote:
One is being returned, the other isn't. You cannot change line 8 without
causing the returned type to depend on the value.
On Aug 16, 2015,
In your definition I think you meant type stability, not type instability.
To be completely explicit, a function is type-stable if you can calculate the
return type(s) of all outputs from the types of the inputs. If you have to
look at the actual values of the inputs, it's not type-stable.
Hey Tim,
Thanks for the answer. I think I meant what I stated in the definition. A
function is type instable if return types depend on input types.
I guess the question I really want to get an answer to is whether or not
functions like this will make it difficult for the compiler to emit
Hey Spencer,
A function is defined to be type stable if the return types depend only on
the input types.
-- John
On Jun 30, 2014, at 9:51 AM, Tim Holy tim.h...@gmail.com wrote:
In your definition I think you meant type stability, not type
instability.
To be completely explicit, a
On Monday, June 30, 2014 09:54:43 AM Spencer Lyon wrote:
Hey Tim,
Thanks for the answer. I think I meant what I stated in the definition. A
function is type instable if return types depend on input types.
No, that's not right. Think about the + function: if you add a Float64 +
Float64, you
Ha, you guys are totally right.
Sorry about that Tim, I was wrong there.
Thanks for clearing it up, John.
On Monday, June 30, 2014 12:56:10 PM UTC-4, John Myles White wrote:
Hey Spencer,
A function is defined to be type stable if the return types depend only
on the input types.
--
11 matches
Mail list logo