<p dir="auto">Broken on both release-0.3 and 0.4-dev:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; [1 1; 1 1] .* [1, 1]
2x2 Array{Int64,2}:
 1  1
 1  1

julia&gt; sparse([1 1; 1 1]) .* [1, 1]
ERROR: DimensionMismatch(&quot;&quot;)
 in .* at sparse/sparsematrix.jl:568
 in .* at sparse/sparsematrix.jl:669

julia&gt; [1, 1] .* [1 1; 1 1]
2x2 Array{Int64,2}:
 1  1
 1  1

julia&gt; [1, 1] .* sparse([1 1; 1 1])
ERROR: DimensionMismatch(&quot;&quot;)
 in .* at sparse/sparsematrix.jl:568
 in .* at sparse/sparsematrix.jl:670"><pre class="notranslate">julia<span class="pl-k">&gt;</span> [<span class="pl-c1">1</span> <span class="pl-c1">1</span>; <span class="pl-c1">1</span> <span class="pl-c1">1</span>] <span class="pl-k">.*</span> [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>]
<span class="pl-c1">2</span>x2 Array{Int64,<span class="pl-c1">2</span>}<span class="pl-k">:</span>
 <span class="pl-c1">1</span>  <span class="pl-c1">1</span>
 <span class="pl-c1">1</span>  <span class="pl-c1">1</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">sparse</span>([<span class="pl-c1">1</span> <span class="pl-c1">1</span>; <span class="pl-c1">1</span> <span class="pl-c1">1</span>]) <span class="pl-k">.*</span> [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>]
ERROR<span class="pl-k">:</span> <span class="pl-c1">DimensionMismatch</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>)
 <span class="pl-k">in</span> <span class="pl-k">.*</span> at sparse<span class="pl-k">/</span>sparsematrix<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">568</span>
 <span class="pl-k">in</span> <span class="pl-k">.*</span> at sparse<span class="pl-k">/</span>sparsematrix<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">669</span>

julia<span class="pl-k">&gt;</span> [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>] <span class="pl-k">.*</span> [<span class="pl-c1">1</span> <span class="pl-c1">1</span>; <span class="pl-c1">1</span> <span class="pl-c1">1</span>]
<span class="pl-c1">2</span>x2 Array{Int64,<span class="pl-c1">2</span>}<span class="pl-k">:</span>
 <span class="pl-c1">1</span>  <span class="pl-c1">1</span>
 <span class="pl-c1">1</span>  <span class="pl-c1">1</span>

julia<span class="pl-k">&gt;</span> [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>] <span class="pl-k">.*</span> <span class="pl-c1">sparse</span>([<span class="pl-c1">1</span> <span class="pl-c1">1</span>; <span class="pl-c1">1</span> <span class="pl-c1">1</span>])
ERROR<span class="pl-k">:</span> <span class="pl-c1">DimensionMismatch</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>)
 <span class="pl-k">in</span> <span class="pl-k">.*</span> at sparse<span class="pl-k">/</span>sparsematrix<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">568</span>
 <span class="pl-k">in</span> <span class="pl-k">.*</span> at sparse<span class="pl-k">/</span>sparsematrix<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">670</span></pre></div>
