Tensor Contraction in C++
March–April 2001
class Polynomial
{
TermList Terms;
public:
Polynomial& operator+= (const Term& T)
{
Terms [T. Monomial] += T. Coefficient;
return *this;
}
};
In the previous chapter, I talked about a notational device for matrix algebra called tensor diagrams. This time I'm going to get real and write some C++ code to evaluate these quantities symbolically. This gives me a chance to play with some as yet untried (by me) features in the C++ Standard Library, like strings and STL container classes. For more on STL, check out my favorite book on the subject: The C++ Standard Library by Nicolai M. Josuttis (Addison Wesley, 1999). I am trying to figure out if I like these new-fangled programming tools by seeing ...
Get Jim Blinn's Corner: Notation, Notation, Notation now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.