~ubuntu-branches/ubuntu/saucy/gfan/saucy-proposed

« back to all changes in this revision

Viewing changes to app_matrixproduct.cpp

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2013-07-09 10:44:01 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130709104401-5q66ozz5j5af0dak
Tags: 0.5+dfsg-3
* Upload to unstable.
* modify remove_failing_tests_on_32bits.patch to replace command of
  0009RenderStairCase test with an empty one instead of deleting it.
* remove lintian override about spelling error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * app_matrixproduct.cpp
 
3
 *
 
4
 *  Created on: Jan 4, 2011
 
5
 *      Author: anders
 
6
 */
 
7
 
 
8
#include "parser.h"
 
9
#include "printer.h"
 
10
#include "gfanapplication.h"
 
11
#include "matrix.h"
 
12
 
 
13
class MatrixProductApplication : public GFanApplication
 
14
{
 
15
public:
 
16
  SimpleOption optionTropical;
 
17
  bool includeInDefaultInstallation()
 
18
  {
 
19
    return false;
 
20
  }
 
21
  const char *helpText()
 
22
  {
 
23
    return "This program computes the product of two matrices.\n";
 
24
  }
 
25
  MatrixProductApplication():
 
26
    optionTropical("--tropical","Do the computation in the max-plus semi-ring.")
 
27
  {
 
28
    registerOptions();
 
29
  }
 
30
 
 
31
  const char *name()
 
32
  {
 
33
    return "_matrixproduct";
 
34
  }
 
35
 
 
36
  int main()
 
37
  {
 
38
    FileParser P(Stdin);
 
39
 
 
40
    IntegerMatrix A=rowsToIntegerMatrix(P.parseIntegerVectorList());
 
41
    IntegerMatrix B=rowsToIntegerMatrix(P.parseIntegerVectorList());
 
42
 
 
43
    pout<<((optionTropical.getValue())?tropicalProduct(A,B):A*B).getRows();
 
44
 
 
45
    return 0;
 
46
  }
 
47
};
 
48
 
 
49
static MatrixProductApplication theApplication;