Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheus.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheus.js
Commits
3d24dced
Commit
3d24dced
authored
Jul 29, 2016
by
jgould
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added value to count
parent
8197216c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
src/matrix/vector_util.js
src/matrix/vector_util.js
+21
-1
No files found.
src/matrix/vector_util.js
View file @
3d24dced
...
@@ -39,6 +39,26 @@ morpheus.VectorUtil.createValueToCountMap = function (vector) {
...
@@ -39,6 +39,26 @@ morpheus.VectorUtil.createValueToCountMap = function (vector) {
}
}
return
map
;
return
map
;
};
};
morpheus
.
VectorUtil
.
createValuesToCountMap
=
function
(
vectors
)
{
var
map
=
new
morpheus
.
Map
();
var
nvectors
=
vectors
.
length
;
if
(
vectors
[
0
]
==
null
)
{
throw
'
no vectors found
'
;
}
for
(
var
i
=
0
,
nitems
=
vectors
[
0
].
size
();
i
<
nitems
;
i
++
)
{
var
array
=
[];
for
(
var
j
=
0
;
j
<
nvectors
;
j
++
)
{
var
vector
=
vectors
[
j
];
var
val
=
vector
.
getValue
(
i
);
array
.
push
(
val
);
}
var
key
=
new
morpheus
.
Identifier
(
array
);
var
count
=
map
.
get
(
key
)
||
0
;
map
.
set
(
key
,
count
+
1
);
}
return
map
;
};
morpheus
.
VectorUtil
.
maybeConvertToStringArray
=
function
(
vector
,
delim
)
{
morpheus
.
VectorUtil
.
maybeConvertToStringArray
=
function
(
vector
,
delim
)
{
var
newValues
=
[];
var
newValues
=
[];
var
regex
=
new
RegExp
(
delim
);
var
regex
=
new
RegExp
(
delim
);
...
@@ -153,7 +173,7 @@ morpheus.VectorUtil.getValues = function (vector, excludeNull) {
...
@@ -153,7 +173,7 @@ morpheus.VectorUtil.getValues = function (vector, excludeNull) {
}
}
set
.
add
(
val
);
set
.
add
(
val
);
}
}
var
array
=
set
.
values
();
var
array
=
set
.
values
();
array
.
sort
(
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
);
array
.
sort
(
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
);
...
...
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