Repository navigation
MatRust 0.1.4 (alpha)
Pre-releaseFifth alpha of MatRust. In the Windows test set of real public scripts, 454 of 473 pass the rule below (they finish in time; that does not mean their results are correct). It speeds up scalar loops, and adds sparse, plotting, N-D and toolbox functions found missing by that test set.
This is an alpha, so expect gaps. The README lists what works and what does not yet. Function help lists supported inputs, limits and fallbacks.
What's new
Language and loops
- Scalar loops use a faster slot form. It covers
abs,sqrt,exp,log,sin,cos,tan,floor,ceil,round,fix,mod,rem,min,maxandsign. Other statements in the loop run as before.MATRUST_SLOT_LOOPS=0turns the slot form off. Expressions in such loops are evaluated on plain numbers where possible, anonymous-function calls that capture only numbers reuse their call frame, and matrix literals of real scalars are built directly. - Built-in function lookup is done once per name instead of on every call.
- Language forms: multiple outputs from nested and indexed struct targets (
[s.a, s(2).b] = f()), a function file whose name differs from its first function,bsxfunon N-D arrays,A(i,:)on N-D arrays, a scalar object indexed withobj(:). inputParseroptional-argument matching,validateattributeson N-D arrays, andisappdata,getappdata,setappdata,rmappdata.rngaccepts integer seeds up to 2^32-1 and'mrg32k3a'.- Functions can have up to 4096 inputs and 4096 outputs.
struct()with no arguments returns an empty scalar struct.
Numerics, sparse and linear algebra
- Rectangular
A\bandb/Ause pivoted QR and return the basic solution, with a rank-deficiency warning. - Sparse: symmetric indefinite
\uses an AMD-ordered LDL' factorization, which lowers fill on large meshes; sparse times dense no longer expands the sparse operand; submatrix assignment is limited by the number of nonzeros, not the full size; sparse comparison with a scalar stays sparse; the sparse product workspace is limited by the work it needs. - Real dense
choluses a blocked factorization when that succeeds, otherwise the earlier loop.cholabove about 4,100 by 4,100 is refused. repmatof a sparse matrix stays sparse.fminconinterior-point solves its dense KKT system with a faster factorization and accepts infinite bounds.fmincon,fminimaxandfgoalattain: on an infeasible exit they keep the last iterate if that is finite, and return empty outputs if it is not.- New:
optimget. - N-D arrays:
fftn,ifftn,fftshift,ifftshift,interpn(linear and nearest),interp1with N-D queries,accumarraywith N-D subscripts,isnan,isinfandisfinitekeep the input shape, andislogical,isnumeric,isinteger,isfloataccept N-D input. sptarn(generalized sparse eigenproblem),eigswith word values forsigma,interp2with complex values, complexisfinite,isnanandtriu, typedhistcounts,interp1with'*method',dealon N-D arrays.mvnrndchecks its size limit before factoring. New:mvnpdf,mvncdf(bivariate and trivariate, fixed-seed quasi-Monte Carlo above three dimensions).linspace(a,b,n)with n at least 2 starts ataand ends atb.linspace(a,b,1)isb.- Control: LTI property names are case-insensitive and accept prefixes;
marginandallmargintake the data form frombode;c2dreturns[sysd,G];pzmap(b,a);bodewith several systems in one plot. - Geometry: 3-D
delaunayTriangulation,delaunayn,delaunay(x,y,z), 3-DnearestNeighbor,pointLocation,scatteredInterpolant;freeBoundary,circumcenter.
Plots and graphics
- Plot series: a marker-only
plotis a Line object;MarkerIndices;plot(vector,scalar);contourfis one Contour object instead of one series per level;imagescof a sparse matrix; hold-on appends no longer copy the whole figure;hold allis the same ashold on. - Patches and surfaces: polygons with more than four vertices,
FaceVertexCData, interpolatedFaceColorandEdgeColor,XDataandYDataset after creation,FaceLightingand lighting properties,camprojandProjection(stored; drawn orthographic). - Added:
streamline,stream2(2-D),coneplot,spy,getframe(without a window),tetramesh(T,X,C),daspect,triplot,uistack, andfindobjwith any property and value pairs. - Figures and axes: figure property prefixes and callback properties,
XDir,YDir,ZDir, axis colours, labelRotation, setting axesPosition(also beyond [0,1] without a subplot overlap error),tiledlayoutspacing and titles,legendTitle,ColorandTextColor, numericlegendlocations, textbox defaults andVerticalAlignment,PlotBoxAspectRatio,DefaultAxesPosition,Quiverobjects withMaxHeadSize, andquiver3on N-D data. - New colormaps:
winter,spring,summer,autumn,pink,lines. New:gobjects,cameratoolbar. TagandUserDatacan be set when a plot object is created.HandleVisibilityat creation is still not accepted.
Files and system
java.security.MessageDigestsupports SHA-256 and SHA-512.- GIF files can be written with
imwrite, including animated append.rgb2indis new, andimfinforeports GIF frames. Local\\?\X:\paths are no longer refused as network paths on Windows.
PDE toolbox
initmesh,refinemeshandpdeInterpolant(withevaluate) on the existing deterministic mesher.
Browser console and Windows
- Browser console (matrust.dev /try/): an operator chain taller than 1,024 levels gives the error "Expression tree exceeds 1024 levels". The desktop and command line allow 4,096. Parentheses stop at 128 levels everywhere.
- Windows: the programs now reserve an 8 MiB main stack (it was 1 MiB).
- Each cell or struct value holds up to 512 MiB on the desktop and command line (256 MiB in the browser), 65536 slots, or 16 levels.
Compatibility fixes from running real public scripts
A set of real public scripts is run on Windows each round and the commonest failures are fixed. In round 5 a script passes if it finishes without error within 600 s on Windows and, where GNU Octave finishes it, is faster than Octave. Octave was timed on a Linux machine; MatRust's time is from the Windows PC, which is the slower of the two (5 close cases were timed on the same Linux machine). Passing is not the same as giving correct results.
- Result: 454 of 473 in-scope scripts pass (96 %), round 5. Of those, 252 finish faster than Octave; for the other 202, Octave stopped with an error (198) or did not finish within 600 s (4). The v0.1.3 figure, 273 of 515 (53.01 %), used the earlier rule (the script ran without error), so the two numbers are not comparable.
- The set is smaller: 40 scripts left the in-scope set (515 to 475) after triage and were tagged upstream-error, and 2 more (475 to 473) in round 5: binomial2 passes a non-integer seed to
rng, and Poisson3vemrate indexes with 0. The manifest stores the tag; the write-up for the 40 is indocs/corpus/round-4-triage.md. One of the 40 is a Finder alias, not a script. - The 19 that do not pass: 14 time out at 600 s, 4 stop with an error, and 1 is slower than Octave.
Behaviour changes
- Rectangular least-squares solves with
\and/return the basic solution from pivoted QR and warn when the matrix is rank deficient. isnan,isinfandisfiniteon N-D arrays keep the input shape.contourfcreates one Contour object, so code that counted one child per level sees one.- A marker-only
plotcall creates a Line object. linspace(a,b,n)with n at least 2 starts ataand ends atb.- A cell or struct value above the new limit (512 MiB desktop and command line, 256 MiB browser) gives an error.
struct()returns an empty scalar struct.- A blank default legend title is the same as no title.
Known gaps
- In the browser console, an operator chain taller than 1,024 levels errors (desktop and command line: 4,096). Parentheses stop at 128 levels everywhere.
- Not included in the PDE toolbox: 3-D geometry, STL import, structural, thermal and electromagnetic models,
adaptmesh,assempde. - Not included in the UI components:
uihtml, GUIDE.figfiles,matlab.uitest, custom component authoring. - Video: uncompressed and Motion JPEG AVI work natively; reading other containers or AVI codecs needs both
ffmpegandffprobe(absolute tool paths also work). DICOM: some compressed transfer syntaxes error with their UID; individual DICOM reads and writes refuse files over 256 MiB, while the collection browser lists larger files from bounded headers. - Not supported yet: complex
singleand complex integer values,?Namemetaclass syntax, enumeration object arrays. - A named desktop layout does not save Command-only mode; it restores as Editor. In Separate layout, a figure created during a run detaches once the desktop is idle.
- Updating an existing
.xlsxworkbook withxlswritekeeps other sheets and cell values outside the written area as values. Formatting, formulas and charts are not kept.webreadandwebsaveneed the systemcurland only do http and https.pspectrumis not available. - Sound: on a real device, buffering can affect where playback resumes. Silent playback resumes at the paused sample.
Install
- Homebrew:
brew install leoom-labs/tap/matrust - Scoop:
scoop bucket add matrust https://github.com/leoom-labs/scoop-bucket, thenscoop install matrust - Or download an archive below.
Downloads
| File | System |
|---|---|
MatRust-0.1.4-windows-x64.zip |
Windows, 64-bit (x64) |
MatRust-0.1.4-linux-x64.tar.gz |
Linux, x86-64 (glibc 2.35 or newer: Ubuntu 22.04, Debian 12, Fedora 36 and later) |
MatRust-0.1.4-linux-x64.AppImage |
Linux, x86-64, single file: chmod +x it and run (same glibc minimum) |
MatRust-0.1.4-macos-arm64.tar.gz |
macOS on Apple silicon, unsigned |
- Each download has a
.sha256file next to it, so you can check that the file is complete and unchanged. - macOS: the programs are not signed. After unpacking, run once in Terminal:
xattr -dr com.apple.quarantine <unpacked folder>, then start./matrust-desktopfrom that folder. - Each archive holds three programs:
matrust-desktop(the desktop app),matrust(the command line) andmatrust-pdf-worker(a helper; keep it in the same folder).
License
GNU General Public License, version 3 or later. Third-party notices ship in each archive.
MATLAB is a registered trademark of The MathWorks, Inc. MatRust is not affiliated with, endorsed by, or sponsored by MathWorks.