ICode9

精准搜索请尝试: 精确搜索
  • 粒子群算法matlab以求解函数最优解为例2021-04-01 15:33:44

    粒子群算法matlab以求解函数最优解为例 clear; clc; close all; N=100; %粒子个数 D=2; %粒子维数 MaxIter=500; %最大迭代次数 C1max=1.8; %权重参数,自适应 C2max=1.8; C1=1.2; C2=1.2; w=0.79; Wmax=0.8; %对自己速度的记忆 Wmin=0.4; Xmax=4; Xmin=-4; %自变量的范

  • 【leetcode】137. 只出现一次的数字 II2021-03-08 23:03:13

    【leetcode】137. 只出现一次的数字 II 题目python3语言C++语言 题目 python3语言 代码1: class Solution: def singleNumber(self, nums: List[int]) -> int: list1=nums.copy() for i in nums: list1.remove(i) if i not

  • 每日刷题20210303—338. 比特位计数2021-03-03 21:29:20

    比特位计数难度中等621收藏分享切换为英文接收动态反馈给定一个非负整数 num。对于 0 ≤ i ≤ num 范围中的每个数字 i ,计算其二进制数中的 1 的数目并将它们作为数组返回。 示例 1: 输入: 2 输出: [0,1,1] 示例 2: 输入: 5 输出: [0,1,1,2,1,2] 进阶: 给出时间复杂度为O(n*s

  • [LeetCode 1504] Count Submatrices With All Ones2021-02-16 06:32:50

    Given a rows * columns matrix mat of ones and zeros, return how many submatrices have all ones.   Example 1: Input: mat = [[1,0,1],   [1,1,0],   [1,1,0]] Output: 13 Explanation: There are 6 rectangles of side 1x1. There are 2

  • 2021-02-112021-02-11 09:01:26

    广播 (broadcasting) 飞桨(PaddlePaddle,以下简称Paddle)和其他框架一样,提供的一些API支持广播(broadcasting)机制,允许在一些运算时使用不同形状的张量。 通常来讲,如果有一个形状较小和一个形状较大的张量,希望多次使用较小的张量来对较大的张量执行一些操作,看起来像是较小形状的

  • 广播 (broadcasting)2021-02-11 09:01:05

    广播 (broadcasting) 飞桨(PaddlePaddle,以下简称Paddle)和其他框架一样,提供的一些API支持广播(broadcasting)机制,允许在一些运算时使用不同形状的张量。 通常来讲,如果有一个形状较小和一个形状较大的张量,希望多次使用较小的张量来对较大的张量执行一些操作,看起来像是较小形状的张量

  • 【优化求解】遗传优化隶属度函数matlab源码2021-02-01 21:31:11

    遗传算法(Genetic Algorithm, GA)是模拟达尔文生物进化论的自然选择和遗传学机理的生物进化过程的计算模型,是一种通过模拟自然进化过程搜索最优解(所找到的解是全局最优解)的方法。 参数编码、初始群体的设定、适应度函数的设计、遗传操作设计、控制参数设定五个要素组成了遗传算法

  • Numpy库基础2021-02-01 17:35:32

    •ndarray一个强大的N维数组对象Array ndarray的建立(元素默认浮点数) 可以利用list列表建立ndarray import numpy as np list =[0,1,2,3] 从列表类型建立 x = np.array(list) print(x) #[0 1 2 3] 可以利用tuple元组建立ndarray import numpy as np 从元组类型建立 x = n

  • 【CVX】Interpolation with convex functions & Penalty function approx.2021-01-18 13:33:56

    Navigator InterpolationFitting a convex function to given datacvx/yalmip code Penalty function approx.log barrier penalty Reference Interpolation Question: When does there exist a convex function f

  • [LeetCode] 1004. Max Consecutive Ones III 最大连续1的个数之三2021-01-18 06:32:04

    Given an array A of 0s and 1s, we may change up to K values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s. Example 1: Input: A = [1,1,1,0,0,0,1,1,1,1,0], K = 2 Output: 6 Explanation: [1,1,1,0,0,1,1,1,1,1,1] Bol

  • [LeetCode] 1004. Max Consecutive Ones III2021-01-06 03:03:20

    Given an array A of 0s and 1s, we may change up to K values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s.  Example 1: Input: A = [1,1,1,0,0,0,1,1,1,1,0], K = 2 Output: 6 Explanation: [1,1,1,0,0,1,1,1,1,1,1]

  • 方差分析matlib实现2020-12-30 13:33:33

    单因素方差分析的MATLAB实现 单因素均衡数据的实现 单因素非均衡数据方差分析 p192 8.22 X=[85,80,90,88,87,94,56,62,55,48,92,99,95,91,75,72,81]; group=[ones(1,3),2*ones(1,4),3*ones(1,2),4*ones(1,2),5*ones(1,4),6*ones(1,3)]; anova1(X,group); 从箱线图可以看

  • 平安夜快乐 From:二进制人工智能2020-12-24 18:30:20

    Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with th

  • pytorch自定义二值化网络层方式2020-12-16 20:02:33

    更多python教程请到: 菜鸟教程www.piaodoo.com 人人影视www.sfkyty.com 16影视www.591319.com 星辰影院www.591319.com 任务要求: 自定义一个层主要是定义该层的实现函数,只需要重载Function的forward和backward函数即可,如下: import torch from torch.autograd import Functio

  • CSS3 实现倒计时效果2020-11-22 10:35:28

    这篇文章主要介绍了CSS3 实现倒计时效果的示例代码,帮助大家更好的理解和使用CSS3,感兴趣的朋友可以了解下 实现效果      html 1 %div.wrapper 2 %div.time-part-wrapper 3 %div.time-part.minutes.tens 4 %div.digit-wrapper 5 %span.digit 0 6

  • LeetCode 1524 - Number of Sub-arrays With Odd Sum (Medium)2020-11-08 08:01:41

    Given an array of integers arr. Return the number of sub-arrays with odd sum. As the answer may grow large, the answer must be computed modulo 10^9 + 7.   Example 1: Input: arr = [1,3,5] Output: 4 Explanation: All sub-arrays are [[1],[1,3],[1,3,5],[3

  • python基础教程详解torch.Tensor的4种乘法2020-11-06 13:00:28

    更多python教程请到: 菜鸟教程 https://www.piaodoo.com/ torch.Tensor有4种常见的乘法:*, torch.mul, torch.mm, torch.matmul. 本文抛砖引玉,简单叙述一下这4种乘法的区别,具体使用还是要参照官方文档。 点乘 a与b做*乘法,原则是如果a与b的size不同,则以某种方式将a或b进行复制,使得

  • LeetCode #485. Max Consecutive Ones2020-11-03 09:01:35

    题目 485. Max Consecutive Ones 解题方法 遍历数组,如果是1,更新连1的个数,如果是0,更新最大连1个数并把连1个数置0。遍历结束再更新一次最大连1个数即可。 代码 class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: maxones = 0 coun

  • 474. Ones and Zeroes2020-07-16 12:01:36

    Given an array, strs, with strings consisting of only 0s and 1s. Also two integers m and n. Now your task is to find the maximum number of strings that you can form with given m 0s and n 1s. Each 0 and 1 can be used at most once.   Example 1

  • PAT.1049 Counting Ones(排列组合)2020-05-29 21:52:15

    1049 Counting Ones (30分)   The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1's in 1, 10, 11,

  • 国密随机数检测--2/15 块内频数检测2020-04-23 09:52:19

    最近研究随机数检测,主要学习了一下NIST和国密检测,这里整理了国密15项检测规项目的原理,数学表达式以及python源码。 15项检测项目分别为单比特频数检测、块内频数检测、扑克检测、重叠子序列检测、游程总数检测、游程分布检测、块内最大“1”游程检测、二元推导检测、自相关检测、

  • 1049 Counting Ones2020-02-03 18:36:21

     题目 题意:给出一个数字n,求1~n的所有数字里面出现1的个数 tip:从第一位(个位)到最高位,设now为当前位的数字,left为now左边的所有数字构成的数字,right是now右边的所有数字构成的数字。只需要一次次累加对于当前位now来说可能出现1的个数,然后把它们累加即可。a表示当前所在的位数 对

  • [leetcode]Max Consecutive Ones II2020-01-31 21:01:23

    反转0,会将前一段和这一段拼起来。所以记录上一段1的个数和这一段1的个数。 class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: maxCnt = 0 lastCnt = -1 thisCnt = 0 for i in range(len(nums)): if

  • LeetCode474 - Ones and Zeros - Medium (Python)2020-01-31 10:57:50

    In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a dominator of m 0s and n 1s respectively. On the other hand, there is an array with strings consisting of onl

  • opencv学习笔记(二)2020-01-22 13:39:44

    opencv学习笔记(二) 主要熟悉了几个基本操作函数,如下: 腐蚀操作,kernel是一个55数组,腐蚀操作中先在图像中取出一个上述大小的像素方阵,然后对比其他像素,如果在55范围内出现相同值(比如说黑色),则把该像素置为黑色。 def corrosionOperation(img):#腐蚀操作 kernel = np.ones((5,

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有