Changeset 2974cff in tol


Ignore:
Timestamp:
Jul 7, 2009, 1:38:38 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
774b169
Parents:
c126b51
Message:

ForMat is now a built-in faster function

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1145 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/general/grammars/_matrix.tol

    rc126b51 r2974cff  
    385385PutDescription("Aplica un Polyn ar a una Matrix z", FunArMat);
    386386//////////////////////////////////////////////////////////////////////////////
    387 //////////////////////////////////////////////////////////////////////////////
    388   Matrix ForMat(Real rows, Real columns, Code fun)
    389 //////////////////////////////////////////////////////////////////////////////
    390 {
    391   Real n = 0;
    392   Matrix M = Rand(rows,columns,0,0);
    393   Real While
    394   (
    395     n<rows,
    396     {
    397       n:=n+1;
    398       Real m = 0;
    399       While
    400       (
    401         m<columns,
    402         {
    403           m:=m+1;
    404           Real x = fun(n,m);
    405           PutMatDat(M,n,m,x);
    406           m
    407         }   
    408       ),
    409       n
    410     }
    411   );
    412   M
    413 };
    414 //////////////////////////////////////////////////////////////////////////////
    415   PutDescription(I2(
    416   "",
    417   "Devuelve una matriz con las dimensiones dadas y los valores generados "+
    418   "por la funcion indicada, la cual toma dos argumentos reales "+
    419   "correspondientes a las coordenadas (i,j) y devuelve el elemento (i,j) "+
    420   "de la matriz.") + NL +
    421   I2("Example : ", "Ejemplo : ") + NL +
    422   "Matrix ForMat(2, 3, Real (Real n, Real m){n*m});",
    423   ForMat);
    424 //////////////////////////////////////////////////////////////////////////////
    425 
    426387
    427388
Note: See TracChangeset for help on using the changeset viewer.