Displaying 20 results from an estimated 40000 matches similar to: "Overloading %*%"
2010 Mar 23
1
Operator overloading for custom classes
Hi,
I need some help to get some of the object orientation, specifically the
methods that overload the basic arithmetic operations, from sample C++
code to R. I don't have experience with such advanced language features
inside of R. So I was wondering if some of you could help me out in this
regard.
I have written a simple demonstration of a forward mode automatic
differentiator in C++ and
2010 Mar 23
1
: Operator overloading for custom classes
Hi,
I need some help to get some of the object orientation, specifically the
methods that overload the basic arithmetic operations, from sample C++
code to R. I don't have experience with such advanced language features
inside of R. So I was wondering if some of you could help me out in this
regard.
I have written a simple demonstration of a forward mode automatic
differentiator in C++ and
2008 Jul 10
1
Operator overloading
Hi!
I was just wondering is there anyway to overload operator for custom class.
For example:
I have two matrices A and B with same dimensions. I want to overload
operator '+' with my own function.
Or even better can I create my own (new) operator.
Example:
A+-B where '+-' would be some function.
bye,
Tine
2005 Apr 20
5
Overloading methods in R
(1) It seems to me that, generally, in R it is not possible to overload
functions. Is that right?
(2) Assuming that the above is true, or partially true, is there any extra
packages to handle overloading in R?
(3) Assuming (1) is TRUE and (2) is FALSE, can anyone provide some advice on
developing some function that understand what the arguments are and then
calls the right overloaded
2009 Feb 15
1
Overloading in R
I have been trying to write a new class that reimplements the vector
class. As a test of my overloading I decided to try and and call
t.test on two vectors which were objects of my class rather than the
default class.
The overloaded length I wrote seems to work correctly. I used
setMethod("length", "myvector", ...)
setMethod("mean", "myvector", ...)
2011 Jun 01
1
Overloading S4 methods
Dear all,
I am experiencing some problems with S4 method overloading. I have
defined a generic for graphics:plot, using
setGeneric("plot", useAsDefault = plot)
and with
importFrom('graphics', 'plot') and
exportMethods('plot') in the NAMESPACE file of pkg A.
I then proceed to define a method for signature c('myS4class',
'missing'). This works
2010 Oct 28
1
overloading the generic primitive functions "+" and "["
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101028/d7e0cc89/attachment.pl>
2012 May 03
1
* operator overloading & setOldClass
Dear R gurus,
I am trying to overload some operators in order to let these work with the
ff package by registering the S3 objects from the ff package and
overloading the operators as shown below in a reproducible example where
the "*" operator is overloaded.
require(ff)
setOldClass(Classes=c("ff_vector"))
setMethod(
f="*",
signature = signature(e1 =
2016 Jul 28
0
Help wanted: Overloading an Intinsic
Hi David,
The error shows that the clang source code uses this intrinsic as well, but in the old form. You need to modify the clang source code (where this intrinsic is used) to consider the overloaded operands.
The assert would show the trace where clang uses this intrinsic.
Hope this helps,
Anna
> On Jul 26, 2016, at 3:21 PM, David Noursi via llvm-dev <llvm-dev at lists.llvm.org>
2016 Jul 26
2
Help wanted: Overloading an Intinsic
Hello All,
I have been modifying LLVM a project of mine, and have encountered issues
with overloading an intrinsic function.
I have defined two types, abit (which is mapped, in Intrinsics.td, to i128)
and qbit (accordingly mapped to i16). I would like my intrinsic function,
CNOT(x,y), to accept either an abit or a qbit for each argument, so I
overload with iAny and llvm_anyint_ty, as seemed to
2010 Oct 30
1
overloading "[" and "[<-" using S3 classes
How can I overload the "[" and "[<-" operators using S3 classes?
Something like '['.{class} did not work or at least I do not know how to define it properly.
For S4 it is straightforward:
setMethod("[", signature(x = "myClass", i = "numeric"),
function (x, i, j, ..., drop){
... some operations
})
How to do the same for S3?
TIA!
2012 Dec 01
2
[LLVMdev] operator overloading fails while debugging with gdb for i386
Hi,
Structures are passed by pointer, so the return value is not actually in eax. That code gets transformed into something like:
void sum(A1 *out, const A1 one, const A1 two) {
out->x = one.x + two.x
out->y = one.y + two.y
}
So actually the function ends up returning void and operating on a hidden parameter, so %eax is dead at the end of the function and should not be being relied
2012 Dec 01
0
[LLVMdev] operator overloading fails while debugging with gdb for i386
Problem seems not only with operator overloading, It occurs with struct
value returning also.
gdb while debugging expects the return value in eax, gcc does returns in
eax, But Clang returns in edx(it can be checked in gdb by printing the
contents of edx).
Code(sample code)
struct A1 {
int x;
int y;
};
A1 sum(const A1 one, const A1 two)
{
A1 plus = {0,0};
plus.x = one.x + two.x;
plus.y
2012 Dec 02
0
[LLVMdev] operator overloading fails while debugging with gdb for i386
Hi,
As you told that function ends up returning void, I just confirmed it in
the IR, the function is defined as:
define *void* @_Z3sum2A1S_(*%struct.A1* noalias sret %agg.result*,
%struct.A1* byval align 4 %one, %struct.A1* byval align 4 %two).
But when i checked the register values in g++, eax contains an address of
stack, which points to the value (object) returned by sum. That is if we
2005 Feb 17
1
Subsetting using dimnames on S4 array-based class
Hello,
I did send this message to r-help and got no reply, no I am resubmitting
here in case this was a bit too specific for the other list.
Many thanks,
Iago
From:
Iago Mosqueira
<imosqueira@suk.azti.es>
To:
r-help@stat.math.ethz.ch
Subject:
Subsetting using dimnames on S4
array-based class
2011 Nov 02
1
overloading + operator for chars
Hello,
I would like to overload the "+" operator so that it can be used to concatenate two strings, e.g "John" + "Doe" = "JohnDoe".
How can I 'unseal' the "+" method?
> setMethod("+", signature(e1="character", e2="character"), function(e1, e2) paste(e1, e2, sep="") )
Error in
2007 Nov 13
5
How to overload the assignment operator?
Dear all,
what is the proper way to make the assignment operator generic and define methods depending on the class of the assigned value?
Best regards
Jens Oehlschl?gel
P.S. I vaguely remember that this was possible in S+. In R I tried to no avail:
# using this like h<-1:3 gives Error: in `<-.default`(h, 1:3) : invalid (do_set) left-hand side to assignment
2007 Mar 09
4
Using large datasets: can I overload the subscript operator?
Hello,
I do some computations on datasets that come from climate models. These data
are huge arrays, significantly larger than typically available RAM, so they
have to be accessed row-by-row, or rather slice-by slice, depending on the
task. I would like to make an R package to easily access such datasets
within R. The C++ backend is ready and being used under Windows/.Net/Visual
Basic, but I have
2012 Nov 29
2
[LLVMdev] operator overloading fails while debugging with gdb for i386
For the given test:
class A1 {
int x;
int y;
public:
A1(int a, int b)
{
x=a;
y=b;
}
A1 operator+(const A1&);
};
A1 A1::operator+(const A1& second)
{
A1 sum(0,0);
sum.x = x + second.x;
sum.y = y + second.y;
return (sum);
}
int main (void)
{
A1 one(2,3);
A1 two(4,5);
return 0;
}
when the exectable of this code is debugged in gdb for i386, we dont get the
2009 Jan 25
3
Defining an iterator
Inspired by Rudolf Biczok's query of Fri, Jan 23, 2009 at 1:25 AM, I
tried to implement iteration in a generic way using S4. (Though I am
admittedly still struggling with learning S4.)
> setClass("foo",representation(bar="list"))
[1] "foo"
> x<-new("foo",bar=list(1,2,3))
Given this, I would not expect for(i in x)... to work, since R has no
way