GCC常用参数

从零构建HFSS连接器仿真模型:以SMP接口的精准复现为例 本文详细介绍了如何从零构建HFSS连接器仿真模型,以SMP接口的精准复现为例。通过获取官方模型、导入技巧、信号路径提取和介质结构复现等步骤,帮助工程师避免常见错误,提升高频电路仿真的准确性。文章特别强调了模型精度对仿真结果的影响,并提供了实用的调试和管理建议。 阅读详情
 一、生成规则的一些选项

-M   自动生成规则,显示.c文件依赖的所有头文件
-MM  自动生成规则,显示.c文件依赖的除标准库外的头文件,输出到终端
-MMD 自动生成规则,显示.c文件依赖的除标准库外的头文件,输出到.d文件
例如Makefile里有如下规则:
    byte_order.o: byte_order.c byte_order.h lala.h other.h

使用-MMD选项的话,只要在Makefile里 #include .d 文件就可以了
但如果只是这样,就会产生重复编译头文件的问题。解决方法是,"预编译"头文件
  1. gcc -x c++-hearder a.h        #生成 a.gch

二、传入宏和取消宏

-D  传入宏
-U  取消宏
  1. #include <stdio.h>
  2.    #ifdef YES
  3.    char* str = "Yes, this is a macro.";
  4.    #else
  5.    char* str = "No, there is no macro.";
  6.    #endif
  7. int main(void){
  8.     printf("%s\n", str);
  9.     return 0;
  10. }
使用-D传入宏YES来进行编译:
  1. recordus@LFS test # gcc -DYES -o helloyes hello.c
  2. recordus@LFS test # ./helloyes
  3. Yes, this is a macro.
而不传入宏则是这样的:
  1. recordus@LFS test # gcc -o hellono hello.c
  2. recordus@LFS test # ./hellono
  3. No, there is no macro.
gcc还有与-D对应的另一个参数-U用于取消宏,比如:
  1. root@LFS test # gcc -DYES -UYES -o helloyesno hello.c
  2. root@LFS test # ./helloyesno
  3. No, there is no macro.
所以看代码时,如果有些宏死活找不到它的定义的话,不妨到Makefile里看一看。
附上Man手册中关于这两个选项的解释:
       -D name
           Predefine name as a macro, with definition 1.

       -D name=definition
           Predefine name as a macro, with definition definition.  The con-
           tents of definition are tokenized and processed as if they
           appeared during translation phase three in a #define directive.
           In particular, the definition will be truncated by embedded new-
           line characters.

           If you are invoking the preprocessor from a shell or shell-like
           program you may need to use the shell's quoting syntax to protect
           characters such as spaces that have a meaning in the shell syntax.

           If you wish to define a function-like macro on the command line,
           write its argument list with surrounding parentheses before the
           equals sign (if any).  Parentheses are meaningful to most shells,
           so you will need to quote the option.  With sh and csh,
           -D'name(args...)=definition' works.

           -D and -U options are processed in the order they are given on the
           command line.  All -imacros file and -include file options are
           processed after all -D and -U options.

       -U name
           Cancel any previous definition of name, either built in or pro-
           vided with a -D option.

转义宏
#
在宏体中允许#号加于参数之前,在宏扩展时将#后的参数转义为字符串
  1. #define PRINTF(x) printf(#x" = %d\n",x)

  2. PRINTF(salary);
    经过gcc预编器扩展为:
        printf("salary"" = %d \n",salary);
        即  printf("salary = %d \n",salary);

合并宏## 在宏体中##将两边的单词合并为一个单词。合并符两边允许有空格。
预处理器在处理时,将这些空格和##符一并删去,使合并符两边的单词合二为一
  1. #define printconv(x) printf("token"#x" = %d",token##x)

  2. printfconv(5);  
    经过gcc预编译器扩展为:
         printf("token5 = %d",token5);

调试宏
  1. printf("%s %d %s\n",__FILE__, __LINE__, __FUNCTION__);

三、库的使用


动态库是执行代码与库代码分离,代码执行过程中才去动态的寻找库文件。
 优点:可以多段代码共用一个库文件,而不用多个拷贝。
 缺点:因为未整合到一起,执行代码移植时,动态库也得移植,否则程序无法运行。

静态库是执行代码与库文件编译成一个文件。
 优点:代码封装在一起,移植时拷贝一个文件即可运行。
 缺点:因为每个执行代码都把库文件代码引进来,文件比较大,系统消耗大。

