# 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
        output $M.data[$j*$rs+$i]
        printf " "
        set $j++
     end
     printf "]"
     printf "\n"
     set $i++
   end
end

define dm2
   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 "%2.2f,",$M.data[$j*$rs+$i]
        printf " "
        set $j++
     end
     printf "]"
     printf "\n"
     set $i++
   end
end

define dav
   set $i=0
   printf "{"
   while $i < $arg0.ndata
     dv $arg0.data[$i]
     set $i++
   end
   printf "}"
end

define dam
   set $i=0
   printf "{"
   while $i < $arg0.ndata
     dm $arg0.data[$i]
     set $i++
   end
   printf "}"
end


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

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