Permalink
Browse files

initial dump of Matrixy repo from code.google.com/p/matrixy

  • Loading branch information...
0 parents commit 84916b5a0c5842434ca0a18adf3ed954bf126639 @Whiteknight committed Oct 13, 2009
Showing with 8,823 additions and 0 deletions.
  1. +33 −0 Configure.pl
  2. +12 −0 PAST-Compiler.patch
  3. +80 −0 README.NCI.pod
  4. +73 −0 README.pod
  5. +106 −0 ROADMAP.pod
  6. +135 −0 config/makefiles/root.in
  7. +27 −0 examples/loadlibrary/blas_mtimes.m
  8. +27 −0 examples/loadlibrary/blas_transpose.m
  9. +127 −0 extern/include/cblas.hints
  10. +1,276 −0 extern/include/clapack.hints
  11. BIN extern/lib/amd64-linux/cblas.so
  12. BIN extern/lib/amd64-linux/clapack.so
  13. BIN extern/lib/i386-MSWin32/cblas.dll
  14. BIN extern/lib/i386-MSWin32/clapack.dll
  15. BIN extern/lib/i386-linux/cblas.so
  16. BIN extern/lib/i386-linux/clapack.so
  17. +12 −0 matrixy.cmd
  18. +128 −0 matrixy.pir
  19. +26 −0 src/builtins/abs.pir
  20. +28 −0 src/builtins/addpath.pir
  21. +99 −0 src/builtins/arrayfun.pir
  22. +26 −0 src/builtins/ceil.pir
  23. +16 −0 src/builtins/clearscreen.pir
  24. +15 −0 src/builtins/columns.pir
  25. +50 −0 src/builtins/complex.pir
  26. +31 −0 src/builtins/computer.pir
  27. +18 −0 src/builtins/disp.pir
  28. +19 −0 src/builtins/error.pir
  29. +23 −0 src/builtins/exist.pir
  30. +5 −0 src/builtins/exit.pir
  31. +44 −0 src/builtins/eye.pir
  32. +26 −0 src/builtins/feval.pir
  33. +26 −0 src/builtins/floor.pir
  34. +18 −0 src/builtins/getenv.pir
  35. +44 −0 src/builtins/help.pir
  36. +67 −0 src/builtins/isequal.pir
  37. +12 −0 src/builtins/lasterr.pir
  38. +507 −0 src/builtins/loadlibrary.pir
  39. +76 −0 src/builtins/mtimes.pir
  40. +40 −0 src/builtins/ones.pir
  41. +15 −0 src/builtins/parrot_typeof.pir
  42. +43 −0 src/builtins/path.pir
  43. +16 −0 src/builtins/pir.pir
  44. +16 −0 src/builtins/printf.pir
  45. +5 −0 src/builtins/quit.pir
  46. +12 −0 src/builtins/read.pir
  47. +65 −0 src/builtins/rmpath.pir
  48. +27 −0 src/builtins/round.pir
  49. +16 −0 src/builtins/rows.pir
  50. +23 −0 src/builtins/setenv.pir
  51. +17 −0 src/builtins/size.pir
  52. +14 −0 src/builtins/sprintf.pir
  53. +51 −0 src/builtins/sum.pir
  54. +35 −0 src/builtins/system.pir
  55. +47 −0 src/builtins/transpose.pir
  56. +40 −0 src/builtins/zeros.pir
  57. +445 −0 src/internals/dispatch.pir
  58. +445 −0 src/internals/fortran_helpers.pir
  59. +16 −0 src/internals/generate_complex.pir
  60. +532 −0 src/internals/matrix.pir
  61. +211 −0 src/internals/operators.pir
  62. +149 −0 src/internals/stdio.pir
  63. +28 −0 src/internals/system.pir
  64. +785 −0 src/parser/actions.pm
  65. +34 −0 src/parser/grammar-oper.pg
  66. +359 −0 src/parser/grammar.pg
  67. +19 −0 t/000-sanity.t
  68. +15 −0 t/001-if_then_else.t
  69. +82 −0 t/002-function.t
  70. +14 −0 t/003-system_call.t
  71. +31 −0 t/004-parrot.t
  72. +31 −0 t/005-env.t
  73. +115 −0 t/006-vector.t
  74. +159 −0 t/007-matrix.t
  75. +61 −0 t/008-path.t
  76. +52 −0 t/009-dispatch.t
  77. +22 −0 t/010-expression-todo.t
  78. +41 −0 t/010-expression.t
  79. +30 −0 t/011-strings.t
  80. +69 −0 t/012-function_handle.t
  81. +61 −0 t/013-complex.t
  82. +31 −0 t/014-variables.t
  83. +15 −0 t/015-operators.t
  84. +22 −0 t/016-TAP_functions.t
  85. +23 −0 t/017-range.t
  86. +14 −0 t/018-for.t
  87. +18 −0 t/019-try_catch.t
  88. +33 −0 t/100-fortran_helpers.t
  89. +12 −0 t/200-zeros.t
  90. +17 −0 t/201-eye.t
  91. +34 −0 t/202-isequal.t
  92. +10 −0 t/203-sprintf.t
  93. +37 −0 t/204-arrayfun.t
  94. +11 −0 t/205-ones.t
  95. +17 −0 t/206-computer.t
  96. +39 −0 t/300-transpose.t
  97. +17 −0 t/301-mtimes.t
  98. +36 −0 t/302-floor-ceil-round.t
  99. +117 −0 t/303-matrix-operations.t
  100. +17 −0 t/304-isscalar.t
  101. +53 −0 t/305-clapack.t
  102. +17 −0 t/306-inverse.t
  103. +21 −0 t/307-abs-max-min.t
  104. +16 −0 t/308-loadlibrary.t
  105. +22 −0 t/800-loadlibrary-examples.t
  106. +20 −0 t/README.Tests.pod
  107. +13 −0 t/harness
  108. +5 −0 t/lib/test1.m
  109. +3 −0 t/lib/test2.m
  110. +3 −0 t/lib/test3.m
  111. +3 −0 t/lib/test4.m
  112. +3 −0 t/lib/test6.m
  113. +3 −0 t/lib/test_script.m
  114. +9 −0 t/lib/test_script2.m
  115. +8 −0 t/lib/test_script3.m
  116. +3 −0 t/test5.m
  117. +7 −0 toolbox/ctranspose.m
  118. +5 −0 toolbox/e.m
  119. +9 −0 toolbox/end_todo.m
  120. +9 −0 toolbox/import_cblas_library.m
  121. +13 −0 toolbox/import_clapack_library.m
  122. +26 −0 toolbox/inverse.m
  123. +7 −0 toolbox/is.m
  124. +8 −0 toolbox/isscalar.m
  125. +8 −0 toolbox/ldivide.m
  126. +12 −0 toolbox/length.m
  127. +7 −0 toolbox/matrixyrc.m
  128. +19 −0 toolbox/max.m
  129. +19 −0 toolbox/min.m
  130. +8 −0 toolbox/minus.m
  131. +13 −0 toolbox/nok.m
  132. +21 −0 toolbox/ok.m
  133. +5 −0 toolbox/pi.m
  134. +9 −0 toolbox/plan.m
  135. +8 −0 toolbox/plus.m
  136. +8 −0 toolbox/power.m
  137. +16 −0 toolbox/rdivide.m
  138. +10 −0 toolbox/start_todo.m
  139. +16 −0 toolbox/times.m
  140. +184 −0 tools/nci/h_to_pir.pl
  141. +154 −0 tools/nci/lib_to_dll.pl
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+use 5.008;
+
+use lib "../../lib";
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+
+$| = 1; # $OUTPUT_AUTOFLUSH = 1;
+
+my $args = process_options(
+ {
+ step => 'gen::makefiles',
+ mode => 'reconfigure',
+ conditioned_lines => 1,
+ replace_slashes => 1,
+ }
+);
+exit(1) unless ( defined $args );
+
+my $conf = Parrot::Configure->new;
+$conf->options->set( %{$args} );
+$conf->data()->get_PConfig(); #load configuration data
+
+my @builtins = glob("src/builtins/*.pir");
+$conf->data()->set('builtins_pir', join(' ', @builtins));
+
+my @internals = glob("src/internals/*.pir");
+$conf->data()->set('internals_pir', join(' ', @internals));
+
+$conf->genfile( 'config/makefiles/root.in' => 'Makefile');
+
+exit(0);
@@ -0,0 +1,12 @@
+Index: compilers/pct/src/PAST/Compiler.pir
+===================================================================
+--- compilers/pct/src/PAST/Compiler.pir (revision 37388)
++++ compilers/pct/src/PAST/Compiler.pir (working copy)
+@@ -90,6 +90,7 @@
+ valflags['String'] = 's~*:e'
+ valflags['Integer'] = 'i+*:'
+ valflags['Float'] = 'n+*:'
++ valflags['Complex'] = 's~*:e'
+ set_global '%valflags', valflags
+
+ ## %!controltypes holds the list of exception types for each
@@ -0,0 +1,80 @@
+=head1 DESCRIPTION
+
+Parrot must be recompiled with signatures produced in files in extern/pir/*.nci. These
+need to be appended to <parrot source>\config\gen\call_list, then Parrot needs to be
+recompiled.
+
+The relevant dynamic library for a platform must be dropped into extern/lib/. The Windows
+DLLs should be already there and one version for Linux (libc.so.6).
+
+=head1 BUILD INSTRUCTIONS
+
+=head2 WINDOWS
+
+Either download the specific static library from
+
+http://www.netlib.org/clapack/LIB_WINDOWS/prebuilt_libraries_windows.html
+
+or build them yourself using the VS solution provided at
+
+http://www.netlib.org/clapack/
+
+Then run
+
+./tools/nci/lib_to_dll.pl --libdir "C:\CLAPACK-3.1.1-VisualStudio\LIB\Win32" --name clapack
+ --olib libf2c.lib --olib BLAS.lib --outdir "extern\lib"
+
+./tools/nci/lib_to_dll.pl --libdir "C:\CLAPACK-3.1.1-VisualStudio\LIB\Win32" --name cblas
+ --olib libf2c.lib --outdir "extern\lib"
+
+=head2 LINUX
+
+Download clapack.tgz from
+
+http://www.netlib.org/clapack/
+
+and unpack somewhere on your filesystem.
+
+tar zxvf clapack.tgz
+cd CLAPACK-3.1.1.1
+copy make.inc.example make.inc
+
+Edit make.inc, add -fPIC option to NOOPT, i.e.
+
+NOOPT = -O0 -fPIC
+
+and add the following lines to the end: -
+
+BLASLIBSO = ../../cblas.so
+LAPACKLIBSO = clapack.so
+
+Edit SRC/Makefile and add the following lines: -
+
+../$(LAPACKLIBSO): $(ALLOBJ) ../F2CLIBS/libf2c.a ../blas_LINUX.a
+ $(LOADER) $(LOADOPTS) -shared -Wl,-soname,clapack.so -o $@ $(ALLOBJ) ../F2CLIBS/libf2c.a ../blas_LINUX.a
+
+Also, change
+
+all: ../$(LAPACKLIB)
+
+to
+
+all: ../$(LAPACKLIB) ../$(LAPACKLIBSO)
+
+
+Edit BLAS/SRC/Makefile and add the following lines: -
+
+$(BLASLIBSO): $(ALLOBJ) ../../F2CLIBS/libf2c.a
+ $(LOADER) $(LOADOPTS) -z muldefs -shared -Wl,-soname,cblas.so -o $@ $(ALLOBJ) ../../F2CLIBS/libf2c.a
+
+Also, change
+
+all: $(BLASLIB)
+
+to
+
+all: $(BLASLIB) $(BLASLIBSO)
+
+Finally run make and copy the cblas.so and clapack.so files to extern/lib/.
+
+=cut
@@ -0,0 +1,73 @@
+=head1 Matrixy
+
+=head2 INTRODUCTION
+
+This is a port of the MATLAB/Octave programming language to
+Parrot. See the ROADMAP file for more information on the
+status of this project, and what else needs to be done.
+
+=head2 ABOUT
+
+Primary goals are:
+
+=over 4
+
+=item* Create a working compiler that understands the
+majority of the MATLAB/Octave programming language.
+
+=item* Create a series of PMCs and library files, especially
+those involving matrices, that can be used by other
+programming languages which target Parrot.
+
+=back
+
+=head2 IMPLEMENTATION
+
+This project is broken into three primary components:
+
+=over 4
+
+=item* The first is the parser, located in the
+C<src/parser/> directory. The parser is composed of two
+source files, F<grammar.pg> which is a Perl6Grammar file,
+and F<actions.pm> which is the associated actions file
+written in NQP.
+
+=item* The second component is the library of builtin
+functions in the C<src/builtins/> directory. These
+functions are, currently, written primarily in PIR.
+Function names prefixed with an underscore are "private"
+functions for use with the parser. Other functions should
+have names which are the same as names for regular MATLAB
+or Octave functions, since they will be available to the
+HLL.
+
+=item* the final component is the set of various PMC classes
+that make up the data objects in Matrixy. The "master" super
+class is the "MatrixyData" class. This class represents an
+instantiation of a generic data object. From here, data can
+be subclassed into "Matrix", "Cell Array", or other types
+of values, as necessary.
+
+=back
+
+=head2 BUILDING
+
+ perl Configure.pl
+ nmake test
+
+=head2 TODO
+
+ * Parser
+ * Standard Builtins
+ * Test against Octave Test Suite.
+
+=head2 BUGS
+
+Lots!
+
+=head2 CONTACT
+
+Contact Project Owners at http://code.google.com/p/matrixy/.
+
+=end
@@ -0,0 +1,106 @@
+=head1 ROADMAP
+
+=head2 INTRODUCTION
+
+There is a long way to go between the current implementation
+and a final robust one. The final version should be able to
+emulate the vast majority of MATLAB/Octave language syntax,
+and should also try to emulate some of the basic library
+functions thereof. Notice that some "standard" features of
+MATLAB/Octave won't be available here, at least not
+immediately: Plots and graphs, user interfaces, toolboxes,
+etc.
+
+=head2 Future Versions
+
+Version 1.0 will support most of the basic language syntax,
+and hopefully many of the core library functions. Here,
+abbreviated and horribly inaccurate, is a general roadmap
+for this project:
+
+Version 0.1: (current) We have basic support for single-
+value subroutines, basic control structures, basic scalar
+variables. Also some ideosyncratic features like using ';'
+to suppress printing line results, using '!' to make a
+system call, etc. Implemented basic functions like 'disp',
+'error', 'exit', and 'feval', all for scalar arguments only.
+
+Version 0.2: Implement matrices, and improved support for
+functions with multiple return values.
+
+Version 0.3: Write some of the standard matrix manipulation
+functions, or basic versions thereof. Transpose, determinant,
+size, addition, multiplication, etc.
+
+Version 0.4: Implement function/file look-up. Searching for
+function "foo", look in file "foo.m", etc.
+
+Version 0.5: Implement cell arrays
+
+Version 0.6: Write more-advanced function features: nargin,
+nargout, varargin, varargout, return. Implement matrix-
+ready functions that iterate over matrix values
+
+Version 0.7: Implement matrix and cell array slicing:
+'x(1:)', and similar. implement matrix and cell array
+concatination '[[1 2 3], [4 5 6]] = [1 2 3 4 5 6]'. Treat
+all scalars as matrices.
+
+Version 0.8: Implement basic MATLAB classes and data
+structures. Implement a dedicated matrix PMC (probably in C)
+implement sparse matrices (may be part of the same pmc).
+
+Version 0.9: Implement most of the standard library of
+functions, including error-stubs for common functions which
+cannot be implemented (graphics, etc). Core builtins should be
+written in PIR, and the rest should be written in M.
+
+Version 1.0: All the basic stuff should be working, including
+a proper test suite. Enough of the language should be implemented
+in order to run the Octave test suite (or portions of it that
+we haven't explicitly excluded). Matrixy won't have all the
+features of MATLAB or Octave, but the features it does have
+should match them syntactically. Everything should be documented
+
+=head2 Wishlist
+
+The roadmap above should produce a 1.0 which is a stable clone
+of a core subset of MATLAB/Octave. From that base, there are a
+large number of standard features (extensions/libraries, larger
+subsets of the language) that could be implemented. Plus, there
+are a number of non-standard wishlist features that could be added
+to extend the language. Such non-standard features might be made
+available through a command-line switch, an in-code pragma or in
+a separate executable. Here is a list of such features, in no
+particular order:
+
+=over 4
+
+=item* Better, more robust support for OO, classes, namespaces.
+
+Notice that OO was added to MATLAB in R2008A. This wishlist item
+means better support for this including some of the more advanced
+features that Parrot enables.
+
+=item* Better Multithreading
+
+Notice that MATLAB supplies a Parallel Computing Toolbox which gives
+the user some explicit support for multithreading and support for
+multicore computing. Matrixy may attempt to reproduce this toolbox
+or may attempt to add a more generic threading system.
+
+=item* disambiguous matrix/function syntax.
+
+Should be able to use '[]' for matrix indices, use '()' for function
+arguments, if desired. This will help ease human readability in some
+cases, and is more natural for some programmers.
+
+=item* Allow inlining code from other languages.
+
+Matrixy will likely contain subroutines very early on to compile code
+strings from other programming languages. An inlineable interface will
+be more robust and natural.
+
+=back
+
+=end
Oops, something went wrong.

0 comments on commit 84916b5

Please sign in to comment.