Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
965a5e29
Commit
965a5e29
authored
Jan 10, 2014
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding another NIST data file (Gauss3)
Removing an error introducted in a previous commit
parent
56792be4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
35 deletions
+76
-35
sources/core/function.cpp
sources/core/function.cpp
+39
-19
sources/core/plugins_manager.cpp
sources/core/plugins_manager.cpp
+16
-2
sources/core/rational_function.cpp
sources/core/rational_function.cpp
+4
-4
sources/core/vertical_segment.cpp
sources/core/vertical_segment.cpp
+9
-2
sources/softs/brdf2gnuplot/main.cpp
sources/softs/brdf2gnuplot/main.cpp
+8
-8
No files found.
sources/core/function.cpp
View file @
965a5e29
...
...
@@ -168,43 +168,63 @@ double function::Linf_distance(const data* d) const
vec
mean
=
vec
::
Zero
(
dimY
());
vec
var
=
vec
::
Zero
(
dimY
());
std
::
cout
<<
"<<DEBUG>> input param here = "
<<
params
::
get_name
(
input_parametrization
())
<<
std
::
endl
;
double
linf_dist
=
0.0
;
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
{
vec
dat
=
d
->
get
(
i
);
vec
x
(
dimX
()),
y
(
dimY
());
if
(
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
memcpy
(
&
x
[
0
],
&
dat
[
0
],
dimX
()
*
sizeof
(
double
));
}
else
// Convert the position of the data sample to the parametrization
// of the function.
if
(
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
memcpy
(
&
x
[
0
],
&
dat
[
0
],
dimX
()
*
sizeof
(
double
));
}
else
{
params
::
convert
(
&
dat
[
0
],
d
->
input_parametrization
(),
input_parametrization
(),
&
x
[
0
]);
}
// Copy the value part of the data vector in a vector to perform vector
// operations on it (used in the computation of the mean).
memcpy
(
&
y
[
0
],
&
dat
[
d
->
dimX
()],
d
->
dimY
()
*
sizeof
(
double
));
// Take the componentwise-max of the two vectors.
const
vec
v
=
value
(
x
);
for
(
int
j
=
0
;
j
<
d
->
dimY
();
++
j
)
{
params
::
convert
(
&
dat
[
0
],
d
->
input_parametrization
(),
input_parametrization
(),
&
x
[
0
]
);
linf_dist
=
std
::
max
<
double
>
(
linf_dist
,
std
::
abs
(
y
[
j
]
-
v
[
j
])
);
}
memcpy
(
&
y
[
0
],
&
dat
[
d
->
dimX
()],
dimY
()
*
sizeof
(
double
));
linf_dist
=
std
::
max
<
double
>
(
linf_dist
,
std
::
abs
(
norm
(
y
-
value
(
x
))));
mean
+=
(
y
-
value
(
x
))
/
double
(
d
->
size
());
// Compute the mean
mean
+=
(
y
-
v
)
/
double
(
d
->
size
());
}
// Compute the standard deviation with respect to the mean error
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
{
vec
dat
=
d
->
get
(
i
);
vec
x
(
dimX
()),
y
(
d
->
dimY
()),
val
(
dimY
());
// Convert the position of the data sample to the parametrization
// of the function.
if
(
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
memcpy
(
&
x
[
0
],
&
dat
[
0
],
dimX
()
*
sizeof
(
double
));
}
else
{
params
::
convert
(
&
dat
[
0
],
d
->
input_parametrization
(),
input_parametrization
(),
&
x
[
0
]);
}
if
(
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
memcpy
(
&
x
[
0
],
&
dat
[
0
],
dimX
()
*
sizeof
(
double
));
}
else
{
params
::
convert
(
&
dat
[
0
],
d
->
input_parametrization
(),
input_parametrization
(),
&
x
[
0
]);
}
// Copy the value part of the data vector in a vector to perform vector
// operations on it (used in the computation of the mean).
memcpy
(
&
y
[
0
],
&
dat
[
d
->
dimX
()],
dimY
()
*
sizeof
(
double
));
val
=
value
(
x
);
val
=
value
(
x
);
for
(
int
j
=
0
;
j
<
d
->
dimY
();
++
j
)
{
y
[
j
]
=
dat
[
d
->
dimX
()
+
j
];
...
...
sources/core/plugins_manager.cpp
View file @
965a5e29
...
...
@@ -213,6 +213,7 @@ function* plugins_manager::get_function(const std::string& filename)
// Parameters of the function object
int
nX
,
nY
;
params
::
input
param_in
;
params
::
output
param_out
;
arguments
args
;
// Test for the first line of the file. Should be a ALTA FUNC HEADER
...
...
@@ -228,7 +229,6 @@ function* plugins_manager::get_function(const std::string& filename)
while
(
line
!=
"#ALTA HEADER END"
)
{
std
::
getline
(
file
,
line
)
;
std
::
cout
<<
line
<<
std
::
endl
;
std
::
stringstream
linestream
(
line
)
;
linestream
.
ignore
(
1
)
;
...
...
@@ -239,7 +239,19 @@ function* plugins_manager::get_function(const std::string& filename)
if
(
comment
==
std
::
string
(
"DIM"
))
{
linestream
>>
nX
>>
nY
;
std
::
cout
<<
"<<DEBUG>> "
<<
nX
<<
" x "
<<
nY
<<
std
::
endl
;
}
else
if
(
comment
==
std
::
string
(
"PARAM_IN"
))
{
std
::
string
name
;
linestream
>>
name
;
std
::
cout
<<
"<<DEBUG>> parsed input parametrization: "
<<
name
<<
std
::
endl
;
param_in
=
params
::
parse_input
(
name
);
}
else
if
(
comment
==
std
::
string
(
"PARAM_OUT"
))
{
std
::
string
name
;
linestream
>>
name
;
param_out
=
params
::
parse_output
(
name
);
}
else
if
(
comment
==
std
::
string
(
"CMD"
))
{
...
...
@@ -251,6 +263,8 @@ function* plugins_manager::get_function(const std::string& filename)
function
*
f
=
get_function
(
args
);
f
->
setDimX
(
nX
);
f
->
setDimY
(
nY
);
f
->
setParametrization
(
param_in
);
f
->
setParametrization
(
param_out
);
// Load the function part from the file object
f
->
load
(
file
);
...
...
sources/core/rational_function.cpp
View file @
965a5e29
...
...
@@ -19,10 +19,10 @@ rational_function_1d::rational_function_1d(int np, int nq, bool separable)
}
rational_function_1d
::
rational_function_1d
(
const
vec
&
a
,
const
vec
&
b
)
const
vec
&
b
)
:
a
(
a
),
b
(
b
)
{
_separable
=
false
;
update
(
a
,
b
)
;
//update(a, b)
;
_separable
=
false
;
}
bool
rational_function_1d
::
load
(
std
::
istream
&
)
...
...
@@ -39,7 +39,7 @@ void rational_function_1d::update(const vec& in_a,
//#define NORMALIZE
#ifdef NORMALIZE
const
double
b0
=
(
std
::
abs
(
in_b
[
0
])
>
1.0E-1
0
)
?
in_b
[
0
]
:
1.0
;
const
double
b0
=
(
std
::
abs
(
in_b
[
0
])
>
1.0E-1
6
)
?
in_b
[
0
]
:
1.0
;
#else
const
double
b0
=
1.0
;
#endif
...
...
sources/core/vertical_segment.cpp
View file @
965a5e29
...
...
@@ -49,7 +49,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
{
linestream
>>
_nX
>>
_nY
;
vs
.
assign
(
dimY
(),
0
)
;
vs
.
reserve
(
dimY
()
)
;
for
(
int
k
=
0
;
k
<
dimY
();
++
k
)
{
vs
[
k
]
=
0
;
...
...
@@ -60,11 +60,15 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
min
=
args
.
get_vec
(
"min"
,
_nX
,
-
std
::
numeric_limits
<
float
>::
max
())
;
max
=
args
.
get_vec
(
"max"
,
_nX
,
std
::
numeric_limits
<
float
>::
max
())
;
#ifdef DEBUG
std
::
cout
<<
"<<DEBUG>> data will remove outside of "
<<
min
<<
" -> "
<<
max
<<
" x-interval"
<<
std
::
endl
;
#endif
ymin
=
args
.
get_vec
(
"ymin"
,
_nY
,
-
std
::
numeric_limits
<
float
>::
max
())
;
ymax
=
args
.
get_vec
(
"ymax"
,
_nY
,
std
::
numeric_limits
<
float
>::
max
())
;
#ifdef DEBUG
std
::
cout
<<
"<<DEBUG>> data will remove outside of "
<<
ymin
<<
" -> "
<<
ymax
<<
" y-interval"
<<
std
::
endl
;
#endif
for
(
int
k
=
0
;
k
<
dimX
();
++
k
)
{
...
...
@@ -160,7 +164,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
if
(
args
.
is_defined
(
"dt-relative"
))
{
v
[
dimX
()
+
dimY
()
+
i
]
=
v
[
dimX
()
+
i
]
*
(
1.0
+
min_dt
)
;
v
[
dimX
()
+
dimY
()
+
i
]
=
v
[
dimX
()
+
i
]
*
(
1.0
+
min_dt
)
;
v
[
dimX
()
+
2
*
dimY
()
+
i
]
=
v
[
dimX
()
+
i
]
*
(
1.0
+
max_dt
)
;
}
else
...
...
@@ -168,6 +172,9 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
v
[
dimX
()
+
dimY
()
+
i
]
=
v
[
dimX
()
+
i
]
+
min_dt
;
v
[
dimX
()
+
2
*
dimY
()
+
i
]
=
v
[
dimX
()
+
i
]
+
max_dt
;
}
#ifdef DEBUG
std
::
cout
<<
"<<DEBUG>> vs = ["
<<
v
[
dimX
()
+
dimY
()
+
i
]
<<
", "
<<
v
[
dimX
()
+
2
*
dimY
()
+
i
]
<<
"]"
<<
std
::
endl
;
#endif
}
// If data is not in the interval of fit
...
...
sources/softs/brdf2gnuplot/main.cpp
View file @
965a5e29
...
...
@@ -100,14 +100,14 @@ int main(int argc, char** argv)
vec
x
(
f
->
dimX
());
// Convert the data to the function's input space.
if
(
f
->
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
memcpy
(
&
x
[
0
],
&
v
[
0
],
f
->
dimX
()
*
sizeof
(
double
));
}
else
{
params
::
convert
(
&
v
[
0
],
d
->
input_parametrization
(),
f
->
input_parametrization
(),
&
x
[
0
]);
}
if
(
f
->
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
memcpy
(
&
x
[
0
],
&
v
[
0
],
f
->
dimX
()
*
sizeof
(
double
));
}
else
{
params
::
convert
(
&
v
[
0
],
d
->
input_parametrization
(),
f
->
input_parametrization
(),
&
x
[
0
]);
}
// Evaluate the function. I can add the cosine term to the BRDF
// value.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment