RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
MatBuilder.java
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
package
org.wpilib.math.linalg;
6
7
import
java.util.Objects;
8
import
org.ejml.simple.SimpleMatrix;
9
import
org.wpilib.math.util.Nat;
10
import
org.wpilib.math.util.Num;
11
13
public
final
class
MatBuilder {
14
private
MatBuilder() {
15
throw
new
UnsupportedOperationException(
"This is a utility class!"
);
16
}
17
29
public
static <R extends Num, C extends Num>
Matrix<R, C>
fill
(
30
Nat<R>
rows,
Nat<C>
cols,
double
... data) {
31
if
(Objects.requireNonNull(data).length != rows.
getNum
() * cols.
getNum
()) {
32
throw
new
IllegalArgumentException(
33
"Invalid matrix data provided. Wanted "
34
+ rows.
getNum
()
35
+
" x "
36
+ cols.
getNum
()
37
+
" matrix, but got "
38
+ data.length
39
+
" elements"
);
40
}
41
return
new
Matrix<>
(
new
SimpleMatrix(rows.
getNum
(), cols.
getNum
(),
true
, data));
42
}
43
}
org.wpilib.math.linalg.MatBuilder.fill
static< R extends Num, C extends Num > Matrix< R, C > fill(Nat< R > rows, Nat< C > cols, double... data)
Definition
MatBuilder.java:29
org.wpilib.math.linalg.Matrix
Definition
Matrix.java:36
org.wpilib.math.linalg.Matrix.Matrix
Matrix(Nat< R > rows, Nat< C > columns)
Definition
Matrix.java:46
org.wpilib.math.util.Nat
Definition
Nat.java:41
org.wpilib.math.util.Nat.getNum
int getNum()
org
wpilib
math
linalg
MatBuilder.java
Generated by
1.18.0