A DenseMatrix is a matrix with all elements found in an array. It is column major unless isTranspose is true, It is designed to be fast: Double- (and potentially Float-)valued DenseMatrices can be used with blas, and support operations to that effect.
- Value Params
- cols
number of cols
- data
The underlying data. Column-major unless isTranpose is true. Mutate at your own risk. Note that this matrix may be a view of the data. Use linearIndex(r,c) to calculate indices.
- isTranspose
if true, then the matrix is considered to be "transposed" (that is, row major)
- majorStride
distance separating columns (or rows, for isTranspose). should have absolute value >= rows (or cols, for isTranspose)
- offset
starting point into array
- rows
number of rows
- Companion
- object
Value members
Constructors
Creates a matrix with the specified data array, rows, and columns.
Creates a matrix with the specified data array, rows, and columns.
Creates a matrix with the specified data array, rows, and columns. Data must be column major
Creates a matrix with the specified data array, rows, and columns. Data must be column major
Creates a matrix with the specified data array, rows, and columns. Data must be column major
Creates a matrix with the specified data array, rows, and columns. Data must be column major
Concrete methods
Converts this matrix to a DenseVector (column-major) If view = true (or View.Require), throws an exception if we cannot return a view. otherwise returns a view. If view == false (or View.Copy) returns a copy If view == View.Prefer (the default), returns a view if possible, otherwise returns a copy.
Converts this matrix to a DenseVector (column-major) If view = true (or View.Require), throws an exception if we cannot return a view. otherwise returns a view. If view == false (or View.Copy) returns a copy If view == View.Prefer (the default), returns a view if possible, otherwise returns a copy.
Views are only possible (if(isTranspose) majorStride == cols else majorStride == rows) == true
Returns true if this dense matrix takes up a contiguous segment of the array
Returns true if this dense matrix takes up a contiguous segment of the array
Calculates the index into the data array for row and column
Calculates the index into the data array for row and column
Reshapes this matrix to have the given number of rows and columns If view = true (or View.Require), throws an exception if we cannot return a view. otherwise returns a view. If view == false (or View.Copy) returns a copy If view == View.Prefer (the default), returns a view if possible, otherwise returns a copy.
Reshapes this matrix to have the given number of rows and columns If view = true (or View.Require), throws an exception if we cannot return a view. otherwise returns a view. If view == false (or View.Copy) returns a copy If view == View.Prefer (the default), returns a view if possible, otherwise returns a copy.
Views are only possible if (!isTranspose && majorStride == rows)
rows * cols must equal size, or cols < 0 && (size / rows * rows == size)
- Value Params
- cols
the number of columns, or -1 to auto determine based on size and rows
- rows
the number of rows
Converts this matrix to a flat Array (column-major)
Converts this matrix to a flat Array (column-major)
Inherited methods
Alias for :%(b) when b is a scalar.
Alias for :%(b) when b is a scalar.
- Inherited from
- ImmutableNumericOps
Element-wise modulo of this and b.
Element-wise modulo of this and b.
- Inherited from
- ImmutableNumericOps
Element-wise logical "and" operator -- returns true if corresponding elements are non-zero.
Element-wise logical "and" operator -- returns true if corresponding elements are non-zero.
- Inherited from
- ImmutableNumericOps
Mutates this by element-wise and of this and b.
Mutates this by element-wise and of this and b.
- Inherited from
- NumericOps
Element-wise product of this and b.
Element-wise product of this and b.
- Inherited from
- ImmutableNumericOps
Element-wise difference of this and b.
Element-wise difference of this and b.
- Inherited from
- ImmutableNumericOps
Alias for :/(b) when b is a scalar.
Alias for :/(b) when b is a scalar.
- Inherited from
- ImmutableNumericOps
Element-wise quotient of this and b.
Element-wise quotient of this and b.
- Inherited from
- ImmutableNumericOps
Element-wise inequality comparator of this and b.
Element-wise inequality comparator of this and b.
- Inherited from
- ImmutableNumericOps
Mutates this by element-wise modulo of b into this.
Mutates this by element-wise modulo of b into this.
- Inherited from
- NumericOps
Mutates this by element-wise and of this and b.
Mutates this by element-wise and of this and b.
- Inherited from
- NumericOps
Mutates this by element-wise multiplication of b into this.
Mutates this by element-wise multiplication of b into this.
- Inherited from
- NumericOps
Mutates this by element-wise addition of b into this.
Mutates this by element-wise addition of b into this.
- Inherited from
- NumericOps
Mutates this by element-wise subtraction of b from this
Mutates this by element-wise subtraction of b from this
- Inherited from
- NumericOps
Mutates this by element-wise division of b into this
Mutates this by element-wise division of b into this
- Inherited from
- NumericOps
Mutates this by element-wise assignment of b into this.
Mutates this by element-wise assignment of b into this.
- Inherited from
- NumericOps
Element-wise equality comparator of this and b.
Element-wise equality comparator of this and b.
- Inherited from
- ImmutableNumericOps
Mutates this by element-wise exponentiation of this by b.
Mutates this by element-wise exponentiation of this by b.
- Inherited from
- NumericOps
Mutates this by element-wise xor of this and b.
Mutates this by element-wise xor of this and b.
- Inherited from
- NumericOps
Mutates this by element-wise or of this and b.
Mutates this by element-wise or of this and b.
- Inherited from
- NumericOps
Element-wise less=than comparator of this and b.
Element-wise less=than comparator of this and b.
- Inherited from
- NumericOps
Element-wise less-than-or-equal-to comparator of this and b.
Element-wise less-than-or-equal-to comparator of this and b.
- Inherited from
- NumericOps
Element-wise greater-than-or-equal-to comparator of this and b.
Element-wise greater-than-or-equal-to comparator of this and b.
- Inherited from
- NumericOps
Element-wise greater-than comparator of this and b.
Element-wise greater-than comparator of this and b.
- Inherited from
- NumericOps
Element-wise exponentiation of this and b.
Element-wise exponentiation of this and b.
- Inherited from
- ImmutableNumericOps
Element-wise logical "xor" operator -- returns true if only one of the corresponding elements is non-zero.
Element-wise logical "xor" operator -- returns true if only one of the corresponding elements is non-zero.
- Inherited from
- ImmutableNumericOps
Mutates this by element-wise xor of this and b.
Mutates this by element-wise xor of this and b.
- Inherited from
- NumericOps
Method for slicing that is tuned for Matrices.
Method for slicing that is tuned for Matrices.
- Inherited from
- TensorLike
Slice a sequence of elements. Must be at least 2.
Slice a sequence of elements. Must be at least 2.
- Inherited from
- TensorLike
method for slicing a tensor. For instance, DenseVectors support efficient slicing by a Range object.
method for slicing a tensor. For instance, DenseVectors support efficient slicing by a Range object.
- Inherited from
- TensorLike
Returns all indices k whose value satisfies a predicate.
Returns all indices k whose value satisfies a predicate.
- Inherited from
- QuasiTensor
Returns true if and only if the given predicate is true for all elements.
Returns true if and only if the given predicate is true for all elements.
- Inherited from
- TensorLike
Returns true if and only if the given predicate is true for all elements.
Returns true if and only if the given predicate is true for all elements.
- Inherited from
- TensorLike
Applies the given function to each key in the tensor.
Applies the given function to each key in the tensor.
- Inherited from
- TensorLike
Applies the given function to each key and its corresponding value.
Applies the given function to each key and its corresponding value.
- Inherited from
- TensorLike
Applies the given function to each value in the map (one for each element of the domain, including zeros).
Applies the given function to each value in the map (one for each element of the domain, including zeros).
- Inherited from
- TensorLike
- Inherited from
- MatrixLike
Maps all active key-value pairs values.
Maps all active key-value pairs values.
- Inherited from
- TensorLike
Maps all non-zero values.
Maps all non-zero values.
- Inherited from
- TensorLike
Creates a new map containing a transformed copy of this map.
Creates a new map containing a transformed copy of this map.
- Inherited from
- TensorLike
Creates a new map containing a transformed copy of this map.
Creates a new map containing a transformed copy of this map.
- Inherited from
- TensorLike
A transposed view of this object, followed by a slice. Sadly frequently necessary.
A transposed view of this object, followed by a slice. Sadly frequently necessary.
- Inherited from
- ImmutableNumericOps
A transposed view of this object, followed by a slice. Sadly frequently necessary.
A transposed view of this object, followed by a slice. Sadly frequently necessary.
- Inherited from
- ImmutableNumericOps
A transposed view of this object.
A transposed view of this object.
- Inherited from
- ImmutableNumericOps
Element-wise logical "or" operator -- returns true if either element is non-zero.
Element-wise logical "or" operator -- returns true if either element is non-zero.
- Inherited from
- ImmutableNumericOps
Mutates this by element-wise or of this and b.
Mutates this by element-wise or of this and b.
- Inherited from
- NumericOps