// Copyright (C) 2008-2013 Conrad Sanderson
// Copyright (C) 2008-2013 NICTA (www.nicta.com.au)
// Copyright (C) 2012 Ryan Curtin
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup Mat
//! @{
template<typename eT>
inline
Mat<eT>::~Mat()
{
arma_extra_debug_sigprint_this(this);
if(mem_state == 0)
{
if(n_elem > arma_config::mat_prealloc)
{
memory::release( access::rw(mem) );
}
}
if(arma_config::debug == true)
{
// try to expose buggy user code that accesses deleted objects
access::rw(mem) = 0;
}
arma_type_check(( is_supported_elem_type<eT>::value == false ));
}
template<typename eT>
inline
Mat<eT>::Mat()
: n_rows(0)
, n_cols(0)
, n_elem(0)
, vec_state(0)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
}
//! construct the matrix to have user specified dimensions
template<typename eT>
inline
Mat<eT>::Mat(const uword in_n_rows, const uword in_n_cols)
: n_rows(in_n_rows)
, n_cols(in_n_cols)
, n_elem(in_n_rows*in_n_cols)
, vec_state(0)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
init_cold();
}
//! construct the matrix to have user specified dimensions and fill with specified pattern
template<typename eT>
template<typename fill_type>
inline
Mat<eT>::Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill_class<fill_type>& f)
: n_rows(in_n_rows)
, n_cols(in_n_cols)
, n_elem(in_n_rows*in_n_cols)
, vec_state(0)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
init_cold();
(*this).fill(f);
}
//! constructor used by Row and Col classes
template<typename eT>
inline
Mat<eT>::Mat(const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
}
//! constructor used by Row and Col classes
template<typename eT>
inline
Mat<eT>::Mat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state)
: n_rows(in_n_rows)
, n_cols(in_n_cols)
, n_elem(in_n_rows*in_n_cols)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
init_cold();
}
template<typename eT>
inline
Mat<eT>::Mat(const arma_fixed_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state, const eT* in_mem)
: n_rows (in_n_rows)
, n_cols (in_n_cols)
, n_elem (in_n_rows*in_n_cols)
, vec_state (in_vec_state)
, mem_state (3)
, mem (in_mem)
{
arma_extra_debug_sigprint_this(this);
}
template<typename eT>
inline
void
Mat<eT>::init_cold()
{
arma_extra_debug_sigprint( arma_boost::format("n_rows = %d, n_cols = %d") % n_rows % n_cols );
// ensure that n_elem can hold the result of (n_rows * n_cols)
arma_debug_check
(
(
( (n_rows > ARMA_MAX_UHWORD) || (n_cols > ARMA_MAX_UHWORD) )
? ( (float(n_rows) * float(n_cols)) > float(ARMA_MAX_UWORD) )
: false
),
"Mat::init(): requested size is too large"
);
if(n_elem <= arma_config::mat_prealloc)
{
arma_extra_debug_print("Mat::init(): using local memory");
access::rw(mem) = mem_local;
}
else
{
arma_extra_debug_print("Mat::init(): allocating memory");
access::rw(mem) = memory::acquire<eT>(n_elem);
}
}
//! internal matrix construction; if the requested size is small enough, memory from the stack is used. otherwise memory is allocated via 'new'
template<typename eT>
inline
void
Mat<eT>::init_warm(uword in_n_rows, uword in_n_cols)
{
arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d") % in_n_rows % in_n_cols );
if( (n_rows == in_n_rows) && (n_cols == in_n_cols) )
{
return;
}
bool err_state = false;
char* err_msg = 0;
const uhword t_vec_state = vec_state;
const uhword t_mem_state = mem_state;
arma_debug_set_error
(
err_state,
err_msg,
(t_mem_state == 3),
"Mat::init(): size is fixed and hence cannot be changed"
);
if(t_vec_state > 0)
{
if( (in_n_rows == 0) && (in_n_cols == 0) )
{
if(t_vec_state == 1)
{
in_n_cols = 1;
}
else
if(t_vec_state == 2)
{
in_n_rows = 1;
}
}
else
{
if(t_vec_state == 1)
{
arma_debug_set_error
(
err_state,
err_msg,
(in_n_cols != 1),
"Mat::init(): requested size is not compatible with column vector layout"
);
}
else
if(t_vec_state == 2)
{
arma_debug_set_error
(
err_state,
err_msg,
(in_n_rows != 1),
"Mat::init(): requested size is not compatible with row vector layout"
);
}
}
}
// ensure that n_elem can hold the result of (n_rows * n_cols)
arma_debug_set_error
(
err_state,
err_msg,
(
( (in_n_rows > ARMA_MAX_UHWORD) || (in_n_cols > ARMA_MAX_UHWORD) )
? ( (float(in_n_rows) * float(in_n_cols)) > float(ARMA_MAX_UWORD) )
: false
),
"Mat::init(): requested size is too large"
);
arma_debug_check(err_state, err_msg);
const uword old_n_elem = n_elem;
const uword new_n_elem = in_n_rows * in_n_cols;
if(old_n_elem == new_n_elem)
{
arma_extra_debug_print("Mat::init(): reusing memory");
access::rw(n_rows) = in_n_rows;
access::rw(n_cols) = in_n_cols;
}
else
{
arma_debug_check
(
(t_mem_state == 2),
"Mat::init(): mismatch between size of auxiliary memory and requested size"
);
if(t_mem_state == 0)
{
if(old_n_elem > arma_config::mat_prealloc)
{
arma_extra_debug_print("Mat::init(): freeing memory");
memory::release( access::rw(mem) );
}
}
if(new_n_elem <= arma_config::mat_prealloc)
{
arma_extra_debug_print("Mat::init(): using local memory");
access::rw(mem) = mem_local;
}
else
{
arma_extra_debug_print("Mat::init(): allocating memory");
access::rw(mem) = memory::acquire<eT>(new_n_elem);
}
access::rw(n_rows) = in_n_rows;
access::rw(n_cols) = in_n_cols;
access::rw(n_elem) = new_n_elem;
access::rw(mem_state) = 0;
}
}
//! create the matrix from a textual description
template<typename eT>
inline
Mat<eT>::Mat(const char* text)
: n_rows(0)
, n_cols(0)
, n_elem(0)
, vec_state(0)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
init( std::string(text) );
}
//! create the matrix from a textual description
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::operator=(const char* text)
{
arma_extra_debug_sigprint();
init( std::string(text) );
return *this;
}
//! create the matrix from a textual description
template<typename eT>
inline
Mat<eT>::Mat(const std::string& text)
: n_rows(0)
, n_cols(0)
, n_elem(0)
, vec_state(0)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
init(text);
}
//! create the matrix from a textual description
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::operator=(const std::string& text)
{
arma_extra_debug_sigprint();
init(text);
return *this;
}
//! internal function to create the matrix from a textual description
template<typename eT>
inline
void
Mat<eT>::init(const std::string& text_orig)
{
arma_extra_debug_sigprint();
const bool replace_commas = (is_cx<eT>::yes) ? false : ( text_orig.find(',') !=
没有合适的资源?快使用搜索试试~ 我知道了~
BpHero-UWB上位机源码V1.zip
共386个文件
hpp:379个
lib:2个
dll:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 162 浏览量
2024-03-01
20:16:53
上传
评论
收藏 3.01MB ZIP 举报
温馨提示
BpHero-UWB上位机源码V1.zip
资源推荐
资源详情
资源评论
收起资源包目录
BpHero-UWB上位机源码V1.zip (386个子文件)
armadillo 19KB
config.hpp.cmake 6KB
lapack_win32_MT.dll 4.14MB
blas_win32_MT.dll 718KB
Mat_meat.hpp 146KB
SpMat_meat.hpp 110KB
diskio_meat.hpp 95KB
Cube_meat.hpp 92KB
auxlib_meat.hpp 90KB
subview_meat.hpp 73KB
Proxy.hpp 64KB
unwrap.hpp 52KB
subview_cube_meat.hpp 45KB
field_meat.hpp 40KB
eglue_core_meat.hpp 31KB
Mat_bones.hpp 31KB
SpSubview_meat.hpp 31KB
Col_meat.hpp 29KB
traits.hpp 29KB
Row_meat.hpp 27KB
SpMat_bones.hpp 27KB
debug.hpp 27KB
glue_times_meat.hpp 26KB
SpSubview_iterators_meat.hpp 24KB
lapack_wrapper.hpp 23KB
eop_core_meat.hpp 22KB
subview_elem1_meat.hpp 21KB
Cube_bones.hpp 21KB
diagview_meat.hpp 20KB
lapack_bones.hpp 19KB
subview_elem2_meat.hpp 19KB
hdf5_misc.hpp 17KB
SpMat_iterators_meat.hpp 17KB
arrayops_meat.hpp 17KB
fn_conv_to.hpp 17KB
ProxyCube.hpp 17KB
SpSubview_bones.hpp 16KB
SpProxy.hpp 16KB
op_strans_meat.hpp 16KB
fn_norm.hpp 15KB
op_princomp_meat.hpp 15KB
diagmat_proxy.hpp 15KB
arma_ostream_meat.hpp 15KB
subview_each_meat.hpp 14KB
promote_type.hpp 14KB
glue_mixed_meat.hpp 14KB
eop_aux.hpp 14KB
mul_gemv.hpp 14KB
op_dot_meat.hpp 13KB
mul_gemm.hpp 13KB
running_stat_vec_meat.hpp 13KB
mul_herk.hpp 13KB
SpRow_meat.hpp 12KB
fn_elem.hpp 12KB
subview_bones.hpp 12KB
mul_syrk.hpp 12KB
mul_gemm_mixed.hpp 12KB
op_cx_scalar_meat.hpp 12KB
SpCol_meat.hpp 12KB
field_bones.hpp 12KB
format_wrap.hpp 12KB
operator_times.hpp 11KB
diskio_bones.hpp 11KB
op_find_meat.hpp 11KB
fn_as_scalar.hpp 11KB
op_min_meat.hpp 11KB
op_htrans_meat.hpp 11KB
op_max_meat.hpp 11KB
fft_engine.hpp 10KB
injector_meat.hpp 10KB
constants.hpp 10KB
op_median_meat.hpp 10KB
op_relational_meat.hpp 10KB
op_all_meat.hpp 9KB
atlas_wrapper.hpp 9KB
restrictors.hpp 9KB
spop_max_meat.hpp 9KB
spop_min_meat.hpp 9KB
spop_var_meat.hpp 9KB
op_any_meat.hpp 9KB
Col_bones.hpp 8KB
fn_eig.hpp 8KB
op_fft_meat.hpp 8KB
Row_bones.hpp 8KB
compiler_setup.hpp 8KB
spglue_times_meat.hpp 8KB
running_stat_meat.hpp 8KB
auxlib_bones.hpp 7KB
op_mean_meat.hpp 7KB
typedef_mat_fixed.hpp 7KB
Gen_meat.hpp 7KB
blas_wrapper.hpp 7KB
op_var_meat.hpp 7KB
glue_relational_meat.hpp 7KB
fn_dot.hpp 6KB
subview_field_meat.hpp 6KB
atlas_bones.hpp 6KB
operator_relational.hpp 6KB
forward_bones.hpp 6KB
operator_cube_relational.hpp 6KB
共 386 条
- 1
- 2
- 3
- 4
资源评论
- weixin_437182782024-06-11感谢大佬,让我及时解决了当下的问题,解燃眉之急,必须支持!
小鸭文库
- 粉丝: 148
- 资源: 5906
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功