Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize load csv 01 #735

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
76b8f71
first commit
stereomatchingkiss Jul 24, 2016
a479c4c
first commit
stereomatchingkiss Jul 24, 2016
f09c01b
use fast csv parser to load csv and tsv file
stereomatchingkiss Jul 24, 2016
068c439
1 : fix bug, did not put the data into the matrix properly
stereomatchingkiss Jul 24, 2016
69f8a81
use boost format and string operation to generate error messages
stereomatchingkiss Jul 24, 2016
1669a22
remove useless codes
stereomatchingkiss Jul 24, 2016
f848d8e
fix bug--wrong namespace
stereomatchingkiss Jul 24, 2016
9165f9e
change char array to std::string
stereomatchingkiss Jul 24, 2016
8330f78
1 : fix warning
stereomatchingkiss Aug 6, 2016
623d708
1 : refine preprocess guard
stereomatchingkiss Aug 6, 2016
e143213
remove duplicate header
stereomatchingkiss Aug 6, 2016
4bb002c
remove useless codes
stereomatchingkiss Aug 6, 2016
035da37
refine preprocess guard
stereomatchingkiss Aug 6, 2016
70f292e
add missed header
stereomatchingkiss Aug 6, 2016
871042d
remove duplicate header
stereomatchingkiss Aug 6, 2016
5a497e1
add missed header
stereomatchingkiss Aug 6, 2016
9b60921
add license
stereomatchingkiss Aug 6, 2016
3059b83
use another way to include header
stereomatchingkiss Aug 6, 2016
e915439
use dot template to call the function since original solution can not…
stereomatchingkiss Aug 6, 2016
42944fe
adjust format
stereomatchingkiss Aug 14, 2016
802b21a
refine preprocessor guard
stereomatchingkiss Aug 14, 2016
6d74a65
adjust format
stereomatchingkiss Aug 14, 2016
f67fa11
fix bug--function name errors
stereomatchingkiss Aug 14, 2016
da6ac2e
refine class name
stereomatchingkiss Aug 14, 2016
08739c2
fix type cast warning
stereomatchingkiss Aug 14, 2016
26f911a
add test for fast csv parser
stereomatchingkiss Aug 14, 2016
9487e0b
fix bug--wrong namespace
stereomatchingkiss Aug 26, 2016
1e13c4b
fix warnings
stereomatchingkiss Aug 26, 2016
14e8283
include missed header
stereomatchingkiss Aug 26, 2016
5687076
const correctness
stereomatchingkiss Aug 26, 2016
cc87e08
add test cases for csv_reader
stereomatchingkiss Sep 3, 2016
b05d054
remove useless data member and adjust style
stereomatchingkiss Sep 6, 2016
356a797
add new test ParseLineTest
stereomatchingkiss Sep 8, 2016
64259a5
1 : add new policy NoQuoteEscapes, able to separate text with variabl…
stereomatchingkiss Sep 9, 2016
5a6b0c6
implement LoadARFF without DatasetInfo
stereomatchingkiss Sep 9, 2016
ac6f46c
add NoMappingARFFTest
stereomatchingkiss Sep 9, 2016
b9c5b7d
merge from master branch
stereomatchingkiss Sep 9, 2016
2e38924
use inline to avoid symbol confliction
stereomatchingkiss Sep 9, 2016
3fafb8f
replace multiple spaces to one space when parsing arff
stereomatchingkiss Sep 9, 2016
732de6b
avoid recreation of regex object
stereomatchingkiss Sep 9, 2016
37477ff
boost xpressive to replace std regex since there are some bugs when u…
stereomatchingkiss Sep 9, 2016
41a7166
switch back to std regex since xpressive need long compile time
stereomatchingkiss Sep 9, 2016
7252e2d
fix type mismatch
stereomatchingkiss Sep 9, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/mlpack/core/data/file_reader/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void ParseLine(
if(line == nullptr){
throw error::TooFewColumns();
}
char*col_begin, *col_end;
char *col_begin, *col_end;
ChopNextColumn<QuotePolicy>(line, col_begin, col_end);

if(colOrder[i] != -1){
Expand All @@ -84,7 +84,7 @@ void ParseLine(
}

template<class OverFlowPolicy>
void Parse(char *col, char &x){
void Parse(const char *col, char &x){
if(!*col)
throw error::InvalidSingleCharacter();
x = *col;
Expand All @@ -94,12 +94,12 @@ void Parse(char *col, char &x){
}

template<class OverFlowPolicy>
void Parse(char *col, std::string &x){
void Parse(const char *col, std::string &x){
x = col;
}

template<class OverFlowPolicy>
void Parse(char* col, const char*& x){
void Parse(const char* col, const char*& x){
x = col;
}

Expand All @@ -126,15 +126,15 @@ void ParseUnsignedInteger(const char *col, T &x){
}
}

template<class OverFlowPolicy>void Parse(char *col, unsigned char &x)
template<class OverFlowPolicy>void Parse(const char *col, unsigned char &x)
{ParseUnsignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, unsigned short &x)
template<class OverFlowPolicy>void Parse(const char *col, unsigned short &x)
{ParseUnsignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, unsigned int &x)
template<class OverFlowPolicy>void Parse(const char *col, unsigned int &x)
{ParseUnsignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, unsigned long &x)
template<class OverFlowPolicy>void Parse(const char *col, unsigned long &x)
{ParseUnsignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, unsigned long long &x)
template<class OverFlowPolicy>void Parse(const char *col, unsigned long long &x)
{ParseUnsignedInteger<OverFlowPolicy>(col, x);}

template<class OverFlowPolicy, class T>
Expand Down Expand Up @@ -162,15 +162,15 @@ void ParseSignedInteger(const char *col, T &x){
ParseUnsignedInteger<OverFlowPolicy>(col, x);
}

template<class OverFlowPolicy>void Parse(char *col, signed char &x)
template<class OverFlowPolicy>void Parse(const char *col, signed char &x)
{ParseSignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, signed short &x)
template<class OverFlowPolicy>void Parse(const char *col, signed short &x)
{ParseSignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, signed int &x)
template<class OverFlowPolicy>void Parse(const char *col, signed int &x)
{ParseSignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, signed long &x)
template<class OverFlowPolicy>void Parse(const char *col, signed long &x)
{ParseSignedInteger<OverFlowPolicy>(col, x);}
template<class OverFlowPolicy>void Parse(char *col, signed long long &x)
template<class OverFlowPolicy>void Parse(const char *col, signed long long &x)
{ParseSignedInteger<OverFlowPolicy>(col, x);}

template<class T>
Expand Down Expand Up @@ -238,12 +238,12 @@ void ParseFloat(const char *col, T &x){
x = -x;
}

template<class OverFlowPolicy> void Parse(char *col, float &x) { ParseFloat(col, x); }
template<class OverFlowPolicy> void Parse(char *col, double &x) { ParseFloat(col, x); }
template<class OverFlowPolicy> void Parse(char *col, long double &x) { ParseFloat(col, x); }
template<class OverFlowPolicy> void Parse(const char *col, float &x) { ParseFloat(col, x); }
template<class OverFlowPolicy> void Parse(const char *col, double &x) { ParseFloat(col, x); }
template<class OverFlowPolicy> void Parse(const char *col, long double &x) { ParseFloat(col, x); }

template<class OverFlowPolicy, class T>
void Parse(char*, T&){
void Parse(const char*, T&){
// GCC evalutes "false" when reading the template and
// "sizeof(T)!=sizeof(T)" only when instantiating it. This is why
// this strange construct is used.
Expand Down
1 change: 1 addition & 0 deletions src/mlpack/core/data/file_reader/reader_exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <exception>
#include <cassert>
#include <cerrno>
#include <cstring>
#include <istream>
#include <string>

Expand Down