-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Multidimensional arrays with one dimension of length zero #1245
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
Labels
won't change
Indicates that work won't continue on an issue or pull request
Comments
It's definitely important to allow. The size of a dimension might reflect, for example, the number of apples you have, and you might have zero apples. Functions not handling length-zero dimensions properly is a common source of bugs though. Just have to be careful. |
On reflection, this does make sense in a mathematical way, it just rubs against my previous more programming-oriented thinking. Thanks! |
jishnub
added a commit
that referenced
this issue
Apr 23, 2025
) Stdlib: LinearAlgebra URL: https://github.com/JuliaLang/LinearAlgebra.jl.git Stdlib branch: master Julia branch: master Old commit: 1ce8426 New commit: 07725da Julia version: 1.13.0-DEV LinearAlgebra version: 1.12.0(Does not match) Bump invoked by: @jishnub Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/LinearAlgebra.jl@1ce8426...07725da ``` $ git log --oneline 1ce8426..07725da 07725da Branch on `Bool` `alpha` in scaling `mul!` (#1286) 61e444d Fix exponentiation with immutable matrix (#1289) 77475c1 Fix `lmul!`/`rmul!` for 0-sized matrices (#1290) c3d35c0 Test for `versioninfo` with `ENV` variable (#1279) 830ea2f Fit broken matmul test (#1288) 222f7f2 Propagate inbounds in diagzero (#1285) e65e75c Clean up `herk_wrapper!` and add 5-arg tests (#1254) ece1962 `versioninfo`: simplify, improve type stability (#1274) 3e525a8 Speicalize `copy!` for triangular, and use `copy!` in `ldiv` (#1263) 763f19f Forward scaling `lmul!`/`rmul!` for `Tridiagonal` to bands (#1284) 2d27d1c Explicit loop in converting `Bidiagonal`/`Tridiagonal` to `Matrix` (#1283) 0671a7b Simplify small Bidiagonal-AbstractVecOrMat multiplication (#1278) a8fd121 Test for empty `Symmetric` and `BlasFlag.NONE` (#1280) 6e2de14 Remove bounds-checking in `Bidiagonal` `rdiv!` (#1281) 4a8fc62 Test for 5-arg `mul!` c437beb Test for empty `Symmetric` and `BlasFlag.NONE` 7a891e9 Test for `versioninfo` with `ENV` variable 84fd21b Test for `versioninfo` (#1276) 243efdb `AbstractQ` bugfix: define `Base.IteratorSize` (#1277) 6073f28 Ease inference in `Bidiagonal` divmul tests (#1273) 30cb5d6 Avoid copy in empty bidiag `ldiv!` (#1275) 5d3ef46 Skip symmetry check in converting Symmetric to SymTridiagonal (#1269) ae5385b Specialize `isreal` for banded matrices (#1271) 0a253be Explicit loop in `_iszero` for strided views (#1264) 3f46f5f `istril`/`istriu` for opposite triangularity (#1265) cd048eb Tests for `mul!` scaling with mismatched axes (#1266) 26db4c8 Restrict tests to `Number` eltypes 8b21ca6 Tests for `mul!` scaling with mismatched axes 9675c38 Fix minimum band for `UpperTriangular`/`Lowertriangular` aeeed7d Add unit triangular tests 3e1aaac Add banded tests 7fdfb3b Add tests d866014 istril/istriu for opposite triangularity 925acef Return view in `_diag` for `Bidiagonal` (#1258) b1bcca1 Branch on `Bool` `alpha` in diagonal matmul (#1256) e3e9987 `peakflops`: make `eltype` a static parameter of the method (#1253) 781eb5d `peakflops`: make the element type a static parameter of the method e53b50c use smaller matrix size in `peakflops` on 32-bit (#1255) 0c87d0d use smaller matrix size in `peakflops` on 32-bit 0cbf85f Check approx equality in bunchkaufman docstring (#1251) 5e53d12 Avoid accessing unset indices in symmetric copyto! (#1244) e64a3df fix dispatch to herk (#1247) bfdb742 Destination zeros from eltype in zero-length generic_matvecmul (#1241) 16dedb5 Remove redundant adjoint/transpose methods for Symmetric/Hermitian (#1245) 7f1dfe4 stop assuming that you can mutate data structures in other packages at precompile time (#1252) ``` Co-authored-by: jishnub <[email protected]>
LebedevRI
pushed a commit
to LebedevRI/julia
that referenced
this issue
May 2, 2025
…iaLang#58180) Stdlib: LinearAlgebra URL: https://github.com/JuliaLang/LinearAlgebra.jl.git Stdlib branch: master Julia branch: master Old commit: 1ce8426 New commit: 07725da Julia version: 1.13.0-DEV LinearAlgebra version: 1.12.0(Does not match) Bump invoked by: @jishnub Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/LinearAlgebra.jl@1ce8426...07725da ``` $ git log --oneline 1ce8426..07725da 07725da Branch on `Bool` `alpha` in scaling `mul!` (JuliaLang#1286) 61e444d Fix exponentiation with immutable matrix (JuliaLang#1289) 77475c1 Fix `lmul!`/`rmul!` for 0-sized matrices (JuliaLang#1290) c3d35c0 Test for `versioninfo` with `ENV` variable (JuliaLang#1279) 830ea2f Fit broken matmul test (JuliaLang#1288) 222f7f2 Propagate inbounds in diagzero (JuliaLang#1285) e65e75c Clean up `herk_wrapper!` and add 5-arg tests (JuliaLang#1254) ece1962 `versioninfo`: simplify, improve type stability (JuliaLang#1274) 3e525a8 Speicalize `copy!` for triangular, and use `copy!` in `ldiv` (JuliaLang#1263) 763f19f Forward scaling `lmul!`/`rmul!` for `Tridiagonal` to bands (JuliaLang#1284) 2d27d1c Explicit loop in converting `Bidiagonal`/`Tridiagonal` to `Matrix` (JuliaLang#1283) 0671a7b Simplify small Bidiagonal-AbstractVecOrMat multiplication (JuliaLang#1278) a8fd121 Test for empty `Symmetric` and `BlasFlag.NONE` (JuliaLang#1280) 6e2de14 Remove bounds-checking in `Bidiagonal` `rdiv!` (JuliaLang#1281) 4a8fc62 Test for 5-arg `mul!` c437beb Test for empty `Symmetric` and `BlasFlag.NONE` 7a891e9 Test for `versioninfo` with `ENV` variable 84fd21b Test for `versioninfo` (JuliaLang#1276) 243efdb `AbstractQ` bugfix: define `Base.IteratorSize` (JuliaLang#1277) 6073f28 Ease inference in `Bidiagonal` divmul tests (JuliaLang#1273) 30cb5d6 Avoid copy in empty bidiag `ldiv!` (JuliaLang#1275) 5d3ef46 Skip symmetry check in converting Symmetric to SymTridiagonal (JuliaLang#1269) ae5385b Specialize `isreal` for banded matrices (JuliaLang#1271) 0a253be Explicit loop in `_iszero` for strided views (JuliaLang#1264) 3f46f5f `istril`/`istriu` for opposite triangularity (JuliaLang#1265) cd048eb Tests for `mul!` scaling with mismatched axes (JuliaLang#1266) 26db4c8 Restrict tests to `Number` eltypes 8b21ca6 Tests for `mul!` scaling with mismatched axes 9675c38 Fix minimum band for `UpperTriangular`/`Lowertriangular` aeeed7d Add unit triangular tests 3e1aaac Add banded tests 7fdfb3b Add tests d866014 istril/istriu for opposite triangularity 925acef Return view in `_diag` for `Bidiagonal` (JuliaLang#1258) b1bcca1 Branch on `Bool` `alpha` in diagonal matmul (JuliaLang#1256) e3e9987 `peakflops`: make `eltype` a static parameter of the method (JuliaLang#1253) 781eb5d `peakflops`: make the element type a static parameter of the method e53b50c use smaller matrix size in `peakflops` on 32-bit (JuliaLang#1255) 0c87d0d use smaller matrix size in `peakflops` on 32-bit 0cbf85f Check approx equality in bunchkaufman docstring (JuliaLang#1251) 5e53d12 Avoid accessing unset indices in symmetric copyto! (JuliaLang#1244) e64a3df fix dispatch to herk (JuliaLang#1247) bfdb742 Destination zeros from eltype in zero-length generic_matvecmul (JuliaLang#1241) 16dedb5 Remove redundant adjoint/transpose methods for Symmetric/Hermitian (JuliaLang#1245) 7f1dfe4 stop assuming that you can mutate data structures in other packages at precompile time (JuliaLang#1252) ``` Co-authored-by: jishnub <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I searched but couldn't find an issue on this, my apologies if I missed it.
I'm somewhat surprised that I can do the following:
Why would it ever be useful to have a dimension of length zero? If it is never useful, why is it allowed?
The text was updated successfully, but these errors were encountered: