Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jean-Noël Grad
pystencils
Commits
c5cdc763
Commit
c5cdc763
authored
Jun 08, 2020
by
Markus Holzer
Browse files
Fix: vectorization of float sqrt
parent
e685321c
Changes
2
Hide whitespace changes
Inline
Side-by-side
pystencils/backends/cbackend.py
View file @
c5cdc763
...
...
@@ -391,6 +391,8 @@ class CustomSympyPrinter(CCodePrinter):
if
isinstance
(
arg
,
sp
.
Number
)
and
arg
.
is_finite
:
return
self
.
_typed_number
(
arg
,
data_type
)
else
:
if
str
(
arg
)
==
"-1"
:
print
(
"!!"
)
return
"((%s)(%s))"
%
(
data_type
,
self
.
_print
(
arg
))
elif
isinstance
(
expr
,
fast_division
):
return
"({})"
.
format
(
self
.
_print
(
expr
.
args
[
0
]
/
expr
.
args
[
1
]))
...
...
pystencils/data_types.py
View file @
c5cdc763
...
...
@@ -550,7 +550,7 @@ def get_type_of_expression(expr,
return
result
elif
isinstance
(
expr
,
sp
.
Pow
):
base_type
=
get_type
(
expr
.
args
[
0
])
if
expr
.
exp
.
is_integer
:
if
expr
.
exp
.
is_integer
or
expr
.
exp
==
sp
.
Rational
(
1
,
2
)
:
return
base_type
else
:
return
collate_types
([
create_type
(
default_float_type
),
base_type
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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