Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/StatsAPI.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
module StatsAPI

# pairwise(f, x[, y])
#
# Return a matrix holding the result of applying `f` to all possible pairs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure it will always be a matrix? Maybe it should be a more general n-dimensional pairwise (but admittedly then it should probably be tuple-wise)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular as x and y are allowed to be any iterators what should happen with a 0-dimensional iterator (e.g. when x is a number)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure it will always be a matrix? Maybe it should be a more general n-dimensional pairwise (but admittedly then it should probably be tuple-wise)

"pairwise" seems to imply there are only two elements, right? IIRC we mentioned the possibility of having a more general outer function, but I find pairwise nicer to compute pairwise correlations, and it's already used by Distances.

In particular as x and y are allowed to be any iterators what should happen with a 0-dimensional iterator (e.g. when x is a number)

Well the number of dimensions of the iterator doesn't matter, only the number of elements it contains. So a number gives a 1×1 matrix.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

# of entries in iterators `x` and `y`, and return it.
#
# This generic function is owned by StatsBase.jl, which is the sole provider
# of the default definition.
function pairwise end

# pairwise!(f, dest::AbstractMatrix, x[, y])
#
# Store in matrix `dest` the result of applying `f` to all possible pairs
# of entries in iterators `x` and `y`, and return it.
#
# This generic function is owned by StatsBase.jl, which is the sole provider
# of the default definition.
function pairwise! end

end # module