Skip to content

Commit c06252f

Browse files
author
plearner
committed
Rationalization of the external dependencies (while porting on Mac OS X)
executables and include lists in commands/ have been arranged in groups according to the implied dependency on external libraries.
1 parent 3eed5a5 commit c06252f

39 files changed

+3440
-1902
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// -*- C++ -*-
2+
3+
// VMatDictionaryCommand.cc
4+
//
5+
// Copyright (C) 2006 Pascal Vincent
6+
//
7+
// Redistribution and use in source and binary forms, with or without
8+
// modification, are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright
11+
// notice, this list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright
14+
// notice, this list of conditions and the following disclaimer in the
15+
// documentation and/or other materials provided with the distribution.
16+
//
17+
// 3. The name of the authors may not be used to endorse or promote
18+
// products derived from this software without specific prior written
19+
// permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
22+
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23+
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24+
// NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26+
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
//
32+
// This file is part of the PLearn library. For more information on the PLearn
33+
// library, go to the PLearn Web site at www.plearn.org
34+
35+
// Authors: Pascal Vincent
36+
37+
/*! \file VMatDictionaryCommand.cc */
38+
39+
40+
#include "VMatDictionaryCommand.h"
41+
#include <plearn/vmat/DictionaryVMatrix.h>
42+
#include <plearn/db/getDataSet.h>
43+
#include <plearn/io/load_and_save.h>
44+
45+
namespace PLearn {
46+
using namespace std;
47+
48+
//! This allows to register the 'VMatDictionaryCommand' command in the command registry
49+
PLearnCommandRegistry VMatDictionaryCommand::reg_(new VMatDictionaryCommand);
50+
51+
VMatDictionaryCommand::VMatDictionaryCommand()
52+
: PLearnCommand(
53+
"vmat_dictionary",
54+
"Create Dictionary objects for each field of a vmat",
55+
"Will create <dataset>.field#.dict, where # is the\n"
56+
"field (column) number, starting at 0. Those files contain the plearn\n"
57+
"scripts of the Dictionary objets for each field.\n"
58+
)
59+
{}
60+
61+
//! The actual implementation of the 'VMatDictionaryCommand' command
62+
void VMatDictionaryCommand::run(const vector<string>& args)
63+
{
64+
PPath indexf= "";
65+
string vmat_file = args[0];
66+
string ext = extract_extension(vmat_file);
67+
VMat vmat;
68+
if(ext == ".txt")
69+
{
70+
DictionaryVMatrix* dvmat = new DictionaryVMatrix();
71+
TVec<PPath> file_names(1);
72+
file_names[0] = vmat_file;
73+
dvmat->file_names = file_names;
74+
dvmat->delimiters = "";
75+
dvmat->build();
76+
vmat = dvmat;
77+
}
78+
else
79+
vmat = getDataSet(vmat_file);
80+
81+
for(int i=0; i<vmat->width(); i++)
82+
{
83+
if(vmat->getDictionary(i))
84+
{
85+
string dico_name = vmat_file + ".col" + tostring(i) + ".dict";
86+
save(dico_name,*(vmat->getDictionary(i)));
87+
}
88+
}
89+
}
90+
91+
} // end of namespace PLearn
92+
93+
94+
/*
95+
Local Variables:
96+
mode:c++
97+
c-basic-offset:4
98+
c-file-style:"stroustrup"
99+
c-file-offsets:((innamespace . 0)(inline-open . 0))
100+
indent-tabs-mode:nil
101+
fill-column:79
102+
End:
103+
*/
104+
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// -*- C++ -*-
2+
3+
// VMatDictionaryCommand.h
4+
//
5+
// Copyright (C) 2006 Pascal Vincent
6+
//
7+
// Redistribution and use in source and binary forms, with or without
8+
// modification, are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright
11+
// notice, this list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright
14+
// notice, this list of conditions and the following disclaimer in the
15+
// documentation and/or other materials provided with the distribution.
16+
//
17+
// 3. The name of the authors may not be used to endorse or promote
18+
// products derived from this software without specific prior written
19+
// permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
22+
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23+
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24+
// NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26+
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
//
32+
// This file is part of the PLearn library. For more information on the PLearn
33+
// library, go to the PLearn Web site at www.plearn.org
34+
35+
// Authors: Pascal Vincent
36+
37+
/*! \file VMatDictionaryCommand.h */
38+
39+
40+
#ifndef VMatDictionaryCommand_INC
41+
#define VMatDictionaryCommand_INC
42+
43+
#include <commands/PLearnCommands/PLearnCommand.h>
44+
#include <commands/PLearnCommands/PLearnCommandRegistry.h>
45+
46+
namespace PLearn {
47+
48+
/**
49+
* The first sentence should be a BRIEF DESCRIPTION of what the class does.
50+
* Place the rest of the class programmer documentation here. Doxygen supports
51+
* Javadoc-style comments. See http://www.doxygen.org/manual.html
52+
*
53+
* @todo Write class to-do's here if there are any.
54+
*
55+
* @deprecated Write deprecated stuff here if there is any. Indicate what else
56+
* should be used instead.
57+
*/
58+
class VMatDictionaryCommand : public PLearnCommand
59+
{
60+
typedef PLearnCommand inherited;
61+
62+
public:
63+
VMatDictionaryCommand();
64+
virtual void run(const std::vector<std::string>& args);
65+
66+
protected:
67+
static PLearnCommandRegistry reg_;
68+
};
69+
70+
71+
} // end of namespace PLearn
72+
73+
#endif
74+
75+
76+
/*
77+
Local Variables:
78+
mode:c++
79+
c-basic-offset:4
80+
c-file-style:"stroustrup"
81+
c-file-offsets:((innamespace . 0)(inline-open . 0))
82+
indent-tabs-mode:nil
83+
fill-column:79
84+
End:
85+
*/
86+
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// -*- C++ -*-
2+
3+
// VMatViewCommand.cc
4+
//
5+
// Copyright (C) 2006 Pascal Vincent
6+
//
7+
// Redistribution and use in source and binary forms, with or without
8+
// modification, are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright
11+
// notice, this list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright
14+
// notice, this list of conditions and the following disclaimer in the
15+
// documentation and/or other materials provided with the distribution.
16+
//
17+
// 3. The name of the authors may not be used to endorse or promote
18+
// products derived from this software without specific prior written
19+
// permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
22+
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23+
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24+
// NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26+
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
//
32+
// This file is part of the PLearn library. For more information on the PLearn
33+
// library, go to the PLearn Web site at www.plearn.org
34+
35+
// Authors: Pascal Vincent
36+
37+
/*! \file VMatViewCommand.cc */
38+
39+
40+
#include "VMatViewCommand.h"
41+
#include <plearn/db/getDataSet.h>
42+
#include <plearn/misc/viewVMat.h>
43+
44+
namespace PLearn {
45+
using namespace std;
46+
47+
//! This allows to register the 'VMatViewCommand' command in the command registry
48+
PLearnCommandRegistry VMatViewCommand::reg_(new VMatViewCommand);
49+
50+
VMatViewCommand::VMatViewCommand()
51+
: PLearnCommand(
52+
"vmat_view",
53+
"interactive display of a vmatrix (curses-based)",
54+
"vmat view <vmat_specification> \n"
55+
"will interactively display contents of the \n"
56+
"specified vmatrix (any recognized file format)\n"
57+
)
58+
{}
59+
60+
//! The actual implementation of the 'VMatViewCommand' command
61+
void VMatViewCommand::run(const vector<string>& args)
62+
{
63+
string vmat_view_dataset = string(args[1]);
64+
VMat vm = getDataSet(vmat_view_dataset);
65+
viewVMat(vm);
66+
}
67+
68+
} // end of namespace PLearn
69+
70+
71+
/*
72+
Local Variables:
73+
mode:c++
74+
c-basic-offset:4
75+
c-file-style:"stroustrup"
76+
c-file-offsets:((innamespace . 0)(inline-open . 0))
77+
indent-tabs-mode:nil
78+
fill-column:79
79+
End:
80+
*/
81+
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// -*- C++ -*-
2+
3+
// VMatViewCommand.h
4+
//
5+
// Copyright (C) 2006 Pascal Vincent
6+
//
7+
// Redistribution and use in source and binary forms, with or without
8+
// modification, are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright
11+
// notice, this list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright
14+
// notice, this list of conditions and the following disclaimer in the
15+
// documentation and/or other materials provided with the distribution.
16+
//
17+
// 3. The name of the authors may not be used to endorse or promote
18+
// products derived from this software without specific prior written
19+
// permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
22+
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23+
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24+
// NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26+
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
//
32+
// This file is part of the PLearn library. For more information on the PLearn
33+
// library, go to the PLearn Web site at www.plearn.org
34+
35+
// Authors: Pascal Vincent
36+
37+
/*! \file VMatViewCommand.h */
38+
39+
40+
#ifndef VMatViewCommand_INC
41+
#define VMatViewCommand_INC
42+
43+
#include <commands/PLearnCommands/PLearnCommand.h>
44+
#include <commands/PLearnCommands/PLearnCommandRegistry.h>
45+
46+
namespace PLearn {
47+
48+
/**
49+
* The first sentence should be a BRIEF DESCRIPTION of what the class does.
50+
* Place the rest of the class programmer documentation here. Doxygen supports
51+
* Javadoc-style comments. See http://www.doxygen.org/manual.html
52+
*
53+
* @todo Write class to-do's here if there are any.
54+
*
55+
* @deprecated Write deprecated stuff here if there is any. Indicate what else
56+
* should be used instead.
57+
*/
58+
class VMatViewCommand : public PLearnCommand
59+
{
60+
typedef PLearnCommand inherited;
61+
62+
public:
63+
VMatViewCommand();
64+
virtual void run(const std::vector<std::string>& args);
65+
66+
protected:
67+
static PLearnCommandRegistry reg_;
68+
};
69+
70+
71+
} // end of namespace PLearn
72+
73+
#endif
74+
75+
76+
/*
77+
Local Variables:
78+
mode:c++
79+
c-basic-offset:4
80+
c-file-style:"stroustrup"
81+
c-file-offsets:((innamespace . 0)(inline-open . 0))
82+
indent-tabs-mode:nil
83+
fill-column:79
84+
End:
85+
*/
86+
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :

