Frank Wilcoxon's 1945 paper [1] described two tests -- for "Unpaired Experiments" and "Paired Comparisons" which have come to be called the (Wilcoxon) rank sum test and the (Wilcoxon) signed rank test respectively.
So the first test is for independent (unpaired) samples and the second is for paired samples*.
* It can also be used for comparing single samples from a symmetric distribution versus some specified center of location.
The test for comparing unpaired samples was extended by Mann and Whitney in 1947. They organized it in a way that may at first seem like a different test, though the tests turn out to be equivalent. [A number of other authors suggested the same idea around the same time as Wilcoxon -- or even a bit earlier. Nevertheless the test is generally named for Wilcoxon or Mann and Whitney or both]
However, you seem to be familiar with the rank sum test so I will now focus on the signed rank test.
In the same way that the rank sum test corresponds (more or less) to an ordinary two-sample t-test, the signed rank test corresponds to a one-sample t-test on paired differences. In this case the differences are ranked in magnitude (i.e. without regard to sign) then the ranks that correspond to positive differences are summed.
This is compared with the distribution of the same statistic if the pair labels had be allocated to the pair-members arbitrarily (because if they come from the same population distribution their pair differences should be symmetrically distributed about 0, and the sign that goes with each rank would then be equally likely to be + or - when the null is true.
Conversely when the populations are different in distribution in a way that tends to make one sample larger, the statistic should tend to be large or small (depending on which sample is from the population that tends to be larger).
[Note that if the null is false, it is not required that the differences be symmetrically distributed - many books incorrectly claim this is a requirement. However, if you are focused only on location shift alternatives then the differences should be symmetric about the amount of the location-shift.]
That is, large or small sums of positive ranks (relative to what you'd expect under the null) indicate a difference in the populations in a way that indicates one group tends to be higher than the other.
Wikipedia's version of the test adds together the positive and negative ranks (with the accompanying signs instead. This shifts the center to 0 but gives an equivalent test.
The function you're calling defines the statistic differently to both of the above versions (as the smaller of the sum of positive and sum of negative ranks, which matches the original definition in Wilcoxon's paper) but the different versions of the tests are all equivalent and should give the same p-values under the same conditions.
[1] Wilcoxon, Frank (1945),
"Individual comparisons by ranking methods"
Biometrics Bulletin. 1 (6), Dec, p80–83.
(The Wikipedia page on this test offers a link to a pdf of the paper)
Calculate the Wilcoxon signed-rank test.
vsCompute the Wilcoxon rank-sum statistic for two samples.
... the first goes on to explaintests the null hypothesis that two related paired samples come from the same distribution. In particular, it tests whether the distribution of the differences x - y is symmetric about zero. It is a non-parametric version of the paired T-test.
while the second statesThe Wilcoxon rank-sum test tests the null hypothesis that two sets of measurements are drawn from the same distribution
... $\endgroup$