first model

This commit is contained in:
2026-07-29 17:34:22 +02:00
parent 47671354ce
commit f5e0ee209b
25 changed files with 2642 additions and 108 deletions
+82 -1
View File
@@ -48,7 +48,7 @@
* Small vectors and matrices are kept serial because the overhead of starting
* worker threads can be larger than the work itself.
*/
static const panic::types::uint_t matrix_omp_min_size = 10000;
static const panic::types::uint_t matrix_omp_min_size = 500;
namespace panic{
namespace tensor{
@@ -308,6 +308,87 @@ const T& matrix<T>::operator()(panic::types::uint_t index_n, panic::types::uint_
}
//--------------------------------------------------------------------------------------------------------------------------
// Function Name : panic::tensor::matrix::set_row
//
// Description:
// Filles and set a row to a value.
//--------------------------------------------------------------------------------------------------------------------------
template <typename T>
bool matrix<T>::set_row(const panic::types::uint_t index_row, const T c){
PANIC_OMP_PARALLEL_FOR_IF(m > matrix_omp_min_size)
for (panic::types::uint_t i = 0; i < m; ++i){
data[index_row*m + i] = c;
}
return true;
}
//--------------------------------------------------------------------------------------------------------------------------
// Function Name : panic::tensor::matrix::set_row
//
// Description:
// Filles and set a row to a vector.
//--------------------------------------------------------------------------------------------------------------------------
template <typename T>
bool matrix<T>::set_row(const panic::types::uint_t index_row, const panic::tensor::vector<T> v){
if (m != v.size()){
return false;
}
PANIC_OMP_PARALLEL_FOR_IF(m > matrix_omp_min_size)
for (panic::types::uint_t i = 0; i < m; ++i){
data[index_row*m + i] = v[i];
}
return true;
}
//--------------------------------------------------------------------------------------------------------------------------
// Function Name : panic::tensor::matrix::set_col
//
// Description:
// Filles and set a column to a value.
//--------------------------------------------------------------------------------------------------------------------------
template <typename T>
bool matrix<T>::set_col(const panic::types::uint_t index_col, const T c){
PANIC_OMP_PARALLEL_FOR_IF(n > matrix_omp_min_size)
for (panic::types::uint_t i = 0; i < n; ++i){
data[i*m + index_col] = c;
}
return true;
}
//--------------------------------------------------------------------------------------------------------------------------
// Function Name : panic::tensor::matrix::set_col
//
// Description:
// Filles and set a colmn to a vector.
//--------------------------------------------------------------------------------------------------------------------------
template <typename T>
bool matrix<T>::set_col(const panic::types::uint_t index_col, const panic::tensor::vector<T> v){
if (n != v.size()){
return false;
}
PANIC_OMP_PARALLEL_FOR_IF(n > matrix_omp_min_size)
for (panic::types::uint_t i = 0; i < n; ++i){
data[i*m + index_col] = v[i];
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------------
// EXPLICIT TEMPLATE INSTANTIATION
//---------------------------------------------------------------------------------------------------------------------------