HyperMath

Relational Operations

Relational Operations

Previous topic Next topic Expand/collapse all hidden text  

Relational Operations

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  
hmtoggle_plus1greyEq

Performs element-by-element equal comparison of the first argument against the second one.  The arguments must be same-sized (unless the second argument is a scalar).  It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not.  If the second argument is a scalar, all entries of the first argument are compared against this.  The optional tol argument specifies the minimum inequality that will be accepted as equality.  It must be a scalar if either m1 or m2 is a scalar or one-element matrix, or it must be a matrix with the same dimensions as m1 and m2.  The default value of tol is twice the machine precision, which is approximately 2.2E-16.

b = Eq(m1,m2,tol)

m1

A vector or a matrix.

m2

A scalar, vector, or a matrix.

tol

A scalar, vector, or a matrix.

b

A vector or a matrix of Boolean entries.

hmtoggle_plus1greyGeq

Performs element-by-element greater than or equal comparison of the first argument against the second one.  The arguments must be same-sized (unless the second argument is a scalar).  It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not.  If the second argument is a scalar, all entries of the first argument are compared against this. The optional tol argument specifies the maximum inequality that will be accepted as equality.  It must be a scalar if either m1 or m2 is a scalar or a one-element matrix, or it must be a matrix with the same dimensions as m1 and m2.  The default value of tol is twice the machine precision, which is approximately 2.2E-16.

b = Geq(m1,m2,tol)

m1

A vector or a matrix.

m2

A scalar, vector, or a matrix.

tol

A scalar, vector, or a matrix.

b

A vector or a matrix of Boolean entries.

hmtoggle_plus1greyGt

Performs element-by-element greater than comparison of the first argument against the second one.  The arguments must be same-sized (unless the second argument is a scalar).  It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not.  If the second argument is a scalar, all entries of the first argument are compared against this. The optional tol argument specifies the minimum inequality that must be exceeded to return true.  It must be a scalar if either m1 or m2 is a scalar or a one-element matrix, or it must be a matrix with the same dimensions as m1 and m2.  The default value of tol is twice the machine precision, which is approximately 2.2E-16.

b = Gt(m1,m2,tol)

m1

A vector or a matrix.

m2

A scalar, vector, or a matrix.

tol

A scalar, vector, or a matrix.

b

A vector or a matrix of Boolean entries.

> M1 = [1,2;3,4]; M2 = [3,4;1,2];

> print(Gt(M1,M2));        // Compares corresponding element pairs

[Matrix] (2 x 2)

0  0

1  1

 

> M1 = [1,2;3,4];

> print(Gt(M1,1));        // Compares each element with the scalar

[Matrix] (2 x 2)

0  1

1  1

hmtoggle_plus1greyLeq

Performs element-by-element less than or equal comparison of the first argument against the second one.  The arguments must be same-sized (unless the second argument is a scalar).  It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not.  If the second argument is a scalar, all entries of the first argument are compared against this.  The optional tol argument specifies the maximum inequality that will be accepted as equality.  It must be a scalar if either m1 or m2 is a scalar or a one-element matrix, or it must be a matrix with the same dimensions as m1 and m2.  The default value of tol is twice the machine precision, which is approximately 2.2E-16.

b = Leq(m1,m2,tol)

m1

A vector or a matrix.

m2

A scalar, vector, or a matrix.

tol

A scalar, vector, or a matrix.

b

A vector or a matrix of Boolean entries.

hmtoggle_plus1greyLt

Performs element-by-element less than comparison of the first argument against the second one.  The arguments must be same-sized (unless the second argument is a scalar).  It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not.  If the second argument is a scalar, all entries of the first argument are compared against this. The optional tol argument specifies the minimum inequality that must be exceeded to return true.  It must be a scalar if either m1 or m2 is a scalar or a one-element matrix, or it must be a matrix with the same dimensions as m1 and m2.  The default value of tol is twice the machine precision, which is approximately 2.2E-16.

b = Lt(m1,m2,tol)

m1

A vector or a matrix.

m2

A scalar, vector, or a matrix.

tol

A scalar, vector, or a matrix.

b

A vector or a matrix of Boolean entries.

hmtoggle_plus1greyNeq

Performs element-by-element, not equal comparison of the first argument against the second one.  The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not.  If the second argument is a scalar, all entries of the first argument are compared against this. The optional tol argument specifies the minimum inequality that will be accepted as equality.  It must be a scalar if either m1 or m2 is a scalar or a one-element matrix, or it must be a matrix with the same dimensions as m1 and m2.  The default value of tol is twice the machine precision, which is approximately 2.2E-16.

b = Neq(m1,m2,tol)

m1

A vector or a matrix.

m2

A scalar, vector, or a matrix.

tol

A scalar, vector, or a matrix.

b

A vector or a matrix of Boolean entries.