动态库的查找路径:
1、可以用 LD_LIBRARY_PATH 环境变量指定,可以放到自己的 ~/.bashrc 中只对本用户起作用
2、如果启用了 ld.so.cache 的话,系统会在 /etc/ld.so.cache 中存储所有可引用的动态链接库。
   文件位置可通过 /etc/ld.so.conf 来指定,对全局所有用户都有影响;
   root更改设置后,记得调用 ldconfig 来刷新一下。
3、默认的标准库路径。包括 /lib 和 /usr/lib
4、也可以在编译时指定搜索路径。gcc 的 -Wl 和 -rpath 参数。

pthread 库不是 Linux 系统默认的库,使用时要加头文件#include <pthread.h>
编译时要加 -lpthread
    gcc thread_test.c -o thread -lpthread

<math.h>使用时,需在编译时加 -lm 参数。
<semaphore.h> ,需在编译时加 -lrt参数
编译 mq_open ....等等的时候,要用到 -lrt      (man 7 mq_overview)

可以通过ldd命令来看二进制程序调用了哪些共享库(print shared library dependencie)
  1. [root@local ~]# ldd /bin/ls
  2. librt.so.1 => /lib/tls/librt.so.1 (0x0056b000)
  3. libacl.so.1 => /lib/libacl.so.1 (0x00d70000)
  4. libselinux.so.1 => /lib/libselinux.so.1 (0x00627000)
  5. libc.so.6 => /lib/tls/libc.so.6 (0x006f3000)
  6. libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00942000)
  7. /lib/ld-linux.so.2 (0x006d4000)
  8. libattr.so.1 => /lib/libattr.so.1 (0x00bbc000)
  9. [root@local ~]#
库             头文件         描述
----------   --------------  ----------------------------------
libGL.so       <GL/gl.h>      实现到OpenGL API的接口
libGLU.so      <GL/glu.h>     实现到OpenGL API的接口
libImlib.so    <Imlib.h>      实现一套图像处理例程
libc.so                       实现标准C库(不需要头文件)
libcom_err.so  <com_err.h>    实现出错处理例程的集合
libcrypt.so    <crypt.h>      实现加密函数的集合
libcurses.so   <curses.h>     光标字符模式的屏幕操作库
libdb.so       <db.h>         创建和操作数据库的库
libdl.so       <dlfcn.h>      让程序在运行时加载和使用库代码而无须在编译时链接库
libform.so     <form.h>       实现字符模式应用程序的窗体处理能力
libglib.so     <glib.h>       Glib库,提供了大多数程序需要的大量基本工具函数,比如散列表等
libgthread.so  <glib.h>       实现对Glib的线程支持
libgtk.so      <gtk/gtk.h>    GIMP下的X库
libhistory.so  <readline/readline.h>  实现GNU readline(libreadline)包中的命令行历史机制
libjpeg.so     <jpeglib.h>    定义到JPEG库的接口,赋予应用程序使用JPEG图像文件的能力
libm.so        <math.h>       实现标准C数学库
libmenu.so     <menu.h>       提供在字符模式屏幕上创建和使用菜单的例程
libncurses.so  <ncurses.h>    使用ncurses文本模式屏幕控制系统的应用程序的基础库
libnss.so      <nss.h>        用于名字服务切换工具的功能,提供了名字数据库比如DNS接口
libpanel.so    <panel.h>      提供在字符模式屏幕上创建和使用面板的例程
libpbm.so      <pbm.h>        可移植的位图库,实现了使用多种格式单色位图的接口
libpgm.so      <pgm.h>        可移植的灰度图库,实现了使用多种格式灰色位图的接口
libpng.so      <png.h>        用于编码,解码和操作PNG格式图像文件的参考实现
libpnm.so      <pnm.h>        可移植anymap库是使用多种位图格式的基础库
libppm.so      <ppm.h>        可移植的像素图库实现了使用多种格式彩色像素图的接口
libpthread.so  <pthread.h>    实现了POSIX线程库,标准的Linux多线程库
libreadline.so <readline/readline.h> GNU readline包的基础库
libresolv.so   <resolv.h>     提供使用因特网域名服务器和服务的接口
libslang.so    <slang.h>      提供方便的脚本语言S-lang,用于嵌入其它应用程序
libtiff.so     <tiffio.h>     读写TIFF格式图像文件的库
libz.so        <zlib.h>       通用压缩例程库
libvga.so      <vga.h>        Linux的底层VGA和SVGA图形库 


四、__attribute__机制

