Equivalent of VecDoub in C?
I am new to C++ and was curious what is the C equivalent of Vecdoub and VecInt?
I am trying to evaluate code for LU decomposition but it is written in C++, some of the code is as follows.
VecDoub vv(n);
VecInt indx;
vv[i] = 1/max;
I am assuming that VecInt is similar to an array and vecdoub is similar to a 2-d array or am I completely wrong? Any clear and concise information would be greatly appreciated.
c++ c
|
show 1 more comment
I am new to C++ and was curious what is the C equivalent of Vecdoub and VecInt?
I am trying to evaluate code for LU decomposition but it is written in C++, some of the code is as follows.
VecDoub vv(n);
VecInt indx;
vv[i] = 1/max;
I am assuming that VecInt is similar to an array and vecdoub is similar to a 2-d array or am I completely wrong? Any clear and concise information would be greatly appreciated.
c++ c
3
What isVecDoub
in c++? There's no such class supported by the c++ standard.
– πάντα ῥεῖ
Nov 22 '18 at 11:54
1
Same forVecInt
.
– HolyBlackCat
Nov 22 '18 at 11:55
Maybe VecDoub vv(n) - is array of n elements of type double. VecInt indx - is array of type int (size not initialized). But it's only my assumption
– snake_style
Nov 22 '18 at 11:56
I was viewing some information from Numerical Recipes in C and I figured the chunk of code I am looking at was in C++, I am even more perplexed now.
– KolacheMaster
Nov 22 '18 at 11:56
1
make your own opinion, but note that the code in Numerical Recipes is partly outdated and partly even the algorithms they use are rather controversial numerics wise. I love the book for its easy to grasp explanations, but dont take everything for granted what they write
– user463035818
Nov 22 '18 at 12:15
|
show 1 more comment
I am new to C++ and was curious what is the C equivalent of Vecdoub and VecInt?
I am trying to evaluate code for LU decomposition but it is written in C++, some of the code is as follows.
VecDoub vv(n);
VecInt indx;
vv[i] = 1/max;
I am assuming that VecInt is similar to an array and vecdoub is similar to a 2-d array or am I completely wrong? Any clear and concise information would be greatly appreciated.
c++ c
I am new to C++ and was curious what is the C equivalent of Vecdoub and VecInt?
I am trying to evaluate code for LU decomposition but it is written in C++, some of the code is as follows.
VecDoub vv(n);
VecInt indx;
vv[i] = 1/max;
I am assuming that VecInt is similar to an array and vecdoub is similar to a 2-d array or am I completely wrong? Any clear and concise information would be greatly appreciated.
c++ c
c++ c
asked Nov 22 '18 at 11:51
KolacheMasterKolacheMaster
319
319
3
What isVecDoub
in c++? There's no such class supported by the c++ standard.
– πάντα ῥεῖ
Nov 22 '18 at 11:54
1
Same forVecInt
.
– HolyBlackCat
Nov 22 '18 at 11:55
Maybe VecDoub vv(n) - is array of n elements of type double. VecInt indx - is array of type int (size not initialized). But it's only my assumption
– snake_style
Nov 22 '18 at 11:56
I was viewing some information from Numerical Recipes in C and I figured the chunk of code I am looking at was in C++, I am even more perplexed now.
– KolacheMaster
Nov 22 '18 at 11:56
1
make your own opinion, but note that the code in Numerical Recipes is partly outdated and partly even the algorithms they use are rather controversial numerics wise. I love the book for its easy to grasp explanations, but dont take everything for granted what they write
– user463035818
Nov 22 '18 at 12:15
|
show 1 more comment
3
What isVecDoub
in c++? There's no such class supported by the c++ standard.
– πάντα ῥεῖ
Nov 22 '18 at 11:54
1
Same forVecInt
.
– HolyBlackCat
Nov 22 '18 at 11:55
Maybe VecDoub vv(n) - is array of n elements of type double. VecInt indx - is array of type int (size not initialized). But it's only my assumption
– snake_style
Nov 22 '18 at 11:56
I was viewing some information from Numerical Recipes in C and I figured the chunk of code I am looking at was in C++, I am even more perplexed now.
– KolacheMaster
Nov 22 '18 at 11:56
1
make your own opinion, but note that the code in Numerical Recipes is partly outdated and partly even the algorithms they use are rather controversial numerics wise. I love the book for its easy to grasp explanations, but dont take everything for granted what they write
– user463035818
Nov 22 '18 at 12:15
3
3
What is
VecDoub
in c++? There's no such class supported by the c++ standard.– πάντα ῥεῖ
Nov 22 '18 at 11:54
What is
VecDoub
in c++? There's no such class supported by the c++ standard.– πάντα ῥεῖ
Nov 22 '18 at 11:54
1
1
Same for
VecInt
.– HolyBlackCat
Nov 22 '18 at 11:55
Same for
VecInt
.– HolyBlackCat
Nov 22 '18 at 11:55
Maybe VecDoub vv(n) - is array of n elements of type double. VecInt indx - is array of type int (size not initialized). But it's only my assumption
– snake_style
Nov 22 '18 at 11:56
Maybe VecDoub vv(n) - is array of n elements of type double. VecInt indx - is array of type int (size not initialized). But it's only my assumption
– snake_style
Nov 22 '18 at 11:56
I was viewing some information from Numerical Recipes in C and I figured the chunk of code I am looking at was in C++, I am even more perplexed now.
– KolacheMaster
Nov 22 '18 at 11:56
I was viewing some information from Numerical Recipes in C and I figured the chunk of code I am looking at was in C++, I am even more perplexed now.
– KolacheMaster
Nov 22 '18 at 11:56
1
1
make your own opinion, but note that the code in Numerical Recipes is partly outdated and partly even the algorithms they use are rather controversial numerics wise. I love the book for its easy to grasp explanations, but dont take everything for granted what they write
– user463035818
Nov 22 '18 at 12:15
make your own opinion, but note that the code in Numerical Recipes is partly outdated and partly even the algorithms they use are rather controversial numerics wise. I love the book for its easy to grasp explanations, but dont take everything for granted what they write
– user463035818
Nov 22 '18 at 12:15
|
show 1 more comment
1 Answer
1
active
oldest
votes
I think you're talking about VecDoub
, which is a typedef/rename of the type std::vector<double>
in the book Numerical Recipes.
C doesn't have an STL library like C++, so there's nothing there that you won't have to create yourself from scratch. Even if you plan to do it, you should be proficient C programmer to be able to manage memory correctly. One library I saw implementing such a vector is libbtc. See their implementation here and here. You can also see how to use it in the tests here.
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430425%2fequivalent-of-vecdoub-in-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you're talking about VecDoub
, which is a typedef/rename of the type std::vector<double>
in the book Numerical Recipes.
C doesn't have an STL library like C++, so there's nothing there that you won't have to create yourself from scratch. Even if you plan to do it, you should be proficient C programmer to be able to manage memory correctly. One library I saw implementing such a vector is libbtc. See their implementation here and here. You can also see how to use it in the tests here.
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
add a comment |
I think you're talking about VecDoub
, which is a typedef/rename of the type std::vector<double>
in the book Numerical Recipes.
C doesn't have an STL library like C++, so there's nothing there that you won't have to create yourself from scratch. Even if you plan to do it, you should be proficient C programmer to be able to manage memory correctly. One library I saw implementing such a vector is libbtc. See their implementation here and here. You can also see how to use it in the tests here.
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
add a comment |
I think you're talking about VecDoub
, which is a typedef/rename of the type std::vector<double>
in the book Numerical Recipes.
C doesn't have an STL library like C++, so there's nothing there that you won't have to create yourself from scratch. Even if you plan to do it, you should be proficient C programmer to be able to manage memory correctly. One library I saw implementing such a vector is libbtc. See their implementation here and here. You can also see how to use it in the tests here.
I think you're talking about VecDoub
, which is a typedef/rename of the type std::vector<double>
in the book Numerical Recipes.
C doesn't have an STL library like C++, so there's nothing there that you won't have to create yourself from scratch. Even if you plan to do it, you should be proficient C programmer to be able to manage memory correctly. One library I saw implementing such a vector is libbtc. See their implementation here and here. You can also see how to use it in the tests here.
edited Nov 22 '18 at 12:05
answered Nov 22 '18 at 11:59
The Quantum PhysicistThe Quantum Physicist
11.7k64698
11.7k64698
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
add a comment |
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
Thank you! Yes, I figured I could replicate what I am reading by dynamically allocating memory but so far I've been running into issues. I'll look into the links you've posted.
– KolacheMaster
Nov 22 '18 at 12:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430425%2fequivalent-of-vecdoub-in-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
What is
VecDoub
in c++? There's no such class supported by the c++ standard.– πάντα ῥεῖ
Nov 22 '18 at 11:54
1
Same for
VecInt
.– HolyBlackCat
Nov 22 '18 at 11:55
Maybe VecDoub vv(n) - is array of n elements of type double. VecInt indx - is array of type int (size not initialized). But it's only my assumption
– snake_style
Nov 22 '18 at 11:56
I was viewing some information from Numerical Recipes in C and I figured the chunk of code I am looking at was in C++, I am even more perplexed now.
– KolacheMaster
Nov 22 '18 at 11:56
1
make your own opinion, but note that the code in Numerical Recipes is partly outdated and partly even the algorithms they use are rather controversial numerics wise. I love the book for its easy to grasp explanations, but dont take everything for granted what they write
– user463035818
Nov 22 '18 at 12:15