Comments (3)
BTW, the quick-and-dirty "fix" is to copy LinearAlgebra and insert this all over the place:
julia> LinearAlgebra.require_one_based_indexing(zeros(3))
true
julia> LinearAlgebra.require_one_based_indexing(zeros(0:2))
ERROR: ArgumentError: offset arrays are not supported but got an array with index other than 1
(Only exists on Julia 1.2 & up, obviously trivial to roll your own.) Of course better to fix things to allow offsets, but not a bad first step to forbid them.
from logexpfunctions.jl.
Agreed, using Base.require_one_based_indexing
would be an improvement over the current state of affairs. It's documented in the devdocs, though as you say only available on Julia 1.2 and up.
What is zeros(0:2)
? On Julia 1.5.3 and 1.6 I get an error:
julia> zeros(0:2)
ERROR: MethodError: no method matching zeros(::Type{Float64}, ::Tuple{UnitRange{Int64}})
Closest candidates are:
zeros(::Type{T}, ::Union{Integer, AbstractUnitRange}...) where T at array.jl:521
zeros(::Type{T}, ::Tuple{}) where T at array.jl:529
zeros(::Type{T}, ::Tuple{Vararg{Integer,N}}) where {T, N} at array.jl:524
...
Stacktrace:
[1] zeros(::Tuple{UnitRange{Int64}}) at ./array.jl:522
[2] zeros(::UnitRange{Int64}) at ./array.jl:520
[3] top-level scope at REPL[13]:1
``
from logexpfunctions.jl.
I think it would be almost as simple to just fix all the loops to loop over the values instead of the indices.
from logexpfunctions.jl.
Related Issues (20)
- Add `logsumexp!(r, X)` (which behaves like sum!) HOT 1
- xexpx(z) HOT 1
- [FR] smoothed log sum implementation HOT 1
- Weighted logsumexp HOT 1
- logcosh HOT 12
- logsumexp(::SVector) allocates HOT 5
- clarify ChainRulesCore.jl integration
- `log1pmx` and `logmxp1` cannot be differentiated by `ForwardDiff` HOT 7
- `log1pmx`and `logmxp1` are probably not optimized for `Float32` and `Float16`
- `logabsgamma` doesn't work with ForwardDiff HOT 2
- logsoftmax
- `logsumexp(f, x)` (and `logsumexp!(f, out, x)`) HOT 1
- Issue with `logsumexp` with ForwardDiff (and -Inf values) HOT 1
- logaddexp introduces NaNs for non-finite values HOT 1
- 1.9-beta4 Extension errors: HOT 2
- Error during loading of extension HOT 1
- `init` keyword for `logsumexp` and co HOT 2
- `logabssinh`
- Citation?
- Support for `Num` from `Symbolics.jl` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logexpfunctions.jl.