Issues.00116 - lordmundi/wikidoctest GitHub Wiki

00116: MxMt broken

« 00115 | Issues | 00117 »

Summary: MxMt broken

Created: 2008–10–23 10:15

Status: Released

Category: Bug

From: jbullock

Version: 2.0

Released_In: 2.1

Description:

In gui/interface_libraries/math_utils_library.tcl: MxMt is off just a little in the first element calculation

MxMt should be:

# Matrix * Matrix Transpose: Returns the product of ${matrix1} * transposed ${matrix2}
#
#    prod[i][j]=mat1[i][j] * (mat2[i][j])T
#
proc MxMt { matrix1 matrix2 } {
   set prod {}

   set mat1(0,0) [lindex ${matrix1} 0] ; set mat1(0,1) [lindex ${matrix1} 1] ; set mat1(0,2) [lindex ${matrix1} 2]
   set mat1(1,0) [lindex ${matrix1} 3] ; set mat1(1,1) [lindex ${matrix1} 4] ; set mat1(1,2) [lindex ${matrix1} 5]
   set mat1(2,0) [lindex ${matrix1} 6] ; set mat1(2,1) [lindex ${matrix1} 7] ; set mat1(2,2) [lindex ${matrix1} 8]

   set mat2(0,0) [lindex ${matrix2} 0] ; set mat2(0,1) [lindex ${matrix2} 1] ; set mat2(0,2) [lindex ${matrix2} 2]
   set mat2(1,0) [lindex ${matrix2} 3] ; set mat2(1,1) [lindex ${matrix2} 4] ; set mat2(1,2) [lindex ${matrix2} 5]
   set mat2(2,0) [lindex ${matrix2} 6] ; set mat2(2,1) [lindex ${matrix2} 7] ; set mat2(2,2) [lindex ${matrix2} 8]

   lappend prod [expr $mat1(0,0) * $mat2(0,0) + $mat1(0,1) * $mat2(0,1) + $mat1(0,2) * $mat2(0,2)] \
                [expr $mat1(0,0) * $mat2(1,0) + $mat1(0,1) * $mat2(1,1) + $mat1(0,2) * $mat2(1,2)] \
                [expr $mat1(0,0) * $mat2(2,0) + $mat1(0,1) * $mat2(2,1) + $mat1(0,2) * $mat2(2,2)] \
                [expr $mat1(1,0) * $mat2(0,0) + $mat1(1,1) * $mat2(0,1) + $mat1(1,2) * $mat2(0,2)] \
                [expr $mat1(1,0) * $mat2(1,0) + $mat1(1,1) * $mat2(1,1) + $mat1(1,2) * $mat2(1,2)] \
                [expr $mat1(1,0) * $mat2(2,0) + $mat1(1,1) * $mat2(2,1) + $mat1(1,2) * $mat2(2,2)] \
                [expr $mat1(2,0) * $mat2(0,0) + $mat1(2,1) * $mat2(0,1) + $mat1(2,2) * $mat2(0,2)] \
                [expr $mat1(2,0) * $mat2(1,0) + $mat1(2,1) * $mat2(1,1) + $mat1(2,2) * $mat2(1,2)] \
                [expr $mat1(2,0) * $mat2(2,0) + $mat1(2,1) * $mat2(2,1) + $mat1(2,2) * $mat2(2,2)]

   return ${prod}
}

Comments

frankie October 23, 2008, at 02:59 PM: Thanks for the report. I've fixed it. If you need the fix quickly here is a patch file: Attach:0001-Issue-00116-Fixed-typo-in-MxMt.patch. You can apply by:

> patch -b gui/interface_libraries/math_utils_library.tcl 0001-Issue-00116-Fixed-typo-in-MxMt.patch

« 00115 | Issues | 00117 »

Associated Commits

| commit | 78f9edf239b384dedd03d5ee23fa3b888c9089f8 link7 | || | Author: | Frank Graffagnino | | Date: | Thu Oct 23 14:50:45 2008 -0500 | | Message: | [@Issue 00116: Fixed typo in MxMt @] |

Affected Files:

gui/interface_libraries/math_utils_library.tcl | 12 +++++±-----
 1 file changed, 6 insertions(+), 6 deletions(-)