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

cumprod and prod multiply in opposite order #3574

Closed
jasonmorton opened this issue Jun 28, 2013 · 2 comments
Closed

cumprod and prod multiply in opposite order #3574

jasonmorton opened this issue Jun 28, 2013 · 2 comments

Comments

@jasonmorton
Copy link

cumprod and prod multiply in the opposite order, which means they disagree for non-commutative products such as matrix multiplication.

julia> *(a::String,b::String) = string("(",a,"*",b,")")
julia> cumprod(split("a b c"))[3]
 "(c*(b*a))"
julia> prod(split("a b c"))
"((a*b)*c)"

I noticed this while computing a cumulative matrix product.

@StefanKarpinski
Copy link
Sponsor Member

I really enjoy this use of the fact that * for strings is concatenation.

@StefanKarpinski
Copy link
Sponsor Member

Oh, I misread – that's not quite what's going on, but this is still a cool way to demonstrate the issue.

KristofferC pushed a commit that referenced this issue Sep 5, 2023
Stdlib: Pkg
URL: https://github.com/JuliaLang/Pkg.jl.git
Stdlib branch: master
Julia branch: master
Old commit: 047734e4c
New commit: f570abd39
Julia version: 1.11.0-DEV
Pkg version: 1.11.0
Bump invoked by: @KristofferC
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/Pkg.jl@047734e...f570abd

```
$ git log --oneline 047734e4c..f570abd39
f570abd39 tweak how Pkg is loaded for precompiling when testing (#3606)
d3bd38b90 sort compat entries in `pkg> compat` (#3605)
5e07cfed0 Ensure that `string(::VersionSpec)` is compatible with `semver_spec()` (#3580)
6bed7c41a Clarify handling of LOAD_PATH in docstring and REPL help (#3589)
5261b3be7 tweak test dep docs (#3574)
72b430d50 status: expand 2 symbol upgrade note to highlight *may* be upgradable (#3576)
b32db473d precompile: show ext parent in output report (#3603)
```

Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
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