<p dir="auto">I'm pretty sure this worked as of v0.2.</p>
<p dir="auto">I'm fiddling with sparse matrices and have found a few quirks :-)</p>
<p dir="auto">What I pretend to do is use LU factorization in sparse matrices (for now in real matrices, but I hope to get it done also in sparse complex matrices)</p>
<p dir="auto">First, in the manual, in the Linear Algebra section (<a href="http://docs.julialang.org/en/release-0.3/stdlib/linalg/" rel="nofollow">http://docs.julialang.org/en/release-0.3/stdlib/linalg/</a>) there is the relation between the L and U factors (in the case of F=lufact(A) operation they are named/extracted as F[:L] and F[:U] )  and a line and column permutation of the factorized sparse matrix A that reads as<br>
<code class="notranslate"><br>
F[:L] * F[:U] == Rs .* A[F[:p], F[:q]]<br>
</code><br>
It seems to me (according to the explanation in that section) that it should read as<br>
<code class="notranslate"><br>
F[:L] * F[:U] == F[:Rs]  .* A[F[:p], F[:q]]<br>
</code><br>
because Rs doesn't exist per se (it has to be extracted from the object F, and so is  F[:Rs]).</p>
<p dir="auto">Aside that typo, additionally the RHS of that expression when evaluated gives an error due to a mismatch in dimensions. Indeed there is not a perfect equivalence/behavior of the .* operator (this doesn't happen with the .+ operator, for example) in real and in complex matrices, as the session below clearly shows. I end that session with an example of the failure, by applying lufact() and exemplifying the error.</p>
<p dir="auto">I checked the code around "sparse/sparsematrix.jl:531" where the error is triggered and there is a check of conformant dimensions for matrix dot product .* (and of other operators)</p>
<pre class="notranslate">       .............
           if size(A,1) != size(B,1) || size(A,2) != size(B,2)
                throw(DimensionMismatch(""))            # line 531 of the source code
            end
       ...............
</pre>
<p dir="auto">(where A and B are the operands) which means that the .* operator  only accepts operands with the same dimensions. I think that it is what triggers the error.</p>
<p dir="auto">But then this configures a different behavior for .* in sparse and non sparse matrix representations.</p>
<p dir="auto">Below is a session with julia 0.3.0 running in windows 7 in AMD 8-core Piledriver processor where the above cases are visible, with added comments. I experimented in julia 0.2.1 in Linux-Ubuntu (over Virtualbox) and the behavior of .* is the same as in windows 7; however, in 0.2.1 lufact() is not implemented for sparses, so I could not check it.</p>
<pre class="notranslate"># H and v are a matrix and a vector, Hs and vs the corresponding sparse objects.

julia&gt; H=[1 0; 2 -1.0]
2x2 Array{Float64,2}:
 1.0   0.0
 2.0  -1.0

julia&gt; v=[2,3.0]
2-element Array{Float64,1}:
 2.0
 3.0

julia&gt; Hs=sparse(H)
2x2 sparse matrix with 3 Float64 entries:
        [1, 1]  =  1.0
        [2, 1]  =  2.0
        [2, 2]  =  -1.0

julia&gt; vs=sparse(v)
2x1 sparse matrix with 2 Float64 entries:
        [1, 1]  =  2.0
        [2, 1]  =  3.0

julia&gt; v .* H
2x2 Array{Float64,2}:
 2.0   0.0
 6.0  -3.0

julia&gt; v .* Hs
ERROR: DimensionMismatch("")
 in .* at sparse/sparsematrix.jl:531

julia&gt; vs .* H
ERROR: DimensionMismatch("")
 in .* at sparse/sparsematrix.jl:531

julia&gt; vs .* Hs
ERROR: DimensionMismatch("")
 in .* at sparse/sparsematrix.jl:531

# product * is OK

julia&gt; H * Hs
2x2 Array{Float64,2}:
 1.0  0.0
 0.0  1.0

julia&gt; Hs * H
2x2 Array{Float64,2}:
 1.0  0.0
 0.0  1.0

# does difference in sizes of v and vs explain something?

julia&gt; size(H)
(2,2)

julia&gt; size(Hs)
(2,2)

julia&gt; size(v)
(2,)

julia&gt; size(vs)
(2,1)

## the .+ operator is OK with mismatch in operand dimensions (sparse or not)

julia&gt; v .+ H
2x2 Array{Float64,2}:
 3.0  2.0
 5.0  2.0

julia&gt; v .+ Hs
2x2 Array{Float64,2}:
 3.0  2.0
 5.0  2.0

julia&gt; vs .+ H
2x2 Array{Float64,2}:
 3.0  2.0
 5.0  2.0

julia&gt; vs .+ Hs
2x2 Array{Float64,2}:
 3.0  2.0
 5.0  2.0

# for conformant sparse operands is OK

julia&gt; Hs .* Hs
2x2 sparse matrix with 3 Float64 entries:
        [1, 1]  =  1.0
        [2, 1]  =  4.0
        [2, 2]  =  1.0

# now we lufact(Hs) and show the problem with F[:Rs] .* A[F[:p], F[:q]]

julia&gt; S=lufact(Hs)
UMFPACK LU Factorization of a 2-by-2 sparse matrix
Ptr{Void} @0x0000000020c65560


julia&gt; S[:L]
2x2 sparse matrix with 2 Float64 entries:
        [1, 1]  =  1.0
        [2, 2]  =  1.0

julia&gt; S[:U]
2x2 sparse matrix with 3 Float64 entries:
        [1, 1]  =  -0.333333
        [1, 2]  =  0.666667
        [2, 2]  =  1.0

julia&gt; S[:p]
2-element Array{Int64,1}:
 2
 1

julia&gt; S[:q]
2-element Array{Int64,1}:
 2
 1

julia&gt; S[:Rs]
2-element Array{Float64,1}:
 1.0
 0.333333

julia&gt; Hsperm=Hs[S[:p],S[:q]]
2x2 sparse matrix with 3 Float64 entries:
        [1, 1]  =  -1.0
        [1, 2]  =  2.0
        [2, 2]  =  1.0

julia&gt; S[:Rs] .* Hsperm
ERROR: DimensionMismatch("")
 in .* at sparse/sparsematrix.jl:531

</pre>