📄 daxpy_.cpp
字号:
#include <iostream>#include <stdlib.h>#include "lbfgs.h"/* Compute the sum of a vector times a scalar plus another vector. Concretely speacking, it computes four relative weights at one time.*/void main(){ double x[10]={1,2,3,4,5,6,7,8,9,10}; double 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; scitbx::lbfgs::detail::daxpy<double,int>(10,0.1,x,0,y); for(int i=0;i<10;++i) std::cout<<y[i]<<" "; std::cout<<std::endl; std::cout<<"vector starts at first position and shifts with 2 step length"<<std::endl; scitbx::lbfgs::detail::daxpy<double,int>(5,0.1,x,0,2,y,0,2); for(int i=0;i<10;++i) std::cout<<y[i]<<" "; std::cout<<std::endl; std::cout<<"vector starts at third position and shifts with 1 step length"<<std::endl; scitbx::lbfgs::detail::daxpy<double,int>(7,0.1,x,3,1,y,3,1); for(int i=0;i<10;++i) std::cout<<y[i]<<" "; std::cout<<std::endl;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -