Cauchy Matrix
easynumpy_linalgImplement cauchy(x, y).
Given 1D arrays x (length n) and y (length m) with all x[i] != y[j],
return the (n, m) Cauchy matrix C where C[i, j] = 1 / (x[i] - y[j]).
Use broadcasting — no for/while loops.
Constraints
- no scipy, sklearn
- no for/while loops
Your solution
Edit cauchy and run the real pytest suite in your browser — no install required. Your code is saved locally.
Loading the Python runtime (first run only)…
Hints
Hint 1
np.subtract.outer(x, y) builds the (len(x), len(y)) difference matrix; take its reciprocal.