代码搜索结果
找到约 582,192 项符合
Cortex-M 的代码
sampleuniformints.m
function M = sampleUniformInts(N, r, c)
% M is an rxc matrix of integers in 1..N
prob = normalize(ones(N,1));
M = sample_discrete(prob, r, c);
sqdist.m
function m = sqdist(p, q, A)
% SQDIST Squared Euclidean or Mahalanobis distance.
% SQDIST(p,q) returns m(i,j) = (p(:,i) - q(:,j))'*(p(:,i) - q(:,j)).
% SQDIST(p,q,A) returns m(i,j) = (p(:,i)
is_psd.m
function b = positive_semidefinite(M)
%
% Return true iff v M v' >= 0 for any vector v.
% We do this by checking that all the eigenvalues are non-negative.
E = eig(M);
if length(find(E>=0)) ==
normalize.m
function [M, z] = normalise(A, dim)
% NORMALISE Make the entries of a (multidimensional) array sum to 1
% [M, c] = normalise(A)
% c is the normalizing constant
%
% [M, c] = normalise(A, dim)
% I
myplot.m
colors = ['r' 'b' 'k' 'g' 'c' 'y' 'm' ...
'r' 'b' 'k' 'g' 'c' 'y' 'm'];
symbols = ['o' 'x' 's' '>' '
setdiag.m
function M = setdiag(M, v)
% SETDIAG Set the diagonal of a matrix to a specified scalar/vector.
% M = set_diag(M, v)
n = length(M);
if length(v)==1
v = repmat(v, 1, n);
end
% e.g., for 3x
rand_psd.m
function M = rand_psd(d, d2, k)
% Create a random positive definite matrix of size d by d by k (k defaults to 1)
% M = rand_psd(d, d2, k) default: d2 = d, k = 1
if nargin
sample_discrete.m
function M = sample_discrete(prob, r, c)
% SAMPLE_DISCRETE Like the built in 'rand', except we draw from a non-uniform discrete distrib.
% M = sample_discrete(prob, r, c)
%
% Example: sample_discr
assign_cols.m
function M = assign_cols(cols, vals, M)
% ASSIGN_COLS Assign values to columns of a matrix
% function M = assign_cols(M, cols, vals, M)
%
% Example:
% M = assign_cols(data, ones(1,N))
% will con
normalise.m
function [M, z] = normalise(A, dim)
% NORMALISE Make the entries of a (multidimensional) array sum to 1
% [M, c] = normalise(A)
% c is the normalizing constant
%
% [M, c] = normalise(A, dim)
% I