Java cova真军片明_Java与Smalltalk - 协方差和逆变 (Java vs Smalltalk - covarince and contravariance)...

Covariance and contravariance are concepts that relate to declared types of arguments and return values. For example, method arguments are contravariant if the types of the arguments in subclass methods can specify a more general type than the types in the superclass.

Smalltalk has no static type declarations. You can apply the concepts of covariance and contravariance but since the language allows you to send any message to any object, it won't enforce any rules that covariance and contravariance may entail.

So, yes, Smalltalk supports covariance and contravariance in the sense that it allows you to use those concepts and no in the sense that it just doesn't care one way or the other.

void Trajectory::predict_box( uint idx_duration, std::vector<Box>& vec_box, std::vector<Eigen::MatrixXf, Eigen::aligned_allocatorEigen::MatrixXf>& vec_cova, bool& is_replay_frame) { vec_box.clear(); vec_cova.clear(); if (is_replay_frame) { for (auto iter = map_current_box_.begin(); iter != map_current_box_.end(); ++iter) { Destroy(iter->second.track_id()); } m_track_start_.Clear_All(); NU = 0; is_replay_frame = false; } Eigen::MatrixXf F_temp = F_; F_temp(0, 1) = idx_duration * F_(0, 1); F_temp(2, 3) = idx_duration * F_(2, 3); F_temp(4, 5) = idx_duration * F_(4, 5); uint64_t track_id; Eigen::Matrix<float, 6, 1> state_lidar; Eigen::Matrix<float, 6, 6> P_kkminus1; Eigen::Matrix3f S_temp; for (auto beg = map_current_box_.begin(); beg != map_current_box_.end(); ++beg) { float t = (fabs(0.1 - beg->second.frame_duration()) > 0.05) ? 0.1 : 0.2 - beg->second.frame_duration(); F_temp(0, 1) = t; F_temp(2, 3) = t; F_temp(4, 5) = t; // uint64_t timestamp_new = beg->second.timestamp() + uint(10.0 * t * NANO_FRAME); track_id = beg->first; state_lidar = F_temp * map_lidar_state_.at(track_id); P_kkminus1 = F_temp * map_lidar_cova_.at(track_id) * F_temp.transpose() + Q_lidar_; S_temp = H_ * P_kkminus1 * H_.transpose() + R_lidar_; float psi_new = (1 - P_D_ * P_G_) * beg->second.psi() / (1 - P_D_ * P_G_ * beg->second.psi()); Box bbox = beg->second; bbox.set_psi(psi_new); // bbox.set_timestamp(timestamp_new); bbox.set_position_x(state_lidar(0)); bbox.set_position_y(state_lidar(2)); bbox.set_position_z(state_lidar(4)); bbox.set_speed_x(state_lidar(1)); bbox.set_speed_y(state_lidar(3)); bbox.set_speed_z(state_lidar(5)); vec_box.emplace_back(bbox); vec_cova.emplace_back(S_temp); } AINFO << "Finish predict with duration frame num: " << idx_duration; } 代码解读
07-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值