__attribute__关键字主要是用来在函数或数据声明中设置其属性,让编译器进行优化。
语法格式:
  1. __attribute__ ((attribute-list))
用法:其位置约束:放于声明的尾部“;”之前,始终紧跟在 '}'之后
  1. struct str_struct{
  2.   uint8_t a;
  3.   uint8_t b;
  4. } __attribute__ ((packed));

  5. typedef struct _GuiPacket_Payload_t {
  6.     uint8_t data[GUI_MAX_DATA_SIZE];
  7.     uint16_t data_len;

  8. }__attribute__ ((packed)) GuiPacket_Payload_t;
packed属性:最常用的一个属性,使用该属性可以使得变量或者结构体成员使用最小的对齐方式。
  1. struct my{ char ch; int a;};    sizeof(int)=4;    sizeof(struct my)=8;  (非紧凑模式)

  2. struct my{ char ch; int a;}__attrubte__((packed));  sizeof(int)=4;  sizeof(struct my)=5;
noreturn属性:告诉编译器这个函数不会返回,以便编译器在优化时去掉不必要的函数返回代码。
  1. extern void exit(int) __attribute__((noreturn));
  2. extern void abort(void) __attribute__((noreturn));
编译原理(东南大学)一:【编译原理期末冲刺救命笔记】速存!看完再上考场稳了! 本文详细介绍了编译原理的核心概念和流程,包括程序设计语言的分类、编译程序的各个阶段(如词法分析、语法分析、语义分析、中间代码生成、优化和目标代码生成)以及编译程序生成和构造的基础知识。文章还探讨了编译中的表格管理、出错处理和遍的概念,以及编译基础知识如高级语言、语法规则、字母表和符号串的运算。此外,文中还涉及文法与语言的关系,包括文法的概念、非终结符、终结符、产生式、推导和规约等。整体内容旨在为学习编译原理的学生提供全面的复习资料和考试准备指南。 阅读详情

相关推荐

存储关键技术·RAID技术·RAID2.0·华为RAID2.0+·华为服务器·云计算

一.RAID基本概念 常见的RAID级别组合RAID级别 二.RAID的数据组织形式 三.RAID的数据保护功能 方法一:镜像方法二:奇偶校验算法(XOR) 四.RAID热备和重构 1.热备(Hot Spare)的定义2.热备的分类3.热备的工作原理 五.RAID 2.0技术 1.RAID 2.02.RAID 2.0+3.华为RAID 2.0+ 六.RAID 2.0+块虚拟化技术 1.什么会出现RAID 2.0+技术?2.什么是RAID 2.0?3.RAID 2.0+的原理是什么?

qq_47480932的博客 3326

毕业设计底层

#include “imlib.h” typedef struct xylr { int16_t x, y, l, r, t_l, b_l; } xylr_t; static float sign(float x) { return x / fabsf(x); } static int sum_m_to_n(int m, int n) { return ((n * (n + 1)) - (m * ...

qq_37756688的博客 266

Windows下Anaconda换清华镜像源最全指南(含常见问题解决)

本文提供了一份详尽的Windows系统下Anaconda配置清华镜像源的完整指南。针对网络下载缓慢的痛点,文章详细对比了命令行添加与直接编辑配置文件两种主流方法,并重点解决了配置过程中常见的文件缺失、安装失败、环境求解缓慢等疑难问题,帮助用户一劳永逸地提升包管理效率。

brandy的博客 342

gcc常用的使用参数

本文详细介绍了GCC编译器的常用参数与实用技巧,涵盖从预处理到优化的完整编译流程。主要内容包括:编译流程控制参数(-E、-S、-c、-o)、警告处理(-Wall、-Werror)、优化选项(-O0到-O3)、调试参数(-g)、头文件与库文件路径设置(-I、-L、-l)、预处理器定义(-D)、C标准选择(-std)等。同时提供了多文件编译、动态库生成等实战示例,以及常见错误的解决方法,帮助开发者高效使用GCC进行项目构建和调试。

2503_90160677的博客 979

基于单片机的室内空气质量监控系统设计

摘 要 I Abstract II 引 言 1 1 控制系统设计 3 1.1 方案选择 3 1.2 系统控制原理 4 2系统硬件设计 5 2.1 单片机的选择与设计 5 2.2 温湿度模块设计 6 2.3 甲醛采集模块设计 8 2.4 显示器模块设计 9 2.5 按键模块设计 10 2.6 报警模块设计 11 2.7 加湿及风扇模块设计 11 3系统软件设计 13 3.1 总流程方案设计 13 3.2 温湿度获取的软件设计 14 3.3 液晶屏LCD1602的软件设计 15 4系统调试 13 4

