Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtschump committed Jun 1, 2024
2 parents cd08d4a + d8ce981 commit 7954d3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion CImg.h
Original file line number Diff line number Diff line change
Expand Up @@ -13538,7 +13538,24 @@ namespace cimg_library {
CImg<_cimg_Tt> operator*(const CImg<t>& img) const {
typedef _cimg_Ttdouble Ttdouble;
typedef _cimg_Tt Tt;
if (_width!=img._height || _depth!=1 || _spectrum!=1)

if (img._spectrum>1 && _width==img._spectrum && _depth==1 && _spectrum==1) {
// Manage special case of pointwise matrix multiplication of vector-valued images.
if (img.size()<~0U) { // Do it all in one step
CImg<t> arg = CImg<t>(img,true).resize(img._width*img._height*img._depth,img._spectrum,1,1,-1);
return ((*this)*arg).resize(img._width,img._height,img._depth,_height,-1);
} else { // Do it row by row
CImg<Tt> res(img._width,img._height,img._depth,_height);
cimg_forYZ(res,y,z) {
CImg<t> arg = img.get_crop(0,y,z,img.width() - 1,y,z);
arg.resize(arg._width,arg._spectrum,1,1,-1);
res.draw_image(0,y,z,0,((*this)*arg).resize(img._width,1,1,_height,-1));
}
return res;
}
}

if (_width!=img._height || _depth!=1 || _spectrum!=1 || img._depth!=1 || img._spectrum!=1)
throw CImgArgumentException(_cimg_instance
"operator*(): Invalid multiplication of instance by specified "
"matrix (%u,%u,%u,%u,%p).",
Expand Down
2 changes: 1 addition & 1 deletion html/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="header">
<a href="index.html"><img alt="Logo" src="img/logo_header.jpg" class="center_image" style="margin-top:1em;"/></a>
<h2 style="padding-bottom: 1em">
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.3.6</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="http://cimg.eu/files/CImg_latest.zip">3.3.7</a></b> (2024/05/28)
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.3.6</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="http://cimg.eu/files/CImg_latest.zip">3.3.7</a></b> (2024/05/31)
</h2>

<hr/>
Expand Down
2 changes: 1 addition & 1 deletion html/header_doxygen.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="header">
<a href="../index.html"><img alt="Logo" src="../img/logo_header.jpg" class="center_image" style="margin-top:1em;"/></a>
<h2 style="padding-bottom: 1em">
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.3.6</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="http://cimg.eu/files/CImg_latest.zip">3.3.7</a></b> (2024/05/28)
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.3.6</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="http://cimg.eu/files/CImg_latest.zip">3.3.7</a></b> (2024/05/31)
</h2>

<hr/>
Expand Down

0 comments on commit 7954d3f

Please sign in to comment.