Comments (13)
Maybe I can break it for you:
M:
1 2 3
4 5 6
7 8 9
M
has three rows:
1 2 3
4 5 6
7 8 9
In order to sum the rows, we have to add the first row to the second row and then to the third row.
That means adding
1+4+7, 2+5+8, 3+6+9
If you take the first row (1 2 3
) and add the elements together, you are not adding the rows, you are adding the columns. If you write the loops to do that, you'll see that when you do the addition, the row index stays constant, and the column index changes: you are adding the columns.
from dlib.
This?
M:
1 2 3
4 5 6
7 8 9
Sum of Rows:
12 15 18
Sum of Cols:
6
15
24
That's the right output. sum_rows()
adds all the row vectors together, which gives the result you have there from your program.
from dlib.
I am very glad how kind you respond to my issue! (I also made ..let's say, "other experiences".) I feel very sorry, that I flagged my issue directly as "Bug". I should have started a discussion or opened a normal issue.
from dlib.
Yeah, updated the docs. Can't rename the functions though, too much code and people are using the current names :D
from dlib.
After reading the documentation, it seems to me like it's working as intended.
from dlib.
I read
const matrix_exp sum_rows (
const matrix_exp& m
);
/*!
requires
- m.size() > 0
ensures
- returns a row matrix that contains the sum of all the rows in m.
- returns a matrix M such that
- M::type == the same type that was in m
- M.nr() == 1
- M.nc() == m.nc()
- for all valid i:
- M(i) == sum(colm(m,i))
!*/
especially sum(colm(m, i))
as a sum over column i
of matrix m
, although the function is called sum_rows
and the first sentence says that it "returns a row matrix that contains the sum of all the rows in m." I can't exclude mistakes on my side. I'm glad for clarification.
Source:
dlib/dlib/matrix/matrix_utilities_abstract.h
Line 1593 in ca7fd9d
from dlib.
Yep, it's doing what it's supposed to do :)
from dlib.
Then I'm puzzled. When sum_rows()
and sum_cols()
work appropriately, am I reading the output of my example program incorrectly?
from dlib.
Although I closed the issue, I want to give some feedback—you can freely decide, what you will do with it!
For me "sum of all the rows" still sounds more like I thought in the first place (but I am obviously biased). Hence, the documentation, ie. sum(colm(m, i))
, looked contradictory. I would advocate for a less ambiguous description. In case you agree, I can try my best and submit a PR.
from dlib.
No worries.
What if it said "sum of all the row vectors", that clearer?
from dlib.
Yes, definitely! 🚀
(In my opinion, sum_row_vectors()
additionally as function name would be even better but I guess this is not feasible due to backwards compatibility, ie. deleting/changing the name sum_rows()
is a big nono. 😄)
from dlib.
Nice!
... As mentioned, I can fully understand a renaming is out of scope.. but we all have hopes and wishes! :D
To conclude: Thank you for the nice conversation on my fake bug! :)
from dlib.
My pleasure :D
from dlib.
Related Issues (20)
- NEON Instructions for ARM chips HOT 4
- [Bug]: Fhog_example does not work with example data HOT 4
- [Bug]: HOT 1
- [Bug]: DLIB_IN_PROJECT_BUILD incorrectly puts -llapack into `Libs` of `dlib-1.pc` HOT 3
- [Bug]: ImportError: /usr/lib/libpango-1.0.so.0: undefined symbol: g_string_free_and_steal HOT 2
- [Bug]: having issues converting opencv mat to iplimage HOT 4
- [Bug]: Cannot build wheel on macOS since v19.24.2 HOT 4
- [Bug]: runtime error importing dlib HOT 7
- [Bug]: python setup.py install (_dlib_pybind11: not found error) / pip install dlib (CUDA disabled error) HOT 6
- [Bug]: dlib doesnt install. says cmake is required but have installed cmake. HOT 12
- [Bug]: RuntimeError in dlib.load_rgb_image: Failing expression was false with Python HOT 10
- [Bug]: dlib.DLIB_USE_CUDA: false HOT 6
- [Bug]: Importing fuction from dlib not working. HOT 2
- [Bug]: Installation failed in 'microcanda env' HOT 4
- [Bug]: dlib doesn't build with FFmpeg 7 HOT 8
- [Bug]: unable to access dlib.net from work because there is no valid signed certificate HOT 3
- [Bug]: Cmake regex error while trying to make install HOT 1
- [Bug]: Multiple errors using dlib on macOS (either dynamic linked or statically compiled) with test target HOT 2
- [Bug]: Segmentation fault (core dumped) on cuda 12.4 & cudnn 9.3.0
- dlib website update HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dlib.