Q_1928499906的博客 2707

MIT Cheetah Learning (一):State Estimate 从理论到实践:EKF融合IMU与编码器的状态估计全解析

本文深入解析了MIT Cheetah机器人中基于Extended Kalman Filter的状态估计技术,详细探讨了如何融合IMU与编码器数据以实现精准的State Estimate。通过四元数建模和传感器误差分析,揭示了EKF在复杂地形中的工程实践价值,为四足机器人的实时状态估计提供了完整解决方案。

weixin_30292843的博客 311

GCC常用参数使用说明

GCC(GNU Compiler Collection)是一个开源的编译器,它可以编译多种编程语言的源代码,包括C、C++。本文主要讲述GCC常用参数,分类归纳,从学习认知层面更容易吸收。

u013391407的专栏 1576

超越数据手册:深入Zynq XADC的DRP接口与PL端自定义采样逻辑

本文深入探讨Zynq-7000系列XADC模块的DRP接口机制与PL端自定义采样逻辑实现。通过硬件级多通道轮询、触发采样和实时校准技术,突破传统软件驱动限制,为高精度电压测量和通讯应用提供极致灵活性和响应速度。

xxx12的博客 776

[翻译]15个最常用的GCC编译器参数

[翻译]15个最常用的GCC编译器参数 目录 [−] 指定编译输出的名字 通过-Wall参数启用所有警告 使用-E参数只产生预处理输出 使用-S参数只产生汇编代码 使用-C参数只产生编译的代码 使用-save-temps参数产生所有的中间步骤的文件 使用-l参数链接共享库 使用-fPIC产生位置无关的代码 使用-V打印所有的执行命令 使用-ansi参数支持 ISO C89程序 使用-funsigned-char将char解释为符号的char 使用-fsigned-char将char解释为有符号的char

勤学如春起之苗,不见其增,日有所长! 辍学如磨刀之石,不见其损,日有所亏! 1579

117、HDR多帧融合算法:曝光序列、运动鬼影消除与合成权重的高效实现

HDR多帧融合算法实战经验总结 本文分享了HDR多帧融合算法在实际应用中的关键技术和优化经验。主要内容包括: 曝光序列设计:强调动态调整曝光时间比、帧间间隔和拍摄顺序的重要性,特别指出短-中-长的拍摄顺序优势。 运动鬼影消除:比较了三种运动检测方法,推荐梯度域检测方案,并强调在RAW域进行检测的必要性。 合成权重设计:提出基于高斯型权重函数的多因素考量方法,包括基础权重、运动权重和噪声权重的综合处理策略。 高效实现方案:提供NEON指令集加速的具体代码示例,包括梯度计算、权重查表和融合处理等关键步骤。 实用

zzfmlxs的博客 70

华东理工大学计算机预推免面试

华东理工大学预推免面试经验分享

D1379951481的博客 1408

gcc 常用参数

gcc工作流程 预处理  -E(宏替换,头文件展开,注释去掉,xxx.c -&gt; xxx.i) 编译     -S  (xxx.i&gt;xxx.s  汇编文件) 汇编     -c   (xxx.s-&gt;xxx.o 二进制文件)   链接   (xxx.o-&gt;xxx  (可执行)) gcc常用参数 -v/-version 查询版本号。 -I 编译时指定头文...

FixTheCoder 181

华为OD机试 - 整型数组按照个位数排序(Java 双机位C卷 100分)

华为OD机试 双机位C卷题库疯狂收录中,刷题。

学Java,找哪吒 353

GCC常用编译参数

(通常我们不需要这种优化)Os会关闭如下选项: -falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -fprefetch-loop-arrays。l -fpeephole2:允许计算机进行特定的观察孔优化(这个不晓得是什么意思),-fpeephole与-fpeephole2的差别在于不同的编译器采用不同的方式,由的采用-fpeephole,有的采用-fpeephole2,也有两种都采用的。

weixin_42700464的博客 804

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

GCC 使用说明:常用参数详解与最佳实践

GCC(GNU Compiler Collection)是 Linux 系统下广泛使用的编译器套件,支持多种编程语言。本文详细介绍了 GCC 的常用参数,按功能分类整理,包括基础编译选项、库编译选项、链接选项、优化与调试选项、警告与错误控制以及跨平台与兼容性相关参数。通过灵活组合这些参数,开发者可以高效控制代码生成、优化及兼容性需求,满足不同场景下的开发需求。

