Class VariableBlock
java.lang.Object
org.wpilib.math.autodiff.VariableBlock
A submatrix of autodiff variables with reference semantics.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Variable block pointing to all of the given matrix.VariableBlock(VariableMatrix mat, int rowOffset, int colOffset, int blockRows, int blockCols) Constructs a Variable block pointing to a subset of the given matrix.VariableBlock(VariableMatrix mat, Slice rowSlice, int rowSliceLength, Slice colSlice, int colSliceLength) Constructs a Variable block pointing to a subset of the given matrix. -
Method Summary
Modifier and TypeMethodDescriptionblock(int rowOffset, int colOffset, int blockRows, int blockCols) Returns a block of the variable matrix.col(int col) Returns a column slice of the variable matrix.intcols()Returns the number of columns in the matrix.cwiseMap(UnaryOperator<Variable> unaryOp) Maps the matrix coefficient-wise with an unary operator.div(double rhs) Binary division operator.Binary division operator.get(int index) Returns a scalar subblock at the given index.get(int row, int col) Returns a scalar subblock at the given row and column.Returns a slice of the variable matrix.get(int row, Slice.None colSlice) Returns a slice of the variable matrix.get(Slice.None rowSlice, int col) Returns a slice of the variable matrix.get(Slice.None rowSlice, Slice colSlice) Returns a slice of the variable matrix.get(Slice.None rowSlice, Slice.None colSlice) Returns a slice of the variable matrix.Returns a slice of the variable matrix.Returns a slice of the variable matrix.get(Slice rowSlice, Slice.None colSlice) Returns a slice of the variable matrix.iterator()minus(org.ejml.simple.SimpleMatrix rhs) Binary subtraction operator.minus(VariableBlock rhs) Binary subtraction operator.minus(VariableMatrix rhs) Binary subtraction operator.plus(org.ejml.simple.SimpleMatrix rhs) Binary addition operator.plus(VariableBlock rhs) Binary addition operator.plus(VariableMatrix rhs) Binary addition operator.row(int row) Returns a row slice of the variable matrix.introws()Returns the number of rows in the matrix.segment(int offset, int length) Returns a segment of the variable vector.set(double value) Assigns a double to the block.set(double[][] values) Assigns a double array to the block.voidset(int index, double value) Sets a scalar subblock at the given index.voidset(int row, int col, double value) Sets a scalar subblock at the given row and column.voidSets a scalar subblock at the given row and column.voidSets a scalar subblock at the given index.set(org.ejml.simple.SimpleMatrix values) Assigns an EJML matrix to the block.Assigns a Variable to the block.set(VariableBlock values) Assigns a VariableBlock to the block.set(VariableMatrix values) Assigns a VariableMatrix to the block.voidsetValue(double value) Assigns a double to the block.voidsetValue(double[][] values) Sets block's internal values.voidsetValue(org.ejml.simple.SimpleMatrix values) Sets block's internal values.intsize()Returns number of elements in matrix.stream()Creates a Stream of VariableBlock elements.T()Returns the transpose of the variable matrix.times(double rhs) Matrix-scalar multiplication operator.Matrix-scalar multiplication operator.times(VariableBlock rhs) Matrix multiplication operator.times(VariableMatrix rhs) Matrix multiplication operator.Unary minus operator.org.ejml.simple.SimpleMatrixvalue()Returns the contents of the variable matrix.doublevalue(int index) Returns an element of the variable block.doublevalue(int row, int col) Returns an element of the variable matrix.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
VariableBlock
Constructs a Variable block pointing to all of the given matrix.- Parameters:
mat- The matrix to which to point.
-
VariableBlock
public VariableBlock(VariableMatrix mat, int rowOffset, int colOffset, int blockRows, int blockCols) Constructs a Variable block pointing to a subset of the given matrix.- Parameters:
mat- The matrix to which to point.rowOffset- The block's row offset.colOffset- The block's column offset.blockRows- The number of rows in the block.blockCols- The number of columns in the block.
-
VariableBlock
public VariableBlock(VariableMatrix mat, Slice rowSlice, int rowSliceLength, Slice colSlice, int colSliceLength) Constructs a Variable block pointing to a subset of the given matrix.Note that the slices are taken as is rather than adjusted.
- Parameters:
mat- The matrix to which to point.rowSlice- The block's row slice.rowSliceLength- The block's row length.colSlice- The block's column slice.colSliceLength- The block's column length.
-
-
Method Details
-
set
Assigns a double to the block.This only works for blocks with one row and one column.
- Parameters:
value- Value to assign.- Returns:
- This VariableBlock.
-
set
Assigns a Variable to the block.This only works for blocks with one row and one column.
- Parameters:
value- Value to assign.- Returns:
- This VariableBlock.
-
set
Assigns a double array to the block.- Parameters:
values- Double array of values to assign.- Returns:
- This VariableBlock.
-
set
Assigns an EJML matrix to the block.- Parameters:
values- EJML matrix of values to assign.- Returns:
- This VariableBlock.
-
set
Assigns a VariableMatrix to the block.- Parameters:
values- VariableMatrix of values.- Returns:
- This VariableBlock.
-
set
Assigns a VariableBlock to the block.- Parameters:
values- VariableBlock of values.- Returns:
- This VariableBlock.
-
set
-
set
Sets a scalar subblock at the given row and column.- Parameters:
row- The scalar subblock's row.col- The scalar subblock's column.value- The value.
-
set
Sets a scalar subblock at the given index.- Parameters:
index- The scalar subblock's index.value- The value.
-
set
-
setValue
Assigns a double to the block.This only works for blocks with one row and one column.
- Parameters:
value- Value to assign.
-
setValue
Sets block's internal values.- Parameters:
values- Double array of values.
-
setValue
Sets block's internal values.- Parameters:
values- EJML matrix of values.
-
get
-
get
-
get
Returns a slice of the variable matrix.- Parameters:
row- The row.colSlice- The column slice.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
row- The row.colSlice- The column slice.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
rowSlice- The row slice.col- The column.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
rowSlice- The row slice.col- The column.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
rowSlice- The row slice.colSlice- The column slice.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
rowSlice- The row slice.colSlice- The column slice.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
rowSlice- The row slice.colSlice- The column slice.- Returns:
- A slice of the variable matrix.
-
get
Returns a slice of the variable matrix.- Parameters:
rowSlice- The row slice.colSlice- The column slice.- Returns:
- A slice of the variable matrix.
-
block
Returns a block of the variable matrix.- Parameters:
rowOffset- The row offset of the block selection.colOffset- The column offset of the block selection.blockRows- The number of rows in the block selection.blockCols- The number of columns in the block selection.- Returns:
- A block of the variable matrix.
-
segment
Returns a segment of the variable vector.- Parameters:
offset- The offset of the segment.length- The length of the segment.- Returns:
- A segment of the variable vector.
-
row
Returns a row slice of the variable matrix.- Parameters:
row- The row to slice.- Returns:
- A row slice of the variable matrix.
-
col
Returns a column slice of the variable matrix.- Parameters:
col- The column to slice.- Returns:
- A column slice of the variable matrix.
-
times
Matrix multiplication operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of matrix multiplication.
-
times
Matrix multiplication operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of matrix multiplication.
-
times
Matrix-scalar multiplication operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of matrix-scalar multiplication.
-
times
Matrix-scalar multiplication operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of matrix-scalar multiplication.
-
div
Binary division operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of division.
-
div
Binary division operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of division.
-
plus
Binary addition operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of addition.
-
plus
Binary addition operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of addition.
-
plus
Binary addition operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of addition.
-
minus
Binary subtraction operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of subtraction.
-
minus
Binary subtraction operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of subtraction.
-
minus
Binary subtraction operator.- Parameters:
rhs- Operator right-hand side.- Returns:
- Result of subtraction.
-
unaryMinus
-
T
Returns the transpose of the variable matrix.- Returns:
- The transpose of the variable matrix.
-
rows
Returns the number of rows in the matrix.- Returns:
- The number of rows in the matrix.
-
cols
Returns the number of columns in the matrix.- Returns:
- The number of columns in the matrix.
-
value
Returns an element of the variable matrix.- Parameters:
row- The row of the element to return.col- The column of the element to return.- Returns:
- An element of the variable matrix.
-
value
Returns an element of the variable block.- Parameters:
index- The index of the element to return.- Returns:
- An element of the variable block.
-
value
Returns the contents of the variable matrix.- Returns:
- The contents of the variable matrix.
-
cwiseMap
Maps the matrix coefficient-wise with an unary operator.- Parameters:
unaryOp- The unary operator to use for the map operation.- Returns:
- Result of the unary operator.
-
size
-
iterator
-
stream
-