1.2.3-SNAPSHOT Arrow_down_16x16
  • (div & args)
Performs element-by-element division on multiple matrices, sequences
and/or numbers. Equivalent to R's / operator.

Examples:

(def A (matrix [[1 2 3]
[4 5 6]
[7 8 9]]))
(div A A A)
(div A 2)
(div 2 A)
(div [1 2 3] [1 2 3])
(div [1 2 3] 2)
(div 2 [1 2 3])

(div [1 2 3]) ; returns [1 1/2 13]

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/core.clj:472 top

(defn div
"   Performs element-by-element division on multiple matrices, sequences
    and/or numbers. Equivalent to R's / operator.

    Examples:

      (def A (matrix [[1 2 3]
                      [4 5 6]
                      [7 8 9]]))
      (div A A A)
      (div A 2)
      (div 2 A)
      (div [1 2 3] [1 2 3])
      (div [1 2 3] 2)
      (div 2 [1 2 3])

      (div [1 2 3]) ; returns [1 1/2 13]

"
   ([& args] (if (= (count args) 1)
               (combine-with 1 (first args) clojure.core// div)
               (reduce (fn [A B] (combine-with A B clojure.core// div)) args))))
Vars in incanter.core/div: = count defn first fn reduce /
Used in 0 other vars

Comments top

No comments for div. Log in to add a comment.