mul method
Implementation
MathMatrix mul( dynamic r ){
if( _len == 1 ){
return dup( this ).mulAndAss( r );
}
if( r is MathMatrix ){
if( r._len == 1 ){
MathMatrix a = MathMatrix( _row, _col );
for( int i = 0; i < _len; i++ ){
MathValue.copy( a._mat[i], _mat[i].mul( r._mat[0] ) );
}
return a;
}
int i, j, k;
int l = _row;
int m = (_col > r._row) ? _col : r._row;
int n = r._col;
MathValue t = MathValue();
MathMatrix a = MathMatrix( l, n );
for( i = 0; i < a._row; i++ ){
for( j = 0; j < a._col; j++ ){
t.ass( 0.0 );
for( k = 0; k < m; k++ ){
t.addAndAss( val( i, k ).mul( r.val( k, j ) ) );
}
MathValue.copy( a._val( i, j ), t );
}
}
return a;
}
double rr = ClipMath.toDouble(r);
MathMatrix a = MathMatrix( _row, _col );
for( int i = 0; i < _len; i++ ){
MathValue.copy( a._mat[i], _mat[i].mul( rr ) );
}
return a;
}