mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-peak.git
synced 2025-06-10 01:55:59 +00:00
Fix asserts for get_index
This commit is contained in:
parent
e9b2017744
commit
5cf23f802e
@ -27,7 +27,7 @@ sta::math::matrix m_0 = sta::math::matrix::zeros(3,2);
|
|||||||
// Set specific entries in the matrix:
|
// Set specific entries in the matrix:
|
||||||
m_0.set(0, 1, 4); // set the entry in the first column and second column to 0
|
m_0.set(0, 1, 4); // set the entry in the first column and second column to 0
|
||||||
m_0.set(1, 0, 5);
|
m_0.set(1, 0, 5);
|
||||||
m_0.set(2, 2, 99);
|
//m_0.set(2, 2, 99); -> Column index out of range
|
||||||
|
|
||||||
// Display the matrix:
|
// Display the matrix:
|
||||||
m_0.show_serial();
|
m_0.show_serial();
|
||||||
|
@ -329,7 +329,8 @@ float matrix::operator[](uint16_t i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t matrix::get_idx(uint8_t r, uint8_t c) {
|
uint16_t matrix::get_idx(uint8_t r, uint8_t c) {
|
||||||
STA_ASSERT_MSG(r * c <= get_size(), "Index out of bounds get_idx");
|
STA_ASSERT_MSG(c < get_cols(), "Column index out of bounds get_idx");
|
||||||
|
STA_ASSERT_MSG(r < get_rows(), "Row index out of bounds get_idx");
|
||||||
|
|
||||||
return (r * get_cols()) + c;
|
return (r * get_cols()) + c;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user