Description Usage Arguments Details Value Author(s) See Also Examples
Functions to convert between simval
s and ordinary scalar values.
1 2 |
x |
a numeric value (i.e., a vector of length 1 ) |
e1 |
a |
A simval
("Similarity value") is a numeric vector of length 1
with the S3 class simval
. Various functions, e.g., dot()
and cosine()
return simval
objects. A object with a class
is used instead of an ordinary scalar so as to catch some possible
operator precedence errors such as writing x * y %.% z
with the
(false) belief that it will be parsed as (x * y) %.% z
when in
fact it will be parsed as x * (y %.% z)
. Having %.%
return a simval
object allows the expression x * y %.% z
to result in an error, because it is illegal to multiple a vector by a
simval
. If x * (y %.% z)
really was intended, then it
must be written as x * scalar(y %.% z)
.
simval()
returns a vector with the S3 class simval
.
scalar()
strips off the S3 class simval
(i.e., it returns a numeric vector with no S3 class).
Tony Plate tplate@acm.org
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.