MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / handleComplexJoin

Method handleComplexJoin

src/library/blas/gens/kprintf.cpp:835–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833}
834
835void kprintf::handleComplexJoin(char **_src, char **_dst)
836{
837 int numCharsWritten = 0;
838 char id1[256], id2[256], id3[256];
839 char *ptr;
840 char *src = *_src;
841 char *dst = *_dst;
842
843 ptr = mystrtok( src, "(,)");
844 ptr = mystrtok( NULL, "(,)"); // Get first ID
845 strcpy( id1, ptr);
846 ptr = mystrtok( NULL, "(,)"); // Get second ID
847 strcpy( id2, ptr);
848 ptr = mystrtok( NULL, "(,)"); // Get third ID
849 strcpy( id3, ptr);
850 *_src = ptr + strlen(ptr) + 1;
851 //std::cout << id1 << " " << id2 << " " << id3 << std::endl;
852
853 switch(s_or_v)
854 {
855 case SCALAR:
856 //
857 // Don't do a thing...ComplexJoin not applicable for Real numbers
858 //
859 break;
860
861 case VECTOR:
862 for(int i=0; i<effectiveVectorWidthOnBaseType; i++)
863 {
864 if (effectiveVectorWidthOnBaseType > 2)
865 {
866 if ((i % 2) == 0)
867 {
868 numCharsWritten = sprintf(dst, "%s.%s = %s.%s;\n",
869 id1, vecIndices[i],
870 id2, vecIndices[i/2]);
871 dst += numCharsWritten;
872 } else {
873 numCharsWritten = sprintf(dst, "%s.%s = %s.%s;\n",
874 id1, vecIndices[i],
875 id3, vecIndices[i/2]);
876 dst += numCharsWritten;
877 }
878 } else {
879 if ((i % 2) == 0)
880 {
881 numCharsWritten = sprintf(dst, "%s.%s = %s;\n",
882 id1, vecIndices[i],
883 id2);
884 dst += numCharsWritten;
885 } else {
886 numCharsWritten = sprintf(dst, "%s.%s = %s;\n",
887 id1, vecIndices[i],
888 id3);
889 dst += numCharsWritten;
890 }
891 }
892 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected