# This file defines handy gdb macros for printing out ITPP types
# To use it, add this line to your ~/.gdbinit :
# source gdb_bdm

define dm
   set $i=0

   set $M = $arg0
   set $rs = $M.no_rows
   set $col = $M.no_cols

   while $i < $rs
     set $j=0
     printf "["
     while $j< $col
        printf "%f,",  $M.data[$j*$rs+$i]
        set $j++
     end
     printf "]"
     printf "\n"
     set $i++
   end
end

define dme
   set $i=0

   set $M = $arg0
   set $rs = $M.no_rows
   set $col = $M.no_cols

   while $i < $rs
     set $j=0
     printf "["
     while $j< $col
        printf "%e,", $M.data[$j*$col+$i]
        set $j++
     end
     printf "]"
     printf "\n"
     set $i++
   end
end

define dv
    print $arg0.data[0]@($arg0.datasize)
end

define dl
   dm $M.L
   dv $M.D
end