source: tol/tolsh/tests/matprod/data.tol @ 6d7779d

1941-docker-image-to-testdevel
Last change on this file since 6d7779d was 6d7779d, checked in by Jorge Pérez <josp.jorge@…>, 18 years ago

initial import

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

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/* -*- mode: c++ -*- */
2
3/*
4   ----------------------------------------------------------------------
5                     Funciones de carga de datos
6   ----------------------------------------------------------------------
7 */
8Real GenerateData(Text fileM, Real R, Real C)
9{
10  WriteLn("Generating random matrix "<<fileM<<" of size " << R <<"X"<< C);
11  Matrix MatWriteFile(fileM, Rand(R,C,0,1));
12  Real 1
13};
14
15Set ReadData(Set param)
16{
17  Real M = param["M"];
18  Real K = param["K"];
19  Real N = param["N"];
20 
21  Text fileA = "A.bbm";
22  Text fileB = "B.bbm";
23
24  Real If(FileExist(fileA), Real {
25      Matrix A = MatReadFile(fileA);
26      Real If(Rows(A)!=M | Columns(A)!=K,
27              GenerateData(fileA, M, K))
28    }, GenerateData(fileA, M, K));
29 
30  Real If(FileExist(fileB), Real {
31      Matrix B = MatReadFile(fileB);
32      Real If(Rows(B)!=K | Columns(B)!=N,
33              GenerateData(fileB, K, N))
34    }, GenerateData(fileB, M, K));
35
36  Matrix A = MatReadFile(fileA);
37  Matrix B = MatReadFile(fileB);
38
39  Set [[ A, B ]]
40};
41
Note: See TracBrowser for help on using the repository browser.