plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | GHilmarG/UaSource-master | cfmtri2.m | .m | UaSource-master/Mesh2d/mesh-util/cfmtri2.m | 4,325 | utf_8 | 90e3b1bd128edf865b221553865e748a | function [vert,econ,tria] = cfmtri2(vert,econ)
%CFMTRI2 compute a conforming 2-simplex Delaunay triangulat-
%ion in the two-dimensional plane.
% [VERT,CONN,TRIA]=CFMTRI2(VERT,CONN) computes the confor-
% ming Delaunay trianguation, given the points VERT, and
% edge constraints CONN. New points are inserted t... |
github | GHilmarG/UaSource-master | findtria.m | .m | UaSource-master/Mesh2d/aabb-tree/findtria.m | 9,997 | utf_8 | 484eecf719f81563654cfacbf4377716 | function [tp,tj,tr] = findtria(pp,tt,pj,varargin)
%FINDTRIA spatial queries for collections of d-simplexes.
% [TP,TI] = FINDTRIA(PP,TT,PJ) finds the set of simple-
% xes that intersect with a given spatial query. Simplexes
% are specified via the vertex array PP = [X1,X2,...,XN]
% and the indexing array ... |
github | GHilmarG/UaSource-master | findball.m | .m | UaSource-master/Mesh2d/aabb-tree/findball.m | 4,408 | utf_8 | 44330ba8e7fd8128d6bbe9ea837e3e73 | function [bp,bj,tr] = findball(bb,pp,varargin)
%FINDBALL spatial queries for collections of d-balls.
% [BP,BI] = FINDBALL(BB,PI) finds the set of d-dim. balls
% that intersect with a given spatial query. Balls are sp-
% ecified as a set of centres BB(:,1:ND) and (squared)
% radii BB(:,ND+1), where ND is t... |
github | GHilmarG/UaSource-master | maprect.m | .m | UaSource-master/Mesh2d/aabb-tree/maprect.m | 1,836 | utf_8 | 16eb7494a1e2590af6fe9ea8bde87bbf | function [tm,im] = maprect(tr,pr)
%MAPRECT find the tree-to-rectangle mappings.
% [TM,IM] = MAPRECT(TR,PR) returns the tree-to-rectangle
% and rectangle-to-tree mappings for a given aabb-tree TR
% and a collection of query vertices PI.
%
% The tree-to-item mapping TM is a structure representing
% the... |
github | GHilmarG/UaSource-master | lineline.m | .m | UaSource-master/Mesh2d/aabb-tree/lineline.m | 5,459 | utf_8 | a61d4428bcee73b9e9d407a012faf025 | function [lp,lj,tr] = lineline(pa,pb,pc,pd,varargin)
%LINELINE intersection between lines in d-dimensional space.
% [LP,LI] = LINELINE(PA,PB,PC,PD) finds intersections bet-
% ween line segments in d-dimensions. Lines are specified
% as a set of endpoints [PA,PB] and [PC,PD] where PA, PB,
% PC and PD are ... |
github | GHilmarG/UaSource-master | mapvert.m | .m | UaSource-master/Mesh2d/aabb-tree/mapvert.m | 1,727 | utf_8 | 73a7c379f942b1ad4978499565f51ce6 | function [tm,im] = mapvert(tr,pi)
%MAPVERT find the tree-to-vertex mappings.
% [TM,IM] = MAPVERT(TR,PI) returns the tree-to-vertex and
% vertex-to-tree mappings for a given aabb-tree TR and a
% collection of query vertices PI.
%
% The tree-to-item mapping TM is a structure representing
% the intersec... |
github | GHilmarG/UaSource-master | findline.m | .m | UaSource-master/Mesh2d/aabb-tree/findline.m | 5,368 | utf_8 | 39eb8d29fa2ce3eb356455be3cc1496f | function [lp,lj,tr] = findline(pa,pb,pp,varargin)
%FINDLINE "point-on-line" queries in d-dimensional space.
% [LP,LI] = FINDLINE(PA,PB,PI) finds the set of d-dimensi-
% onal line-segments that intersect with a given spatial
% query. Lines are specified as a set of endpoints [PA,PB]
% where both PA and PB ... |
github | GHilmarG/UaSource-master | kxky2kl.m | .m | UaSource-master/TransferFunctions/kxky2kl.m | 385 | utf_8 | 0189de25b3e4e6c7c01486f19bc7c4a2 |
function [k,l] = kxky2kl(kx,ky)
% kxky2kl
% if both kx and ky are vectors create 2d arrays by replicating
% otherwise do nothing
if isvector(kx) && isvector(ky) && length(kx) >1 && length(ky)>1
kx=kx(:); ky=ky(:);
k=repmat(kx,1,length(ky));
l=repmat(ky',lengt... |
github | GHilmarG/UaSource-master | SSTREAM_Tsb_t_3d_m.m | .m | UaSource-master/TransferFunctions/SSTREAM_Tsb_t_3d_m.m | 1,394 | utf_8 | d70e1e5b5bcd3c188b53de82123308ce |
function [trans]=SSTREAM_Tsb_t_3d_m(kx,ky,t,alpha,H,eta,C,rho,g,m)
% time-dependent ratio between surface topography and
% bedrock in Fourier space in dimensional units
% for non-dimensional a la gudmundsson 2003
% put eta=1/2, H0=1,rho*g=1/sin(alpha), lambda in units of mean ice thickness
% Cnondimensiona... |
github | GHilmarG/UaSource-master | SSTREAM_Tsc_t_3d_m.m | .m | UaSource-master/TransferFunctions/SSTREAM_Tsc_t_3d_m.m | 850 | utf_8 | c568f4d64485c6453b11e573b2462372 |
function [trans]=SSTREAM_Tsc_t_3d_m(kx,ky,t,alpha,H,eta,C,rho,g,m)
% for non-dimensional a la gudmundsson 2003
% put eta=1/2, H0=1,rho*g=1/sin(alpha), lambda in units of mean ice thickness
% Cnondimensional=2 eta/H0 Cdimesional, and then
% U0nondimensional=Cnondimensional
[k,l] = kxky2kl(kx,ky);
j2=k.^2+... |
github | GHilmarG/UaSource-master | SSTREAM_Tuc_t_3d_m.m | .m | UaSource-master/TransferFunctions/SSTREAM_Tuc_t_3d_m.m | 1,079 | utf_8 | 35e9842cc4b68132c71366bd0ab285b6 |
function [trans]=SSTREAM_Tuc_t_3d_m(kx,ky,t,alpha,H,eta,C,rho,g,m)
% for non-dimensional a la gudmundsson 2003
% put eta=1/2, H0=1,rho.*g=1/sin(alpha), lambda in units of mean ice thickness
% Cnondimensional=2 eta/H0 Cdimesional, and then
% U0nondimensional=Cnondimensional
[k,l] = kxky2kl(kx,ky);
j2=k.^2... |
github | GHilmarG/UaSource-master | colornames_cube.m | .m | UaSource-master/colornames/colornames_cube.m | 7,688 | utf_8 | b1e91a82fd28a8581c22d047d752a424 | function colornames_cube(palette,space)
% Plot COLORNAMES palettes in a color cube (RGB/Lab/LCh/HSV/XYZ). With DataCursor labels.
%
% (c) 2014 Stephen Cobeldick
%
%%% Syntax:
% colornames(palette,space)
%
% Plot the COLORNAMES palettes in an RGB/Lab/LCh/HSV/XYZ cube. Color names
% can be viewed by clicking on... |
github | GHilmarG/UaSource-master | colornames.m | .m | UaSource-master/colornames/colornames.m | 17,607 | utf_8 | f3e0ceaa5aff351b723c9c166bb403f6 | function [clr,rgb] = colornames(palette,varargin)
% Convert between RGB values and color names: from RGB to names, and names to RGB.
%
% (c) 2014 Stephen Cobeldick
%
% Easily convert between RGB values and color names, in both directions!
%
% COLORNAMES matches the input colors (either names or an RGB map) to co... |
github | GHilmarG/UaSource-master | SuiteSparse_install.m | .m | UaSource-master/SuiteSparse/SuiteSparse_install.m | 11,044 | utf_8 | c668fa28a0231969d48eca22885b7eed | function SuiteSparse_install (do_demo)
%SuiteSparse_install: compiles and installs all of SuiteSparse
% A Suite of Sparse matrix packages, authored or co-authored by Tim Davis.
%
% Packages in SuiteSparse:
%
% UMFPACK sparse LU factorization (multifrontal)
% CHOLMOD sparse Cholesky factorization, a... |
github | GHilmarG/UaSource-master | colamd_test.m | .m | UaSource-master/SuiteSparse/COLAMD/MATLAB/colamd_test.m | 12,366 | utf_8 | fcff410561273f12f57df697888bb401 | function colamd_test
%COLAMD_TEST test colamd2 and symamd2
% Example:
% colamd_test
%
% COLAMD and SYMAMD testing function. Here we try to give colamd2 and symamd2
% every possible type of matrix and erroneous input that they may encounter.
% We want either a valid permutation returned or we want them to fai... |
github | GHilmarG/UaSource-master | ccolamd_test.m | .m | UaSource-master/SuiteSparse/CCOLAMD/MATLAB/ccolamd_test.m | 12,434 | utf_8 | a5153f976efc4b39c20a9bd41a02ca8b | function ccolamd_test
%CCOLAMD_TEST extensive test of ccolamd and csymamd
%
% Example:
% ccolamd_test
%
% See also csymamd, ccolamd, ccolamd_make.
% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam
% Developed in collaboration with J. Gilbert and E. Ng.
help ccolamd_test
g... |
github | GHilmarG/UaSource-master | klu_make.m | .m | UaSource-master/SuiteSparse/KLU/MATLAB/klu_make.m | 12,116 | utf_8 | e3f759ae224922a40d4013c9bca8ab12 | function klu_make (metis_path)
%KLU_MAKE compiles the KLU mexFunctions
%
% Example:
% klu_make
%
% KLU relies on AMD, COLAMD, and BTF for its ordering options, and can
% optionally use CHOLMOD, CCOLAMD, CAMD, and METIS as well. METIS must
% be placed in ../../metis-4.0 alongside KLU, or it will not be used.
... |
github | GHilmarG/UaSource-master | cs_make.m | .m | UaSource-master/SuiteSparse/CSparse/MATLAB/CSparse/cs_make.m | 7,945 | utf_8 | a731ff76c59beca14c7d55e10c836946 | function [objfiles, timestamp_out] = cs_make (f)
%CS_MAKE compiles CSparse for use in MATLAB.
% Usage:
% cs_make
% [objfiles, timestamp] = cs_make (f)
%
% With no input arguments, or with f=0, only those files needing to be
% compiled are compiled (like the Unix/Linux/GNU "make" command, but no... |
github | GHilmarG/UaSource-master | mynormest1.m | .m | UaSource-master/SuiteSparse/CSparse/MATLAB/Test/mynormest1.m | 1,913 | utf_8 | 99abcc31ec47830285e9740170414ccd | function est = mynormest1 (L, U, P, Q)
%MYNORMEST1 estimate norm(A,1), using LU factorization (L*U = P*A*Q).
%
% Example:
% est = mynormest1 (L, U, P, Q)
% See also: testall
% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
n = size (L,1) ;
est = 0 ;
S = zeros (n,1) ;
for k = 1:5
... |
github | GHilmarG/UaSource-master | testall.m | .m | UaSource-master/SuiteSparse/CSparse/MATLAB/Test/testall.m | 1,590 | utf_8 | 65516a54bf8d8b598250e3a8a90bed7e | function testall
%TESTALL test all CSparse functions (run tests 1 to 28 below)
%
% Example:
% testall
% See also: cs_demo
% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
h = waitbar (0, 'CSparse') ;
cs_test_make % compile all CSparse, Demo, Text, and Test mexFunctions
ntest... |
github | GHilmarG/UaSource-master | umfpack_make.m | .m | UaSource-master/SuiteSparse/UMFPACK/MATLAB/umfpack_make.m | 17,817 | utf_8 | c0d210fae12f7f2660605fc9f36bac38 | function umfpack_make
%UMFPACK_MAKE to compile umfpack2 for use in MATLAB
%
% Compiles the umfpack2 mexFunction and then runs a simple demo.
%
% Example:
% umfpack_make
%
% UMFPACK relies on AMD and its own built-in version of COLAMD for its ordering
% options. The default is for UMFPACK to also use CHOLMOD... |
github | GHilmarG/UaSource-master | umfpack_btf.m | .m | UaSource-master/SuiteSparse/UMFPACK/MATLAB/umfpack_btf.m | 4,825 | utf_8 | e647fe5d80713a2a7b6ed8dd16d5865b | function [x, info] = umfpack_btf (A, b, Control)
%UMFPACK_BTF factorize A using a block triangular form
%
% Example:
% x = umfpack_btf (A, b, Control)
%
% solve Ax=b by first permuting the matrix A to block triangular form via dmperm
% and then using UMFPACK to factorize each diagonal block. Adjacent 1-by-1
... |
github | GHilmarG/UaSource-master | cs_make_helper.m | .m | UaSource-master/SuiteSparse/CXSparse_newfiles/MATLAB/CSparse/private/cs_make_helper.m | 8,580 | utf_8 | 8327610d683fdbae95a2551bd9dc2302 | function [objfiles, timestamp_out] = cs_make_helper (f, docomplex)
%CS_MAKE_HELPER compiles CXSparse for use in MATLAB.
% Usage:
% [objfiles, timestamp] = cs_make (f, docomplex)
%
% With f=0, only those files needing to be
% compiled are compiled (like the Unix/Linux/GNU "make" command, but not
% r... |
github | GHilmarG/UaSource-master | testall.m | .m | UaSource-master/SuiteSparse/CXSparse_newfiles/MATLAB/Test/testall.m | 1,634 | utf_8 | d2c0b4c14361a956eb61cc1c2ca2c962 | function testall
%TESTALL test all CSparse functions (run tests 1 to 28 below)
%
% Example:
% testall
% See also: cs_demo
% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
h = waitbar (0, 'CXSparse') ;
cs_test_make % compile all CSparse, Demo, Text, and Test mexFunctions
ntes... |
github | GHilmarG/UaSource-master | camd_demo.m | .m | UaSource-master/SuiteSparse/CAMD/MATLAB/camd_demo.m | 3,381 | utf_8 | e22c8512f860f2ff300ae0c9d9635f54 | function camd_demo
%CAMD_DEMO a demo of camd, using the can_24 matrix
%
% A demo of CAMD for MATLAB.
%
% Example:
% camd_demo
%
% See also: camd, camd_make
% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, Iain S. Duff, and Y. Chen.
% This orders the same matrix as the ANSI C demo, camd_demo.c. It ... |
github | GHilmarG/UaSource-master | cs_make_helper.m | .m | UaSource-master/SuiteSparse/CXSparse/MATLAB/CSparse/private/cs_make_helper.m | 8,580 | utf_8 | 8327610d683fdbae95a2551bd9dc2302 | function [objfiles, timestamp_out] = cs_make_helper (f, docomplex)
%CS_MAKE_HELPER compiles CXSparse for use in MATLAB.
% Usage:
% [objfiles, timestamp] = cs_make (f, docomplex)
%
% With f=0, only those files needing to be
% compiled are compiled (like the Unix/Linux/GNU "make" command, but not
% r... |
github | GHilmarG/UaSource-master | mynormest1.m | .m | UaSource-master/SuiteSparse/CXSparse/MATLAB/Test/mynormest1.m | 1,913 | utf_8 | 99abcc31ec47830285e9740170414ccd | function est = mynormest1 (L, U, P, Q)
%MYNORMEST1 estimate norm(A,1), using LU factorization (L*U = P*A*Q).
%
% Example:
% est = mynormest1 (L, U, P, Q)
% See also: testall
% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
n = size (L,1) ;
est = 0 ;
S = zeros (n,1) ;
for k = 1:5
... |
github | GHilmarG/UaSource-master | testall.m | .m | UaSource-master/SuiteSparse/CXSparse/MATLAB/Test/testall.m | 1,634 | utf_8 | d2c0b4c14361a956eb61cc1c2ca2c962 | function testall
%TESTALL test all CSparse functions (run tests 1 to 28 below)
%
% Example:
% testall
% See also: cs_demo
% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
h = waitbar (0, 'CXSparse') ;
cs_test_make % compile all CSparse, Demo, Text, and Test mexFunctions
ntes... |
github | GHilmarG/UaSource-master | cholmod_make.m | .m | UaSource-master/SuiteSparse/CHOLMOD/MATLAB/cholmod_make.m | 11,337 | utf_8 | 73f5dfd8435723f5a00942a9af347685 | function cholmod_make (metis_path)
%CHOLMOD_MAKE compiles the CHOLMOD mexFunctions
%
% Example:
% cholmod_make
%
% CHOLMOD relies on AMD and COLAMD, and optionally CCOLAMD, CAMD, and METIS.
% All but METIS are distributed with CHOLMOD. To compile CHOLMOD to use METIS
% you must first place a copy of the meti... |
github | GHilmarG/UaSource-master | graph_demo.m | .m | UaSource-master/SuiteSparse/CHOLMOD/MATLAB/graph_demo.m | 2,472 | utf_8 | fa91cd3be874cee476488906ba51fbd5 | function graph_demo (n)
%GRAPH_DEMO graph partitioning demo
% graph_demo(n) constructs an set of n-by-n 2D grids, partitions them, and
% plots them in one-second intervals. n is optional; it defaults to 60.
%
% Example:
% graph_demo
%
% See also DELSQ, NUMGRID, GPLOT, TREEPLOT
% Copyright 20... |
github | GHilmarG/UaSource-master | cholmod_demo.m | .m | UaSource-master/SuiteSparse/CHOLMOD/MATLAB/cholmod_demo.m | 4,079 | utf_8 | 0b21e2a9d14aaea8927d9ce50c80b74b | function cholmod_demo
%CHOLMOD_DEMO a demo for CHOLMOD
%
% Tests CHOLMOD with various randomly-generated matrices, and the west0479
% matrix distributed with MATLAB. Random matrices are not good test cases,
% but they are easily generated. It also compares CHOLMOD and MATLAB on the
% sparse matrix problem used ... |
github | GHilmarG/UaSource-master | test29.m | .m | UaSource-master/SuiteSparse/CHOLMOD/MATLAB/Test/test29.m | 3,419 | utf_8 | 7a18ca2c98624f15dbfad3356f0d4ae4 | function test29
%TEST29 test spsym
% Example:
% spsym
% See also cholmod_test
% Copyright 2015, Timothy A. Davis, http://www.suitesparse.com
rand ('state', 0) ;
r = zeros (0,2) ;
for n = 0:5
% real unsymmetric, diagonal all nonzero
A = sparse (rand (n,n)) ;
r = [r ; test_spsym(A)] ;
... |
github | GHilmarG/UaSource-master | test15.m | .m | UaSource-master/SuiteSparse/CHOLMOD/MATLAB/Test/test15.m | 3,922 | utf_8 | e4879ecf272a167468606d2ffa47bd90 | function test15 (nmat)
%TEST15 test symbfact2 vs MATLAB
% Example:
% test15(nmat)
% See also cholmod_test
% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com
fprintf ('=================================================================\n');
index = UFget ;
% only test matrices with nrows = 10... |
github | GHilmarG/UaSource-master | test26.m | .m | UaSource-master/SuiteSparse/CHOLMOD/MATLAB/Test/test26.m | 2,009 | utf_8 | 10c6715b8ce44c45bb351cf82a259df2 | function test26 (do_metis)
%TEST26 test logical full and sparse matrices
% Example:
% test26
% See also cholmod_test
% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com
fprintf ('=================================================================\n');
fprintf ('test26: test logical full and sparse... |
github | GHilmarG/UaSource-master | cs_make.m | .m | UaSource-master/SuiteSparse/CSparse3/MATLAB/CSparse/cs_make.m | 7,874 | utf_8 | b19b9be11772a0d4d172d2fbc2067419 | function [objfiles, timestamp_out] = cs_make (f)
%CS_MAKE compiles CSparse for use in MATLAB.
% Usage:
% cs_make
% [objfiles, timestamp] = cs_make (f)
%
% With no input arguments, or with f=0, only those files needing to be
% compiled are compiled (like the Unix/Linux/GNU "make" command, but no... |
github | GHilmarG/UaSource-master | mynormest1.m | .m | UaSource-master/SuiteSparse/CSparse3/MATLAB/Test/mynormest1.m | 1,935 | utf_8 | 1dd90462ed30f08f6d1c2c3cbad7fee2 | function est = mynormest1 (L, U, P, Q)
%MYNORMEST1 estimate norm(A,1), using LU factorization (L*U = P*A*Q).
%
% Example:
% est = mynormest1 (L, U, P, Q)
% See also: testall
% Copyright 2006-2007, Timothy A. Davis.
% http://www.cise.ufl.edu/research/sparse
n = size (L,1) ;
est = 0 ;
S = zeros (n,1... |
github | GHilmarG/UaSource-master | testall.m | .m | UaSource-master/SuiteSparse/CSparse3/MATLAB/Test/testall.m | 1,610 | utf_8 | ffb83c20bdea4670c315bb832ad63912 | function testall
%TESTALL test all CSparse functions (run tests 1 to 28 below)
%
% Example:
% testall
% See also: cs_demo
% Copyright 2006-2007, Timothy A. Davis.
% http://www.cise.ufl.edu/research/sparse
h = waitbar (0, 'CSparse') ;
cs_test_make % compile all CSparse, Demo, Text, and Test m... |
github | GHilmarG/UaSource-master | pagerankdemo.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/pagerankdemo.m | 6,512 | utf_8 | b7f6a5e5612e41adb00413989170ded9 | function pagerankdemo (steps)
% PAGERANKDEMO draw a 6-node web and compute its pagerank
%
% PAGERANKDEMO draws the 6-node "tiny web" in Section 2.11 of "Numerical
% Computing with MATLAB", by Cleve Moler, SIAM, 2004. It then simulates the
% computation of Google's PageRank algorithm, by randomly selecting links t... |
github | GHilmarG/UaSource-master | gipper.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/gipper.m | 7,632 | utf_8 | ff4637be4d5f71e627c4d382c9f69d82 | function files_out = gipper (directory, include, exclude, exclude_hidden)
%GIPPER zip selected files and subdirectories (gipper = grep + zip)
%
% files = gipper (directory, include, exclude, exclude_hidden) ;
%
% Creates a zip file of all files and subdirectories in a directory. A file in
% the directory or an... |
github | GHilmarG/UaSource-master | cod_sparse.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/cod_sparse.m | 6,992 | utf_8 | a1195dfd5474bc1a0fc1e49fe0f3e7cc | function [U, R, V, r] = cod_sparse (A, arg)
%COD_SPARSE complete orthogonal decomposition of a sparse matrix A = U*R*V'
%
% [U, R, V, r] = cod_sparse (A)
% [U, R, V, r] = cod_sparse (A, opts)
%
% The sparse m-by-n matrix A is factorized into U*R*V' where R is m-by-n and
% all zero except for R(1:r,1:r), whic... |
github | GHilmarG/UaSource-master | factorize.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/factorize.m | 12,303 | utf_8 | f644bf20b509b4ed07534d862411c97c | function F = factorize (A,strategy,burble)
%FACTORIZE an object-oriented method for solving linear systems
% and least-squares problems, and for representing operations with the
% inverse of a square matrix or the pseudo-inverse of a rectangular matrix.
%
% F = factorize(A) returns an object F that holds the facto... |
github | GHilmarG/UaSource-master | factorization.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/factorization.m | 27,378 | utf_8 | f3640c25ae3fa6c72b971c16a5443e7d | classdef factorization
%FACTORIZATION a generic matrix factorization object
% Normally, this object is created via the F=factorize(A) function. Users
% do not need to use this method directly.
%
% This is an abstract class that is specialized into 13 different kinds of
% matrix factorizations:
%
% factorizat... |
github | GHilmarG/UaSource-master | test_factorize.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/Test/test_factorize.m | 14,934 | utf_8 | 65416227d1887041c8ced00af87e2791 | function err = test_factorize (A, strategy)
%TEST_FACTORIZE test the accuracy of the factorization object
%
% Example
% test_factorize (A) ; % where A is square or rectangular, sparse or dense
% test_factorize (A, strategy) ; % forces a particular strategy;
% % works only if the ... |
github | GHilmarG/UaSource-master | test_disp.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/Test/test_disp.m | 6,190 | utf_8 | bb82c431ff5c91202e476911d3be74d1 | function test_disp
%TEST_DISP test the display method of the factorize object
%
% Example
% test_disp
%
% See also factorize, test_all.
% Copyright 2011-2012, Timothy A. Davis, http://www.suitesparse.com
reset_rand ;
tol = 1e-10 ;
err = 0 ;
%-----------------------------------------------------------... |
github | GHilmarG/UaSource-master | test_svd.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/Test/test_svd.m | 6,426 | utf_8 | 206b291a31ad93351962daad8db13283 | function err = test_svd (A)
%TEST_SVD test factorize(A,'svd') and factorize(A,'cod') for a given matrix
%
% Example
% err = test_svd (A) ;
%
% See also test_all
% Copyright 2011-2012, Timothy A. Davis, http://www.suitesparse.com
fprintf ('.') ;
if (nargin < 1)
% has rank 3
A = magic (4) ;
e... |
github | GHilmarG/UaSource-master | test_accuracy.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/Factorize/Test/test_accuracy.m | 3,072 | utf_8 | 139c034b3bad00de8700066e4199cd38 | function err = test_accuracy
%TEST_ACCURACY test the accuracy of the factorize object
%
% Example
% err = test_accuracy
%
% See also test_all, test_factorize.
% Copyright 2011-2012, Timothy A. Davis, http://www.suitesparse.com
fprintf ('\nTesting accuracy:\n') ;
reset_rand ;
A = [ 0.1482 0.3952 ... |
github | GHilmarG/UaSource-master | shellgui.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/shellgui/shellgui.m | 11,959 | utf_8 | b9d190535f6a0fce4e3ae249748ba2ed | function varargout = shellgui(varargin)
%SHELLGUI GUI interface for seashell function
% Timothy A. Davis, Chapman Hall / CRC Press, 7th edition.
% Controls the parameters a, b, c, n, azimuth, and elevation, using
% sliders. To the whole range of each parameter, click on the button to
% the right of each s... |
github | GHilmarG/UaSource-master | spok_test.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/spok/spok_test.m | 2,125 | utf_8 | 3a896276b073fd2e2b0c88418cdbf7d7 | function spok_test
%SPOK_TEST installs and tests SPOK
%
% Example:
% spok_install
%
% See also sparse, spok, spok_install
% Copyright 2008-2011, Timothy A. Davis, http://www.suitesparse.com
% compile and install spok
help spok ;
spok_install ;
c = pwd ;
cd private ;
% mex spok_invalid.c ;
is64 = ~... |
github | GHilmarG/UaSource-master | waitex.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/waitmex/waitex.m | 1,086 | utf_8 | ac4e4f03994d4d23a0dae8d119c3e207 | function result = waitex
%WAITEX same as the waitexample mexFunction, just in M instead of C.
% The only purpose of this function is to serve as a precise description of
% what the waitexample mexFunction does.
%
% Example:
% waitex % draw a waitbar, make progress, and then close the waitbar
% h = w... |
github | GHilmarG/UaSource-master | spqr_rank_stats.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/spqr_rank/spqr_rank_stats.m | 33,936 | utf_8 | 348a2e01c6def57a5d1ffef387ce102e | function spqr_rank_stats (stats, print_opts)
%SPQR_RANK_STATS prints the statistics from spqr_rank functions
%
% For a detailed description of the meaning of the basic statistic for
% spqr_basic, spqr_null, spqr_pinv or spqr_cod, just type
% 'spqr_rank_stats' with no inputs. Type spqr_rank_stats('ssi') or
% spqr... |
github | GHilmarG/UaSource-master | demo_spqr_rank.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/spqr_rank/demo_spqr_rank.m | 52,621 | utf_8 | d1f683ee1088fc954b38241115341ce9 | function [nfailures SJid_failures] = demo_spqr_rank (ids,args)
%DEMO_SPQR_RANK lengthy demo for spqr_rank functions (requires SJget)
% Usage: demo_spqr_rank(ids,args)
%
% This is a demonstration program for the routines spqr_basic, spqr_null,
% spqr_pinv, spqr_cod discussed in the paper "Algorithm xxx: Reliable
%... |
github | GHilmarG/UaSource-master | meshnd_example.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/MESHND/meshnd_example.m | 2,507 | utf_8 | b7e5c7db152709e5cc40c21403885a15 | function meshnd_example
%MESHND_EXAMPLE example usage of meshnd and meshsparse.
%
% Example:
% meshnd_example
%
% See also meshnd.
% Copyright 2009, Timothy A. Davis, http://www.suitesparse.com
help meshnd
% 2D mesh, compare with Cleve Moler's demos
m = 7 ;
n = 7 ;
[G p pinv Gnew] = meshnd (m,n)... |
github | GHilmarG/UaSource-master | meshnd.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/MESHND/meshnd.m | 3,227 | utf_8 | c12c4dd02457fc801e1070fb10784f87 | function [G, p, pinv, Gnew] = meshnd (arg1,n,k)
%MESHND creation and nested dissection of a regular 2D or 3D mesh.
% [G p pinv Gnew] = meshnd (m,n) constructs an m-by-n 2D mesh G, and then finds
% a permuted mesh Gnew where Gnew = pinv(G) and G = p(Gnew). meshnd(m,n,k)
% creates an m-by-n-by-k 3D mesh.
%
% [G p ... |
github | GHilmarG/UaSource-master | ssmult_test.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/SSMULT/ssmult_test.m | 3,868 | utf_8 | a459a5a007562176b0e745de839e92af | function ssmult_test
%SSMULT_TEST lengthy test of SSMULT and SSMULTSYM
%
% Example
% ssmult_test
%
% See also ssmult, ssmultsym
% Copyright 2007-2011, Timothy A. Davis, http://www.suitesparse.com
fprintf ('\nTesting large sparse column vectors (1e7-by-1)\n') ;
x = sprandn (1e7,1,1e-4) ;
y = sprand... |
github | GHilmarG/UaSource-master | find_components_example.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/find_components/find_components_example.m | 4,073 | utf_8 | c612a5cdd093a8c6581f099dd83eb792 | function find_components_example(example, dopause)
%FIND_COMPONENTS_EXAMPLE gives an example usage of find_components.
%
% Example:
% find_components_example(0) % a small example, with lots of printing
% find_components_example(1) % Doug's example, with lots of printing
% find_components_example(2) % a l... |
github | GHilmarG/UaSource-master | UFpage.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/UFcollection/UFpage.m | 21,977 | utf_8 | 922ccdaf2f7e568b8ca9074a68118adc | function UFpage (matrix, index, figures)
%UFPAGE create web page for a matrix in UF Sparse Matrix Collection
%
% Usage:
% UFpage (matrix, index, figures)
%
% matrix: id or name of matrix to create the web page for.
% index: the UF index, from UFget.
% figures: 1 if the figures are to be created, 0 otherwis... |
github | GHilmarG/UaSource-master | UFread.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/UFcollection/UFread.m | 14,029 | utf_8 | 904767ab0566e8691de9881ce6c2113c | function Problem = UFread (directory, tmp)
%UFREAD read a Problem in Matrix Market or Rutherford/Boeing format
% containing a set of files created by UFwrite, in either Matrix Market or
% Rutherford/Boeing format. See UFwrite for a description of the Problem struct.
%
% Usage: Problem = UFread (directory)
%
% Ex... |
github | GHilmarG/UaSource-master | UFwrite.m | .m | UaSource-master/SuiteSparse/MATLAB_Tools/UFcollection/UFwrite.m | 17,903 | utf_8 | 76736e4b7cbacbecb1b9ce536e690705 | function UFwrite (Problem, Master, arg3, arg4)
%UFWRITE write a Problem in Matrix Market or Rutherford/Boeing format
% containing a set of text files in either Matrix Market or Rutherford/Boeing
% format. The Problem can be read from the files back into MATLAB via UFread.
% See http://www.suitesparse.com for the U... |
github | GHilmarG/UaSource-master | spqr_make.m | .m | UaSource-master/SuiteSparse/SPQR/MATLAB/spqr_make.m | 16,778 | utf_8 | 92f52bb999dac9ca4b8b1472fc9e8b88 | function spqr_make (opt1)
%SPQR_MAKE compiles the SuiteSparseQR mexFunctions
%
% Example:
% spqr_make
%
% SuiteSparseQR relies on CHOLMOD, AMD, and COLAMD, and optionally CCOLAMD,
% CAMD, and METIS. All but METIS are distributed with CHOLMOD. To compile
% SuiteSparseQR to use METIS you must first place a co... |
github | GHilmarG/UaSource-master | cholmod_make.m | .m | UaSource-master/mutils-0.2/SuiteSparse/cholmod_make.m | 11,175 | utf_8 | 0f9e06091f50814d6610fefe67b1ad01 | function cholmod_make
%CHOLMOD_MAKE compiles the CHOLMOD mexFunctions
%
% Example:
% cholmod_make
%
% CHOLMOD relies on AMD and COLAMD, and optionally CCOLAMD, CAMD, and METIS.
% All but METIS are distributed with CHOLMOD. To compile CHOLMOD to use METIS
% you must first place a copy of the metis-4.0 directo... |
github | GHilmarG/UaSource-master | insidepoly.m | .m | UaSource-master/InsidePolyFolder/insidepoly.m | 7,924 | utf_8 | bb18a667eec47331f5fe0bf1d969fca1 | function [inpoly onboundary] = insidepoly(varargin)
% [inpoly onboundary] = insidepoly(X, Y, PX, PY)
%
% Check if (X,Y) are inside the interior of a 2D polygon delimited by the
% polygon vertices (PX,PY).
%
% INPUTS:
% - X, Y: arrays of same size, coordinates of N data points
% - PX, PY: arrays of same siz... |
github | AlexanderFengler/hyperbolic_discounting_Matlab-master | kopti.m | .m | hyperbolic_discounting_Matlab-master/kopti.m | 1,528 | utf_8 | dabde3611f2c82fa25f6fbc0f328394f |
function [x,y] = findK
%%%%%%%%%%%%%%%%%%%%%%%%%
% READING IN DATA %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
% Initialize Questionnaire Data
% Four columns:
% 1. Order
% 2. SIR (small immediate reward)
% 3. LDR (large delayed reward)
% 4. Delay
qdat = readtable('kirby.csv');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SIMUL... |
github | AlexanderFengler/hyperbolic_discounting_Matlab-master | SimulateChoice.m | .m | hyperbolic_discounting_Matlab-master/SimulateChoice.m | 641 | utf_8 | 424041b7b9311bb080477ef479095c20 | % Title: Simulate choice when provided with two options of reward//delay combinations (Hyperbolic Discounting applied)
% Author: Alexander Fengler
% Date: Feburary 7th 2015
function choice = SimulateChoice(k,sir,ldr,delay)
% Not used for now
%p = exp(ldr/(1 + k*delay)) / (exp(sir) + exp(ldr/(1 + k*delay)));
% By Chab... |
github | AlexanderFengler/hyperbolic_discounting_Matlab-master | findK.m | .m | hyperbolic_discounting_Matlab-master/findK.m | 2,177 | utf_8 | f7aab9c7548fb27596704d6d89ae3450 | % Title: Solve for optimal parameters in hyperbolic discounting function
% (including simulated choices)
% Author: Alexander Fengler
% Date: February 7th 2015
% Provided a certain k for simulating choices, this function return the k
% that minimizes errors for subjects that have preferences according to a
% logit des... |
github | qihongl/mathCognition_PDP_RL-master | runAgent.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/runAgent.m | 1,097 | utf_8 | 0a7909b39dd7dae2f4ed5cc01985a057 | % written by professor Jay McClelland
function [ results ] = runAgent()
global a w h p mode;
%% initialize the state
initState();
updateState();
computeAnswer(); % compute the true 'answers'
%% train the model once
t = 0;
indices = zeros(1,p.maxIter);
while ~(w.done) && t < p.maxIter
%% choose act... |
github | qihongl/mathCognition_PDP_RL-master | trainOne.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/trainOne.m | 762 | utf_8 | 21dcda9b96b8b91864f134446f1b6ea7 | % just testing, a short cut for running the model
function record = trainOne(epoch, seed)
clear global
if nargin == 0
epoch = 10000;
seed = randi(99);
seed = 66
end
%% run the simulation
global p
record = trainAgent(epoch, seed);
% save the simulation results
saveDirName = getSaveDir();
save([saveDirNa... |
github | qihongl/mathCognition_PDP_RL-master | updateWeights.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/updateWeights.m | 2,749 | utf_8 | e88ec6a6a6d1b79913230a727649e487 | % written by professor Jay McClelland
function [ ] = updateWeights()
% this function controls:
% 1. the reward policy
% 2. the weight update
% 3. activate the "teaching"
global p a w buffer;
% % update the input
w.input_old = horzcat(w.vS.visInput_old, w.rS.touchLocs_old);
w.input_cur = horzcat(w.vS.visInpu... |
github | qihongl/mathCognition_PDP_RL-master | showState.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/showState.m | 2,369 | utf_8 | c21f87f660c0fca0cff629e57b109e9f | % written by professor Jay McClelland
function [ ] = showState( )
global p w d a;
%% plot current and expected rewards over time
axes(d.rwd);
plot(w.rS.time,a.curRwd,'-b*'); hold on;
plot(w.rS.time,a.expRwd,'-r*');
legend({'current reward', 'esimtated reward'},...
'Location','northwest', 'fontsize', d.F... |
github | qihongl/mathCognition_PDP_RL-master | initParams.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/initParams.m | 4,056 | utf_8 | 746b72b532be26830b271e47a6e5cc40 | % written by professor Jay McClelland
function [] = initParams(epoch)
% This program initialize and preallocate the parameters needed for the
% model. This should be executed before the simulations.
global p a buffer
%% teaching strategy
% if teaching style is specified here, then trainGroup will use this
% va... |
github | qihongl/mathCognition_PDP_RL-master | updateState.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/updateState.m | 1,126 | utf_8 | 8ccdecb091c8ed3cf52ff40ca19e9e6e | % written by professor Jay McClelland
function [ ] = updateState()
%this function uses the real state to update the internal state
%after Act is called to execute the hand or eye movement action
global w h p a;
%% compute the relative locations
% the relative locations of eye and hand
w.vS.eyePos = 0;
w.vS.... |
github | qihongl/mathCognition_PDP_RL-master | initState.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/initState.m | 1,868 | utf_8 | 5be2f9e27554c0eb635aa5754cd6e482 | % written by professor Jay McClelland
function [ ] = initState( )
global a w h p mode;
%realState is characterized by the position of a target to touch,
%position of eye, and position of hand 1-d space
%viewedState is the input I have given that my eye and hand are
%at particular positions w.r.t. the realSt... |
github | qihongl/mathCognition_PDP_RL-master | updateBuffer.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/updateBuffer.m | 1,421 | utf_8 | fe9d8ac011755547c9d6302214550874 | %% update the memory buffer using the current experience
function [ ] = updateBuffer()
global p a w buffer;
memoryIdx = min(a.bufferUsage+1, p.bufferSize);
if a.bufferUsage+1 <= p.bufferSize
saveCurrentExperience(memoryIdx)
else
% delete the 1st experience in the buffer
buffer(1) = [];
% preallocate a... |
github | qihongl/mathCognition_PDP_RL-master | trainAgent.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/trainAgent.m | 1,904 | utf_8 | 21504ec932683638285ced6a258b4d14 | %% Trains the network n trials
% written by professor Jay McClelland
function [record] = trainAgent(epoch, seed)
%% initialization
% initialize parameters
global p a w mode;
initParams(epoch);
p.seed = seed;
rng(seed)
% preallocate
record.wts = cell(1,epoch / p.saveWtsInterval+1);
s.steps = nan(1,epoch);
... |
github | qihongl/mathCognition_PDP_RL-master | computeExpectedReward.m | .m | mathCognition_PDP_RL-master/sim22.0_touchInput/computeExpectedReward.m | 915 | utf_8 | 1b6dc2da305832b91de647e7f0c3d517 | %% compute the expected reward with the Q learning rule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% given: act_next predicted Q value
% s_cur current state (input)
% r_cur current actual reward
% taskDone if the task is terminated
% return: d... |
github | qihongl/mathCognition_PDP_RL-master | getNumRecords.m | .m | mathCognition_PDP_RL-master/testGroup/getNumRecords.m | 860 | utf_8 | cce15ec9b1913c7a3ca647f7ef5485ac | %% This function counts how many records you have
% It counts number of files that are in the form of "recordXX.mat", where
% XX is the index of the record. Based on this, it will be able to figure
% out the number of subejcts, which is convenient for running analysis.
function [numSubjects] = getNumRecords(path)
% i... |
github | qihongl/mathCognition_PDP_RL-master | loadParam_development.m | .m | mathCognition_PDP_RL-master/testGroup/loadParam_development.m | 356 | utf_8 | cd03030915099780bb3634e25d7874cc | %% load parameters
% this function is designed for getting developmental data, which should
% test all weights recorded.
%
function [ ] = loadParam_development(record, developEpisode)
global p a;
% get the parameters & weights
p = record.p;
a = record.a;
% set the weights to the correct developmental stage
a.wts =... |
github | qihongl/mathCognition_PDP_RL-master | processGroupDeve.m | .m | mathCognition_PDP_RL-master/testGroup/processGroupDeve.m | 402 | utf_8 | 1812860ae6336226dbbe167741b3df95 | %% this function takes summarized learning data for each group, and save them
function [ deveData ] = processGroupDeve(path)
global p;
deveData = cell(p.numDir, p.nSubj);
for i = 1 : p.numDir
% load developmental group data
fullpath = [path.dataDir{i} '/' path.deveDataName];
load(fullpath);
for ... |
github | qihongl/mathCognition_PDP_RL-master | plotLearningCurve.m | .m | mathCognition_PDP_RL-master/testGroup/plotLearningCurve.m | 1,453 | utf_8 | f9f087a484e5395b3cf2d70d998d91bc | %% Plot the learning curve
% This function needs "groupDeveScores"
% Which is computed by testing the wts for all development time points
function plotLearningCurve()
load('groupDeveScores.mat')
%% Get numSubjects and num development time points
numSubj = size(groupDeveScores,1);
numWts = size(groupDeveScores,2);
% p... |
github | qihongl/mathCognition_PDP_RL-master | plot_meanByCond_deve.m | .m | mathCognition_PDP_RL-master/testGroup/plot_meanByCond_deve.m | 607 | utf_8 | 78c6942fb2e5bd1f2640612eb585baac | function [] = plot_meanByCond_deve( result )
global p;
subplot(2,2,1)
plotOneMeasure(result.stepsUsed, 'Steps used')
subplot(2,2,2)
plotOneMeasure(result.completeRate, 'Complete rate')
subplot(2,2,3)
plotOneMeasure(result.propSkips, 'Proprtion skips')
subplot(2,2,4)
plotOneMeasure(result.propItemsTouched, 'Proprtion... |
github | qihongl/mathCognition_PDP_RL-master | runAgent.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/runAgent.m | 1,097 | utf_8 | 0a7909b39dd7dae2f4ed5cc01985a057 | % written by professor Jay McClelland
function [ results ] = runAgent()
global a w h p mode;
%% initialize the state
initState();
updateState();
computeAnswer(); % compute the true 'answers'
%% train the model once
t = 0;
indices = zeros(1,p.maxIter);
while ~(w.done) && t < p.maxIter
%% choose act... |
github | qihongl/mathCognition_PDP_RL-master | trainOne.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/trainOne.m | 761 | utf_8 | baa37569ccd3dbfe38bfa11d25118de2 | % just testing, a short cut for running the model
function record = trainOne(epoch, seed)
clear global
if nargin == 0
epoch = 1000;
seed = randi(99);
seed = 66
end
%% run the simulation
global p
record = trainAgent(epoch, seed);
% save the simulation results
saveDirName = getSaveDir();
save([saveDirNam... |
github | qihongl/mathCognition_PDP_RL-master | updateWeights.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/updateWeights.m | 2,572 | utf_8 | 24b42412fb538cfefef1b124761fbbad | % written by professor Jay McClelland
function [ ] = updateWeights()
% this function controls:
% 1. the reward policy
% 2. the weight update
% 3. activate the "teaching"
global p a w buffer;
%% compute the reward values according to the reward policy
% compute the true reward at this time step
%% experienc... |
github | qihongl/mathCognition_PDP_RL-master | showState.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/showState.m | 2,369 | utf_8 | c21f87f660c0fca0cff629e57b109e9f | % written by professor Jay McClelland
function [ ] = showState( )
global p w d a;
%% plot current and expected rewards over time
axes(d.rwd);
plot(w.rS.time,a.curRwd,'-b*'); hold on;
plot(w.rS.time,a.expRwd,'-r*');
legend({'current reward', 'esimtated reward'},...
'Location','northwest', 'fontsize', d.F... |
github | qihongl/mathCognition_PDP_RL-master | initParams.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/initParams.m | 4,034 | utf_8 | edc8c0b7df81fb09e9b8ff2ff477eb2a | % written by professor Jay McClelland
function [] = initParams(epoch)
% This program initialize and preallocate the parameters needed for the
% model. This should be executed before the simulations.
global p a buffer
%% teaching strategy
% if teaching style is specified here, then trainGroup will use this
% va... |
github | qihongl/mathCognition_PDP_RL-master | updateState.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/updateState.m | 1,137 | utf_8 | b7f489fdff68b16f52c2b5336d86ef59 | % written by professor Jay McClelland
function [ ] = updateState()
%this function uses the real state to update the internal state
%after Act is called to execute the hand or eye movement action
global w h p a;
%% compute the relative locations
% the relative locations of eye and hand
w.vS.eyePos = 0;
w.vS.... |
github | qihongl/mathCognition_PDP_RL-master | initState.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/initState.m | 1,609 | utf_8 | 31fd190a63510d233a4f7fadf964e080 | % written by professor Jay McClelland
function [ ] = initState( )
global a w h p mode;
%realState is characterized by the position of a target to touch,
%position of eye, and position of hand 1-d space
%viewedState is the input I have given that my eye and hand are
%at particular positions w.r.t. the realSt... |
github | qihongl/mathCognition_PDP_RL-master | updateBuffer.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/updateBuffer.m | 1,429 | utf_8 | 0f703ddb26cf30fa6a992dfeb79fcde6 | %% update the memory buffer using the current experience
function [ ] = updateBuffer()
global p a w buffer;
memoryIdx = min(a.bufferUsage+1, p.bufferSize);
if a.bufferUsage+1 <= p.bufferSize
saveCurrentExperience(memoryIdx)
else
% delete the 1st experience in the buffer
buffer(1) = [];
% preallocate a... |
github | qihongl/mathCognition_PDP_RL-master | trainAgent.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/trainAgent.m | 2,003 | utf_8 | 3a7ed21f730accecdb1f79fcbcaf4da5 | %% Trains the network n trials
% written by professor Jay McClelland
function [record] = trainAgent(epoch, seed)
%% initialization
% initialize parameters
global p a w mode;
initParams(epoch);
p.seed = seed;
rng(seed)
% preallocate
record.wts = cell(1,epoch / p.saveWtsInterval+1);
s.steps = nan(1,epoch);
... |
github | qihongl/mathCognition_PDP_RL-master | computeExpectedReward.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/computeExpectedReward.m | 916 | utf_8 | ccb6ec148b459c76de3fda938957ce9b | %% compute the expected reward with the Q learning rule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% given: act_next predicted Q value
% s_cur current state (input)
% r_cur current actual reward
% taskDone if the task is terminated
% return: d... |
github | qihongl/mathCognition_PDP_RL-master | computeRwd.m | .m | mathCognition_PDP_RL-master/sim21.4_autoStop/computeRwd.m | 2,738 | utf_8 | 4db26f71f0f52e8ae38d3eef7f261097 | function Rwd = computeRwd()
%% this function controls the reward policy
global w p h a;
w.actionCorrect = true;
% if there is remaining items
if targetRemain()
if a.choice == p.mvRange +1 % saying "done"
Rwd = p.r.smallNeg;
w.errors = w.errors + 1;
w.done = true;
elseif a.choice == p... |
github | qihongl/mathCognition_PDP_RL-master | runAgent.m | .m | mathCognition_PDP_RL-master/sim23.0_count/runAgent.m | 1,145 | utf_8 | 44f9c4cbf4a7fc724c45965943a50ef9 | % written by professor Jay McClelland
function [ results ] = runAgent()
global a w h p mode;
%% initialize the state
initState();
updateState();
computeAnswer(); % compute the true 'answers'
%% train the model once
t = 0;
indices = zeros(1,p.maxIter);
while ~(w.done) && t < p.maxIter
%% choose act... |
github | qihongl/mathCognition_PDP_RL-master | trainOne.m | .m | mathCognition_PDP_RL-master/sim23.0_count/trainOne.m | 762 | utf_8 | 21dcda9b96b8b91864f134446f1b6ea7 | % just testing, a short cut for running the model
function record = trainOne(epoch, seed)
clear global
if nargin == 0
epoch = 10000;
seed = randi(99);
seed = 66
end
%% run the simulation
global p
record = trainAgent(epoch, seed);
% save the simulation results
saveDirName = getSaveDir();
save([saveDirNa... |
github | qihongl/mathCognition_PDP_RL-master | updateWeights.m | .m | mathCognition_PDP_RL-master/sim23.0_count/updateWeights.m | 2,754 | utf_8 | 9f95f690e93c1de2339de31ae5c8f45a | % written by professor Jay McClelland
function [ ] = updateWeights()
% this function controls:
% 1. the reward policy
% 2. the weight update
% 3. activate the "teaching"
global p a w buffer;
% % update the input
w.input_old = horzcat(w.vS.visInput_old, w.rS.touchLocs_old);
w.input_cur = horzcat(w.vS.visInpu... |
github | qihongl/mathCognition_PDP_RL-master | showState.m | .m | mathCognition_PDP_RL-master/sim23.0_count/showState.m | 2,369 | utf_8 | c21f87f660c0fca0cff629e57b109e9f | % written by professor Jay McClelland
function [ ] = showState( )
global p w d a;
%% plot current and expected rewards over time
axes(d.rwd);
plot(w.rS.time,a.curRwd,'-b*'); hold on;
plot(w.rS.time,a.expRwd,'-r*');
legend({'current reward', 'esimtated reward'},...
'Location','northwest', 'fontsize', d.F... |
github | qihongl/mathCognition_PDP_RL-master | initParams.m | .m | mathCognition_PDP_RL-master/sim23.0_count/initParams.m | 4,433 | utf_8 | 9edcecd32acc40764e218e9f91c448c3 | % written by professor Jay McClelland
function [] = initParams(epoch)
% This program initialize and preallocate the parameters needed for the
% model. This should be executed before the simulations.
global p a buffer
%% teaching strategy
% if teaching style is specified here, then trainGroup will use this
% va... |
github | qihongl/mathCognition_PDP_RL-master | computeFutureReward.m | .m | mathCognition_PDP_RL-master/sim23.0_count/computeFutureReward.m | 1,025 | utf_8 | c8f29d412313e8572886a4044c8bcdaf | %% compute the expected reward with the Q learning rule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% given: act_next predicted Q value
% s_cur current state (input)
% r_cur current actual reward
% taskDone if the task is terminated
% return: d... |
github | qihongl/mathCognition_PDP_RL-master | updateState.m | .m | mathCognition_PDP_RL-master/sim23.0_count/updateState.m | 1,126 | utf_8 | 8ccdecb091c8ed3cf52ff40ca19e9e6e | % written by professor Jay McClelland
function [ ] = updateState()
%this function uses the real state to update the internal state
%after Act is called to execute the hand or eye movement action
global w h p a;
%% compute the relative locations
% the relative locations of eye and hand
w.vS.eyePos = 0;
w.vS.... |
github | qihongl/mathCognition_PDP_RL-master | initState.m | .m | mathCognition_PDP_RL-master/sim23.0_count/initState.m | 2,006 | utf_8 | e2260852ad5dd09494c2df1d3c95c0d7 | % written by professor Jay McClelland
function [ ] = initState( )
global a w h p mode;
%realState is characterized by the position of a target to touch,
%position of eye, and position of hand 1-d space
%viewedState is the input I have given that my eye and hand are
%at particular positions w.r.t. the realSt... |
github | qihongl/mathCognition_PDP_RL-master | updateBuffer.m | .m | mathCognition_PDP_RL-master/sim23.0_count/updateBuffer.m | 1,421 | utf_8 | fe9d8ac011755547c9d6302214550874 | %% update the memory buffer using the current experience
function [ ] = updateBuffer()
global p a w buffer;
memoryIdx = min(a.bufferUsage+1, p.bufferSize);
if a.bufferUsage+1 <= p.bufferSize
saveCurrentExperience(memoryIdx)
else
% delete the 1st experience in the buffer
buffer(1) = [];
% preallocate a... |
github | qihongl/mathCognition_PDP_RL-master | trainAgent.m | .m | mathCognition_PDP_RL-master/sim23.0_count/trainAgent.m | 2,003 | utf_8 | ecb5260cac95cf5625e850cef2868d27 | %% Trains the network n trials
% written by professor Jay McClelland
function [record] = trainAgent(epoch, seed)
%% initialization
% initialize parameters
global p a w mode;
initParams(epoch);
p.seed = seed;
rng(seed)
% preallocate
record.wts = cell(1,epoch / p.saveWtsInterval+1);
s.steps = nan(1,epoch);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.