两个向量的outer product
#include <functional>
template <class T1, class T2, class T3>
void outer_product(std::vector<T1> &inst1, std::vector<T2> &inst2, std::vector<std::vector<T3> > &out) {
std::vector<T3> temp_row(inst2.size());
for(typename::std::vector<T1>::const_iterator it=inst1.begin();it!=inst1.end();++it) {
transform(inst2.begin(), inst2.end(), temp_row.begin(), bind2nd(std::multiplies<T1>(), *it));
out.push_back(temp_row);
}
}
列向量与行向量相乘,结果为一个二维矩阵。
两个向量的outer product的更多相关文章
- 向量 dot cross product 点积叉积 几何意义
向量 dot cross product 点积叉积 几何意义 有向量 a b 点积 a * b = |a| * |b| * cosθ 几何意义: 1. a * b == 0,则 a ⊥ b 2. a ...
- 向量点积(Dot Product),向量叉积(Cross Product)
参考的是<游戏和图形学的3D数学入门教程>,非常不错的书,推荐阅读,老外很喜欢把一个东西解释的很详细. 1.向量点积(Dot Product) 向量点积的结果有什么意义?事实上,向量的点积 ...
- NX二次开发-UFUN已知两个向量方向求夹角角度UF_VEC3_angle_between
NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_vec.h> #include <uf_ ...
- NX二次开发-UFUN求两个向量的叉乘UF_VEC3_cross
NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_vec.h> #include <uf_ ...
- c++ 知道旋转前后矩阵向量值 求旋转矩阵c++/c#代码 知道两个向量求他们的旋转矩阵
原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/12115244.html 知道旋转前后矩阵向量值 如何去求旋转矩阵R 的c++/c#代码??? ...
- MLR:输入两个向量,得出两个向量之间的相关度—Jason niu
import numpy as np from astropy.units import Ybarn import math from statsmodels.graphics.tukeyplot i ...
- 两个向量之间的欧式距离及radial-basis-functions(RBF)
template <class DataType1, class DataType2>double EuclideanDistance(std::vector<DataType1&g ...
- 计算机科学基础知识(一)The Memory Hierarchy
一.前言 最近一个问题经常萦绕在我的脑海:一个学习电子工程的机械师如何称为优秀的程序员?(注:本文作者本科学习机械设计,研究生转到电子工程系学习,毕业后却选择了系统程序员这样的职业).经过思考,我认为 ...
- Vector3函数理解-计算两向量之间的角度
1.已知两个向量dirA,dirB.Vector3 dirA = new Vector3(-1,1,0); Vector3 dirB = new Vector3(-1,1,1);2.使向量处于同一个平 ...
随机推荐
- 三角形状的点阵模糊效果iOS源码
源码FFAngularPointilism,FFAngularPointilism能够将UIImageView像添加滤波器一样生成三角形状的点阵模糊效果.可以通过动画方式来模糊,也可以立刻模糊.另外并 ...
- 循环语句和方法(day4)
- 扩增子分析QIIME2-4分析实战Moving Pictures
本示例的的数据来自文章<Moving pictures of the human microbiome>,Genome Biology 2011,取样来自两个人身体四个部位五个时间点 ...
- 非常好用的1款UI自动化测试工具:airTest
网易团队开发的UI自动化测试神器airTest,下载地址:http://airtest.netease.com/tutorial/Tutorial.html Appium和airTest对比,我的看法 ...
- CAD通过扩展记录实体向数据库读写用户自定义的全局数据(com接口VB语言)
VB代码实现如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...
- xadmin站点管理类
9. Xadmin xadmin是Django的第三方扩展,比使用Django的admin站点更强大也更方便. 文档:https://xadmin.readthedocs.io/en/latest/i ...
- django的时间问题
三个时间datetime.datetime.now().datetime.datetime.utcnow()与django.util.timezone.now()的区别 datetime.dateti ...
- Sencha Toucha 2.1 文件上传
javascript代码: Ext.onReady(function() { Ext.create('Ext.form.Panel', { title: 'Upload a Photo', width ...
- 20180530利用Maxwell组件实时监听Mysql的binlog日志
转自:https://blog.csdn.net/qq_30921461/article/details/78320750 http://kafka.apache.org/quickstart htt ...
- php表单常用正则表达式
<?php /** * @description: 正则表达式匹配 */ class Regex { /** * @手机号 */ public static function Phone($su ...