[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 37 KB, 900x900, unnamed.jpg [View same] [iqdb] [saucenao] [google]
9625791 No.9625791 [Reply] [Original]

I spent 6 hours trying to find a "bug" before I realized that this piece of shit treats strings and character vectors differently but returns true when you use strcmp or '=='. FUCK.

>> No.9625796

grats dude i'm happy that you killed another thread just to share this with us

>> No.9625802

>>9625796
thanks for bumping it and killing another, fucking moron.

>> No.9625808

>>9625791
>doesn't even look at variable explorer

Your fault.

>> No.9625809

>>9625791
Nice. That's the kind of language design I can get behind.

>> No.9625810

>>9625808
I was forced to use this garbage for implementing an SVM classifier.

>> No.9625812

>>9625802
actually i saged
so no, i didn't

>> No.9625814

>>9625796
>>9625802
>flatearth & iq-whining
good riddance

>> No.9625824

>>9625791
>using matlab to compare strings.

>> No.9625889

>>9625791
Why the fuck would you write a C-type program in Matlab

>> No.9625904

>OP didn't test the logic as they went
you shat out code and expected it to just work the first time?

>> No.9625927

>>9625791
I don't know man, learning the basic quirks of the core data structures of your programming language seems like a pretty low bar of knowledge required before you start programming in said language.

Why you would start a project before even studying how the main data structures work is beyond me.

>> No.9625948

>people are actually defending this shit.

Had to stay awake through multiple caffeine pills and piracetams to finish this project on time because this software sucks fucking donkey dick. Fuck off.

>> No.9625956

>>9625948
>blaming a program for your own ignorance

yeah you really deserve that C

>> No.9625957

>>9625948
A bad craftsman blames his tools.

A dogshit craftsman blames his tools without realising he is a tool.

>> No.9625961

>>9625791
Unless you're writing in an assembly language, you're not actually programming.

>> No.9625968

your debugging skills suck, your problem.

>> No.9626075

>>9625824
This. OP deserves to suffer

>> No.9626093

>>9625948
if you'd managed your time better you wouldn't have to take drugs to finish it

>> No.9626314

fuck off brainlet

>> No.9626318
File: 203 KB, 400x400, mikkel.png [View same] [iqdb] [saucenao] [google]
9626318

>>9625791
>proprietary programming language

>> No.9626319

>>9626318
huh?

>> No.9627777

>>9625791
Matlab strings are the worst thing I have ever experienced in Programming, ever single person responsible for that disaster has to be removed from the face of this earth.

Aside from that the language is pretty great though, I like a lot of its features and to be fair, it *probably* wasn't the ideal choice for what you were trying to accomplish.

>> No.9627850

It had it's time. Choose python if you can.

>> No.9627997

>>9627850
Disregard that, I suck cocks.

>> No.9628063

>>9627777
>Using strings in MATLAB ever

You asked for problems

>> No.9628243

>>9628063
Yes, at least that is something I learned during that experience.

>> No.9628290

>>9626318
who are you quoting

>> No.9628310

>>9627850
This. Python is the future. SciPy and the scikit modules are already superior to any commercial software.

The only exception is that Mathematica is superior to SymPy, but you can get one of these for free and more importantly you can modify the source code when you need to.

>> No.9628312
File: 41 KB, 749x512, pineapple_slices.jpg [View same] [iqdb] [saucenao] [google]
9628312

>>9625824
>>9626075
>what are command-line arguments

>> No.9628405

>>9628312
>Doing input in matlab instead of just changing the script

You deserve hell

>> No.9628473

>>9625791
>has to use 35 helper functions to take an array of strings to break it into an array of characters to edit a character and then back into an array of strings

this thing sucks so much ass, just trying to import data from directories takes 100 line script from their forums when in python its a one line import statement using glob.

Python is leagues better or even mathematica if you are lucky to have your school give you a license

>> No.9629354
File: 65 KB, 566x480, read a book.jpg [View same] [iqdb] [saucenao] [google]
9629354

>>9625791
>it's another episode of RTFM
found the shitty undergrad

>> No.9629361

>>9626319
>>9628290
MATLAB is a proprietary programming language you brainlets.

>> No.9629363

>>9629354
More like MATLAB sucks, period.

>> No.9630280

>>9629361
>implying Python in better than Matlab

Get the fuck out of here, gnutard

>> No.9630291

>>9630280
It's not and nobody said so

>> No.9630713

>>9630291
It is though. Python with numba or even numpy is faster than Matlab in array operations; which is the only thing Matlab is supposed to be good for.

>> No.9630765

>>9630713
Do you have any benchmarks for that claim, it seem at least somewhat counter intuitive, I would suspect that both would base themselves on LAPACK or similar and at least use the same underlying BLAS routines.

>> No.9630816
File: 472 KB, 3840x2880, Machine1_res.png [View same] [iqdb] [saucenao] [google]
9630816

>>9630765
As a matter of fact I do.

http://jekel.me/2017/Python-with-Numba-faster-than-fortran/

Notice that MATLAB has the worst results on the all the tests.

> I would suspect that both would base themselves on LAPACK or similar and at least use the same underlying BLAS routines.

You would be correct. However, the Python compiler efficiency is superior on all platforms, as you can see from the other results. In addition, numba allows for greater control of parallelization according to the users needs.

>> No.9630836
File: 222 KB, 950x744, CS math knowledge so wow.png [View same] [iqdb] [saucenao] [google]
9630836

>>9630816
>Numpy code
>X += Y; X += Y;

>Matlab code
>X = X + 2.0*Y;

CS majors prove to be fucking retarded once again.

>> No.9630850

>>9630836
Kek.

Neither me nor that guy is a CS major though. I have to admit, idiotic syntax (which the compiler will modify anyway so doesn't change the results of the benchmark)

>> No.9631017
File: 13 KB, 500x301, 1443251355467.png [View same] [iqdb] [saucenao] [google]
9631017

>>9630850
>I have to admit, idiotic syntax (which the compiler will modify anyway so doesn't change the results of the benchmark
>syntax

The point is the python code is doing 2 floating point addition operations where the Matlab/Fortran code is doing a floating point MULTIPLICATION operation followed by an addition operation. Of course a FP mult instruction will slower than a FP add instruction. The benchmark is highly invalid and purposely misleading.

>> No.9631030

>>9628310
scipy is shit and sympy is full of bugs.

>> No.9631032

>>9630816
Very interesting I have to say, that makes me want to look into numba.

>> No.9631033

>>9631032
fake and gay, look at the code.

>> No.9631038

>>9631033
>look at the code
If I understand you correctly, the only thing you pointed out was the discrepancy between numpy and the others, which I do not care about.
"return x + 2 * y" seems to be the relevant line in the numba code, where it is "X = X + 2.0*Y;" in the matlab example.

>> No.9631059

>>9631017
>The point is the python code is doing 2 floating point addition operations where the Matlab/Fortran code is doing a floating point MULTIPLICATION operation followed by an addition operation.
Sorry, but you don't understand how modern compilers work.

Syntax have zero influence on the final operations performed.

You can write something like

X = X + 1
X = X - 1

And any good compiler will ignore this.

If MATLAB is somehow a 60s tier compiler that doesn't do this then that alone is reason enough not to use it. But it isn't.

>> No.9631070

>>9631030
>scipy is shit
Then why does all the most relevant research questions in the world get answered using it, including the black hole gravity wave simulations, various CERN groups etc. They have more money, resources and intellect than God and you think that they purposely use a shit software? No they use it because it is the best as most research articles show.

>>9631038
He's a fucking idiot of no consequence, just ignore him.

>> No.9631178

>>9631059
>X = X + 1
>X = X - 1
>And any good compiler will ignore this.

Only for built-in types. It can't assume it does nothing for custom data types like matrices and vectors.

>> No.9631193 [DELETED] 

>>9631070
>He's a fucking idiot of no consequence, just ignore him.
>>9631059
>Syntax have zero influence on the final operations performed.

Try finding an optimizing compiler that will return run "y=y+2*x;" instead of "y=y+x; y=y+x;" with the following code. I fucking dare you.

#include<iostream>

class custom_type{
int data;

public:
constexpr custom_type(int data): data{data} {}
constexpr custom_type(): data{0} {}

custom_type operator+(custom_type x){
custom_type z{x.data+data};
std::cout<<"Adding!";
return z;
}

custom_type operator*(custom_type x){
custom_type z{x.data*data};
std::cout<<"Multiplying!";
return z;
}

};

int main(){
custom_type x = 1;
custom_type y = 0;
y = y+x; y = y+x;
}

>> No.9631201

>>9631070
>He's a fucking idiot of no consequence, just ignore him.
>>9631059
>Syntax have zero influence on the final operations performed.

Try finding an optimizing compiler that will return run "y=y+2*x;" instead of "y=y+x; y=y+x;" with the following code. I fucking dare you.

#include<iostream>

class custom_type{
int data;

public:
constexpr custom_type(int data): data{data} {}
constexpr custom_type(): data{0} {}

custom_type operator+(const custom_type& x) const {
std::cout<<"Adding!";
return x.data+data;
}

custom_type operator*(const custom_type& x) const {
std::cout<<"Multiplying!";
return x.data*data;
}

};

int main(){
custom_type x = 1;
custom_type y = 0;
y = y+x; y = y+x;
}

>> No.9631212

>>9630280
>implying Python is better than Matlab
Correct.

>> No.9631257

>>9630816
Really surprising and interesting result, although I'm curious to see how that stacks up for other tasks and also what the errors are in the means. I swear every time someone reports singular values without error estimates in benchmarking I want to punch a bird.

>> No.9631265

Come on people just copy his code and make the adjustment yourself and see if it modifies the benchmark

>> No.9631314

>>9631070
> and you think that they purposely use a shit software?
Some idiot post-doc probably started to program in python (because "muh open source") and now, years later, the code-base is so convoluted that it's not worth changing. The fact that scipy isn't shitty enough for people to rewrite their whole code-base from scratch does not mean it's not shit. Had it been that shitty no one would have used it in the first place.

>> No.9631320

>>9631070
>and you think that they purposely use a shit software

Some of them use Perl, IDL, and labview. \burn

>> No.9632528

>>9630280
When did he imply that

>> No.9634365

>>9628312
>command line arguments in MATLAB
Ahahahahhaha lmaooo

>> No.9635410

>>9625927
Any retard that reads all of the documentation before beginning to do shit in a high-level normie language like MATLAB should be post-birth aborted for severe autism.

>> No.9635424
File: 13 KB, 500x404, tonka.jpg [View same] [iqdb] [saucenao] [google]
9635424

>>9625957
If programming languages are tools, then MATLAB is Tonka tough.

>> No.9635591

>>9635424
Please elaborate.

>> No.9636305

>>9630713
Matlab/Octave/Julia all have better syntax than Python for technical programming by people who are not primarily programmers.

>> No.9636475

>>9628290
Not how this works newfag

>> No.9636698

>>9630816
>I’m not going to touch GPU acceleration in this benchmark, but I think it will be worthwhile to do so sometime.
Into the trash it goes

>> No.9636837

Simulink is a pretty cool guy

>> No.9637347

>>9625791
INDEXES START AT 0
EVERY FUNCTIONS DOESN'T HAVE TO BE ITS OWN FILE
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

>> No.9637353

>>9637347
EVERYTHING DOESN'T HAVE TO BE A GOD DAMN MATRIX

>> No.9637563

>>9637347
>INDEXES START AT 0
so exactly like in linear algebra

>>9637353
if you ain't using matrices use a different language