- 博客(57)
- 资源 (9)
- 收藏
- 关注
转载 mnist cnn
import tensorflow as tfimport osfrom tensorflow.examples.tutorials.mnist import input_datafrom tensorflow.contrib.slim.python.slim.nets.inception_v3 import inception_v3_base# 1、利用数据,在训练的时候实时提供数据# mnist手写数字数据在运行时候实时提供给给占位符tf.app.flags.DEFINE_integ.
2022-03-28 13:25:51 99
原创 mnist 识别
import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_dataimport osdef crete_weights(shape): # return tf.Variable(initial_value=tf.random_normal(shape=shape)) return tf.Variable(initial_value=tf.random_normal(shape=sha.
2022-03-28 00:25:59 156
原创 补充读二进制文件
import osimport tensorflow.compat.v1 as tf# tf.disable_v2_behavior()tf.disable_eager_execution()# import tensorflow as tfclass Cifar(object): def __init__(self): # 初始化操作 self.height = 32 self.width = 32 self.cha.
2022-03-27 21:05:59 408
翻译 typora按照教程试用
添加链接描述# 文字处理标题一标题二标题三标题是用#号加空格强调 与不强调,强调是前后加上两个**,不加空格斜体 前后加一个*删除线 删除线是前后加上两个~~list 列表处理有序列表(使用方法是输入数字“1” + “.” + 空格,自动开始有序列表)无序列表无序列表1(“ + ” + 空格)无序列表2(“ - ” + 空格)无序列表3("*" + 空格)加号空格减号空格星号空格表格 ctrl + T, 在弹出的对话框中可
2022-02-10 10:46:13 127
原创 用矩阵推导紧差分的系数
这个lecture——note的下载链接是:https://www.nas.nasa.gov/assets/pdf/ams/2018/introtocfd/Intro2CFD_Lecture2_Pulliam_Chap3_Compact.pdf
2021-11-26 11:01:18 354
原创 有限差分实现二阶导数的六阶近似
% for i = 1:3% err(i) = log2(a(i)/a(i+1))% endsyms dx f0 f0_div1 f0_div2 f0_div3 f0_div4 f0_div5 f0_div6 f0_div7 f0_div8fp1 = f0 + f0_div1*(dx) + f0_div2*(dx)^2/factorial (2) + f0_div3*(dx)^3/factorial (3) + f0_div4*(dx)^4/factorial (4) + f0_d.
2021-11-25 20:36:46 6008
原创 无粘burgers方程的精确解
function Burgers_Exact_SolutionF = @(x) sin ( x ); dF = @(x ) cos ( x );psi = @(x ,t , xi ) x - F( xi )* t - xi ;dpsi = @(x ,t , xi ) - dF ( xi )* t - 1 ;N = 100;x = linspace ( 0, 2*pi , N );Output ( x , 0, F( x ) )t = 0 ; Step = 0;T = 1 ; % 中断时间为.
2021-11-15 11:18:08 1900
原创 2021-11-10
fvm_1d_swe理论主要是参考:【教学向】从零开始的流体力学(一维浅水方程+有限体积法) - 知乎 (zhihu.com)而且我话的不是动图,而且耗散项系数为0时,也太震荡了。function fvm_test_1dclear all ;clc;L = 1;div = 100;%space numberdx = L/div;x0 = 0;x1 = 1;y00 = 0;y1 = 0.25;t0 = 0.0;Final_time = 5;g = 1.0;x = (1:
2021-11-10 16:03:32 92
转载 Crank-Nicolson
function [error,h,k] = heateq_CN(a,b,ti,tf,m,kappa)% a = 0;% b = 1;% m = 100;% ti = 0;%initial time% tf = 1.1;%final_time% kappa = 0.02; % Discretization set up h = abs(b-a)/(m+1); % h = delta x k = 4*h; .
2021-11-08 10:37:11 590
原创 adams求解微分方程组
clear all;clc;x0 = 1;b = 1; y0 = 1;z0 = 1; t0 = 0;h = 0.1;df = @diff;[k,X,Y] = Adams4t(df,t0,b,x0,y0,z0,h);% temp = exact(X);% plot(X,Y,'r',X,temp,'*');plot(X,Y,'*');legend('x','y','z');% function result = exact(x)% result = 3./(1+x.^3.
2021-09-29 15:10:38 1267
原创 线性多步法
clear all;clc;x0 = 0;%定义域的开始b = 1.5; %定义域的结束y0 = 3;%初值h = 0.1;df = @diff;[k,X,Y,wucha,P] = Adams4x(df,x0,b,y0,h);temp = exact(X);plot(X,Y,'r',X,temp,'*');%plot(X,temp,'*');function result = exact(x)%精确解 result = 3./(1+x.^3);%exp(-5*x);en...
2021-09-28 22:01:40 784
原创 BlueFog installation
BlueFog: A software framework for distributed and decentralized optimizationhttps://github.com/Bluefog-LibTeam: Bicheng Yin (Google), Kun Yuan (Alibaba), Hanbin Hu (UCSB), Ji Liu (Baidu), Wotao Yin (Alibaba)Tutorial for Ubuntu 18.04 or 20.04download
2021-08-04 13:43:45 242 1
原创 正交多项式
学习谱方法的时候,用到了正交多项式,回忆一下。据说谱方法是频域上的有限元方法。正交多项式的构造:联想记忆:夹角余弦公式 = 向量內积/向量模向量投影=向量*夹角余弦向量的垂直部分=向量 - 向量投影基于上面的理解,在正交化的时候,向量phi*<phi,待正交化的向量> = phi往x方向的投影,除以分母是莫得平方,可以配给分子和phi各一个,前者代表数值,后者代表方向。基于上面正交化的思想,任意函数的基于勒让德正交多项式的广义傅里叶级数展开为:...
2021-07-30 20:05:06 1981
原创 c++ 函数指针
#include <iostream>#include<stdlib.h>using namespace std;double max(double *x,int n)//求数组中值得最大值{ int i;double max; max = x[0]; for(i = 1;i<n;i++) if(x[i]>ma...
2021-07-30 19:46:51 68
原创 c++ 程序的一点疑问 好像是非静态函数访问了非静态变量
#if 1#include <iostream>//静态成员函数的使用using namespace std;class Student{public: Student(int n,int a,int s):num(n),age(a),score(s){} void total(Student stu); static float average(S...
2021-07-30 19:46:13 108
原创 删除链表的指定位置、指定数值的结点
#if 1#include <stdio.h>#include <stdlib.h>struct Student { int num; float score; struct Student* next;};void output(struct Student* head);int main() { struct Student* head = NULL,*prep = NULL; struct Student* node,*tail = NULL; st..
2021-07-30 19:44:19 196
原创 汉诺塔 C程序
#include <stdio.h>void hanoi(int n, char one, char two, char three);void move(char x, char y);int main(){ int m; printf("input the number of diskes:"); scanf_s("%d", &m); printf("The step to move %d diskes:\n", m); hanoi(m, 'A', 'B', .
2021-07-30 19:43:29 78
原创 删除链表节点
#if 1#include <stdio.h>#include <stdlib.h>struct Student { int num; float score; struct Student* next;};void output(struct Student* head);int main() { struct Student* head = NULL,*prep = NULL; struct Student* node,*tail = NULL; st..
2021-06-06 19:43:44 84
原创 按顺序插入链表节点,并且打印输出
#if 1#include <stdio.h>#include <stdlib.h>struct Student { int num; float score; struct Student* next;};void output(struct Student* head);int main() { struct Student* head = NULL,*prep = NULL; struct Student* node,*tail = NULL; str.
2021-06-02 11:57:17 119
原创 MATLAB 与C语言实现追赶法 (托马斯算法)
算法的原理就是类似于LU分解,然后求解线性方程组。具体可以参考https://www.cnblogs.com/xpvincent/archive/2013/01/25/2877411.html方法一a = [0,1,1,1]';b = [4,4,4,4]';c = [1,1,1]';x = [1,1,1,0]';m = zeros(3,1);n = 4;c(1) = c(1)/b(1);x(1) = x(1)/b(1);for i = 2:n-1 c(i) = c(i)/
2021-03-18 11:27:17 1530 3
原创 数值方法里面欧拉方法,梯形公式法,线性多步法,RK方法,预估校正,MATLAB代码
这个博客主要写了高等教育出版社《数值方法引论》 第十一章常微分方程的数值解法的MATLAB 代码,是一个课后题page257的参考代码,问题的条件如下:[0,1]区间,步长h = 0.1;以下所有的代码段已经打包上传到我的代码资源中了,有需要的可以下载。https://download.csdn.net/download/renbaifen/15810690?spm=1001.2014.3001.5501线性多步,内插function y = multistep_in() %线性多
2021-03-15 17:36:56 2920
原创 latex中常用的数学命令
%导言区\documentclass{ctexart}%book report letter article\title{My First,Document}\author{\kaishu 张三}\date{\today}\usepackage{amsmath}\usepackage{amssymb}%罗马数字的宏包%\usepackage{ctex}\newcommand\degree{^\circ}\begin{document} Hello World!%空行表示回车.
2020-12-23 12:54:26 1104 2
原创 2020-12-15
fortran中subroutine与function的区别Function 有返回值,subroutine 不一定有几个返回值 function能做到的subroutine 一定能做到,定义两个不同的subroutine但是传入的参数不同时,可以放到interface中进行重定义,modure procedure ex1 module procedure ex2 除了重载subroutine需要在interface中声明之外,subroutine不需要再声明,但是function却要放在i...
2020-12-15 11:06:16 298
转载 关于Linux静态库和动态库的分析
https://www.cnblogs.com/hzh1024n/archive/2009/09/17/1568357.html
2020-04-07 10:25:10 96
原创 atoi()函数
头文件#include <stdlib.h>int NoofRows, NoofCols, i, j,Total_threads,Noofthreads;Noofthreads=atoi(argv[1]);NoofRows=atoi(argv[2]);NoofCols=atoi(argv[3]);这样不用反复修改源文件中的线程数,矩阵规模等变量正常编译,只是执行的时...
2020-02-22 11:56:42 220
原创 C语言的几种不同的计时函数
clock()函数方法 clock_t time1,time2;time1 = clock(); time2 = clock();double run_time = (double)(time2-time1)/CLOCKS_PER_SEC;printf("runtime = %f\n",run_time); ...
2020-02-22 11:48:09 1106
原创 OpenMP实现矩阵转置
矩阵转置实际上是很简单的,但是数据类型是虚数的时候,编译器会认为实部虚部有数据依赖从而不能自动向量化,通过编译指导#pragma ivdep可以解除这种貌似的数据依赖,但是自动向量化的执行速度应该没有OpenMP快,干脆改成OpenMP并行得了。#include <stdio.h>#include <stdlib.h>#include <omp.h>...
2020-02-22 11:13:07 534
Linux 输出当前系统时间
#include<time.h>#include<stdio.h>int main(){ struct tm *t; time_t tt; time(&tt); t = localtime(&tt); printf("%4d年%02d月%02d日 %02d:%02d:%02d\n", t->tm_year ...
2019-10-15 20:32:36 439
原创 Linux输出当前系统时间
#include<time.h>#include<stdio.h>int main(){ struct tm *t; time_t tt; time(&tt); t = localtime(&tt); printf("%4d年%02d月%02d日 %02d:%02d:%02d\n", t->tm_year ...
2019-09-22 10:35:24 1687
原创 MATLAB将数据写入TXT文件
fid=fopen('data.txt','w');for i = 1:size(Echo_h1,1) for j = 1:size(Echo_h1,2) fprintf(fid,'%f\t',Echo_h1(i,j)); endendfclose(fid);
2019-07-26 12:00:12 3248 1
原创 c++ 傅里叶变换
#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <math.h>#include<iostream>#include "fftw3.h"using namespace std;#pragma comment(lib, "libfftw3-3.l...
2019-07-26 08:36:43 1987
原创 c语言c++用来指定输出的小数位数,实现任意长度的FFT,快速傅里叶变换
cout << setiosflags(ios::fixed) << setprecision(6) <<sum.real << "\t" << sum.imag << endl;#if 1#include <stdio.h>#include <complex.h>#include &l...
2019-07-25 22:32:59 850
原创 mpi测试程序
#include<stdio.h>#include<mpi.h>#include<stdlib.h>#include<time.h>int main(int argc, char* argv[]){ int myid, numprocs, namelen; char processor_name[MPI_MAX_PROC...
2019-07-11 11:01:30 2053 2
原创 安装gcc
安装gmp时,因为没有超级用户权限不能登录,不能按照:将2进行修改,,使用 ./configure --prefix=/path/to/install 设置安装路径。因为是没有root权限的,所以需要修改安装路径,安装到自己有权限的文件夹下。安装mpc过程中找不到*.la 的问题可以参考这个网站https://www.csdndoc.com/article/6665202?tdsour...
2019-05-17 19:02:28 470
数值方法的MATLAB代码,Euler方法(向前欧拉,向后欧拉),梯形公式,线性多步法(外插,内插)
2021-03-15
matrix transpose.cpp
2020-02-22
通过减少问题规模形式,做并行计算,求解矩阵相乘问题,mpi,MPI,思想是将第一个矩阵分块,每个进程只计算矩阵的几行
2018-04-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人