Is there a way in dtype-next to express this "shorter":
(def x (dt/->tensor [[1, 1], [1, 2], [2, 2], [2, 3]]))
(dtf/dot-product (first (dt/columns x)) (second (dt/columns x)))
Mainly to get rid of the duplication in calling columns ?👍
The first way to express it "shorter" is by removing the unnecessary commas (all of them) 😄 /s Here are some other thoughts:
user> (require '[tech.v3.tensor :as dtt])
nil
user> (dtt/->tensor [[1 1] [1 2] [2 2] [2 3]])
#tech.v3.tensor<object>[4 2]
[[1 1]
[1 2]
[2 2]
[2 3]]
user> (def x *1)
#'user/x
user> (require '[tech.v3.datatype.functional :as dfn])
nil
user> (dfn/dot-product (first (dtt/columns x))
(second (dtt/columns x)))
13.0
user> (let [[c0 c1] (dtt/columns x)] (dfn/dot-product c0 c1))
13.0
user> (apply dfn/dot-product (dtt/transpose x [1 0]))
13.0@chris441 - vaguely relevant to your interests ^