Module: Colt::Property
- Included in:
- MDMatrix
- Defined in:
- lib/colt/matrix/property.rb
Instance Attribute Summary collapse
-
#colt_matrix ⇒ Object
readonly
Returns the value of attribute colt_matrix.
-
#colt_property ⇒ Object
readonly
Returns the value of attribute colt_property.
Instance Method Summary collapse
-
#check_rectangular ⇒ Object
———————————————————————————— Checks whether the given matrix A is rectangular.
-
#check_square ⇒ Object
———————————————————————————— Checks whether the given matrix A is square.
-
#density ⇒ Object
———————————————————————————— Returns the matrix’s fraction of non-zero cells; A.cardinality() / A.size().
-
#diagonal? ⇒ Boolean
———————————————————————————— A matrix A is diagonal if A == 0 whenever i != j.
-
#diagonally_dominant_by_column? ⇒ Boolean
———————————————————————————— A matrix A is diagonally dominant by column if the absolute value of each diagonal element is larger than the sum of the absolute values of the off-diagonal elements in the corresponding column.
-
#diagonally_dominant_by_row? ⇒ Boolean
———————————————————————————— A matrix A is diagonally dominant by row if the absolute value of each diagonal element is larger than the sum of the absolute values of the off-diagonal elements in the corresponding row.
-
#equals?(val) ⇒ Boolean
———————————————————————————— if val is a Numeric value: Returns whether all cells of the given matrix A are equal to the given value.
-
#generate_non_singular! ⇒ Object
———————————————————————————— Modifies the square matrix such that it is diagonally dominant by row and column, hence non-singular, hence invertible.
-
#identity? ⇒ Boolean
————————————————————————————- A matrix A is an identity matrix if A == 1 and all other cells are zero.
-
#lower_bandwidth ⇒ Object
———————————————————————————— The lower bandwidth of a square matrix A is the maximum i-j for which A is nonzero and i > j.
-
#lower_bidiagonal? ⇒ Boolean
———————————————————————————— A matrix A is lower bidiagonal if A==0 unless i==j || i==j+1.
-
#lower_triangular? ⇒ Boolean
———————————————————————————— A matrix A is lower triangular if A==0 whenever i < j.
-
#non_negative? ⇒ Boolean
———————————————————————————— A matrix A is non-negative if A >= 0 holds for all cells.
-
#orthogonal? ⇒ Boolean
———————————————————————————— A square matrix A is orthogonal if A*transpose(A) = I.
-
#positive? ⇒ Boolean
———————————————————————————— A matrix A is positive if A > 0 holds for all cells.
-
#properties ⇒ Object
———————————————————————————— Returns summary information about the given matrix A.
-
#semi_bandwidth ⇒ Object
———————————————————————————— Returns the semi-bandwidth of the given square matrix A.
-
#singular? ⇒ Boolean
———————————————————————————— A matrix A is singular if it has no inverse, that is, iff det(A)==0.
- #skew_symmetric? ⇒ Boolean
-
#square? ⇒ Boolean
————————————————————————————.
-
#strictly_lower_triangular? ⇒ Boolean
———————————————————————————— A matrix A is strictly lower triangular if A==0 whenever i <= j.
-
#strictly_triangular? ⇒ Boolean
———————————————————————————— A matrix A is strictly triangular if it is triangular and its diagonal elements all equal 0 ————————————————————————————.
-
#strictly_upper_triangular? ⇒ Boolean
———————————————————————————— A matrix A is strictly upper triangular if A==0 whenever i >= j.
- #symmetric? ⇒ Boolean
-
#tolerance ⇒ Object
————————————————————————————.
-
#tolerance=(val) ⇒ Object
———————————————————————————— Sets the tolerance to Math.abs(val).
-
#triangular? ⇒ Boolean
———————————————————————————— A matrix A is triangular iff it is either upper or lower triangular.
-
#tridiagonal? ⇒ Boolean
———————————————————————————— A matrix A is tridiagonal if A==0 whenever Math.abs(i-j) > 1.
-
#unit_triangular? ⇒ Boolean
———————————————————————————— A matrix A is unit triangular if it is triangular and its diagonal elements all equal 1.
-
#upper_bandwidth ⇒ Object
———————————————————————————— The upper bandwidth of a square matrix A is the maximum j-i for which A is nonzero and j > i.
-
#upper_bidiagonal? ⇒ Boolean
———————————————————————————— A matrix A is upper bidiagonal if A==0 unless i==j || i==j-1.
-
#upper_triangular? ⇒ Boolean
———————————————————————————— A matrix A is upper triangular if A==0 whenever i > j.
-
#zero? ⇒ Boolean
———————————————————————————— A matrix A is zero if all its cells are zero.
Instance Attribute Details
#colt_matrix ⇒ Object (readonly)
Returns the value of attribute colt_matrix.
32 33 34 |
# File 'lib/colt/matrix/property.rb', line 32 def colt_matrix @colt_matrix end |
#colt_property ⇒ Object (readonly)
Returns the value of attribute colt_property.
31 32 33 |
# File 'lib/colt/matrix/property.rb', line 31 def colt_property @colt_property end |
Instance Method Details
#check_rectangular ⇒ Object
Checks whether the given matrix A is rectangular.
38 39 40 41 42 43 44 |
# File 'lib/colt/matrix/property.rb', line 38 def check_rectangular begin @colt_property.checkRectangular(@colt_matrix) rescue java.lang.IllegalArgumentException raise "rows < columns. Not rectangular matrix" end end |
#check_square ⇒ Object
Checks whether the given matrix A is square.
50 51 52 53 54 55 56 |
# File 'lib/colt/matrix/property.rb', line 50 def check_square begin @colt_property.checkSquare(@colt_matrix) rescue java.lang.IllegalArgumentException raise "rows != columns. Not square matrix" end end |
#density ⇒ Object
Returns the matrix’s fraction of non-zero cells; A.cardinality() / A.size().
62 63 64 |
# File 'lib/colt/matrix/property.rb', line 62 def density @colt_property.density(@colt_matrix) end |
#diagonal? ⇒ Boolean
71 72 73 |
# File 'lib/colt/matrix/property.rb', line 71 def diagonal? @colt_property.diagonal(@colt_matrix) end |
#diagonally_dominant_by_column? ⇒ Boolean
A matrix A is diagonally dominant by column if the absolute value of each diagonal element is larger than the sum of the absolute values of the off-diagonal elements in the corresponding column. returns true if for all i: abs(A) > Sum(abs(A)); j != i. Matrix may but need not be square.
Note: Ignores tolerance.
84 85 86 |
# File 'lib/colt/matrix/property.rb', line 84 def diagonally_dominant_by_column? @colt_property.diagonallyDominantByColumn(@colt_matrix) end |
#diagonally_dominant_by_row? ⇒ Boolean
A matrix A is diagonally dominant by row if the absolute value of each diagonal element is larger than the sum of the absolute values of the off-diagonal elements in the corresponding row. returns true if for all i: abs(A) > Sum(abs(A)); j != i. Matrix may but need not be square.
Note: Ignores tolerance.
97 98 99 |
# File 'lib/colt/matrix/property.rb', line 97 def diagonally_dominant_by_row? @colt_property.diagonallyDominantByRow(@colt_matrix) end |
#equals?(val) ⇒ Boolean
if val is a Numeric value: Returns whether all cells of the given matrix A are equal to the given value. if val is another matrix: Returns whether both given matrices A and B are equal.
107 108 109 110 111 112 113 114 115 |
# File 'lib/colt/matrix/property.rb', line 107 def equals?(val) if (val.is_a? Numeric) @colt_property.equals(@colt_matrix, val) else @colt_property.equals(@colt_matrix, val.colt_matrix) end end |
#generate_non_singular! ⇒ Object
Modifies the square matrix such that it is diagonally dominant by row and column, hence non-singular, hence invertible.
122 123 124 |
# File 'lib/colt/matrix/property.rb', line 122 def generate_non_singular! @colt_property.generateNonSingular(@colt_matrix) end |
#identity? ⇒ Boolean
A matrix A is an identity matrix if A == 1 and all other cells are zero. Matrix may but need not be square.
131 132 133 |
# File 'lib/colt/matrix/property.rb', line 131 def identity? @colt_property.isIdentity(@colt_matrix) end |
#lower_bandwidth ⇒ Object
286 287 288 |
# File 'lib/colt/matrix/property.rb', line 286 def lower_bandwidth @colt_property.lowerBandwidth(@colt_matrix) end |
#lower_bidiagonal? ⇒ Boolean
139 140 141 |
# File 'lib/colt/matrix/property.rb', line 139 def lower_bidiagonal? @colt_property.isLowerBidiagonal(@colt_matrix) end |
#lower_triangular? ⇒ Boolean
147 148 149 |
# File 'lib/colt/matrix/property.rb', line 147 def lower_triangular? @colt_property.isLowerTriangular(@colt_matrix) end |
#non_negative? ⇒ Boolean
155 156 157 |
# File 'lib/colt/matrix/property.rb', line 155 def non_negative? @colt_property.isNonNegative(@colt_matrix) end |
#orthogonal? ⇒ Boolean
A square matrix A is orthogonal if A*transpose(A) = I.
163 164 165 |
# File 'lib/colt/matrix/property.rb', line 163 def orthogonal? @colt_property.isOrthogonal(@colt_matrix) end |
#positive? ⇒ Boolean
171 172 173 |
# File 'lib/colt/matrix/property.rb', line 171 def positive? @colt_property.isPositive(@colt_matrix) end |
#properties ⇒ Object
Returns summary information about the given matrix A.
326 327 328 |
# File 'lib/colt/matrix/property.rb', line 326 def properties printf(@colt_property.toString(@colt_matrix)) end |
#semi_bandwidth ⇒ Object
Returns the semi-bandwidth of the given square matrix A.
294 295 296 |
# File 'lib/colt/matrix/property.rb', line 294 def semi_bandwidth @colt_property.semiBandwidth(@colt_matrix) end |
#singular? ⇒ Boolean
A matrix A is singular if it has no inverse, that is, iff det(A)==0.
179 180 181 |
# File 'lib/colt/matrix/property.rb', line 179 def singular? @colt_property.isSingular(@colt_matrix) end |
#skew_symmetric? ⇒ Boolean
187 188 189 |
# File 'lib/colt/matrix/property.rb', line 187 def skew_symmetric? @colt_property.isSkewSymmetric(@colt_matrix) end |
#square? ⇒ Boolean
195 196 197 |
# File 'lib/colt/matrix/property.rb', line 195 def square? @colt_property.isSquare(@colt_matrix) end |
#strictly_lower_triangular? ⇒ Boolean
203 204 205 |
# File 'lib/colt/matrix/property.rb', line 203 def strictly_lower_triangular? @colt_property.isStrictlyLowerTriangular(@colt_matrix) end |
#strictly_triangular? ⇒ Boolean
A matrix A is strictly triangular if it is triangular and its diagonal elements all equal 0
212 213 214 |
# File 'lib/colt/matrix/property.rb', line 212 def strictly_triangular? @colt_property.isStrictlyTriangular(@colt_matrix) end |
#strictly_upper_triangular? ⇒ Boolean
220 221 222 |
# File 'lib/colt/matrix/property.rb', line 220 def strictly_upper_triangular? @colt_property.isStrictlyUpperTriangular(@colt_matrix) end |
#symmetric? ⇒ Boolean
228 229 230 |
# File 'lib/colt/matrix/property.rb', line 228 def symmetric? @colt_property.isSymmetric(@colt_matrix) end |
#tolerance ⇒ Object
302 303 304 |
# File 'lib/colt/matrix/property.rb', line 302 def tolerance @colt_property.tolerance() end |
#tolerance=(val) ⇒ Object
Sets the tolerance to Math.abs(val).
310 311 312 |
# File 'lib/colt/matrix/property.rb', line 310 def tolerance=(val) @colt_property.setTolerance(val) end |
#triangular? ⇒ Boolean
A matrix A is triangular iff it is either upper or lower triangular.
236 237 238 |
# File 'lib/colt/matrix/property.rb', line 236 def triangular? @colt_property.isTriangular(@colt_matrix) end |
#tridiagonal? ⇒ Boolean
244 245 246 |
# File 'lib/colt/matrix/property.rb', line 244 def tridiagonal? @colt_property.isTridiagonal(@colt_matrix) end |
#unit_triangular? ⇒ Boolean
A matrix A is unit triangular if it is triangular and its diagonal elements all equal 1.
253 254 255 |
# File 'lib/colt/matrix/property.rb', line 253 def unit_triangular? @colt_property.isUnitTriangular(@colt_matrix) end |
#upper_bandwidth ⇒ Object
335 336 337 |
# File 'lib/colt/matrix/property.rb', line 335 def upper_bandwidth @colt_property.upperBandwidth(@colt_matrix) end |
#upper_bidiagonal? ⇒ Boolean
261 262 263 |
# File 'lib/colt/matrix/property.rb', line 261 def upper_bidiagonal? @colt_property.isUpperBidiagonal(@colt_matrix) end |
#upper_triangular? ⇒ Boolean
269 270 271 |
# File 'lib/colt/matrix/property.rb', line 269 def upper_triangular? @colt_property.isUpperTriangular(@colt_matrix) end |
#zero? ⇒ Boolean
A matrix A is zero if all its cells are zero.
277 278 279 |
# File 'lib/colt/matrix/property.rb', line 277 def zero? @colt_property.isZero(@colt_matrix) end |