[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

__Function:__`TAG`vector-add`vec``val`&optional`clamp`__Function:__`TAG`vector-add!`vec``val`&optional`clamp`__Function:__`TAG`vector-sub`vec``val`&optional`clamp`__Function:__`TAG`vector-sub!`vec``val`&optional`clamp`__Function:__`TAG`vector-mul`vec``val`&optional`clamp`__Function:__`TAG`vector-mul!`vec``val`&optional`clamp`-
Element-wise arithmetic.
`Vec`must be a`TAG`vector, and`val`must be either a`TAG`vector, a vector, or a list of the same length as`vec`, or a number (an exact integer for integer vectors, and a real number for f32- and f64-vectors).If

`val`is a`TAG`vector, its elements are added to, subtracted from, or multiplied by the corresponding elements of`vec`, respectively, and the results are gathered to a`TAG`vector and returned. The destructive version (those have bang `!' in the name) reuses`vec`to store the result. If the result of calculation goes out of the range of`TAG`vector's element, the behavior is specified by`clamp`optional argument. (For f32vector and f64vector,`clamp`argument is ignored and the result may contain infinity).If

`val`is a number, it is added to, subtracted from, or multiplied by each element of`vec`, respectively.(s8vector-add '#s8(1 2 3 4) '#s8(5 6 7 8)) => #s8(6 8 10 12) (u8vector-sub '#u8(1 2 3 4) '#u8(2 2 2 2)) => error (u8vector-sub '#u8(1 2 3 4) '#u8(2 2 2 2) 'both) => #u8(0 0 1 2) (f32vector-mul '#f32(3.0 2.0 1.0) 1.5) => #f32(4.5 3.0 1.5)

__Function:__`TAG`vector-div`vec``val`__Function:__`TAG`vector-div!`vec``val`-
Element-wise division of flonum vectors. These are only defined
for f32vector and f64vector.
`val`must be a`TAG`vector, a vector or a list of the same length as`vec`, or a real number.(f32vector-div '#f32(1.0 2.0 3.0) 2.0) => #f32(0.5 1.0 1.5)

__Function:__`TAG`vector-and`vec``val`__Function:__`TAG`vector-and!`vec``val`__Function:__`TAG`vector-ior`vec``val`__Function:__`TAG`vector-ior!`vec``val`__Function:__`TAG`vector-xor`vec``val`__Function:__`TAG`vector-xor!`vec``val`-
Element-wise logical (bitwise) operation.
These procedures are only defined for integral vectors.
`val`must be a`TAG`vector, a vector or a list of the same length as`vec`, or an exact integer. Bitwise and, inclusive or or exclusive or is calculated between each element in`vec`and the corresponding element of`val`(when`val`is a non-scalar value), or`val`itself (when`val`is an integer). The result is returned in a`TAG`vector. The destructive version reuses`vec`to store the result.

__Function:__`TAG`vector-dot`vec0``vec1`-
Calculates the dot product of two
`TAG`vectors. The length of`vec0`and`vec1`must be the same.

__Function:__`TAG`vector-range-check`vec``min``max`-
`Vec`must be a`TAG`vector, and each of`min`and`max`must be either a`TAG`vector, a vector or a list of the same length as`vec`, or a number, or`#f`

.For each element in

`vec`, this procedure checks if the value is between`minval`and`maxval`inclusive, where`minval`and`maxval`are the corresponding values of`min`and`max`(when`min`and/or`max`is/are non-scalar value) or`min`and`max`themselves (when`min`and/or`max`is/are a number). When`min`is`#f`

, negative infinity is assumed. When`max`is`#f`

, positive infinity is assumed.If all the elements in

`vec`are within the range,`#f`

is returned. Otherwise, the index of the leftmost element of`vec`that is out of range is returned.(u8vector-range-check '#u8(3 1 0 2) 0 3) => #f (u8vector-range-check '#u8(3 1 0 2) 1 3) => 2 (u8vector-range-check '#u8(4 32 64 98) 0 '#u8(10 40 70 90)) => 3 ;; Range check in a program (cond ((u8vector-range-check u8v 1 31) => (lambda (i) (errorf "~sth vector element is out of range: ~s" i (u8vector-ref u8v i)))) (else (do-something u8v)))

__Function:__`TAG`vector-clamp`vec``min``max`__Function:__`TAG`vector-clamp!`vec``min``max`-
`Vec`must be a`TAG`vector, and each of`min`and`max`must be either a`TAG`vector, a vector or a list of the same length as`vec`, or a number, or`#f`

.Like

`TAG`vector-range-check, these procedures check if each element of`vec`are within the range between`minval`and`maxval`inclusive, which are defived from`min`and`max`. If the value is less than`minval`, it is replaced by`minval`. If the value is grater than`maxval`, it is replaced by`maxval`.`TAG`vector-clamp creates a copy of`vec`and do clamp operation on it, while`TAG`vector-clamp! modifies`vec`. Both return the clamped vector.(s8vector-clamp '#s8(8 14 -3 -22 0) -10 10) => #s8(8 10 -3 -10 0)

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated by