Skip to content

Commit

Permalink
Remove functor references from docs
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Apr 20, 2016
1 parent bbfa4c8 commit 5d3a2b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
9 changes: 0 additions & 9 deletions base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,6 @@ This method runs in `O(m, n, length(I))` time. The HALFPERM algorithm described
F. Gustavson, "Two fast algorithms for sparse matrices: multiplication and permuted
transposition," ACM TOMS 4(3), 250-269 (1978) inspired this method's use of a pair of
counting sorts.
Performance note: As of January 2016, `combine` should be a functor for this method to
perform well. This caveat may disappear when the work in `jb/functions` lands.
"""
function sparse!{Tv,Ti<:Integer}(I::AbstractVector{Ti}, J::AbstractVector{Ti},
V::AbstractVector{Tv}, m::Integer, n::Integer, combine, klasttouch::Vector{Ti},
Expand Down Expand Up @@ -635,9 +632,6 @@ This method implements the HALFPERM algorithm described in F. Gustavson, "Two fa
algorithms for sparse matrices: multiplication and permuted transposition," ACM TOMS
4(3), 250-269 (1978). The algorithm runs in `O(A.m, A.n, nnz(A))` time and requires no
space beyond that passed in.
Performance note: As of January 2016, `f` should be a functor for this method to perform
well. This caveat may disappear when the work in `jb/functions` lands.
"""
function qftranspose!{Tv,Ti}(C::SparseMatrixCSC{Tv,Ti}, A::SparseMatrixCSC{Tv,Ti}, q::AbstractVector, f)
# Attach source matrix
Expand Down Expand Up @@ -743,9 +737,6 @@ and `other` is passed in from the call to `fkeep!`. This method makes a single s
through `A`, requiring `O(A.n, nnz(A))`-time for matrices and `O(nnz(A))`-time for vectors
and no space beyond that passed in. If `trim` is `true`, this method trims `A.rowval` or `A.nzind` and
`A.nzval` to length `nnz(A)` after dropping elements.
Performance note: As of January 2016, `f` should be a functor for this method to perform
well. This caveat may disappear when the work in `jb/functions` lands.
"""
function fkeep!(A::SparseMatrixCSC, f, other, trim::Bool = true)
An = A.n
Expand Down
10 changes: 4 additions & 6 deletions doc/devdocs/promote-op.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ just the input types, ``promote_rule`` will be inadequate.

Fortunately, it's possible to provide such definitions via ``promote_op``::

Base.promote_op{R,S}(::Base.AddFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),1}
Base.promote_op{R,S}(::Base.MulFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2}
Base.promote_op{R,S}(::Base.DotMulFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2}
Base.promote_op{R,S}(::typeof(+), ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),1}
Base.promote_op{R,S}(::typeof(*), ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2}
Base.promote_op{R,S}(::typeof(.*), ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2}

The first one defines the promotion rule for ``+``, and the second one
for ``*``. ``AddFun``, ``MulFun``, and ``DotMulFun`` are "functor
types" defined in `functor.jl
<https://github.com/JuliaLang/julia/blob/master/base/functors.jl>`_.
for ``*``.

It's worth noting that as julia's internal representation of functions
evolves, this interface may change in a future version of Julia.

0 comments on commit 5d3a2b5

Please sign in to comment.