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

promote integer types for LAPACK routines #134

Closed
StefanKarpinski opened this issue Jul 19, 2011 · 4 comments
Closed

promote integer types for LAPACK routines #134

StefanKarpinski opened this issue Jul 19, 2011 · 4 comments
Assignees

Comments

@StefanKarpinski
Copy link
Sponsor Member

@HomerReid wrote:

eig() fails for integer matrices:

 julia> eig([1 2; 2 1])
 no method eig(Array{Int32,2},)
 in method_missing, boot.j:250
 in run_repl, /home/homer/hacking/julia/j/client.j:23
 in _start, /home/homer/hacking/julia/j/client.j:153

The solution is to add promotions for Real types in the lapack macros.

@ghost ghost assigned StefanKarpinski Jul 19, 2011
@ViralBShah
Copy link
Member

But, we'd have to change each BLAS/LAPACK/ARPACK macro and such. Isn't there a simpler way?

@StefanKarpinski
Copy link
Sponsor Member Author

See the discussion in #133.

@ViralBShah
Copy link
Member

Let's say we have a promotion rule from Array{Int32} to Array{Float32}, and foo(Array{Float32}).

If I now call foo(Array{Int32}), will julia automatically do the promotion and then call foo on the promoted value?

@StefanKarpinski
Copy link
Sponsor Member Author

No, that's not how our promotions work. Promotions are only for combinations of operands; things like +(Int64, Float64), in which situation both operands get converted to the smallest common supertype — in this case, Float64. For "promoting" array arguments, we would just define the following method:

foo{T<:Real}(x::Array{T}) = foo(float(x))

That's it. That method will get called for any real-valued array that doesn't have a specific implementation already defined, and first convert x to an array of floats (assuming proper vectorization of the float function, which isn't there yet, but should be), and then calls the core foo implementation for floats on it.

ViralBShah added a commit that referenced this issue Aug 20, 2011
…issue #134

Complex array of other types, and subarrays of other types have yet to be addressed.
@ghost ghost assigned ViralBShah Dec 1, 2011
vtjnash pushed a commit to vtjnash/julia that referenced this issue Dec 31, 2011
* 'master' of github.com:JuliaLang/julia:
  Working sparse \
  small fix to suitesparse build.
  Build SuiteSparse. Still need to resolve LAPACK symbols.
  Use lu! for economy mode. No economy argument to lu any more. lu is implemented using lu! Close JuliaLang#272.
  Specialize the conversion for integer arrays as the real case led to stack overflow in the earlier commit.
  Promote all non-float arrays to float for lapack function calls (both real and complex cases) Fix bug in calling complex qr close JuliaLang#134
  ode23 is quite decent. ode45 seems ok, but may need some code cleanup and performance testing. Both need a few more function signatures - but good enough to get started.
  Implement select(k) using quickselect Separate stats stuff into statistics.j Implement median using select
  Almost working quickselect that will pave the way for median and order statistics.
StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
srand([rng], [seed]) and rand([rng], ...) functions
KristofferC pushed a commit to KristofferC/julia that referenced this issue Feb 18, 2018
don't emit compat constraints for stdlib packages
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
Keno pushed a commit that referenced this issue Oct 9, 2023
vtjnash pushed a commit that referenced this issue Dec 8, 2023
Stdlib: Statistics
URL: https://github.com/JuliaStats/Statistics.jl.git
Stdlib branch: master
Julia branch: jn/loading-stdlib-exts
Old commit: 04e5d89
New commit: 68869af
Julia version: 1.11.0-DEV
Statistics version: 1.11.1(Does not match)
Bump invoked by: @vtjnash
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaStats/Statistics.jl@04e5d89...68869af

```
$ git log --oneline 04e5d89..68869af
68869af Bump patch for version 1.11.1
89f5fc7 Create tagbot.yml
dc844db CI: restore v1.9.4 to build matrix (#159)
d0523ae relax test for mapreduce_empty (#156)
d1c1c42 Drop support for v1.9 in CI (#157)
bfc6326 Fix `quantile` with `Date` and `DateTime` (#153)
b8ea3d2 Prevent overflow in `mean(::AbstractRange)` and relax type constraint. (#150)
a88ae4f Document MATLAB behavior in `quantile` docstring (#152)
46290a0 Revert "Prepare standalone package, step 2 (#128)" (#148)
81a90af make SparseArrays a weak dependency (#134)
```

Co-authored-by: Dilum Aluthge <[email protected]>
NHDaly added a commit that referenced this issue May 22, 2024
Fixes #52262.

Performs `^(x, y)` but throws OverflowError on overflow.

Example:
```julia
julia> 2^62
4611686018427387904

julia> 2^63
-9223372036854775808

julia> checked_pow(2, 63)
ERROR: OverflowError: 2147483648 * 4294967296 overflowed for type Int64
```

Co-authored-by: Nathan Daly <[email protected]>
Co-authored-by: Jameson Nash <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Tomáš Drvoštěp <[email protected]>
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

2 participants