commands/README.txt

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
This directory contains the source code of PLearn "executables" to be compiled with pymake.
2+
3+
If you look at the plearn_*.cc files closely, you will notice that they are
4+
all built in the same manner, simply including a number of things they
5+
need, and invoking a single function plearn_main.
6+
So they only differ in the functionalities they #include.
7+
8+
They have been grouped by external library dependencies that will be needed to compile and link each of them.
9+
10+
In short:
11+
12+
plearn_noblas depends only on NSPR, boost (if you don't have blas, it must be compiled with pymake -noblas plearn_noblas )
13+
plearn_lapack depends on NSPR, boost, BLAS, LAPACK
14+
plearn_curses depends on NSPR, boost, BLAS, LAPACK, ncurses
15+
plearn_python depends on NSPR, boost, BLAS, LAPACK, ncurses, python runtime libraries
16+
17+
Since plearn_noblas has the smallest number of requirements, it should be the
18+
easiest to get to compile and link. But several important learning algorithms require LAPACK.
19+
plearn_lapack will contain the most useful 99\% of PLearn.
20+
21+
Note that the plearn_python version has not yet successfully been compiled on Mac OS X.
22+
23+
IMPORTANT ADVICE:
24+
25+
If you are only going to be using PLearn with scripts or from within
26+
python, you can simply compile one of the above (with pymake) that contains
27+
enough of what you need and then never think about it anymore.
28+
29+
If however, you are going to write C++ code, I strongly advise you to write
30+
your own mylearn.cc following the same model as the above programs, but
31+
including only the pieces that you need for your project: this will greatly
32+
reduce link time and executable size.
33+

0 commit comments

Comments
 (0)