Search:

Type: Posts; User: bchudomelka

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    7,018

    My struct is ok, atleast with just complex...

    My struct is ok, atleast with just complex numbers. I can't figure out how to get my array's to hold complex numbers
  2. Replies
    5
    Views
    7,018

    microsoft visual studio express 2010 doesn't have...

    microsoft visual studio express 2010 doesn't have complex.h
  3. Replies
    5
    Views
    7,018

    like.... void printcmplxmtrx(A[2][2]){...

    like....


    void printcmplxmtrx(A[2][2]){
    printf("A[1][1]=%lf+%lf*i", a.r, a.i);
    .
    .
    .
    }
  4. Replies
    5
    Views
    7,018

    A square matrix with complex numbers

    Alright, I've been working on complex numbers, and I have the structure for it...

    struct cmplx {
    double r;
    double i;
    };


    Now, if I wanted to make a matrix with cmplx numbers, could I...
  5. Replies
    29
    Views
    8,197

    I got the code to work. Thanks everyone for your...

    I got the code to work. Thanks everyone for your help.
  6. Replies
    29
    Views
    8,197

    ...uh...oops.

    ...uh...oops.
  7. Replies
    29
    Views
    8,197

    I got it to work. Thanks. Right now, I'm having a...

    I got it to work. Thanks. Right now, I'm having a problem divinding by a friggin' integer... the first section of code is my factorial func


    int factorial(int k){
    if (k==0){return 1;}
    int...
  8. Replies
    29
    Views
    8,197

    I am passing sigma_x[2][2] into expm()... i.e....

    I am passing sigma_x[2][2] into expm()... i.e. expm(sigma_x).

    then it's job after that is to compute sigma_x^n. then it prints out the result then returns back to main.....
    so


    for (int i =...
  9. Replies
    29
    Views
    8,197

    I've ran into another wall. Ouch... I've created...

    I've ran into another wall. Ouch... I've created A^n for the taylor expansion, but the answer is in a func which is not in main. How do I take the result of A^n and map it to something usable in...
  10. Replies
    13
    Views
    1,280

    Got the function. This is the code. #include...

    Got the function. This is the code.


    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>

    void multmtrx(int A[2][2], int *B, int *result)
    {
    for (int i=0; i<2; i++){
  11. Replies
    13
    Views
    1,280

    Yes!!! Thanks!!! Awesome!!! I have a follow up...

    Yes!!! Thanks!!! Awesome!!! I have a follow up question...so now I have this main func that does A^n. To turn this into a func called expon...

    Hypothetically, I would..


    int expon (int...
  12. Replies
    13
    Views
    1,280

    I'm lost. I see that by defining temp to be all...

    I'm lost. I see that by defining temp to be all zeroes, then it just outputs a zero matrix. Whatever I define temp as in main, that is what's returned. I'm not following your suggestions so well.
  13. Replies
    13
    Views
    1,280

    Like this? do { temp =...

    Like this?

    do {
    temp = (int*)malloc(sizeof(int) * 4);
    temp[0] = 0;
    temp[1] = 0;
    temp[2] = 0;
    temp[3] = 0;
  14. Replies
    13
    Views
    1,280

    Now the func doesn't do anything. Should I change...

    Now the func doesn't do anything. Should I change void to int and return result or some other matrix? Then printmtrx(result);
  15. Replies
    13
    Views
    1,280

    I am actually trying to reset the counter. So it...

    I am actually trying to reset the counter. So it does the multmtrx op again from scratch. I tried to move it to a func.


    void expon(int A[2][2], int m)
    {
    int *temp;

    temp =...
  16. Replies
    29
    Views
    8,197

    I'm sure there's a slick way to do it. I'm not...

    I'm sure there's a slick way to do it. I'm not there yet in my skills. Currently, I'm just working on developing a taylor series for the expm[A]. Once that works, I'll try to develop some structure...
  17. Replies
    13
    Views
    1,280

    Sorry, this code isn't right. I've done some...

    Sorry, this code isn't right. I've done some editing and this is now the correct code.



    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>

    void multmtrx(int A[2][2], int *B, int...
  18. Replies
    17
    Views
    7,486

    Got it! Thanks!

    Got it! Thanks!
  19. Replies
    13
    Views
    1,280

    Matrix Multiplication

    I have some code here to multiply matrices. It's not working as designed. Any suggestions? I want it to multiply a matrix then continue to do so until it reaches n. So, the desire output is A^n,...
  20. Replies
    29
    Views
    8,197

    Matlab code to be converted

    ii=i;

    %Pauli ops
    sx=[0,1;1,0];
    sz=[0,0;0,1];

    %Number of steps, define time slice
    dt=T/N;

    %Physical parameters
  21. Replies
    17
    Views
    7,486

    How do I map values to the elements then? ...

    How do I map values to the elements then?


    for (i=0; i<nrows; i++)
    for (j=0; j<ncolumns; j++)
    array2d[i][j]=0;

    ?
  22. Replies
    17
    Views
    7,486

    This is an example I create with the code you...

    This is an example I create with the code you gave.


    #include <stdio.h>
    #include <stdlib.h>
    int main(){
    int k;
    int col = 10;
    int row = 10;
    int *array1d;
  23. Replies
    29
    Views
    8,197

    I'm trying to convert some matlab code into C for...

    I'm trying to convert some matlab code into C for a qubit simulation. So, I'm trying to create the taylor series for the time evolution operator. How could I get a function like:

    printf("How many...
  24. Replies
    17
    Views
    7,486

    Thanks so much. I was able to create the malloc....

    Thanks so much. I was able to create the malloc. It's starting to make more sense.
  25. Replies
    17
    Views
    7,486

    So, the int **array1 assigns the array1 pointer...

    So, the int **array1 assigns the array1 pointer to be of int type? malloc allocates the memory of the nrows in the 1st instance? the for loop causes array element i to be allocate the memory for...
Results 1 to 25 of 34
Page 1 of 2 1 2