Skip to content

Commit 7da5597

Browse files
Apply suggestions from code review
Co-authored-by: Johnny Chen <johnnychen94@hotmail.com>
1 parent 7155c33 commit 7da5597

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ operations will "just work" on `AbstractRGB`, `AbstractGray`
5252
(`OpaqueColor{T,1}`), `TransparentRGB`, and `TransparentGray` objects.
5353
(See definitions for the latter inside of `ColorTypes`).
5454

55-
However, there are some additional operations.
55+
However, there are some additional operations that you may need to distinguish carefully.
5656

5757
### Multiplication
5858

@@ -64,13 +64,14 @@ This package supports three different notions of multiplication: the inner produ
6464
julia> c1, c2 = RGB(0.2, 0.3, 0.4), RGB(0.5, 0.3, 0.2)
6565
(RGB{Float64}(0.2,0.3,0.4), RGB{Float64}(0.5,0.3,0.1))
6666

67-
julia> c1c2 # or dot(c1, c2)
67+
julia> c1c2 # \cdot<TAB> # or dot(c1, c2)
6868
0.09000000000000001
6969

70-
julia> c1c2 # or hadamard(c1, c2)
70+
# This is equivelant to `mapc(*, c1, c2)`
71+
julia> c1c2 # \odot<TAB> # or hadamard(c1, c2)
7172
RGB{Float64}(0.1,0.09,0.08000000000000002)
7273

73-
julia> c1c2 # or tensor(c1, c2)
74+
julia> c1c2 # \otimes<TAB> # or tensor(c1, c2)
7475
RGBRGB{Float64}(
7576
0.1 0.06 0.04000000000000001
7677
0.15 0.09 0.06
@@ -79,13 +80,14 @@ RGBRGB{Float64}(
7980

8081
Note that `c1⋅c2 = (c1.r*c2.r + c1.g*c2.g + c1.b*c2.b)/3`, where the division by 3 ensures the equivalence of `x`, `Gray(x)`, and `RGB(x, x, x)` for scalar `x` as described above for `norm`.
8182

82-
It is not obvious that one of these should be the default notion of multiplication, so the ordinary multiplication operation `*` is undefined for RGB colors.
83-
(It is defined for grayscale.)
83+
It is designed to not support the ordinary multiplication operation `*` because it is not obvious which one of these should be the default option.
84+
85+
However, `*` is defined for grayscale since all these three multiplication operations (i.e., ``, `` and ``) are equivalent in the 1D vector space.
8486

8587
### Variance
8688

8789
The variance `v = E((c - μ)^2)` (or its bias-corrected version) involves a multiplication,
88-
and consistent with the above you must specify which sense of multiplication you wish to use:
90+
and to be consistent with the above you must specify which sense of multiplication you wish to use:
8991

9092
```julia
9193
julia> cs = [c1, c2]

0 commit comments

Comments
 (0)