removed C++11 dependencies

8 views
Skip to first unread message

Bob Carpenter

unread,
Mar 4, 2012, 4:07:02 PM3/4/12
to stan...@googlegroups.com
The complete set of tests is compiling and passing
for me on Mac OSX (Snow Leopard) using g++ version 4.2.1
without the option:

-std=gnu++0x

All the unit tests Daniel put in have been a lifesaver.

I went with the backward-compatible refactor, so the
distributions and error checking code should all work
exactly the same as it did before.

I also checked that it still compiles under clang++
version 2.9.

I don't have other hardware to test on here, but at
least Jenkins didn't balk at the changes with its current
settings.

g++ 4.2.1 sure is slow relative to clang++ version 2.9
(both at optimization level 0).

- Bob

Ben Goodrich

unread,
Mar 4, 2012, 7:29:46 PM3/4/12
to stan...@googlegroups.com
We're fine with clang 3.0, g++ 4.3.x, 4.4.x, 4.5.x, and 4.6.x. There are build failures with g++ 4.7 snapshot but it looks like Eigen breaks rather than anything particular to stan.

Bob Carpenter

unread,
Mar 4, 2012, 8:40:28 PM3/4/12
to stan...@googlegroups.com
I don't think we need to do this right away,
but eventually, it'd be nice to expand
our existing functional syntax to matrix
operators.

MATLAB looks nicer than R/BUGS/JAGS for matrix
operation syntax, because the basic arithmetic
ops have their natural translation to corresponding
matrix ops.

A * B matrix multiply
A .* B elementwise multiply

A ./ B elementwise divide

A + B matrix and elementwise add

A - B matrix and elementwise subtract

+A matrix positive (no op)

-A matrix negation

A ^ n matrix power

A .^ B elementwise power

The only thing I don't like is:

A' complex conjugate transpose

A.' transpose

But I suppose we can write A' since it has the same
behavior as A' for real-valued matrices. Matt -- what's
the convention in MATLAB -- do people just write A'
for real matrix transposes, too?

This brings up the issue of logical operations on
matrices like (A && B) and any(A). We don't really have
booleans yet, but if we add conditionals (which I think
we eventually should), then we'll need boolean types, and
then it'll make sense to have logical operations.

Anyway, let's not turn this into a bikeshed issue. There's
apparently even a name for bikeshedding on programming
language syntax, namely "Wadler's Law". See:

http://en.wikipedia.org/wiki/Parkinson's_Law_of_Triviality

Andrew: this topic looks ripe for blogging. You've mentioned
Parkinson's First Law, but not his Law of Triviality as far
as I could search.

- Bob

Matt Hoffman

unread,
Mar 4, 2012, 9:26:18 PM3/4/12
to stan...@googlegroups.com
To answer the question about complex conjugate transposes, the answer
is yes, A.' is a thing that is rarely seen. (Excuse the awkward
construction, but ending the sentence with ".'." would have been a
little weird.)

I didn't want to sound partisan, but I'm inclined to agree that
Matlab's matrix operator syntax seems a little more well thought out
than R's. As one would hope, given that MATLAB is short for MATrix
LABoratory.

Matt

Marcus Brubaker

unread,
Mar 4, 2012, 9:54:24 PM3/4/12
to stan...@googlegroups.com
Most people don't know about or use .'.  I happen to use it a fair bit, but primarily because it's a bit faster than just '.  I doubt stan will need to worry about explicit internal handling of complex numbers so this is indeed a bit of bikeshedding.
Reply all
Reply to author
Forward
0 new messages