]> www.ginac.de Git - ginac.git/blobdiff - ginac/matrix.h
* Supplement some (now deprecated) macros by inlined template functions:
[ginac.git] / ginac / matrix.h
index 0cb7a71c487d41f45a28fdce7f3f2500a052a290..fac033a99ec8ed70e1a4df88521f67d3003410a5 100644 (file)
@@ -133,11 +133,20 @@ inline matrix inverse(const matrix & m)
 { return m.inverse(); }
 
 // utility functions
+
+/** Return the matrix object handled by an ex.
+ *  This is unsafe: you need to check the type first. */
 inline const matrix &ex_to_matrix(const ex &e)
 {
        return static_cast<const matrix &>(*e.bp);
 }
 
+/** Specialization of is_exactly_a<matrix>(obj) for matrix objects. */
+template<> inline bool is_exactly_a<matrix>(const basic & obj)
+{
+       return obj.tinfo()==TINFO_matrix;
+}
+
 /** Convert list of lists to matrix. */
 extern ex lst_to_matrix(const lst & l);