Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • xerus xerus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 41
    • Issues 41
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • xerusxerus
  • xerusxerus
  • Issues
  • #210
Closed
Open
Issue created Aug 13, 2018 by RoteKekse@RoteKekseMaintainer

offset_add is not behaving as expected

#include <xerus.h>
using namespace xerus;

int main() {
	auto test1  = xerus::Tensor::dirac({1,1,1},0);
	auto test2  = xerus::Tensor::dirac({2,2,1},0);
	test2[3] = 4;
	test2[1] = 2;
	test2[2] = 3;
	XERUS_LOG(info, "test1 =  \n" << test1  );
	XERUS_LOG(info, "test2 =  \n" << test2  );
	std::unique_ptr<Tensor> comb(new Tensor({3,3,2}));
	comb->offset_add(test1, std::vector<size_t>({0,0,0}));
	comb->offset_add(test2, std::vector<size_t>({1,1,1}));

	XERUS_LOG(info, "comb =  \n" << *comb );
}

The above code returns:

+00:00:00,000 testAddition.cpp    :  10 : info        : test1 =  
1.000000 

+00:00:00,000 testAddition.cpp    :  11 : info        : test2 =  
1.000000 	0.000000 
0.000000 	1.000000 

+00:00:00,002 testAddition.cpp    :  28 : info        : comb =  
1.000000 / 0.000000 	0.000000 / 0.000000 	0.000000 / 0.000000 
0.000000 / 0.000000 	0.000000 / 1.000000 	0.000000 / 2.000000 
0.000000 / 3.000000 	0.000000 / 4.000000 	0.000000 / 0.000000 

I expected

+00:00:00,000 testAddition.cpp    :  10 : info        : test1 =  
1.000000 

+00:00:00,000 testAddition.cpp    :  11 : info        : test2 =  
1.000000 	0.000000 
0.000000 	1.000000 

+00:00:00,002 testAddition.cpp    :  28 : info        : comb =  
1.000000 / 0.000000 	0.000000 / 0.000000 	0.000000 / 0.000000 
0.000000 / 0.000000 	0.000000 / 1.000000 	0.000000 / 2.000000 
0.000000 / 0.000000 	0.000000 / 3.000000 	0.000000 / 4.000000 

Is this a bug?

Cheers Micha

Edited Aug 14, 2018 by RoteKekse
Assignee
Assign to
Time tracking