青蛙博客 1436

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

gcc编译器常用参数

1.gcc 常用参数整理: -v/--version:查看编译器版本 -I:编译时指定头文件路径 -c: 将汇编文件生成二进制文件,得到一个.o文件 -o:指定生成文件的名字 -g:gdb调试的时候需要 -D:在编译的时候指定一个宏 一般在测试的时候使用 2.重点整理 -I 当文件目录结构如下所示:sum.c 为主函数,include目录中包含了头文件head.h ...

杨跟的博客 1800

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

gcc编译常用参数

gcc编译常用参数 指定头文件位置 -I gcc hello.c -I ./headers -o hello 只做预处理, 编译, 汇编, 不做连接, 拿到二进制文件 -c 编译时添加调试信息, 支持gdb调试 -g gcc hello.c -I ./headers -o hello2 -g 显示所有警告信息-Wall 向程序中动态注册一个宏 -D gcc hello.c -o hello -D HELLO 这种宏定义常可以做开关使用, 用于输出调试信息; #ifdef HELLO #defi

qq_38966867的博客 1121

GCC常用参数解释

1)常见编译参数介绍 gcc可以说是个伟大的编译器集合。支持c, c++, object-c, java, fortran, pascal, ada等一大堆语言,同时支持几乎所有32位以上的cpu和部分16位、8位cpu。因此几乎所有开源操作系统、商业unix操作系统、嵌入式开发都使用gcc做编译器。风河也使用gcc来编译vxworks的代码。下面介绍些最常用的编译参数(仅以gcc作为c编译器使

浮白 2252

gcc 常用参数介绍

转自:http://blog.chinaunix.net/uid-13539494-id-1991081.html   1)       常见编译参数介绍 gcc可以说是个伟大的编译器集合。支持c, c++, object-c, java, fortran, pascal, ada等一大堆语言,同时支持几乎所有32位以上的cpu和部分16位、8位cpu。因此几乎所有开源操作系统、商业un

smilestone322的专栏 2124

arm-linux-gcc 常用参数

我们需要编译出运行在ARM平台上的代码,所使用的交叉编译器为 arm-linux-gcc。下面将arm-linux-gcc编译工具的一些常用命令参数介绍给大家。 在此之前首先介绍下编译器的工作过程,在使用GCC编译程序时,编译过程分为四个阶段: 预处理(Pre-Processing) 编译(Compiling) 汇编(Assembling) 链接(Linking) Linux程序员...

退5不落5 501

gcc编译四个步骤及常用参数

gcc编译流程、gcc常用参数

染指流年的博客 2593

GCC常用参数详解

简介 gcc and g++现在是gnu中最主要和最流行的c & c++编译器 .gcc/g++在执行编译工作的时候,总共需要以下几步: 1.预处理,生成.i的文件[预处理器cpp] 2.将预处理后的文件不转换成汇编语言,生成文件.s[编译器egcs] 3.有汇编变为目标代码(机器代码)生成.o的文件[汇编器as] 4.连接目标代码,生成可执行程序[链接器ld] GCC能够处理的后

jiaxiaokai的博客 443

gcc常用参数

gcc 常用参数 命令格式 gcc [选项] 文件 选项 -E    只激活预处理,这个不生成文件,你需要把它重定向到一个输出文件里面 -S 编译到汇编语言不进行汇编和链接 -c 编译到目标代码 -o 文件 输出到 文件 ----------------------------------------------------------------------------...

yanlijun250 93

gcc/g++常用参数

gcc用于编译c语言,g++用于编译c++源代码生成可执行文件过程,预处理-编译-汇编-链接。

qq_45417579的博客 401

GCC常用参数及制作使用库

GCC常用参数及制作使用库 常用参数 -o 指定输出文件名 gcc hello.c -o hello -I 指定头文件所在目录 gcc hello.c -o hello -I ./includes -g 添加调试信息,配合gdb使用 gcc main.c -o debug_main -g -I ./includes/ -Wall 显示所有调试信息 gcc main.c -o mai...

XCMercy 655

gcc命令常用选项参数详解

gcc是GUN C和C++编译器,我们通常使用GCC时,编译器会依次做如下工作:preprocess(预处理),compilation(编译),assembly(汇编),link(链接)。gcc提供了一些选项参数能够让编译器停在某个过程(如编译过程)。

万里之书 9381
上一篇: socketpair用法及用途
下一篇: debian source list源
yanook
博客等级 码龄16年 54粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值