math:vector/

(math:vector/ v1 [v2 | val] [v3] [slice])

Description:

Division of v1 by v2 or a static val.  Result will be placed in v3 if supplied else v1. If a slice is provided v2 must equal the length of the slice. a slice is a list of (startpos size increment) or a list containing a single mask.  a mask is a vector of 0.0 or 1.0 values.  Any vectors must contain real numbers only

Arguments:

slice -- slice v1 into segments.  slice is a list of (startpos size increment) or a list containing a single mask.  a mask is a vector of 0.0 or 1.0 values.

v1 -- vector

v3 -- optional vector to place result. must be at least equal in length to the expected result

v2 | val -- vector of equal length to v1 or a single value to use for each vector position

Returns: boolean

Examples:

(define v1 (vector 1.0 2.0 3.0 4.0 -5.0 6.0 7.0 8.0 9.0 10.0))

(define v2 (make-vector 10 2.0))

(define v3 (make-vector 10))

(define v4 (make-vector 5 2.2))

(define v5 (make-vector 10))

(define mask (vector 0 1 1 0 1 0 1 1 0 0))

(print v1 v2 v3)

; put result in v3

(math:vector/ v1 v2 v3 v4 v5)

(print v1 v2 v3)

; put result in v1

(math:vector/ v1 3.0)

(print v1 v2 v3 v4 v5)

; put result in v3

(math:vector/ v1 -1.0 v3)

(print v1 v2 v3 v4 v5)

; put result v1

(math:vector/ v1 v4 '(0 5 2))

(print v1 v2 v3 v4 v5)

; put result in v5

(math:ector/ v1 v4 v5 (list mask))

(print v1 v2 v3 v4 v5)

Back to index