mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-peak.git
synced 2025-09-29 06:37:33 +00:00
Add: conviniece functions, Fix: Asserts and debug prints
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include <sta/math/linalg/matrix.hpp>
|
||||
#include <sta/math/linalg/linalg.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sta/debug/debug.hpp>
|
||||
#include <sta/debug/assert.hpp>
|
||||
|
||||
namespace math {
|
||||
|
||||
matrix::matrix() {
|
||||
@@ -302,9 +302,19 @@ matrix matrix::zeros(uint8_t r, uint8_t c) {
|
||||
|
||||
}
|
||||
|
||||
float matrix::operator()(uint8_t r, uint8_t c) {
|
||||
matrix matrix::full(uint8_t r, uint8_t c, float v) {
|
||||
|
||||
return datafield[get_idx(r, c)];
|
||||
matrix output(r, c);
|
||||
for (uint16_t i = 0; i < r * c; i++) {
|
||||
output.datafield[i] = v;
|
||||
}
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
float matrix::operator()(uint8_t r, uint8_t c) {
|
||||
float i = datafield[get_idx(r, c)];
|
||||
return i;
|
||||
|
||||
}
|
||||
|
||||
@@ -415,6 +425,7 @@ void matrix::show_serial() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void matrix::show_shape() {
|
||||
|
||||
STA_DEBUG_PRINTF("Matrix shape: (%d x %d)", get_rows(), get_cols());
|
||||
|
Reference in New Issue
Block a user