Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
0711e731
Commit
0711e731
authored
8 years ago
by
Zbynek Slajchrt
Browse files
Options
Downloads
Patches
Plain Diff
Rebased on master
parent
b2e9d594
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Cdist.java
+7
-4
7 additions, 4 deletions
...library/src/com/oracle/truffle/r/library/stats/Cdist.java
with
7 additions
and
4 deletions
com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Cdist.java
+
7
−
4
View file @
0711e731
...
...
@@ -16,11 +16,13 @@ import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.instanceOf;
import
com.oracle.truffle.api.dsl.Cached
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.api.object.DynamicObject
;
import
com.oracle.truffle.r.nodes.attributes.SetAttributeNode
;
import
com.oracle.truffle.r.nodes.attributes.SetAttributeNodeGen
;
import
com.oracle.truffle.r.nodes.builtin.CastBuilder
;
import
com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode
;
import
com.oracle.truffle.r.runtime.RError
;
import
com.oracle.truffle.r.runtime.RRuntime
;
import
com.oracle.truffle.r.runtime.data.RAttributes
;
import
com.oracle.truffle.r.runtime.data.RDataFactory
;
import
com.oracle.truffle.r.runtime.data.RDoubleVector
;
import
com.oracle.truffle.r.runtime.data.RList
;
...
...
@@ -41,7 +43,8 @@ public abstract class Cdist extends RExternalBuiltinNode.Arg4 {
@Specialization
(
guards
=
"method == cachedMethod"
)
protected
RDoubleVector
cdist
(
RAbstractDoubleVector
x
,
@SuppressWarnings
(
"unused"
)
int
method
,
RList
list
,
double
p
,
@SuppressWarnings
(
"unused"
)
@Cached
(
"method"
)
int
cachedMethod
,
@Cached
(
"getMethod(method)"
)
Method
methodObj
)
{
@Cached
(
"getMethod(method)"
)
Method
methodObj
,
@Cached
(
"create()"
)
SetAttributeNode
setAttrNode
)
{
int
nr
=
RRuntime
.
nrows
(
x
);
int
nc
=
RRuntime
.
ncols
(
x
);
int
n
=
nr
*
(
nr
-
1
)
/
2
;
/* avoid int overflow for N ~ 50,000 */
...
...
@@ -49,7 +52,7 @@ public abstract class Cdist extends RExternalBuiltinNode.Arg4 {
RDoubleVector
xm
=
x
.
materialize
();
rdistance
(
xm
.
getDataWithoutCopying
(),
nr
,
nc
,
ans
,
false
,
methodObj
,
p
);
RDoubleVector
result
=
RDataFactory
.
createDoubleVector
(
ans
,
naCheck
.
neverSeenNA
());
RAttributes
resultAttrs
=
result
.
initAttributes
();
DynamicObject
resultAttrs
=
result
.
initAttributes
();
RStringVector
names
=
(
RStringVector
)
list
.
getAttr
(
RRuntime
.
NAMES_ATTR_KEY
);
for
(
int
i
=
0
;
i
<
names
.
getLength
();
i
++)
{
String
name
=
names
.
getDataAt
(
i
);
...
...
@@ -57,7 +60,7 @@ public abstract class Cdist extends RExternalBuiltinNode.Arg4 {
if
(
name
.
equals
(
RRuntime
.
CLASS_ATTR_KEY
))
{
result
.
setClassAttr
(
listValue
instanceof
RStringVector
?
(
RStringVector
)
listValue
:
RDataFactory
.
createStringVectorFromScalar
((
String
)
listValue
));
}
else
{
resultAttrs
.
put
(
name
,
listValue
);
setAttrNode
.
execute
(
resultAttrs
,
name
,
listValue
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment