⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddot_.cpp

📁 最大熵 等模型使用的 lbfgs 训练源代码。
💻 CPP
字号:
#include <iostream>#include <stdlib.h>#include "lbfgs.h"/* ddot function realizes inner production of two input vectors x and y.   Concretely speacking, it computes five relative weights at one time.*/void main(){	float x[10]={1,2,3,4,5,6,7,8,9,10};	float y[10]={-1,-2,-3,-4,-5,-6,-7,-8,-9,-10};	std::cout<<"vector starts at first position and shifts with 1 step length"<<std::endl;	std::cout<<scitbx::lbfgs::detail::ddot<float,int>(10,x,y)<<std::endl;	std::cout<<1*1+2*2+3*3+4*4+5*5+6*6+7*7+8*8+9*9+10*10<<std::endl;	std::cout<<"vector starts at first position and shifts with 2 step length"<<std::endl;	std::cout<<scitbx::lbfgs::detail::ddot<float,int>(5,x,0,2,y,0,2)<<std::endl;	std::cout<<1*1+3*3+5*5+7*7+9*9<<std::endl;	std::cout<<"vector starts at third position and shifts with 1 step length"<<std::endl;	std::cout<<scitbx::lbfgs::detail::ddot<float,int>(7,x,3,1,y,3,1)<<std::endl;	std::cout<<4*4+5*5+6*6+7*7+8*8+9*9+10*10<<std::endl;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -