R: Logical mxAlgebra() operators

omxLogical {OpenMx} | R Documentation

## Logical mxAlgebra() operators

### Description

`omxNot` computes the unary negation of the values of a matrix. `omxAnd` computes the binary and of two matrices. `omxOr` computes the binary or of two matrices. `omxGreaterThan` computes a binary greater than of two matrices. `omxLessThan` computes the binary less than of two matrices. `omxApproxEquals` computes a binary equals within a specified epsilon of two matrices.

### Usage

    omxNot(x)
    omxAnd(x, y)
    omxOr(x, y)
    omxGreaterThan(x, y)
    omxLessThan(x, y)
    omxApproxEquals(x, y, epsilon)

### Arguments

`x` | the first argument, the matrix which the logical operation will be applied to.
`y` | the second argument, applicable to binary functions.
`epsilon` | the third argument, specifies the error threshold for omxApproxEquals. Abs(x[i][j]-y[i][j]) must be less than epsilon[i][j].

### Examples

    A <- mxMatrix(values = runif(25), nrow = 5, ncol = 5, name = 'A')
    B <- mxMatrix(values = runif(25), nrow = 5, ncol = 5, name = 'B')
    EPSILON <- mxMatrix(values = 0.04*1:25, nrow = 5, ncol = 5, name = "EPSILON")

    model <- mxModel(A, B, EPSILON, name = 'model')

    mxEval(omxNot(A), model)
    mxEval(omxGreaterThan(A,B), model)
    mxEval(omxLessThan(B,A), model)
    mxEval(omxOr(omxNot(A),B), model)
    mxEval(omxAnd(omxNot(B), A), model)
    mxEval(omxApproxEquals(A,B, EPSILON), model)

[Package OpenMx version 2.18.1 Index]