Milena (Olena)
User documentation 2.0a Id
Main Page
Related Pages
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerator
Groups
Pages
arith/plus.cc
1
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2
//
3
// This file is part of Olena.
4
//
5
// Olena is free software: you can redistribute it and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, version 2 of the License.
8
//
9
// Olena is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
16
//
17
// As a special exception, you may use this file as part of a free
18
// software project without restriction. Specifically, if other files
19
// instantiate templates or use macros or inline functions from this
20
// file, or you compile this file and link it with other files to produce
21
// an executable, this file does not by itself cause the resulting
22
// executable to be covered by the GNU General Public License. This
23
// exception does not however invalidate any other reasons why the
24
// executable file might be covered by the GNU General Public License.
25
26
#include <mln/core/image/image2d.hh>
27
#include <mln/debug/iota.hh>
28
#include <mln/arith/plus.hh>
29
#include <mln/data/compare.hh>
30
31
int
main()
32
{
33
using namespace
mln;
34
35
// trace::quiet = false;
36
37
{
38
image2d<int>
ima(3,3);
39
debug::iota
(ima);
40
41
int
vs[3][3] = {
42
{ 4, 5, 6},
43
{ 7, 8, 9},
44
{10, 11, 12}
45
};
46
47
ima += 2;
48
image2d<int>
ref(
make::image
(vs));
49
50
mln_assertion (ima + 1 == ref);
51
}
52
53
}
54
55
56
57
// #include <mln/core/image/image2d.hh>
58
// #include <mln/core/routine/duplicate.hh>
59
// #include <mln/value/int_u8.hh>
60
61
// #include <mln/arith/plus.hh>
62
// #include <mln/arith/times.hh>
63
// #include <mln/data/compare.hh>
64
// #include <mln/fun/v2v/cast.hh>
65
66
// #include <mln/debug/iota.hh>
67
// #include <mln/debug/println.hh>
68
69
70
71
// int main()
72
// {
73
// using namespace mln;
74
75
// // trace::quiet = false;
76
77
// {
78
// image2d<int> ref(3,3);
79
// debug::iota(ref);
80
81
// image2d<int> ima_i = duplicate(ref);
82
// ima_i += ima_i;
83
// mln_assertion(ima_i == 2 * ref);
84
85
// debug::println(ima_i);
86
// ima_i += 1;
87
// debug::println(ima_i);
88
89
// image2d<float> ima_f(3,3);
90
// debug::iota(ima_f);
91
// debug::println(ima_i + ima_f);
92
93
// point2d p(0, 0);
94
// std::cout << arith::plus<float>(ima_i, ima_i)(p) / 5 << std::endl;
95
// }
96
97
// }
98
99
100
101
// Bench:
102
103
// {
104
// unsigned size = 5000;
105
// image2d<unsigned char> ima_uc(size, size);
106
// image2d<unsigned> ima_u;
107
// ima_u = 2u + ima_uc;
108
// }
109
// {
110
// unsigned size = 5000;
111
// image2d<value::int_u8> ima_uc(size, size);
112
// image2d<unsigned> ima_u;
113
// ima_u = 2u + ima_uc;
114
// }
115
116
// {
117
// unsigned size = 5000;
118
// image2d<unsigned char> ima_uc(size, size);
119
// image2d<unsigned> ima_u;
120
// ima_u = ima_uc + ima_uc;
121
// }
122
// {
123
// unsigned size = 5000;
124
// image2d<value::int_u8> ima_u8(size, size);
125
// image2d<unsigned> ima_u;
126
// ima_u = ima_u8 + ima_u8;
127
// }
tests
arith
plus.cc
Generated on Thu Nov 8 2012 10:58:18 for Milena (Olena) by
1.8.2-20120930