// File: godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::SFA(float, int)
SFA(float RO, int num_invariances)
    {
        ro = RO;
        TOTAL_TIME = 50*ro;


        NUM_INVARIANCES = num_invariances;
        
        if(NUM_INVARIANCES == 1)
        {
            NUM_INPUT_NEURONS_Y = 1;
            NUM_INPUT_NEURONS_X = 101;

            lambda_long = 2.0f * ro;
            lambda_short = ro/31.0f;
            gamma_long = pow(0.5f,(1.0f/(lambda_long)));
            gamma_short = pow(0.5f,(1.0f/(lambda_short)));

            y_tilde = 0.0f;
            y_bar = 0.0f;
            U = 0.000f;
            V = 0.000f;


            vector<unsigned> a;
            a.push_back(NUM_INPUT_NEURONS_X);
            a.push_back(1);
            SetTopology(a);
            InitializeTopology();

            for(int i=0;i<NUM_INPUT_NEURONS_X;i++)
            {
                x_bar_vector.push_back(0.0f);
                x_tilde_vector.push_back(0.0f);
                del_weight_vector.push_back(0.0f);
                input_vector.push_back(0.0f);
            }
/*

            lambda_long = 2.0f * ro;
            lambda_short = ro/31.0f;
            gamma_long = pow(0.5f,(1.0f/(lambda_long)));
            gamma_short = pow(0.5f,(1.0f/(lambda_short)));

            y_tilde = 0.0f;
            y_bar = 0.0f;
            U = 0.000f;
            V = 0.000f;

            vector<unsigned> a;
            a.push_back(NUM_INPUT_NEURONS_X);
            a.push_back(1);
            SetTopology(a);
            InitializeTopology();

            for(int i=0;i<NUM_INPUT_NEURONS_X;i++)
            {
                x_bar_vector.push_back(0.0f);
                x_tilde_vector.push_back(0.0f);
                del_weight_vector.push_back(0.0f);
                input_vector.push_back(0.0f);
            }

*/
        }
        else if(NUM_INVARIANCES == 2)
        {
            NUM_INPUT_NEURONS_Y = 51;
            NUM_INPUT_NEURONS_X = 51;

            lambda_long = 2.0f * ro;
            lambda_short = ro/31.0f;
            gamma_long = pow(0.5f,(1.0f/(lambda_long)));
            gamma_short = pow(0.5f,(1.0f/(lambda_short)));

            y1_tilde = 0.0f;
            y1_bar = 0.0f;
            y2_tilde = 0.0f;
            y2_bar = 0.0f;
            U1 = 0.000f;
            U2 = 0.0f;
            V1 = 0.0f;
            V2 = 0.0f;

            y1 = 0.0f;
            y2 = 0.0f;


            vector<unsigned> a;
            a.push_back(NUM_INPUT_NEURONS_X * NUM_INPUT_NEURONS_Y);
            a.push_back(2);
            SetTopology(a);
            InitializeTopology();

            for(int i=0;i<NUM_INPUT_NEURONS_X * NUM_INPUT_NEURONS_Y;i++)
            {
                x_bar_vector.push_back(0.0f);
                x_tilde_vector.push_back(0.0f);
                del_weight_vector.push_back(0.0f);
                del_weight1_vector.push_back(0.0f);
                del_weight2_vector.push_back(0.0f);
                input_vector.push_back(0.0f);
            }
        }


        cout<<"finished constructing"<<endl;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x6110
movq -0xf8(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x50, %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
movsd 0x999c(%rip), %xmm0     # 0xe040
movsd %xmm0, 0x68(%rdi)
xorps %xmm0, %xmm0
movsd %xmm0, 0x70(%rdi)
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rdi)
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rdi)
xorps %xmm0, %xmm0
movsd %xmm0, 0x88(%rdi)
addq $0x90, %rdi
movq %rdi, -0x198(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0xa8, %rdi
movq %rdi, -0x190(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0xc0, %rdi
movq %rdi, -0x188(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0xd8, %rdi
movq %rdi, -0x180(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0xf0, %rdi
movq %rdi, -0x178(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movq %rdi, -0x170(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movq %rdi, -0x168(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x160(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
movl $0x1, 0x1c8(%rdi)
movsd 0x9887(%rip), %xmm0     # 0xe038
movsd %xmm0, 0x1d0(%rdi)
addq $0x1e0, %rdi            # imm = 0x1E0
movq %rdi, -0x158(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x1f8, %rdi            # imm = 0x1F8
movq %rdi, -0x150(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x210, %rdi            # imm = 0x210
movq %rdi, -0x148(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x228, %rdi            # imm = 0x228
movq %rdi, -0x140(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movq %rdi, -0x138(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
movq %rdi, -0x130(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x270, %rdi            # imm = 0x270
movq %rdi, -0x128(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
movb $0x0, 0x288(%rdi)
movb $0x1, 0x289(%rdi)
xorps %xmm0, %xmm0
movsd %xmm0, 0x290(%rdi)
addq $0x2a0, %rdi            # imm = 0x2A0
movq %rdi, -0x120(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
movq %rdi, -0x118(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x2d0, %rdi            # imm = 0x2D0
movq %rdi, -0x110(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x2e8, %rdi            # imm = 0x2E8
movq %rdi, -0x108(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rdi
addq $0x300, %rdi            # imm = 0x300
movq %rdi, -0x100(%rbp)
callq 0x4340
movq -0xf8(%rbp), %rax
movss -0xc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x1d0(%rax)
movsd 0x970d(%rip), %xmm0     # 0xe030
mulsd 0x1d0(%rax), %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0x1d8(%rax)
movl -0x10(%rbp), %ecx
movl %ecx, 0x298(%rax)
cmpl $0x1, 0x298(%rax)
jne 0x4bbd
movq -0xf8(%rbp), %rax
movl $0x1, 0x1c4(%rax)
movl $0x65, 0x1c0(%rax)
movsd 0x1d0(%rax), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x80(%rax)
movsd 0x1d0(%rax), %xmm0
movsd 0x96be(%rip), %xmm1     # 0xe048
divsd %xmm1, %xmm0
movsd %xmm0, 0x88(%rax)
movsd 0x80(%rax), %xmm0
movsd 0x967a(%rip), %xmm1     # 0xe020
divsd %xmm0, %xmm1
movss 0x96ee(%rip), %xmm0     # 0xe0a0
callq 0x6140
movsd %xmm0, -0x1b0(%rbp)
jmp 0x49c1
movq -0xf8(%rbp), %rax
movsd -0x1b0(%rbp), %xmm0
movsd %xmm0, 0x70(%rax)
movsd 0x88(%rax), %xmm0
movsd 0x963b(%rip), %xmm1     # 0xe020
divsd %xmm0, %xmm1
movss 0x96af(%rip), %xmm0     # 0xe0a0
callq 0x6140
movsd %xmm0, -0x1b8(%rbp)
jmp 0x4a00
movq -0xf8(%rbp), %rax
movsd -0x1b8(%rbp), %xmm0
movsd %xmm0, 0x78(%rax)
movq $0x0, 0x150(%rax)
movq $0x0, 0x158(%rax)
movq $0x0, 0x160(%rax)
movq $0x0, 0x168(%rax)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x6170
movq -0xf8(%rbp), %rsi
movq -0x1c0(%rbp), %rdi
addq $0x1c0, %rsi            # imm = 0x1C0
callq 0x6190
jmp 0x4a6c
movl $0x1, -0x3c(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x6200
jmp 0x4a82
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x6260
jmp 0x4a91
movq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x6230
jmp 0x4aa3
leaq -0x58(%rbp), %rdi
callq 0x6350
movq -0xf8(%rbp), %rdi
callq 0x63b0
jmp 0x4aba
movl $0x0, -0x5c(%rbp)
movq -0xf8(%rbp), %rcx
movl -0x5c(%rbp), %eax
cmpl 0x1c0(%rcx), %eax
jae 0x4ba1
movq -0xf8(%rbp), %rdi
addq $0xa8, %rdi
movq $0x0, -0x68(%rbp)
leaq -0x68(%rbp), %rsi
callq 0x4310
jmp 0x4af8
movq -0xf8(%rbp), %rdi
addq $0x90, %rdi
movq $0x0, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x4310
jmp 0x4b19
movq -0xf8(%rbp), %rdi
addq $0xc0, %rdi
movq $0x0, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x4310
jmp 0x4b3a
movq -0xf8(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movq $0x0, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x4310
jmp 0x4b5b
jmp 0x4b5d
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x4ac1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4f5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4baf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x6350
jmp 0x4baf
leaq -0x38(%rbp), %rdi
callq 0x6350
jmp 0x4f21
leaq -0x38(%rbp), %rdi
callq 0x6350
jmp 0x4f5b
movq -0xf8(%rbp), %rax
cmpl $0x2, 0x298(%rax)
jne 0x4f1f
movq -0xf8(%rbp), %rax
movl $0x33, 0x1c4(%rax)
movl $0x33, 0x1c0(%rax)
movsd 0x1d0(%rax), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x80(%rax)
movsd 0x1d0(%rax), %xmm0
movsd 0x9438(%rip), %xmm1     # 0xe048
divsd %xmm1, %xmm0
movsd %xmm0, 0x88(%rax)
movsd 0x80(%rax), %xmm0
movsd 0x93f4(%rip), %xmm1     # 0xe020
divsd %xmm0, %xmm1
movss 0x9468(%rip), %xmm0     # 0xe0a0
callq 0x6140
movsd %xmm0, -0x1c8(%rbp)
jmp 0x4c47
movq -0xf8(%rbp), %rax
movsd -0x1c8(%rbp), %xmm0
movsd %xmm0, 0x70(%rax)
movsd 0x88(%rax), %xmm0
movsd 0x93b5(%rip), %xmm1     # 0xe020
divsd %xmm0, %xmm1
movss 0x9429(%rip), %xmm0     # 0xe0a0
callq 0x6140
movsd %xmm0, -0x1d0(%rbp)
jmp 0x4c86
movq -0xf8(%rbp), %rax
movsd -0x1d0(%rbp), %xmm0
movsd %xmm0, 0x78(%rax)
movq $0x0, 0x170(%rax)
movq $0x0, 0x180(%rax)
movq $0x0, 0x178(%rax)
movq $0x0, 0x188(%rax)
movq $0x0, 0x190(%rax)
movq $0x0, 0x198(%rax)
movq $0x0, 0x1a0(%rax)
movq $0x0, 0x1a8(%rax)
movq $0x0, 0x1b0(%rax)
movq $0x0, 0x1b8(%rax)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x6170
movq -0xf8(%rbp), %rcx
movq -0x1d8(%rbp), %rdi
movl 0x1c0(%rcx), %eax
movl 0x1c4(%rcx), %ecx
imull %ecx, %eax
movl %eax, -0x9c(%rbp)
leaq -0x9c(%rbp), %rsi
callq 0x6200
jmp 0x4d4c
movl $0x2, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6200
jmp 0x4d6b
leaq -0xb8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x6260
jmp 0x4d80
movq -0xf8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x6230
jmp 0x4d95
leaq -0xb8(%rbp), %rdi
callq 0x6350
movq -0xf8(%rbp), %rdi
callq 0x63b0
jmp 0x4daf
movl $0x0, -0xbc(%rbp)
movq -0xf8(%rbp), %rdx
movl -0xbc(%rbp), %eax
movl 0x1c0(%rdx), %ecx
imull 0x1c4(%rdx), %ecx
cmpl %ecx, %eax
jae 0x4f03
movq -0xf8(%rbp), %rdi
addq $0xa8, %rdi
movq $0x0, -0xc8(%rbp)
leaq -0xc8(%rbp), %rsi
callq 0x4310
jmp 0x4e02
movq -0xf8(%rbp), %rdi
addq $0x90, %rdi
movq $0x0, -0xd0(%rbp)
leaq -0xd0(%rbp), %rsi
callq 0x4310
jmp 0x4e29
movq -0xf8(%rbp), %rdi
addq $0xc0, %rdi
movq $0x0, -0xd8(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x4310
jmp 0x4e50
movq -0xf8(%rbp), %rdi
addq $0xd8, %rdi
movq $0x0, -0xe0(%rbp)
leaq -0xe0(%rbp), %rsi
callq 0x4310
jmp 0x4e77
movq -0xf8(%rbp), %rdi
addq $0xf0, %rdi
movq $0x0, -0xe8(%rbp)
leaq -0xe8(%rbp), %rsi
callq 0x4310
jmp 0x4e9e
movq -0xf8(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movq $0x0, -0xf0(%rbp)
leaq -0xf0(%rbp), %rsi
callq 0x4310
jmp 0x4ec5
jmp 0x4ec7
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x4db9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4f11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x6350
jmp 0x4f11
leaq -0x98(%rbp), %rdi
callq 0x6350
jmp 0x4f1f
leaq -0x98(%rbp), %rdi
callq 0x6350
jmp 0x4f5b
jmp 0x4f21
movq 0x100b0(%rip), %rdi     # 0x14fd8
leaq 0x91d6(%rip), %rsi      # 0xe105
callq 0x21e0
movq %rax, -0x1e0(%rbp)
jmp 0x4f3d
movq -0x1e0(%rbp), %rdi
movq 0x10075(%rip), %rsi     # 0x14fc0
callq 0x2200
jmp 0x4f52
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
movq -0x100(%rbp), %rdi
callq 0x4430
movq -0x108(%rbp), %rdi
callq 0x4430
movq -0x110(%rbp), %rdi
callq 0x4430
movq -0x118(%rbp), %rdi
callq 0x4430
movq -0x120(%rbp), %rdi
callq 0x4430
movq -0x128(%rbp), %rdi
callq 0x4430
movq -0x130(%rbp), %rdi
callq 0x4430
movq -0x138(%rbp), %rdi
callq 0x4430
movq -0x140(%rbp), %rdi
callq 0x4430
movq -0x148(%rbp), %rdi
callq 0x4430
movq -0x150(%rbp), %rdi
callq 0x4430
movq -0x158(%rbp), %rdi
callq 0x4430
movq -0x160(%rbp), %rdi
callq 0x4430
movq -0x168(%rbp), %rdi
callq 0x4430
movq -0x170(%rbp), %rdi
callq 0x4430
movq -0x178(%rbp), %rdi
callq 0x4430
movq -0x180(%rbp), %rdi
callq 0x4430
movq -0x188(%rbp), %rdi
callq 0x4430
movq -0x190(%rbp), %rdi
callq 0x4430
movq -0x198(%rbp), %rdi
callq 0x4430
movq -0x1a0(%rbp), %rdi
callq 0x4430
movq -0x1a8(%rbp), %rdi
callq 0x4430
movq -0xf8(%rbp), %rdi
callq 0x6420
movq -0x18(%rbp), %rdi
callq 0x22f0
nopl (%rax,%rax)