23 float data[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
26 for(
size_t i=0; i<3; i++) {
27 for (
size_t j = 0; j < 3; j++) {
34 for(
size_t i=0; i<3; i++) {
35 for (
size_t j = 0; j < 3; j++) {
36 TEST(isnan(m_nan(i,j)));
41 float data2d[3][3] = {
47 for(
size_t i=0; i<3; i++) {
48 for (
size_t j = 0; j < 3; j++) {
54 float data_times_2[9] = {2, 4, 6, 8, 10, 12, 14, 16, 18};
65 float data_minus_1[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
75 float data_row_02_swap[9] = {
81 float data_col_02_swap[9] = {
126 float m7_array[] = {1,2,0,0};
130 float m8_array[] = {3,2,4,0};
138 float data_m9[9] = {2, 4, 6, 8, 10, 12, 14, 16, 18};
139 float lower_bound = 7;
140 float upper_bound = 11;
141 float data_m9_lower_bounded[9] = {7, 7, 7, 8, 10, 12, 14, 16, 18};
142 float data_m9_upper_bounded[9] = {2, 4, 6, 8, 10, 11, 11, 11, 11};
143 float data_m9_lower_constrained[9] = {7, 7, 7, 8, 10, 11, 11, 11, 11};
145 Matrix3f m9_lower_bounded(data_m9_lower_bounded);
146 Matrix3f m9_upper_bounded(data_m9_upper_bounded);
147 Matrix3f m9_lower_upper_constrained(data_m9_lower_constrained);
156 float data_m10[9] = {2, 4, 6, 8, 10, 12, 14, 16, 18};
157 float data_m10_lower_bound[9] = {5, 7, 4, 8, 19, 10, 20, 16, 18};
158 float data_m10_lower_bounded_ref[9] = {5, 7, 6, 8, 19, 12, 20, 16, 18};
159 float data_m10_upper_bound[9] = {6, 4, 8, 18, 20, 11, 30, 16, 18};
160 float data_m10_upper_bounded_ref[9] = {2, 4, 6, 8, 10, 11, 14, 16, 18};
161 float data_m10_constrained_ref[9] = {5, NAN, 6, 8, 19, 11, 20, 16, 18};
163 Matrix3f m10_lower_bound(data_m10_lower_bound);
164 Matrix3f m10_lower_bounded_ref(data_m10_lower_bounded_ref);
165 Matrix3f m10_upper_bound(data_m10_upper_bound);
166 Matrix3f m10_upper_bounded_ref(data_m10_upper_bounded_ref);
167 Matrix3f m10_constrained_ref(data_m10_constrained_ref);
194 12345.67891f, 12345.67891f,
195 1112345.67891f, 12345.111111111f
198 const size_t len = 10*2*3 + 2 + 1;
201 char output[] =
"\t 1\t12345.678\n\t12345.679\t12345.679\n\t1112345.6\t12345.111\n";
202 for (
size_t i = 0; i < len; i++) {
203 TEST(buffer[i] == output[i]);
204 if (buffer[i] ==
'\0') {
211 FILE *fp = fopen(
"testoutput.txt",
"w+");
216 fp = fopen(
"testoutput.txt",
"r");
218 TEST(!fseek(fp, 0, SEEK_SET));
219 for (
size_t i = 0; i < len; i++) {
220 char c =
static_cast<char>(fgetc(fp));
224 printf(
"%d %d %c\n", static_cast<int>(i), c, c);
225 TEST(c == output[i]);
void write_string(char *buf, size_t n) const
Misc.
SquareMatrix< float, 3 > Matrix3f
Matrix< Type, M, N > constrain(const Matrix< Type, M, N > &x, const Type scalar_lower_bound, const Type scalar_upper_bound)
void setCol(size_t j, const Matrix< Type, M, 1 > &column)
Type min(const Type x, const Type y)
void swapRows(size_t a, size_t b)
void setRow(size_t i, const Matrix< Type, N, 1 > &row_in)
bool isEqual(const Matrix< Type, M, N > &x, const Matrix< Type, M, N > &y, const Type eps=1e-4f)
void print(FILE *stream=stdout) const
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
Vector2< float > Vector2f
Dual< Scalar, N > min(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)
Dual< Scalar, N > max(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)
bool isEqualF(const Type x, const Type y, const Type eps=1e-4f)
Compare if two floating point numbers are equal.
void swapCols(size_t a, size_t b)
Type constrain(const Type x, const Type lower_bound, const Type upper_bound)
Type max(const Type x, const Type y)