1 | % Lightspeed Toolbox.
|
---|
2 | % Efficient operations for Matlab programming.
|
---|
3 | % Version 2.1 10-Oct-2006
|
---|
4 | % By Tom Minka
|
---|
5 | % (c) Microsoft Corporation. All rights reserved.
|
---|
6 | %
|
---|
7 | % Matrix algebra
|
---|
8 | % repmat - Fast replacement for matlab's repmat.
|
---|
9 | % xrepmat - Matlab's original repmat.
|
---|
10 | % row_sum - Sum for each row. Faster than 'sum'.
|
---|
11 | % scale_rows - Scale each row of a matrix.
|
---|
12 | % scale_cols - Scale each column of a matrix.
|
---|
13 | % solve_triu - Left division by upper triangular matrix.
|
---|
14 | % solve_tril - Left division by lower triangular matrix.
|
---|
15 | % sqdist - Squared Euclidean and Mahalanobis distance.
|
---|
16 | % isposdef - Check for positive-definiteness.
|
---|
17 | % logdet - log(determinant) for positive definite matrix.
|
---|
18 | %
|
---|
19 | % Statistics
|
---|
20 | % normpdf - Multivariate normal density.
|
---|
21 | % normpdfln - Log of multivariate normal density.
|
---|
22 | % normcdf - Normal cumulative distribution.
|
---|
23 | % normcdfln - Log of normal cumulative distribution.
|
---|
24 | % normcdflogit - Logit of normal cumulative distribution.
|
---|
25 | % wishpdf - Wishart probability density function.
|
---|
26 | % wishpdfln - Log of Wishart probability density function.
|
---|
27 | % sample - Sample from categorical distribution.
|
---|
28 | % sample_vector - Sample from multiple categorical distributions.
|
---|
29 | % sample_hist - Sample from multinomial distribution.
|
---|
30 | % randbinom - Sample from binomial distribution.
|
---|
31 | % randnorm - Sample from multivariate normal.
|
---|
32 | % randgamma - Sample from Gamma distribution.
|
---|
33 | % randbeta - Sample from Beta distribution.
|
---|
34 | % randwishart - Sample from Wishart distribution.
|
---|
35 | % int_hist - Histogram of integer values.
|
---|
36 | %
|
---|
37 | % Utility
|
---|
38 | % logsumexp - Sum in the log domain.
|
---|
39 | % logmulexp - Matrix multiply in the log domain.
|
---|
40 | % ndgridmat - Matrix of grid points.
|
---|
41 | % ind2subv - Subscript vector from linear index.
|
---|
42 | % subv2ind - Linear index from subscript vector.
|
---|
43 | % gammaln - Fast replacement for matlab's gammaln.
|
---|
44 | % digamma - Derivative of gammaln.
|
---|
45 | % trigamma - Derivative of digamma.
|
---|
46 | % ndsum - Sum over multiple dimensions.
|
---|
47 | % ndmax - Maximum over multiple dimensions.
|
---|
48 | % ndlogsumexp - Sum over multiple dimensions in the log domain.
|
---|
49 | % maxdiff - Maximum difference between structs or arrays.
|
---|
50 | % makestruct - Cell-friendly alternative to STRUCT.
|
---|
51 | % setfields - Set multiple fields of a structure.
|
---|
52 | % struct2arglist - Convert structure to cell array of fields/values.
|
---|
53 | % sameobject - Test if two variables correspond to the same object.
|
---|
54 | % find_sameobject - Find an object in a cell array.
|
---|
55 | % toJava - Convert to Java representation.
|
---|
56 | % fromJava - Convert from Java to Matlab.
|
---|
57 | % glob - Filename expansion via wildcards.
|
---|
58 | % globstrings - String matching via wildcards.
|
---|
59 | %
|
---|
60 | % Mutation
|
---|
61 | % mutable - Convert to a mutable object.
|
---|
62 | % immutable - Convert to an ordinary (immutable) object.
|
---|
63 | %
|
---|
64 | % Set operations
|
---|
65 | % ismember_sorted - True for member of sorted set.
|
---|
66 | % match - Location of matches in a set.
|
---|
67 | % match_sorted - Location of matches in a sorted set.
|
---|
68 | % setdiff_sorted - Set difference between sorted sets.
|
---|
69 | % intersect_sorted - Set intersection between sorted sets.
|
---|
70 | % union_sorted - Set union of sorted sets.
|
---|
71 | % union_sorted_rows - Set union of sorted sets of row vectors.
|
---|
72 | % duplicated - Find duplicated rows in a matrix.
|
---|
73 | %
|
---|
74 | % Readability
|
---|
75 | % rows - Number of rows.
|
---|
76 | % cols - Number of columns.
|
---|
77 | % col_sum - Sum for each column.
|
---|
78 | % setdiag - Modify the diagonals of a matrix.
|
---|
79 | % finddiag - Index of elements on diagonals.
|
---|
80 | % argmax - Index of maximum element.
|
---|
81 | % argmin - Index of minimum element.
|
---|
82 | %
|
---|
83 | % Flop counting
|
---|
84 | % flops - Read/write flop counter.
|
---|
85 | % addflops - Add to flop counter.
|
---|
86 | % flops_chol - Flops for Cholesky decomposition.
|
---|
87 | % flops_col_sum - Flops for column sums.
|
---|
88 | % flops_det - Flops for matrix determinant.
|
---|
89 | % flops_digamma - Flops for gammaln, digamma, and trigamma.
|
---|
90 | % flops_div - Flops for division.
|
---|
91 | % flops_exp - Flops for exponential.
|
---|
92 | % flops_inv - Flops for matrix inversion.
|
---|
93 | % flops_mul - Flops for real matrix multiplication.
|
---|
94 | % flops_normpdfln - Flops for normpdfln.
|
---|
95 | % flops_pow - Flops for raising to real power.
|
---|
96 | % flops_randnorm - Flops for randnorm.
|
---|
97 | % flops_row_sum - Flops for row sums.
|
---|
98 | % flops_sample - Flops for sample(p,n).
|
---|
99 | % flops_solve - Flops for matrix left division.
|
---|
100 | % flops_solve_tri - Flops for triangular left division.
|
---|
101 | % flops_spadd - Flops for sparse matrix addition.
|
---|
102 | % flops_spmul - Flops for sparse matrix multiplication.
|
---|
103 | % flops_sqrt - Flops for square root.
|
---|
104 | %
|
---|
105 | % Stand alone programs
|
---|
106 | % matfile - Read/write MAT files.
|
---|
107 | % test_flops - Compare time versus flops for various math operations.
|
---|
108 | %
|
---|
109 | % Graphics utilities
|
---|
110 | % see graphics/Contents.m
|
---|
111 | %
|
---|
112 | % Demos
|
---|
113 | % test_repmat,
|
---|
114 | % test_solve_tri, ...
|
---|