Implement sliced assignment, a(i,jv) = b where jv a vector, using ? as wildcard.
Implement sliced assignment, a(i,jv) = b where jv a vector, using ? as wildcard.
Implement sliced assignment, a(iv,j) = b where iv a vectors, j integer, using ? as wildcard.
Implement sliced assignment, a(iv,j) = b where iv a vectors, j integer, using ? as wildcard.
Implement sliced assignment, a(iv,jv) = b:T where iv and jv are vectors, using ? as wildcard.
Implement sliced assignment, a(iv,jv) = b:T where iv and jv are vectors, using ? as wildcard.
Implement sliced assignment, a(iv,jv) = b where iv and jv are vectors, using ? as wildcard.
Implement sliced assignment, a(iv,jv) = b where iv and jv are vectors, using ? as wildcard.
Implement a(im) = b where im is a matrix of indices to a, and b is a constant.
Implement a(im) = b where im is a matrix of indices to a, and b is a constant.
Implement a(im) = b where im is a matrix of indices to a and im and b are same-sized.
Implement a(im) = b where im is a matrix of indices to a and im and b are same-sized.
Update a matrix value with linear access, m(i) = v.
Update a matrix value with linear access, m(i) = v.
Update a matrix value, m(r,c) = v, 0- or 1-based.
Update a matrix value, m(r,c) = v, 0- or 1-based.
Bounds-checked linear access, 0- or 1-based.
Bounds-checked linear access, 0- or 1-based.
Bounds-checked matrix access, 0- or 1-based.
Bounds-checked matrix access, 0- or 1-based.
Throws exception if a string is within a limited index range in a string matrix.
Throws exception if a string is within a limited index range in a string matrix.
Clears the elements of a matrix by filling in 0s and nulls.
Performs the Hadamard (element-wise) product between this matrix and a, then adds the elements together into a single double.
Performs the Hadamard (element-wise) product between this matrix and a, then adds the elements together into a single double.
Throws a RuntimeException if the dimensions are incompatible.
Example:
scala> a res8: BIDMat.IMat = 1 2 3 4 5 6 7 8 9 scala> val b = IMat(ones(3,3)) b: BIDMat.IMat = 1 1 1 1 1 1 1 1 1 scala> a.ddot(b) res10: Double = 45.0
A matrix with the same dimensions and compatible type as this matrix.
Find indices (linear) for all non-zeros elements.
Find indices (linear) for all non-zeros elements.
Find indices (i,j) for non-zero elements.
Find indices (i,j) for non-zero elements.
Helper function for find functions.
Helper function for find functions.
Implement slicing, a(i,jv) where i integer, jv a vector, using ? as wildcard.
Implement slicing, a(i,jv) where i integer, jv a vector, using ? as wildcard.
Implement slicing, a(iv,j) where iv a vector, j an integer, using ? as wildcard.
Implement slicing, a(iv,j) where iv a vector, j an integer, using ? as wildcard.
Implement slicing, a(iv,jv) where iv and jv are vectors, using ? as wildcard.
Implement slicing, a(iv,jv) where iv and jv are vectors, using ? as wildcard.
Return a(im) where im is a matrix of indices.
Return a(im) where im is a matrix of indices.
Tries to save a slice into an output matrix, but recreates it if too small.
Tries to save a slice into an output matrix, but recreates it if too small.
Unchecked 0-based matrix access of element at m(r,c).
Unchecked 0-based matrix access of element at m(r,c).
Gets the leading diagonal of this matrix as a vector.
Gets the leading diagonal of this matrix as a vector. Again, like m.mkdiag, m.getdiag will return a seemingly empty matrix on the command line, but it holds the correct elements. Use getdiag(m) for most purposes instead of this method.
Example:
scala> val a = 1\2\3 on 4\5\6 on 7\8\9 a: BIDMat.IMat = 1 2 3 4 5 6 7 8 9 scala> a.getdiag res4: BIDMat.DenseMat[Int] = scala> a(0) res5: Int = 1 scala> a(1) res6: Int = 4 scala> a(2) res7: Int = 7
TODO I suggest making this package-protected. ~Daniel Seita
Find tuples (i,j,v) for non-zero elements.
Find tuples (i,j,v) for non-zero elements.
General operation between two matrices.
General operation between two matrices. Apply op2 to corresponding elements from the input matrices.
Apply the binary operation op2 to the matrix and a scalar argument.
Apply the binary operation op2 to the matrix and a scalar argument.
This version applies the operator op2 with stricter dimension checking, either dims must match or one arg must be scalar
This version applies the operator op2 with stricter dimension checking, either dims must match or one arg must be scalar
General operation between two matrices.
General operation between two matrices. Apply op2 to corresponding elements from the input matrices. Implemented with vector operation primitives.
Stack matrices horizontally.
Stack matrices horizontally.
Throws a RuntimeException if the number of rows does not match.
Note: As is usual with DenseMat methods, it will return a "correct" matrix in that arithmetic, etc. should work, but it is not visible on the command line, so wrap it around with (for instance) a DMat to "see" the results on the command line.
Example:
scala> val b = DMat(1\2 on 3\4) b: BIDMat.DMat = 1 2 3 4 scala> b.ghorzcat(b) res10: BIDMat.DenseMat[Double] = scala> DMat(b.ghorzcat(b)) res11: BIDMat.DMat = 1 2 1 2 3 4 3 4
Tries to save a slice into an output matrix, but recreates it if too small.
Tries to save a slice into an output matrix, but recreates it if too small.
Returns the transpose of this matrix.
Returns the transpose of this matrix.
Stack matrices vertically.
Stack matrices vertically.
Throws a RuntimeException if the number of columns does not match.
Note: As is usual with DenseMat methods, it will return a "correct" matrix in that arithmetic, etc. should work, but it is not visible on the command line, so wrap it around with (for instance) a DMat to "see" the results on the command line.
Example:
scala> val b = DMat(1\2 on 3\4) b: BIDMat.DMat = 1 2 3 4 scala> b.gvertcat(b) res12: BIDMat.DenseMat[Double] = scala> DMat(b.gvertcat(b)) res13: BIDMat.DMat = 1 2 3 4 1 2 3 4 scala>
Returns a single index using linear access (i.e., column-major order) of first occurrence of element a, or -1 if it does not exist.
Returns a single index using linear access (i.e., column-major order) of first occurrence of element a, or -1 if it does not exist.
Note that matrices can be 0- or 1-based; the latter occurs in languages like MATLAB. In that case, an element not present in the matrix gets an index of 0 instead of 1.
In the following examples, the matrix is 0-based:
scala> val a = 3\4 on 7\4 a: BIDMat.IMat = 3 4 7 4 scala> a.indexOf(7) res20: Int = 1 scala> a.indexOf(4) res21: Int = 2
Returns a tuple representing the (row, column) index of element a in this matrix, or (-1,0) if it does not exist and if the matrix is 0-based.
Returns a tuple representing the (row, column) index of element a in this matrix, or (-1,0) if it does not exist and if the matrix is 0-based. 1-based arrays get (0,1) for a non-existent element.
In the following examples, the matrix is 0-based:
scala> val a = 3\4 on 7\4 a: BIDMat.IMat = 3 4 7 4 scala> a.indexOf2(7) res22: (Int, Int) = (1,0) scala> a.indexOf2(4) res23: (Int, Int) = (0,1)
Returns true if this matrix is a row or column vector, false otherwise.
Returns true if this matrix is a row or column vector, false otherwise.
Creates a diagonal, square matrix with this vector's elements in the diagonal.
Creates a diagonal, square matrix with this vector's elements in the diagonal. Note that while this will return a correct matrix, but will be printed as an empty matrix on the command line, so it's recommended to use mkdiag(m) instead of this (which is m.mkdiag).
Throws exception if applied to a non-vector matrix.
Example:
scala> val a = (1 on 2 on 3).mkdiag a: BIDMat.DenseMat[Int] = scala> a(1,1) res2: Int = 2 scala> a(1,2) res3: Int = 0
TODO I suggest making this package-protected. ~Daniel Seita
Returns a string description of this type, i.e., returns "DenseMat".
Count number of non-zero entries.
Prints i spaces, useful for building strings.
Similar to setUpper(v,off), except we set the lower left part of the matrix.
Similar to setUpper(v,off), except we set the lower left part of the matrix.
Examples:
scala> val a = ones(3,3) a: BIDMat.FMat = 1 1 1 1 1 1 1 1 1 scala> a.setLower(2,2) res56: BIDMat.DenseMat[Float] = 1 1 1 1 1 1 1 1 1 scala> a.setLower(2,1) res57: BIDMat.DenseMat[Float] = 1 1 1 1 1 1 2 1 1
The element which we assign to certain positions of the matrix's elements.
Determines the "first" diagonal of the matrix to which we assign v, and all diagonals below that will also be assigned v.
Sets some upper right triangular parts of a matrix to be v; actual elements depend on off.
Sets some upper right triangular parts of a matrix to be v; actual elements depend on off.
Examples:
scala> val a = ones(3,3) a: BIDMat.FMat = 1 1 1 1 1 1 1 1 1 scala> a.setUpper(2,1) res52: BIDMat.DenseMat[Float] = 2 2 2 1 2 2 1 1 2 scala> val b = ones(3,3) b: BIDMat.FMat = 1 1 1 1 1 1 1 1 1 scala> b.setUpper(2,0) res53: BIDMat.DenseMat[Float] = 1 2 2 1 1 2 1 1 1
The element which we assign to certain positions of the matrix's elements.
Determines the "first" diagonal of the matrix to which we assign v, and all diagonals above that will also be assigned v.
Unchecked 0-based set, so m(r,c) = v.
Unchecked 0-based set, so m(r,c) = v.
Returns a string representation of the matrix.
Returns a string representation of the matrix.
Sliced assignment, where m(iv,jv) = b.
Return the (0,0) value as a scalar.
Return the (0,0) value as a scalar.