You can load the elements of a matrix from an array:
Matrix A(3,2); Real a[] = { 11,12,21,22,31,33 }; A << a;This construction does not check that the numbers of elements match correctly. This version of << can be used with submatrices on the left hand side. It is not defined for band matrices.
Alternatively you can enter short lists using a sequence of numbers separated by << .
Matrix A(3,2); A << 11 << 12 << 21 << 22 << 31 << 32;This does check for the correct total number of entries, although the message for there being insufficient numbers in the list may be delayed until the end of the block or the next use of this construction. This does not work for band matrices or submatrices, or for long lists. Also try to restrict its use to numbers. You can include expressions, but these must not call a function which includes the same construction.