tmp
This commit is contained in:
parent
99a2de65d6
commit
3302548788
@ -780,7 +780,7 @@ namespace gctl
|
|||||||
*
|
*
|
||||||
* @return 返回的模长
|
* @return 返回的模长
|
||||||
*/
|
*/
|
||||||
ArrValType module(norm_type_e n_type = L2);
|
ArrValType module(norm_type_e n_type = L2) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Normalize the array to the given module value
|
* @brief Normalize the array to the given module value
|
||||||
@ -1815,7 +1815,7 @@ namespace gctl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename ArrValType>
|
template <typename ArrValType>
|
||||||
ArrValType array<ArrValType>::module(norm_type_e n_type)
|
ArrValType array<ArrValType>::module(norm_type_e n_type) const
|
||||||
{
|
{
|
||||||
static_assert(std::is_arithmetic<ArrValType>::value,
|
static_assert(std::is_arithmetic<ArrValType>::value,
|
||||||
"gctl::array<T>::module(...) could only be used with an arithmetic type.");
|
"gctl::array<T>::module(...) could only be used with an arithmetic type.");
|
||||||
|
@ -245,6 +245,22 @@ namespace gctl
|
|||||||
*/
|
*/
|
||||||
void assign_all(MatValType in_val);
|
void assign_all(MatValType in_val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 填充矩阵行
|
||||||
|
*
|
||||||
|
* @param r_id 行索引
|
||||||
|
* @param in_val 行数据
|
||||||
|
*/
|
||||||
|
void fill_row(size_t r_id, const array<MatValType> &in_arr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 填充矩阵列
|
||||||
|
*
|
||||||
|
* @param c_id 列索引
|
||||||
|
* @param in_val 列数据
|
||||||
|
*/
|
||||||
|
void fill_column(size_t c_id, const array<MatValType> &in_arr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 对全体元素进行缩放
|
* @brief 对全体元素进行缩放
|
||||||
*
|
*
|
||||||
@ -790,6 +806,32 @@ namespace gctl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename MatValType>
|
||||||
|
void matrix<MatValType>::fill_row(size_t r_id, const array<MatValType> &in_arr)
|
||||||
|
{
|
||||||
|
if (r_id >= row_length) throw std::out_of_range("[gctl::matrix<T>::fill_row] Row index out of range.");
|
||||||
|
if (in_arr.size() != col_length) throw std::invalid_argument("[gctl::matrix<T>::fill_row] Invalid array length.");
|
||||||
|
|
||||||
|
for (size_t j = 0; j < col_length; j++)
|
||||||
|
{
|
||||||
|
val[r_id][j] = in_arr[j];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename MatValType>
|
||||||
|
void matrix<MatValType>::fill_column(size_t c_id, const array<MatValType> &in_arr)
|
||||||
|
{
|
||||||
|
if (c_id >= col_length) throw std::out_of_range("[gctl::matrix<T>::fill_column] Column index out of range.");
|
||||||
|
if (in_arr.size()!= row_length) throw std::invalid_argument("[gctl::matrix<T>::fill_column] Invalid array length.");
|
||||||
|
|
||||||
|
for (size_t i = 0; i < row_length; i++)
|
||||||
|
{
|
||||||
|
val[i][c_id] = in_arr[i];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename MatValType>
|
template <typename MatValType>
|
||||||
void matrix<MatValType>::scale(MatValType s)
|
void matrix<MatValType>::scale(MatValType s)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user