Class BVector
Represents Binary Vector
Defined in: bvector07.js.
Constructor Attributes | Constructor Name and Description |
---|---|
BVector()
Define Binary Vector Object BVector.
|
Field Attributes | Field Name and Description |
---|---|
substance of binary vector
|
|
order of vector
|
Method Attributes | Method Name and Description |
---|---|
abs()
Count elements that values are 1 in binary vector
|
|
and(bv2)
Logical and with binary vector object bv2
|
|
clear()
Clear binary vector
|
|
clone()
Method to copy binary vector object
|
|
cross(bv2)
Returns product of binary vector and transposed binary vector (cross product)
|
|
diff(bv2)
Logical difference with binary vector object bv2
|
|
dot(bv2)
Dot product with binary vector object bv2
|
|
equals(bv2)
Returns true if two vectors are equal.
|
|
getValue(i)
Method to get element i of binary vector
|
|
inv()
Returns inverted binary vector
|
|
mul(b2)
Product with scalar (0 or 1)
|
|
or(bv2)
Logical or with binary vector object bv2
|
|
setValue(i, value)
Method to set value 0 or 1 to element i of binary vector object
|
|
toString()
Convert binary vector object to string
|
|
toTeX()
Convert binary vector object to TeX format
|
|
tran()
Returns transposed binary vector as binary matrix
|
|
xor(bv2)
Exclusive or with binary vector object bv2
|
Class Detail
BVector()
Define Binary Vector Object BVector.
bv = new BVector(4); // order 4 binary vector (0, 0, 0, 0) bv = new BVector(4, 1); // order 4 binary vector (1, 1, 1, 1) bv = new BVector(1, 0, 1, 0); // order 4 binary vector (1, 0, 1, 0)
- Since:
- 0.1
Field Detail
{Number[]}
bits
substance of binary vector
{Number}
order
order of vector
Method Detail
{Number}
abs()
Count elements that values are 1 in binary vector
- Since:
- 0.2
- Returns:
- {Number} number of 1 elements
{BVector}
and(bv2)
Logical and with binary vector object bv2
- Parameters:
- {BVector} bv2
- second operand for logical and
- Since:
- 0.1
- Returns:
- {BVector} logical and with bv2 (or null if error)
clear()
Clear binary vector
- Since:
- 0.2
{BVector}
clone()
Method to copy binary vector object
- Since:
- 0.1
- Returns:
- {BVector} returns binary vector copy
{BMatrix}
cross(bv2)
Returns product of binary vector and transposed binary vector (cross product)
- Parameters:
- {BVector} bv2
- second operand for cross product
- Since:
- 0.2
- Returns:
- {BMatrix} cross product (or null if error)
{BVector}
diff(bv2)
Logical difference with binary vector object bv2
- Parameters:
- {BVector} bv2
- second operand for logical difference
- Since:
- 0.2
- Returns:
- {BVector} logical difference with bv2 (or null if error)
{Number}
dot(bv2)
Dot product with binary vector object bv2
- Parameters:
- {BVector} bv2
- second operand for dot product
- Since:
- 0.2
- Returns:
- {Number} dot product with bv2 (or -1 if error)
{Boolean}
equals(bv2)
Returns true if two vectors are equal. Returns false if error or different.
- Parameters:
- bv2
- comparison target binary vector
- Since:
- 0.2
- Returns:
- {Boolean} returns true if two vectors are equal
{Number}
getValue(i)
Method to get element i of binary vector
- Parameters:
- {Number} i
- element number
- Since:
- 0.1
- Returns:
- {Number} value
{BVector}
inv()
Returns inverted binary vector
- Since:
- 0.2
- Returns:
- {BVector} inverted binary vector
{BVector}
mul(b2)
Product with scalar (0 or 1)
- Parameters:
- {Number} b2
- second operand for product
- Since:
- 0.2
- Returns:
- {BVector} product with b2 (or null if error)
{BVector}
or(bv2)
Logical or with binary vector object bv2
- Parameters:
- {BVector} bv2
- second operand for logical or
- Since:
- 0.1
- Returns:
- {BVector} logical or with bv2 (or null if error)
setValue(i, value)
Method to set value 0 or 1 to element i of binary vector object
- Parameters:
- {Number} i
- element number
- {Number} value
- value to set
- Since:
- 0.1
{String}
toString()
Convert binary vector object to string
- Since:
- 0.1
- Returns:
- {String} string e.g. "(0,1,...,1)"
{String}
toTeX()
Convert binary vector object to TeX format
- Since:
- 0.2
- Returns:
- {String} TeX string
{BMatrix}
tran()
Returns transposed binary vector as binary matrix
- Since:
- 0.5
- Returns:
- {BMatrix} transeposed binary vector
{BVector}
xor(bv2)
Exclusive or with binary vector object bv2
- Parameters:
- {BVector} bv2
- second operand for exclusive or
- Since:
- 0.2
- Returns:
- {BVector} exclusive or with bv2 (or null if error)