first model
This commit is contained in:
+82
-1
@@ -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
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user