O'Reilly logo

Jim Blinn's Corner: Notation, Notation, Notation by Jim Blinn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter Twenty-one

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required